/* ============================================================
   MATH ARENA — DESIGN SYSTEM
   Tema: RPG fantasy pixel-art (lihat assets/images/bg-ppt.png)
   ============================================================ */

:root {
    /* Palet warna diambil dari ambience art (langit, hutan, kayu, emas, api) */
    --ma-sky:        #3E7CB8;
    --ma-forest:     #22432B;
    --ma-forest-lt:  #3A6B45;
    --ma-wood-lt:    #A0672E;
    --ma-wood:       #8B5A2B;
    --ma-wood-dk:    #4A2C13;
    --ma-wood-line:  #270e04;
    --ma-gold:       #F2C230;
    --ma-gold-dk:    #B8860B;
    --ma-parchment:  #F1E4C3;
    --ma-parchment-dk: #D9C89A;
    --ma-stone:      #6B6B6B;
    --ma-stone-dk:   #3F3F3F;
    --ma-torch:      #FF7A1A;
    --ma-fire:       #E8452C;
    --ma-ice:        #5FC0E0;
    --ma-heal:       #34C77B;
    --ma-blood:      #C0392B;
    --ma-team-a:     #3B82C4;
    --ma-team-b:     #C4483B;
}

* { box-sizing: border-box; }

body {
    font-family: 'Fredoka', 'Lilita One', system-ui, sans-serif;
    user-select: none;
}

.font-display {
    font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif;
}
.font-pixel {
    font-family: 'Press Start 2P', 'Lilita One', monospace;
}

/* ---------------- Overlay scanline retro (kesan layar CRT/pixel game) ---------------- */
body::after {
    content: "";
    position: fixed; inset: 0;
    z-index: 9990;
    pointer-events: none;
    background: repeating-linear-gradient(
        180deg,
        rgba(0,0,0,0.09) 0px,
        rgba(0,0,0,0.09) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
    opacity: 0.55;
}

/* Sudut "staircase" ala jendela RPG pixel klasik (bukan diagonal, tapi bertingkat kotak-kotak) */
.hud-cut {
    clip-path: polygon(
        0 10px, 10px 10px, 10px 0,
        calc(100% - 10px) 0, calc(100% - 10px) 10px, 100% 10px,
        100% calc(100% - 10px), calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) 100%,
        10px 100%, 10px calc(100% - 10px), 0 calc(100% - 10px)
    );
}
.hud-cut-sm {
    clip-path: polygon(
        0 6px, 6px 6px, 6px 0,
        calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px,
        100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%,
        6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px)
    );
}

/* Bingkai ganda ala jendela RPG: garis luar gelap + garis dalam terang, meniru border 9-slice pixel art */
.pixel-frame {
    position: relative;
    box-shadow:
        0 0 0 3px var(--ma-wood-line),
        0 0 0 6px var(--ma-gold-dk),
        0 0 0 8px var(--ma-wood-line),
        6px 6px 0 0 rgba(0,0,0,0.55);
}
.pixel-frame-tight {
    box-shadow:
        0 0 0 2px var(--ma-wood-line),
        0 0 0 4px var(--ma-gold-dk),
        0 0 0 5px var(--ma-wood-line);
}

/* Paku/rivet kecil di tiap pojok panel — ciri khas jendela RPG pixel (lihat referensi UI) */
.pixel-rivets { position: relative; }
.pixel-rivets::before, .pixel-rivets::after,
.pixel-rivets .rivet-tr, .pixel-rivets .rivet-bl {
    content: ""; position: absolute;
    width: 6px; height: 6px;
    background: var(--ma-gold);
    box-shadow: 0 0 0 2px var(--ma-wood-line), inset 1px 1px 0 rgba(255,255,255,0.6);
    z-index: 3;
}
.pixel-rivets::before { top: 6px; left: 6px; }
.pixel-rivets::after { bottom: 6px; right: 6px; }

/* Bar judul ala jendela game ("SETTINGS", nama karakter, dsb) */
.panel-header-band {
    display: inline-block;
    background: linear-gradient(180deg, var(--ma-forest-lt) 0%, var(--ma-forest) 100%);
    border: 3px solid var(--ma-wood-line);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.35), 0 4px 0 rgba(0,0,0,0.5);
    color: #fff;
    padding: 6px 20px;
}

/* ---------------- Background dunia game (dipakai semua halaman) ---------------- */
.arena-bg {
    background-image: url('../images/bg.webp');
    background-size: cover;
    background-position: center;
    image-rendering: -webkit-optimize-contrast;
    position: relative;
}
.arena-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10,14,20,0.4) 0%, rgba(10,14,20,0.6) 100%);
    pointer-events: none;
    z-index: 0;
}
.arena-bg::after {
    /* Vignette gelap di tepi layar biar fokus ke tengah, kesan lebih "game" */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.48) 100%);
    pointer-events: none;
    z-index: 0;
}
.arena-bg > * { position: relative; z-index: 1; }

/* ---------------- Nuansa warna per halaman (di atas bg-ppt.png yang sama) ---------------- */
.arena-bg.theme-topics::before {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(242,194,48,0.24), transparent 60%),
        linear-gradient(180deg, rgba(20,14,4,0.28) 0%, rgba(10,14,20,0.58) 100%);
}
.arena-bg.theme-learning::before {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(95,192,224,0.22), transparent 60%),
        linear-gradient(180deg, rgba(6,14,28,0.36) 0%, rgba(4,8,18,0.64) 100%);
}
.arena-bg.theme-setup::before {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(196,72,166,0.2), transparent 60%),
        linear-gradient(180deg, rgba(28,8,22,0.34) 0%, rgba(10,4,12,0.64) 100%);
}
.arena-bg.theme-battle::before {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(232,69,44,0.26), transparent 60%),
        linear-gradient(180deg, rgba(35,6,6,0.32) 0%, rgba(15,3,3,0.66) 100%);
}

/* ---------------- Partikel ember mengambang (disuntik otomatis oleh script.js) ---------------- */
.ember-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ember {
    position: absolute;
    bottom: -12px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe1a8 0%, #ff9a3c 55%, transparent 100%);
    opacity: 0;
    animation-name: ma-ember-rise;
    animation-timing-function: ease-in;
    animation-iteration-count: infinite;
}
@keyframes ma-ember-rise {
    0%   { transform: translate(0, 0); opacity: 0; }
    12%  { opacity: 0.9; }
    100% { transform: translate(var(--ember-drift, 20px), -105vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .ember-layer { display: none; }
}

.bg-video-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
}
.bg-video { width: 100%; height: 100%; object-fit: cover; }

/* ---------------- Tombol kayu utama (dipakai di semua halaman utk aksi utama) ---------------- */
.btn-arena-wood {
    position: relative;
    display: block;
    text-align: center;
    padding: 14px 0;
    background: linear-gradient(to bottom, #854d0e 0%, #642e08 100%);
    border: 4px solid #d97706;
    border-color: #eab308 #451a03 #3f1d0b #b45309;
    border-radius: 6px;
    box-shadow:
        0 8px 0 var(--ma-wood-line),
        inset 0 4px 0 rgba(255,255,255,0.15),
        inset 0 -4px 12px rgba(0,0,0,0.6),
        0 10px 15px rgba(0,0,0,0.55);
    transition: all 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}
.btn-arena-wood:hover {
    transform: scale(1.04) translateY(-3px);
    filter: brightness(1.05);
    box-shadow:
        0 11px 0 var(--ma-wood-line),
        inset 0 4px 0 rgba(255,255,255,0.25),
        inset 0 -4px 12px rgba(0,0,0,0.4),
        0 14px 20px rgba(0,0,0,0.6);
}
.btn-arena-wood:active {
    transform: scale(0.98) translateY(5px);
    box-shadow: 0 3px 0 var(--ma-wood-line), inset 0 4px 12px rgba(0,0,0,0.8), 0 3px 8px rgba(0,0,0,0.5);
}
.btn-arena-wood.disabled,
.btn-arena-wood:disabled {
    filter: grayscale(70%);
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Varian kecil untuk navigasi (kembali / lanjut) */
.btn-nav-wood {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    background: linear-gradient(to bottom, #854d0e 0%, #642e08 100%);
    border: 3px solid #d97706;
    border-color: #eab308 #451a03 #3f1d0b #b45309;
    border-radius: 5px;
    box-shadow: 0 5px 0 var(--ma-wood-line), 0 8px 14px rgba(0,0,0,0.5);
    color: #fffdf5;
    font-family: 'Lilita One', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 1.05rem;
    font-weight: 700;
    transition: all 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow:
        -2px -2px 0 var(--ma-wood-line), 2px -2px 0 var(--ma-wood-line),
        -2px  2px 0 var(--ma-wood-line), 2px  2px 0 var(--ma-wood-line),
         2px  3px 3px rgba(0,0,0,0.7);
    cursor: pointer;
}
.btn-nav-wood:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 7px 0 var(--ma-wood-line), 0 10px 16px rgba(0,0,0,0.55); }
.btn-nav-wood:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ma-wood-line); }
.btn-nav-wood.btn-nav-red {
    background: linear-gradient(to bottom, #7f1d1d 0%, #450a0a 100%);
    border-color: #f87171 #2a0505 #200404 #991b1b;
}

.text-game-solid {
    font-family: 'Lilita One', sans-serif;
    font-size: calc(1.35rem + 0.5vw);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 900;
    color: #f1f5f9;
    text-shadow:
        -3px -3px 0 var(--ma-wood-line), 3px -3px 0 var(--ma-wood-line),
        -3px  3px 0 var(--ma-wood-line), 3px  3px 0 var(--ma-wood-line),
         0px  3px 0 var(--ma-wood-line), 0px -3px 0 var(--ma-wood-line),
        -3px  0px 0 var(--ma-wood-line), 3px  0px 0 var(--ma-wood-line),
         2px  4px 4px rgba(0, 0, 0, 0.7);
}

/* Judul besar — disamakan dengan gaya font index (putih, tebal, jelas) */
.title-plaque {
    font-family: 'Lilita One', sans-serif;
    color: #fdfdfd;
    text-shadow:
        -3px -3px 0 var(--ma-wood-line), 3px -3px 0 var(--ma-wood-line),
        -3px  3px 0 var(--ma-wood-line), 3px  3px 0 var(--ma-wood-line),
         0px  3px 0 var(--ma-wood-line), 0px -3px 0 var(--ma-wood-line),
        -3px  0px 0 var(--ma-wood-line), 3px  0px 0 var(--ma-wood-line),
         2px  4px 5px rgba(0,0,0,0.7);
    letter-spacing: 1px;
}

/* Judul di dalam modal (Tentang, Cara Bermain, daftar Bab) — pixel-outline
   yang senada dengan title-plaque, disesuaikan ukurannya buat konteks modal */
.modal-title {
    font-family: 'Lilita One', sans-serif;
    color: var(--ma-gold);
    text-shadow:
        -2px -2px 0 var(--ma-wood-line), 2px -2px 0 var(--ma-wood-line),
        -2px  2px 0 var(--ma-wood-line), 2px  2px 0 var(--ma-wood-line),
         2px  3px 3px rgba(0,0,0,0.5);
    letter-spacing: 0.6px;
}

/* Varian putih polos + outline hitam — dipakai kalau kejelasan lebih
   penting daripada aksen warna (misal judul modal Bab di Topics) */
.modal-title-clear {
    font-family: 'Lilita One', sans-serif;
    color: #fff;
    text-shadow:
        -2px -2px 0 #000, 2px -2px 0 #000,
        -2px  2px 0 #000, 2px  2px 0 #000,
         2px  3px 3px rgba(0,0,0,0.5);
    letter-spacing: 0.6px;
}

/* Logo wordmark "MATH ARENA" — dipakai di index2.php (eksperimen) */
.logo-title {
    font-family: 'Lilita One', sans-serif;
    font-size: 2.6rem;
    line-height: 0.95;
    text-align: center;
    letter-spacing: 2px;
    color: var(--ma-gold);
    -webkit-text-stroke: 2px var(--ma-wood-line);
    text-shadow:
        4px 4px 0 var(--ma-wood-line),
        0 0 26px rgba(255,212,71,0.55),
        0 0 50px rgba(255,212,71,0.3);
    animation: ma-logo-glow 2.4s ease-in-out infinite;
}
@media (min-width: 768px) { .logo-title { font-size: 4rem; } }
@keyframes ma-logo-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}
.logo-symbol {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(160deg, #8a8a8a 0%, #55555a 100%);
    border: 3px solid var(--ma-wood-line);
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1), 3px 3px 0 rgba(0,0,0,0.6);
    flex-shrink: 0;
    align-self: center;
}
@media (min-width: 768px) { .logo-symbol { width: 46px; height: 46px; font-size: 1.5rem; } }

/* Mini mute button */
.btn-mute-pixel {
    position: fixed; top: 16px; right: 16px; z-index: 100;
    width: 48px; height: 48px;
    background: linear-gradient(to bottom, #854d0e 0%, #78350f 100%);
    border: 3px solid #d97706;
    border-color: #eab308 #451a03 #3f1d0b #b45309;
    border-radius: 10px;
    box-shadow: 0 4px 0 var(--ma-wood-line), 0 5px 8px rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.1s ease;
    cursor: pointer;
}
@media (min-width: 768px) { .btn-mute-pixel { width: 56px; height: 56px; top: 20px; right: 20px; } }
.btn-mute-pixel:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 6px 0 var(--ma-wood-line); }
.btn-mute-pixel:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ma-wood-line); }

/* Varian mute kecil, ditaruh menyatu di top bar Battle (bukan fixed corner)
   supaya tidak menutupi panel HP tim */
.btn-mute-inline {
    position: absolute;
    top: -6px;
    right: -34px;
    width: 26px; height: 26px;
    background: linear-gradient(to bottom, #854d0e 0%, #78350f 100%);
    border: 2px solid #d97706;
    border-color: #eab308 #451a03 #3f1d0b #b45309;
    border-radius: 6px;
    box-shadow: 0 3px 0 var(--ma-wood-line);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
}
@media (min-width: 768px) { .btn-mute-inline { width: 32px; height: 32px; top: -8px; right: -42px; } }
.btn-mute-inline:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-mute-inline:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ma-wood-line); }

/* ---------------- Modal ---------------- */
.modal-backdrop {
    background-color: rgba(12, 12, 16, 0.85);
    backdrop-filter: blur(5px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease-out;
}
.modal-box {
    transform: scale(0.7) translateY(30px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: linear-gradient(to bottom, #2d1710 0%, #1c0d0a 100%);
    box-shadow: 0 0 0 5px #451a03, 0 0 0 10px #d97706, 0 25px 50px rgba(0,0,0,0.85);
}
.modal-backdrop.active { opacity: 1; pointer-events: auto; }
.modal-backdrop.active .modal-box { transform: scale(1) translateY(0); }

/* ---------------- Panel Parchment (teks penjelasan / hasil) ---------------- */
.panel-parchment {
    position: relative;
    background: linear-gradient(180deg, var(--ma-parchment) 0%, var(--ma-parchment-dk) 100%);
    color: #3b2a13;
    border: 4px solid var(--ma-wood-dk);
    border-radius: 6px;
    box-shadow: inset 0 0 25px rgba(139,90,43,0.35), 6px 6px 0 rgba(0,0,0,0.6);
}

/* Plakat batu bertuliskan simbol operator - elemen "signature" berulang */
.badge-plaque {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    background: linear-gradient(160deg, #8a8a8a 0%, #55555a 100%);
    border: 3px solid #3a3a3f;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08), 3px 3px 0 rgba(0,0,0,0.55);
    font-family: 'Lilita One', sans-serif;
    font-size: 1.35rem;
    color: var(--ma-parchment);
}

/* ---------------- Kartu Topik (quest card ala pixel RPG) ---------------- */
.wood-card {
    position: relative;
    background: linear-gradient(160deg, var(--ma-wood-lt) 0%, var(--ma-wood) 60%, var(--ma-wood-dk) 100%);
    border: 4px solid var(--ma-wood-dk);
    box-shadow:
        inset -4px -4px 0px 0px rgba(0,0,0,0.4),
        inset 4px 4px 0px 0px rgba(255,255,255,0.12),
        6px 6px 0px 0px rgba(0,0,0,0.7),
        0 0 0 3px var(--ma-gold-dk);
    color: white;
    text-shadow: 2px 2px 0px #000;
    transition: transform 0.12s cubic-bezier(0.175,0.885,0.32,1.275), filter 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
    isolation: isolate;
}
/* Sapuan cahaya berjalan pelan di kartu aktif, biar terasa "hidup" & mengundang klik */
.wood-card:not(.locked)::before {
    content: "";
    position: absolute; top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(115deg, transparent 0%, rgba(255,255,255,0.32) 50%, transparent 100%);
    animation: ma-card-sheen 3.2s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}
@keyframes ma-card-sheen {
    0%   { left: -60%; }
    35%  { left: 130%; }
    100% { left: 130%; }
}
/* Ribbon "MULAI" di pojok kartu yang aktif */
.wood-card:not(.locked)::after {
    content: "MULAI";
    position: absolute; top: 9px; right: -26px;
    width: 100px; text-align: center;
    background: var(--ma-fire);
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.48rem;
    padding: 3px 0;
    transform: rotate(40deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
    border-top: 1px solid rgba(255,255,255,0.4);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    z-index: 2;
    letter-spacing: 0.5px;
}
.wood-card:hover:not(.locked) {
    filter: brightness(1.15);
    transform: translateY(-8px) scale(1.03);
    box-shadow:
        inset -4px -4px 0px 0px rgba(0,0,0,0.4),
        inset 4px 4px 0px 0px rgba(255,255,255,0.12),
        10px 12px 0px 0px rgba(0,0,0,0.7),
        0 0 0 3px var(--ma-gold),
        0 0 26px 4px rgba(255,196,71,0.55);
}
.wood-card:active:not(.locked) { transform: translateY(-2px) scale(1.0); }

/* Panah kursor menu ala JRPG, muncul di kiri kartu saat di-hover */
.wood-card:not(.locked)::marker { content: none; }
.wood-card-cursor {
    position: absolute; left: -2px; top: 50%;
    transform: translateY(-50%) translateX(-100%);
    opacity: 0;
    font-size: 1.1rem;
    color: var(--ma-gold);
    text-shadow: 2px 2px 0 #000;
    transition: opacity 0.15s ease, transform 0.15s ease;
    animation: ma-cursor-bob 0.7s ease-in-out infinite;
    z-index: 3;
}
.wood-card:hover:not(.locked) .wood-card-cursor { opacity: 1; transform: translateY(-50%) translateX(4px); }
@keyframes ma-cursor-bob {
    0%, 100% { margin-left: 0; } 50% { margin-left: 6px; }
}

.topic-card-icon {
    width: 38px; height: 38px;
    margin-bottom: 8px;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.5));
}
@media (min-width: 768px) { .topic-card-icon { width: 46px; height: 46px; } }
.wood-card.locked .topic-card-icon { opacity: 0.85; }

/* Tombol tutup di modal daftar bab */
.bab-modal-close {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 6px;
    background: linear-gradient(180deg, #7f1d1d 0%, #450a0a 100%);
    border: 2px solid #f87171;
    color: #fff;
    font-family: 'Lilita One', sans-serif;
    font-size: 1rem;
    box-shadow: 0 3px 0 rgba(0,0,0,0.5);
    cursor: pointer;
    transition: all 0.1s ease;
}
.bab-modal-close:hover { filter: brightness(1.15); transform: translateY(-1px); }
.bab-modal-close:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.5); }

.wood-card.locked {
    filter: grayscale(100%) brightness(0.75);
    opacity: 0.72;
    cursor: not-allowed;
    position: relative;
}
.wood-card.locked::before {
    /* Garis diagonal "terkunci" ala rambu peringatan retro */
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(0,0,0,0.25) 0px, rgba(0,0,0,0.25) 10px,
        transparent 10px, transparent 20px
    );
    z-index: 1;
    pointer-events: none;
}

/* ---------------- Setup / Kartu Tim ---------------- */
.team-card {
    background: linear-gradient(180deg, rgba(20,22,28,0.92) 0%, rgba(10,11,15,0.95) 100%);
    border: 4px solid var(--team-color, var(--ma-team-a));
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.6), 8px 8px 0 rgba(0,0,0,0.55), inset 0 0 30px rgba(0,0,0,0.4);
    position: relative;
}
.team-card .team-banner {
    background: var(--team-color, var(--ma-team-a));
    text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
}
.input-team-name {
    background: var(--ma-parchment);
    color: var(--ma-wood-dk);
    border: 3px solid var(--ma-wood-dk);
    font-family: 'Lilita One', sans-serif;
    letter-spacing: 0.5px;
}
.input-team-name:focus { outline: 3px solid var(--ma-gold); }

/* Karakter tampil bebas (bukan di dalam kotak) dengan shadow tanah + glow warna skill */
.char-slot {
    width: 84px; height: 98px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    position: relative;
}
@media (min-width: 768px) { .char-slot { width: 108px; height: 124px; } }

/* Battle: sedikit lebih besar dari setup, tapi tetap kompak supaya layout tidak pecah */
.char-slot--lg { width: 80px; height: 96px; }
@media (min-width: 640px)  { .char-slot--lg { width: 104px; height: 122px; } }
@media (min-width: 1024px) { .char-slot--lg { width: 130px; height: 152px; } }

.char-slot::before {
    /* bayangan tanah agar karakter terasa "berpijak" tanpa perlu kotak */
    content: "";
    position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 62%; height: 14px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.6) 0%, transparent 72%);
    z-index: 0;
}
.char-slot img, .char-slot video {
    width: 100%; height: 100%; object-fit: contain;
    position: relative; z-index: 1;
    animation: ma-char-float 2.8s ease-in-out infinite;
}
.char-slot .char-fallback {
    position: relative; z-index: 1;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.55));
    animation: ma-char-float 2.8s ease-in-out infinite;
    color: #fff;
    align-items: center;
    justify-content: center;
}
.char-fallback-icon { width: 34px; height: 34px; }
.char-slot--lg .char-fallback-icon { width: 46px; height: 46px; }
@media (min-width: 1024px) { .char-slot--lg .char-fallback-icon { width: 60px; height: 60px; } }
.char-slot.slot-fire .char-fallback { color: var(--ma-fire); }
.char-slot.slot-ice .char-fallback { color: var(--ma-ice); }
.char-slot.slot-support .char-fallback { color: var(--ma-heal); }
.char-slot .char-label {
    position: static; margin-top: 6px;
    text-align: center; font-size: 0.68rem; letter-spacing: 0.5px;
    color: #fff; text-transform: uppercase;
    font-family: 'Fredoka', sans-serif; font-weight: 600;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.char-slot.slot-fire img, .char-slot.slot-fire .char-fallback { filter: drop-shadow(0 0 12px rgba(232,69,44,0.7)) drop-shadow(0 8px 10px rgba(0,0,0,0.55)); animation-delay: 0s; }
.char-slot.slot-ice img, .char-slot.slot-ice .char-fallback { filter: drop-shadow(0 0 12px rgba(95,192,224,0.7)) drop-shadow(0 8px 10px rgba(0,0,0,0.55)); animation-delay: .35s; }
.char-slot.slot-support img, .char-slot.slot-support .char-fallback { filter: drop-shadow(0 0 12px rgba(52,199,123,0.7)) drop-shadow(0 8px 10px rgba(0,0,0,0.55)); animation-delay: .7s; }

@keyframes ma-char-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ---------------- Battle: HP bar ala pixel RPG (segmented block) ---------------- */
.hp-bar-track {
    background: #1b1b1b;
    border: 2px solid #000;
    border-radius: 2px;
    box-shadow: 0 0 0 2px var(--ma-wood-dk), inset 0 2px 4px rgba(0,0,0,0.6);
    overflow: hidden;
    position: relative;
}
/* Plat nama tim ala label karakter di HUD RPG (lihat referensi) */
.name-plate {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    color: #fff;
    background: linear-gradient(180deg, #2c2c32 0%, #131316 100%);
    border: 2px solid var(--ma-wood-line);
    border-left: 5px solid var(--plate-color, var(--ma-gold));
    border-radius: 3px;
    padding: 3px 8px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 2px 2px 0 rgba(0,0,0,0.5);
}
.name-plate > span:last-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.name-plate .plate-icon {
    width: 10px; height: 10px; flex-shrink: 0;
    background: var(--plate-color, var(--ma-gold));
    border: 1px solid var(--ma-wood-line);
    transform: rotate(45deg);
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.5);
}
.name-plate.plate-right {
    flex-direction: row-reverse;
    border-left: none;
    border-right: 5px solid var(--plate-color, var(--ma-gold));
}
.name-plate.plate-right > span:last-child { text-align: right; }
/* Tick pembagi tetap di health bar (independen dari lebar isi), khas HP bar RPG klasik */
.hp-bar-ticks {
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0, transparent calc(10% - 2px),
        rgba(0,0,0,0.6) calc(10% - 2px), rgba(0,0,0,0.6) 10%
    );
    pointer-events: none;
}
.hp-bar-fill {
    height: 100%;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.4s ease;
    background: linear-gradient(180deg, #86efac 0%, #4ade80 55%, #16a34a 100%);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), inset 0 -3px 0 rgba(0,0,0,0.4);
}
.hp-bar-fill.mid {
    background: linear-gradient(180deg, #fde68a 0%, #facc15 55%, #ca8a04 100%);
}
.hp-bar-fill.low {
    background: linear-gradient(180deg, #fca5a5 0%, #f87171 55%, #b91c1c 100%);
    animation: ma-hp-low-pulse 0.9s ease-in-out infinite;
}
@keyframes ma-hp-low-pulse {
    0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); }
}

@keyframes ma-shake {
    0%, 100% { transform: translate(0,0) rotate(0); }
    10% { transform: translate(-10px, 2px) rotate(-2deg); }
    25% { transform: translate(9px, -2px) rotate(2deg); }
    40% { transform: translate(-8px, 1px) rotate(-1.5deg); }
    55% { transform: translate(7px, -1px) rotate(1.5deg); }
    70% { transform: translate(-5px, 1px) rotate(-1deg); }
    85% { transform: translate(3px, 0) rotate(0.5deg); }
}
.ma-shake { animation: ma-shake 0.45s cubic-bezier(.36,.07,.19,.97); }

@keyframes ma-heal-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52,199,123,0.6); }
    100% { box-shadow: 0 0 0 22px rgba(52,199,123,0); }
}
.ma-heal-pulse { animation: ma-heal-pulse 0.6s ease-out; }

@keyframes ma-float-up {
    0% { transform: translateX(-50%) translateY(10px) scale(0.5); opacity: 0; }
    15% { transform: translateX(-50%) translateY(0) scale(1.25); opacity: 1; }
    30% { transform: translateX(-50%) translateY(-6px) scale(1); }
    100% { transform: translateX(-50%) translateY(-60px) scale(1); opacity: 0; }
}
.floating-text {
    position: absolute;
    left: 50%; top: 40%;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    -webkit-text-stroke: 1.5px #000;
    pointer-events: none;
    animation: ma-float-up 1s cubic-bezier(0.22,1,0.36,1) forwards;
    z-index: 40;
}
.floating-text.dmg { color: #ef4444; }
.floating-text.heal { color: #4ade80; }
.floating-text.freeze { color: #7dd3fc; font-size: 1.1rem; }
.floating-text.combo { color: var(--ma-gold); font-size: 1rem; top: 32%; text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000; -webkit-text-stroke: 0; }

/* Panel UI battle (HP bar top, panel soal, panel skill) */
.ui-panel {
    background: rgba(10,9,8,0.82);
    border: 2px solid var(--ma-wood-dk);
    backdrop-filter: blur(2px);
}

/* Giliran / turn banner — ala banner pengumuman pixel RPG */
.turn-banner {
    font-family: 'Lilita One', sans-serif;
    letter-spacing: 1px;
    color: #fdfdfd;
    text-shadow:
        -2px -2px 0 var(--ma-wood-line), 2px -2px 0 var(--ma-wood-line),
        -2px  2px 0 var(--ma-wood-line), 2px  2px 0 var(--ma-wood-line),
         1px  2px 3px rgba(0,0,0,0.7);
    position: relative;
    display: inline-block;
    padding: 4px 18px;
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 6px, transparent 6px 12px),
        linear-gradient(180deg, var(--ma-gold-dk) 0%, #8a5c05 100%);
    border-top: 2px solid var(--ma-gold);
    border-bottom: 2px solid var(--ma-wood-line);
    animation: ma-turn-pop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ma-turn-pop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

/* Skill buttons */
.skill-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 5px;
    font-family: 'Lilita One', sans-serif;
    letter-spacing: 0.5px;
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    box-shadow: 0 5px 0 rgba(0,0,0,0.7), 0 8px 12px rgba(0,0,0,0.4);
    border: 3px solid rgba(0,0,0,0.4);
    transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}
.skill-btn-icon { width: 16px; height: 16px; flex-shrink: 0; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.5)); }
@media (min-width: 768px) { .skill-btn-icon { width: 20px; height: 20px; } }
@media (min-width: 768px) { .skill-btn { padding: 10px 22px; } }
.skill-btn:hover:not(:disabled) { transform: translateY(-3px) scale(1.05); filter: brightness(1.15); }
.skill-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.7); }
.skill-btn:disabled { opacity: 0.35; filter: grayscale(70%); cursor: not-allowed; box-shadow: none; transform: none; }
.skill-btn.selected {
    outline: 3px solid var(--ma-gold);
    outline-offset: 2px;
    box-shadow: 0 5px 0 rgba(0,0,0,0.7), 0 0 22px 2px rgba(255,212,71,0.75);
    transform: translateY(-2px) scale(1.06);
}
.skill-btn.selected::before {
    content: "▼";
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    color: var(--ma-gold);
    font-size: 0.85rem;
    animation: ma-cursor-bounce-down 0.6s ease-in-out infinite;
}
@keyframes ma-cursor-bounce-down {
    0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(4px); }
}
.skill-btn.fire { background: linear-gradient(180deg, #f0603f, var(--ma-fire)); }
.skill-btn.ice { background: linear-gradient(180deg, #7fd4ee, var(--ma-ice)); }
.skill-btn.support { background: linear-gradient(180deg, #4fe09a, var(--ma-heal)); }
.skill-btn.skip { background: linear-gradient(180deg, #8a8a92, #4b4b52); }
.skill-btn.skip:hover:not(:disabled) { filter: brightness(1.2); }

/* ---------------- Popover konfirmasi Skip ---------------- */
.skip-confirm-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 220px;
    background: linear-gradient(180deg, #2c2c32 0%, #131316 100%);
    border: 3px solid var(--ma-gold);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
    z-index: 60;
    text-align: center;
}
.skip-confirm-popover::after {
    content: "";
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--ma-gold);
}
.skip-confirm-popover p {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.72rem;
    color: #fff;
    line-height: 1.3;
}
@media (min-width: 768px) { .skip-confirm-popover p { font-size: 0.85rem; } }

.btn-mini {
    font-family: 'Lilita One', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.4px;
    padding: 6px 12px;
    border-radius: 5px;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    box-shadow: 0 3px 0 rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: transform 0.1s ease;
}
@media (min-width: 768px) { .btn-mini { font-size: 0.8rem; padding: 7px 16px; } }
.btn-mini:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.6); }
.btn-mini-yes { background: linear-gradient(180deg, #4ade80, #16a34a); }
.btn-mini-no { background: linear-gradient(180deg, #8a8a92, #4b4b52); }
.skill-btn .skill-used-tag {
    position: absolute; top: -8px; right: -6px;
    background: #111; color: #fff; font-size: 0.55rem;
    padding: 2px 6px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.4);
    font-family: 'Press Start 2P', monospace;
}

/* Kartu jawaban battle */
.answer-btn {
    background: linear-gradient(180deg, #4a4a52, #26262b);
    border: 3px solid #1a1a1d;
    border-top-color: #6b6b74;
    border-left-color: #5a5a62;
    border-radius: 4px;
    color: #f1f5f9;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    box-shadow: 0 4px 0 #000, 0 6px 10px rgba(0,0,0,0.45);
    transition: all 0.1s ease;
    cursor: pointer;
}
.answer-btn .answer-badge {
    flex-shrink: 0;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, var(--ma-gold) 0%, var(--ma-gold-dk) 100%);
    color: #3b2a13;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    border-radius: 3px;
    border: 2px solid var(--ma-wood-line);
    box-shadow: 0 2px 0 rgba(0,0,0,0.5);
}
.answer-btn .answer-text { flex: 1; }
.answer-btn:hover { background: linear-gradient(180deg, #5a5a64, #2f2f34); transform: translateY(-2px); border-color: var(--ma-gold); box-shadow: 0 6px 0 #000, 0 0 14px rgba(255,212,71,0.35); }
.answer-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #000; }
.answer-btn.correct { background: linear-gradient(180deg, #4ade80, #15803d); border-color: #0d3d1f; box-shadow: 0 4px 0 #0d3d1f, 0 0 18px rgba(74,222,128,0.6); }
.answer-btn.correct .answer-badge { background: linear-gradient(180deg,#fff,#d1fae5); }
.answer-btn.wrong { background: linear-gradient(180deg, #f87171, #b91c1c); border-color: #4c0d0d; box-shadow: 0 4px 0 #4c0d0d, 0 0 18px rgba(248,113,113,0.6); animation: ma-shake 0.35s ease; }
.answer-btn:disabled { pointer-events: none; }

/* ---------------- Efek skill: flash warna sederhana (pengganti video) ---------------- */
#skill-flash-overlay {
    position: fixed; inset: 0; z-index: 65;
    pointer-events: none;
    opacity: 0;
}
#skill-flash-overlay.flash-fire {
    background: radial-gradient(circle at center, rgba(232,69,44,0.45) 0%, rgba(232,69,44,0) 68%);
    animation: ma-flash-pulse-hard 0.5s ease-out;
}
#skill-flash-overlay.flash-ice {
    background: radial-gradient(circle at center, rgba(95,192,224,0.4) 0%, rgba(95,192,224,0) 68%);
    animation: ma-flash-pulse 0.55s ease-out;
}
#skill-flash-overlay.flash-heal {
    background: radial-gradient(circle at center, rgba(52,199,123,0.4) 0%, rgba(52,199,123,0) 68%);
    animation: ma-flash-pulse 0.55s ease-out;
}
@keyframes ma-flash-pulse { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
/* Fire dapat "impact frame" — sekilas putih terang dulu baru merah, kesan hit lebih nampol */
@keyframes ma-flash-pulse-hard {
    0% { opacity: 0; background: #fff; }
    8% { opacity: 0.9; background: #fff; }
    16% { opacity: 1; background: radial-gradient(circle at center, rgba(232,69,44,0.55) 0%, rgba(232,69,44,0) 68%); }
    100% { opacity: 0; }
}

/* Guncangan layar penuh saat serangan Fire — kesan lebih intens & kompetitif */
@keyframes ma-screen-punch {
    0%, 100% { transform: translate(0,0); }
    15% { transform: translate(-6px, 3px); }
    30% { transform: translate(5px, -3px); }
    45% { transform: translate(-4px, 2px); }
    60% { transform: translate(3px, -1px); }
    75% { transform: translate(-2px, 1px); }
}
body.screen-punch { animation: ma-screen-punch 0.4s cubic-bezier(.36,.07,.19,.97); }

/* Flash pada panel HP tim yang kena efek (fire=merah, ice=biru, support=hijau) */
.hp-wrap-flash-red   { animation: ma-panel-flash-red 0.6s ease-out; border-radius: 10px; }
.hp-wrap-flash-blue  { animation: ma-panel-flash-blue 0.6s ease-out; border-radius: 10px; }
.hp-wrap-flash-green { animation: ma-panel-flash-green 0.6s ease-out; border-radius: 10px; }
@keyframes ma-panel-flash-red   { 0% { box-shadow: 0 0 0 0 rgba(232,69,44,0); } 25% { box-shadow: 0 0 22px 6px rgba(232,69,44,0.85); } 100% { box-shadow: 0 0 0 0 rgba(232,69,44,0); } }
@keyframes ma-panel-flash-blue  { 0% { box-shadow: 0 0 0 0 rgba(95,192,224,0); } 25% { box-shadow: 0 0 22px 6px rgba(95,192,224,0.85); } 100% { box-shadow: 0 0 0 0 rgba(95,192,224,0); } }
@keyframes ma-panel-flash-green { 0% { box-shadow: 0 0 0 0 rgba(52,199,123,0); } 25% { box-shadow: 0 0 22px 6px rgba(52,199,123,0.85); } 100% { box-shadow: 0 0 0 0 rgba(52,199,123,0); } }

/* ---------------- Chip penjelasan singkat tiap skill ---------------- */
.skill-info-row {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    width: 100%; margin-bottom: 4px;
}
.skill-info {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.skill-info-icon { width: 13px; height: 13px; flex-shrink: 0; }
.skill-info.fire { border-color: rgba(232,69,44,0.55); }
.skill-info.ice { border-color: rgba(95,192,224,0.55); }
.skill-info.support { border-color: rgba(52,199,123,0.55); }

/* ---------------- Timer soal (durasi diatur guru) ---------------- */
.timer-select {
    margin-top: 4px;
    background: linear-gradient(180deg, #2c2c32 0%, #131316 100%);
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 0.6rem;
    border: 2px solid var(--ma-wood-line);
    border-radius: 4px;
    padding: 2px 4px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    cursor: pointer;
}
@media (min-width: 768px) { .timer-select { font-size: 0.75rem; padding: 3px 6px; } }
/* Browser merender <option> pakai style native OS, terpisah dari style <select>-nya —
   makanya perlu di-set eksplisit di sini, kalau tidak teksnya bisa putih-di-atas-putih. */
.timer-select option {
    background: #1c1c20;
    color: #fff;
    font-family: 'Fredoka', sans-serif;
}

.timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: #fff;
    background: linear-gradient(180deg, #2c2c32 0%, #131316 100%);
    border: 2px solid var(--ma-gold);
    border-radius: 4px;
    padding: 4px 12px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}
@media (min-width: 768px) { .timer-badge { font-size: 0.95rem; padding: 5px 16px; } }
.timer-badge-icon { width: 12px; height: 12px; flex-shrink: 0; }
@media (min-width: 768px) { .timer-badge-icon { width: 15px; height: 15px; } }
.timer-badge.timer-mid { border-color: #facc15; color: #fde68a; }
.timer-badge.timer-low { border-color: var(--ma-fire); color: #fca5a5; animation: ma-hp-low-pulse 0.6s ease-in-out infinite; }

/* ---------------- Toast notifikasi (pemakaian skill / giliran pindah) ---------------- */
.toast-container {
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    z-index: 55;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    width: 92%; max-width: 460px;
    pointer-events: none;
}
.toast {
    background: rgba(10,9,8,0.94);
    border: 2px solid var(--ma-gold);
    border-radius: 10px;
    padding: 8px 16px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    line-height: 1.3;
    color: #fff;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.5);
    animation: ma-toast-in 0.25s ease-out, ma-toast-out 0.3s ease-in 2.1s forwards;
}
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
@media (min-width: 768px) { .toast { font-size: 0.92rem; padding: 10px 20px; } .toast-icon { width: 22px; height: 22px; } }
.toast.fire { border-color: var(--ma-fire); }
.toast.fire .toast-icon { color: var(--ma-fire); }
.toast.ice { border-color: var(--ma-ice); }
.toast.ice .toast-icon { color: var(--ma-ice); }
.toast.heal { border-color: var(--ma-heal); }
.toast.heal .toast-icon { color: var(--ma-heal); }
.toast.neutral .toast-icon { color: var(--ma-gold); }
@keyframes ma-toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ma-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }
.skill-hint {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.65);
    text-align: center;
    width: 100%;
}

/* Layar hasil pertandingan */
.victory-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(5,6,10,0.92);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
}
.victory-overlay.show { opacity: 1; pointer-events: auto; }

/* ---------------- Confetti kemenangan ---------------- */
.confetti-layer {
    position: absolute; inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 81;
}
.confetti-piece {
    position: absolute;
    top: -20px;
    width: 8px; height: 8px;
    opacity: 0.9;
    animation-name: ma-confetti-fall;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
}
@keyframes ma-confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(540deg); opacity: 0.3; }
}

.victory-card {
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.victory-overlay.show .victory-card { transform: scale(1); }

/* ---------------- Modal Penjelasan Jawaban ---------------- */
.explanation-overlay {
    position: fixed; inset: 0; z-index: 82;
    background: rgba(5,6,10,0.92);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    padding: 20px;
    transition: opacity 0.3s ease;
}
.explanation-overlay.show { opacity: 1; pointer-events: auto; }
.explanation-card {
    transform: scale(0.85) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    max-width: 420px;
    width: 100%;
    padding: 26px 20px 20px;
    text-align: center;
    border-radius: 0 !important;
}
.explanation-overlay.show .explanation-card { transform: scale(1) translateY(0); }

/* Lencana ikon bulat yang "menggantung" di tepi atas kartu */
.explanation-badge {
    position: absolute;
    top: -22px; left: 50%;
    transform: translateX(-50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--ma-gold) 0%, var(--ma-gold-dk) 100%);
    border: 3px solid var(--ma-wood-dk);
    box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 6px 10px rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    color: #3b2a13;
}

.explanation-header {
    display: inline-block;
    font-family: 'Lilita One', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(180deg, var(--ma-wood-lt) 0%, var(--ma-wood-dk) 100%);
    border: 2px solid var(--ma-wood-line);
    padding: 4px 16px;
    margin-top: 12px;
    margin-bottom: 16px;
    box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
@media (min-width: 768px) { .explanation-header { font-size: 1.05rem; } }

/* Sembunyikan scrollbar bawaan browser, tapi konten tetap bisa discroll
   (wheel/touch/keyboard) — dipakai di modal-modal yang isinya bisa panjang */
.scrollbar-hidden {
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge lama */
}
.scrollbar-hidden::-webkit-scrollbar {
    display: none;              /* Chrome/Safari/Edge baru */
}

.explanation-text-box {
    background: rgba(255,255,255,0.45);
    border: 2px solid rgba(74,44,19,0.28);
    box-shadow: inset 0 2px 6px rgba(74,44,19,0.18);
    padding: 12px 14px;
    margin-bottom: 18px;
    text-align: left;
    max-height: 38vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.explanation-text-box::-webkit-scrollbar { display: none; }
.explanation-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #3b2a13;
}
@media (min-width: 768px) { .explanation-text { font-size: 0.95rem; } }

.explanation-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    padding: 8px 20px;
    border-radius: 5px;
    background: linear-gradient(180deg, #ffe08a 0%, var(--ma-gold) 45%, var(--ma-gold-dk) 100%);
    border: 2px solid var(--ma-wood-dk);
    color: #3b2a13;
    font-family: 'Lilita One', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 3px 0 var(--ma-wood-dk), 0 5px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@media (min-width: 768px) { .explanation-continue-btn { font-size: 0.95rem; padding: 9px 24px; } }
.explanation-continue-btn:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 5px 0 var(--ma-wood-dk), 0 7px 10px rgba(0,0,0,0.35); }
.explanation-continue-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ma-wood-dk); }

/* ---------------- Learning: panel kosong (link PPT belum dipasang) ---------------- */
.ppt-viewer {
    position: relative;
    width: 100%; height: 100%;
    background: #0d0d10;
    display: flex; align-items: center; justify-content: center;
}
.ppt-viewer-empty {
    flex-direction: column;
    gap: 14px;
    padding: 32px;
    text-align: left;
}

/* Utility */
.pixelated { image-rendering: pixelated; }
.locked { filter: grayscale(100%); opacity: 0.7; cursor: not-allowed; }
