.character-viewer-panel {
    margin-bottom: 24px;
}

.character-viewer-container {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    overflow: hidden;
    margin: 16px 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.character-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100% - 32px));
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    padding: 18px 18px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.86);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
    text-align: center;
    z-index: 3;
}

.character-viewer-loading[data-tone="success"] {
    background: rgba(22, 101, 52, 0.9);
}

.character-viewer-loading[data-tone="error"] {
    background: rgba(153, 27, 27, 0.92);
}

.character-loading-title {
    font-size: 14px;
    font-weight: 700;
}

.character-loading-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.45;
}

.character-viewer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.character-viewer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 20px;
}

.character-viewer-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.character-import-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.character-import-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.character-import-btn svg {
    width: 18px;
    height: 18px;
}

.character-viewer-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.character-control-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.character-control-btn:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.character-control-btn svg {
    width: 16px;
    height: 16px;
}

/* Background Selector */
.character-background-selector {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.character-background-selector.open {
    max-height: 300px;
    opacity: 1;
}

.character-background-selector:not(.open) {
    padding: 0 16px;
    margin-top: 0;
    border-width: 0;
}

.background-selector-title {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
    font-weight: 600;
}

.background-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.background-option {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.background-option:hover {
    transform: scale(1.05);
    border-color: rgba(251, 191, 36, 0.5);
}

.background-option.active {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

@media (max-width: 640px) {
    .background-options {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
}

@media (max-width: 640px) {
    .character-viewer-container {
        height: 320px;
    }
    
    .character-control-btn {
        font-size: 12px;
        padding: 8px 10px;
    }
}


/* ===================== */
/* BACKGROUND SCENES     */
/* ===================== */

/* 1. SKYWARS ISLAND */
.bg-skywars {
    background: linear-gradient(180deg, #89d4f5 0%, #c9eeff 55%, #e8f8ff 100%);
}
.bg-skywars .cloud1 {
    position: absolute;
    width: 80px; height: 28px;
    background: rgba(255,255,255,0.85);
    border-radius: 40px;
    top: 28px; left: 20px;
}
.bg-skywars .cloud1::before {
    content: '';
    position: absolute;
    width: 44px; height: 30px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    top: -14px; left: 14px;
}
.bg-skywars .cloud2 {
    position: absolute;
    width: 54px; height: 20px;
    background: rgba(255,255,255,0.7);
    border-radius: 30px;
    top: 50px; right: 30px;
}
.bg-skywars .island-dirt {
    position: absolute;
    bottom: 30px;
    left: 50%; transform: translateX(-50%);
    width: 120px; height: 22px;
    background: #5d4037;
    border-radius: 6px 6px 14px 14px;
}
.bg-skywars .island-grass {
    position: absolute;
    bottom: 52px;
    left: 50%; transform: translateX(-50%);
    width: 120px; height: 16px;
    background: #4caf50;
    border-radius: 4px 4px 0 0;
}
.bg-skywars .sun {
    position: absolute;
    top: 20px; right: 30px;
    width: 28px; height: 28px;
    background: #FFD600;
    border-radius: 3px;
}

/* 2. BEDWARS NIGHT */
.bg-bedwars {
    background: linear-gradient(180deg, #0d0120 0%, #1e0540 60%, #0d0120 100%);
}
.bg-bedwars .star { position: absolute; border-radius: 50%; background: #fff; }
.bg-bedwars .moon {
    position: absolute;
    top: 18px; right: 28px;
    width: 22px; height: 22px;
    background: #fffde7;
    border-radius: 50%;
    box-shadow: 0 0 12px 3px rgba(255,253,231,0.4);
}
.bg-bedwars .ground {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 30px;
    background: linear-gradient(180deg, #1a0040, #0d0020);
}
.bg-bedwars .bed-frame {
    position: absolute;
    bottom: 30px;
    left: 50%; transform: translateX(-50%);
    width: 60px; height: 18px;
    background: #5d4037;
    border-radius: 3px;
}
.bg-bedwars .bed-pillow {
    position: absolute;
    bottom: 48px;
    left: 50%; transform: translateX(-50%);
    width: 60px; height: 14px;
    background: #e53935;
    border-radius: 3px 3px 0 0;
}

/* 3. PARKOUR */
.bg-parkour {
    background: linear-gradient(160deg, #fff9e6 0%, #ffe0a0 100%);
}
.bg-parkour .block {
    position: absolute;
    width: 36px; height: 36px;
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 3px;
}
.bg-parkour .b1 { background: #8B5E3C; bottom: 10px; left: 10px; }
.bg-parkour .b2 { background: #4caf50; bottom: 36px; left: 52px; }
.bg-parkour .b3 { background: #8B5E3C; bottom: 62px; left: 96px; }
.bg-parkour .b4 { background: #4caf50; bottom: 88px; left: 140px; }
.bg-parkour .b5 { background: #8B5E3C; bottom: 114px; left: 182px; }
.bg-parkour .b6 { background: #2196f3; bottom: 140px; left: 224px; }
.bg-parkour .void {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 10px;
    background: linear-gradient(180deg, rgba(0,0,0,0.1), rgba(0,0,0,0.3));
}

/* 4. ZOMBIE SURVIVAL */
.bg-zombie {
    background: linear-gradient(180deg, #0a1a0a 0%, #102010 60%, #0a1a0a 100%);
}
.bg-zombie .moon {
    position: absolute;
    top: 14px; right: 22px;
    width: 20px; height: 20px;
    background: #e8f5e9;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(200,240,200,0.25);
}
.bg-zombie .fog {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 50px;
    background: linear-gradient(180deg, transparent, rgba(30,60,30,0.7));
}
.bg-zombie .ground {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 26px; background: #1b3a1b;
}
.bg-zombie .grass-top {
    position: absolute; bottom: 26px; left: 0; right: 0;
    height: 6px; background: #2e7d32;
}
.bg-zombie .tree-trunk {
    position: absolute;
    width: 10px;
    background: #4e342e;
    bottom: 32px;
    border-radius: 2px 2px 0 0;
}
.bg-zombie .tree-leaves {
    position: absolute;
    background: #1b5e20;
    border-radius: 3px;
}
.bg-zombie .t1-trunk { height: 48px; left: 14px; }
.bg-zombie .t1-leaves { width: 36px; height: 36px; bottom: 78px; left: 5px; }
.bg-zombie .t2-trunk { height: 60px; right: 18px; }
.bg-zombie .t2-leaves { width: 42px; height: 42px; bottom: 90px; right: 10px; background: #2e7d32; }
.bg-zombie .particle { position: absolute; border-radius: 50%; background: rgba(100,200,100,0.3); }

/* 5. CREATIVE SUNNY */
.bg-creative {
    background: linear-gradient(180deg, #64b5f6 0%, #bbdefb 40%, #e3f2fd 100%);
}
.bg-creative .sun {
    position: absolute;
    top: 16px; left: 20px;
    width: 30px; height: 30px;
    background: #FFD600;
    border-radius: 3px;
    box-shadow: 0 0 16px 4px rgba(255,214,0,0.4);
}
.bg-creative .cloud {
    position: absolute;
    background: rgba(255,255,255,0.9);
    border-radius: 30px;
}
.bg-creative .c1 { width: 70px; height: 22px; top: 22px; right: 20px; }
.bg-creative .c1::before {
    content: ''; position: absolute;
    width: 36px; height: 28px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%; top: -12px; left: 16px;
}
.bg-creative .ground {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 24px; background: #66bb6a;
}
.bg-creative .dirt {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 10px; background: #8d6e63;
}
.bg-creative .house-body {
    position: absolute;
    bottom: 24px; right: 22px;
    width: 50px; height: 44px;
    background: #795548; border-radius: 2px;
}
.bg-creative .house-door {
    position: absolute;
    bottom: 0; left: 50%; transform: translateX(-50%);
    width: 16px; height: 22px;
    background: #4e342e; border-radius: 2px 2px 0 0;
}
.bg-creative .house-roof {
    position: absolute;
    bottom: 68px; right: 18px;
    width: 0; height: 0;
    border-left: 29px solid transparent;
    border-right: 29px solid transparent;
    border-bottom: 22px solid #e53935;
}
.bg-creative .house-window {
    position: absolute;
    top: 10px; left: 8px;
    width: 12px; height: 12px;
    background: #90caf9; border-radius: 1px;
}
.bg-creative .tree-trunk {
    position: absolute; bottom: 24px; left: 30px;
    width: 10px; height: 30px;
    background: #5d4037; border-radius: 2px 2px 0 0;
}
.bg-creative .tree-leaves {
    position: absolute; bottom: 50px; left: 18px;
    width: 34px; height: 34px;
    background: #388e3c; border-radius: 3px;
}

/* 6. HIDE & SEEK FOREST */
.bg-hideseek {
    background: linear-gradient(180deg, #0d2b0d 0%, #1b4a1b 50%, #0d2b0d 100%);
}
.bg-hideseek .ground {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 24px; background: #1b4a1b;
}
.bg-hideseek .trunk {
    position: absolute; background: #4e342e; border-radius: 2px 2px 0 0;
}
.bg-hideseek .leaves {
    position: absolute; border-radius: 3px;
}
.bg-hideseek .tr1 { width: 14px; height: 55px; left: 12px; bottom: 24px; }
.bg-hideseek .tl1 { width: 48px; height: 48px; background: #2e7d32; left: 1px; bottom: 74px; }
.bg-hideseek .tr2 { width: 14px; height: 70px; left: 80px; bottom: 24px; }
.bg-hideseek .tl2 { width: 52px; height: 52px; background: #388e3c; left: 68px; bottom: 88px; }
.bg-hideseek .tr3 { width: 14px; height: 60px; right: 14px; bottom: 24px; }
.bg-hideseek .tl3 { width: 48px; height: 48px; background: #1b5e20; right: 7px; bottom: 78px; }
.bg-hideseek .bush { position: absolute; width: 38px; height: 22px; background: #2e7d32; border-radius: 4px; bottom: 24px; left: 46px; }
.bg-hideseek .mist {
    position: absolute; left: 0; right: 0;
    background: linear-gradient(90deg, transparent, rgba(100,200,100,0.06), transparent);
}

/* 7. END PORTAL VOID */
.bg-endportal {
    background: radial-gradient(ellipse at center, #1a0040 0%, #080010 70%);
}
.bg-endportal .star { position: absolute; border-radius: 50%; }
.bg-endportal .portal-ring {
    position: absolute;
    bottom: 20px; left: 50%; transform: translateX(-50%);
    width: 100px; height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(100,0,200,0.6);
    box-shadow: 0 0 14px 3px rgba(100,0,200,0.3), inset 0 0 10px rgba(100,0,200,0.2);
}
.bg-endportal .portal-fill {
    position: absolute;
    bottom: 24px; left: 50%; transform: translateX(-50%);
    width: 94px; height: 14px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(80,0,180,0.7) 0%, transparent 70%);
}
.bg-endportal .portal-block {
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.1);
}
.bg-endportal .pb1 { background: #4a148c; bottom: 14px; left: calc(50% - 58px); }
.bg-endportal .pb2 { background: #6a1b9a; bottom: 14px; left: calc(50% - 40px); }
.bg-endportal .pb3 { background: #4a148c; bottom: 14px; left: calc(50% - 22px); }
.bg-endportal .pb4 { background: #6a1b9a; bottom: 14px; left: calc(50% + 0px); }
.bg-endportal .pb5 { background: #4a148c; bottom: 14px; left: calc(50% + 18px); }
.bg-endportal .pb6 { background: #6a1b9a; bottom: 14px; left: calc(50% + 36px); }
.bg-endportal .glow-orb {
    position: absolute; border-radius: 50%;
    background: rgba(140,0,255,0.15);
}

/* 8. NETHER LAVA */
.bg-nether {
    background: linear-gradient(180deg, #0d0000 0%, #2a0000 50%, #0d0000 100%);
}
.bg-nether .lava-glow {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(180deg, transparent, rgba(255,60,0,0.5));
}
.bg-nether .lava-top {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 18px;
    background: #ff6d00;
}
.bg-nether .lava-bright {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 6px;
    background: #ffcc02;
}
.bg-nether .nether-block {
    position: absolute;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.4);
}
.bg-nether .nb1 { width: 32px; height: 32px; background: #880e4f; bottom: 18px; left: 10px; }
.bg-nether .nb2 { width: 32px; height: 32px; background: #6a1b9a; bottom: 18px; left: 44px; }
.bg-nether .nb3 { width: 32px; height: 32px; background: #880e4f; bottom: 18px; right: 10px; }
.bg-nether .nb4 { width: 32px; height: 32px; background: #4a148c; bottom: 18px; right: 44px; }
.bg-nether .nb5 { width: 32px; height: 32px; background: #880e4f; bottom: 50px; left: 10px; }
.bg-nether .nb6 { width: 32px; height: 32px; background: #4a148c; bottom: 50px; right: 10px; }
.bg-nether .ember { position: absolute; border-radius: 50%; background: #ff6d00; }


/* Character Reactions */
.character-reactions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.character-reaction {
    position: absolute;
    width: 48px;
    height: 48px;
    animation: reactionFloat 3s ease-out forwards;
    pointer-events: none;
}

.character-reaction img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes reactionFloat {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }
    50% {
        transform: translateY(-80px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) scale(0.8);
        opacity: 0;
    }
}

.character-react-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 11;
    backdrop-filter: blur(8px);
}

.character-react-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(251, 191, 36, 0.5);
    transform: scale(1.1);
}

.character-react-btn svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.character-reaction-picker {
    position: absolute;
    bottom: 70px;
    right: 16px;
    background: #1e2024;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 8px;
    display: none;
    grid-template-columns: repeat(4, 36px);
    gap: 6px;
    z-index: 12;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.character-reaction-picker.open {
    display: grid;
    animation: pickerSlideIn 0.3s ease forwards;
}

@keyframes pickerSlideIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reaction-emoji {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 4px;
}

.reaction-emoji img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.reaction-emoji:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.reaction-emoji.active {
    background: rgba(88, 101, 242, 0.15);
    border-color: rgba(88, 101, 242, 0.4);
}

.reaction-emoji.active:hover {
    transform: scale(1.1);
}

/* Reaction Summary */
.character-reaction-summary {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 80px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 11;
    pointer-events: auto;
}

.reaction-summary-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.reaction-summary-item:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.reaction-summary-item.has-reactions {
    background: rgba(0, 0, 0, 0.7);
}

.reaction-summary-emoji {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.reaction-summary-count {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    min-width: 12px;
}

.reaction-summary-item.user-reacted {
    background: rgba(88, 101, 242, 0.15);
    border-color: rgba(88, 101, 242, 0.4);
}

.reaction-summary-item.user-reacted .reaction-summary-count {
    color: #5865f2;
}

.reaction-remove-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 2px;
}

.reaction-summary-item.user-reacted .reaction-remove-btn {
    display: flex;
}

.reaction-remove-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    color: #fff;
    transform: scale(1.1);
}


