/* ========================================================
   QUIZ HUNTER - RESPONSIVE GAME STYLING
   Dioptimalkan untuk Smartboard 75", PC/Laptop, Tablet, dan Smartphone Android
   ======================================================== */

:root {
    --font-fredoka: 'Fredoka One', cursive;
    --font-nunito: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --neon-cyan: #00f0ff;
    --neon-blue: #0077ff;
    --neon-red: #ff3344;
    --neon-gold: #ffd700;
    --neon-green: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 18%, #fbf9f4 0%, #ede6d8 50%, #ded4c1 100%);
    font-family: var(--font-nunito);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ========================================================
   WORDWALL PLAYER FRAME & 16:9 ADAPTIVE STAGE
   ======================================================== */
.wordwall-player {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: min(98vw, calc((100vh - 75px) * (16 / 9)));
    max-width: min(98vw, calc((100dvh - 75px) * (16 / 9)));
    margin: auto;
    border-radius: 18px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28), 0 3px 12px rgba(0, 0, 0, 0.12);
    background: #0d1424;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: box-shadow 0.3s ease;
}

.wordwall-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    container-type: inline-size;
    background-color: #000;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

#gameContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

#renderCanvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    outline: none;
    display: block;
    cursor: crosshair;
}

/* Bilah Alat Bawah (Wordwall Universal Control Bar) */
.wordwall-control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 18px;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 16px 16px;
    z-index: 50;
    min-height: 52px;
    user-select: none;
    -webkit-user-select: none;
}

.ww-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ww-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-nunito);
    font-size: clamp(0.82rem, 1.8vw, 0.95rem);
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-decoration: none;
    border: none;
    outline: none;
}

.ww-btn-reload {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.ww-btn-reload:hover {
    background: #334155;
    transform: translateY(-1px);
}
.ww-btn-reload:active {
    transform: translateY(1px);
}

.ww-btn-fullscreen {
    background: #f97316;
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 3px 12px rgba(249, 115, 22, 0.4);
}
.ww-btn-fullscreen:hover {
    background: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(249, 115, 22, 0.55);
}
.ww-btn-fullscreen:active {
    transform: translateY(1px);
}

.ww-bar-right {
    display: flex;
    align-items: center;
}

.ww-esc-hint {
    font-size: clamp(0.72rem, 1.5vw, 0.85rem);
    font-weight: 700;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ww-lamp {
    font-size: 1rem;
}

.ww-kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.82rem;
    color: #e2e8f0;
    font-weight: 800;
}

/* ========================================================
   FULLSCREEN MODE STYLING (Layar Penuh Standar Wordwall)
   ======================================================== */
:fullscreen, ::backdrop {
    background-color: #000000 !important;
}

#player-wrapper:fullscreen,
#player-wrapper.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    background: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center;
    align-items: center;
    box-shadow: none !important;
}

#player-wrapper:fullscreen .wordwall-stage,
#player-wrapper.is-fullscreen .wordwall-stage {
    width: 100%;
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
    max-width: calc((100vh - 54px) * (16 / 9));
    max-width: calc((100dvh - 54px) * (16 / 9));
    aspect-ratio: 16 / 9;
    container-type: inline-size;
    border-radius: 0;
}

#player-wrapper:fullscreen .wordwall-control-bar,
#player-wrapper.is-fullscreen .wordwall-control-bar {
    width: 100%;
    max-width: calc((100vh - 54px) * (16 / 9));
    max-width: calc((100dvh - 54px) * (16 / 9));
    border-radius: 0 0 10px 10px;
    background: rgba(15, 23, 42, 0.95);
}

@media (max-aspect-ratio: 1/1) {
    .wordwall-player {
        max-width: 100vw;
        border-radius: 12px;
    }
    .ww-esc-hint {
        display: none;
    }
    .wordwall-control-bar {
        padding: 8px 12px;
        justify-content: center;
    }
}

#uiLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25; /* Above #targetOverlay (15) so feedback, crosshairs & pause overlays render in front of targets */
}

#uiLayer.lobby-active {
    pointer-events: auto;
    background: url('assets/maps/bg_lobby.webp') no-repeat center center;
    background-size: cover;
}

/* ========================================================
   LOBBY SCREEN & RESPONSIVE LAYOUT
   ======================================================== */
.lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center !important;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    overflow: hidden !important; /* DILARANG SCROLL: TAMPILAN PATEN DI TENGAH 16:9 */
    padding: clamp(4px, 1.2vh, 14px) clamp(6px, 1.2vw, 16px);
    box-sizing: border-box;
}

@media (min-height: 650px) {
    .lobby-container {
        justify-content: center;
    }
}

/* Mobile Orientation Tip (Muncul di Posisi Vertikal HP) */
.mobile-orient-tip {
    display: none !important; /* Sembunyikan agar tidak mendorong menu ke bawah */
}

.title-glow {
    font-family: var(--font-fredoka);
    font-size: clamp(1.4rem, 4.4vw, 3.2rem);
    font-weight: normal;
    color: #fff;
    text-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #00f;
    margin-bottom: clamp(2px, 0.5vh, 6px);
    letter-spacing: clamp(1px, 0.3vw, 3px);
    text-align: center;
    line-height: 1.1;
}

.tagline {
    font-size: clamp(0.72rem, 1.4vw, 1.05rem);
    color: #cbd5e1;
    margin-bottom: clamp(6px, 1.8vh, 18px);
    font-style: italic;
    text-align: center;
    padding: 0 10px;
    line-height: 1.2;
}

.menu-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* PATEN 3 KOLOM DI SEMUA LAYAR */
    gap: clamp(6px, 1.2vw, 14px) !important;
    width: min(92%, 820px) !important;
    max-width: 820px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

.menu-card {
    font-family: var(--font-fredoka);
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(0, 255, 255, 0.4);
    border-radius: clamp(8px, 1.2vw, 14px);
    padding: clamp(8px, 1.6vh, 16px) clamp(6px, 1vw, 12px) !important;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: clamp(0.76rem, 1.35vw, 1.05rem) !important;
    font-weight: bold;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.menu-card small {
    font-size: clamp(0.68rem, 1.3vw, 0.85rem) !important;
    font-family: var(--font-nunito);
    font-weight: 700;
    opacity: 0.92;
    display: block;
}

.menu-card:hover {
    background: rgba(0, 255, 255, 0.22);
    border-color: #0ff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    transform: translateY(-4px) scale(1.02);
}

.menu-card:active {
    transform: translateY(1px) scale(0.98);
}

.menu-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.menu-card.disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: none;
    transform: none;
}

/* Map Selection Specifics */
.map-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(130px, 25vw, 260px), 1fr)) !important;
    max-width: 900px !important;
}

.map-card {
    padding: clamp(10px, 1.5vh, 16px) !important;
}

.map-preview-img {
    width: 100%;
    height: clamp(80px, 15vh, 150px);
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 2px solid #0ff;
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
}

/* ========================================================
   LOADING SCREEN
   ======================================================== */
#loadingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loader-content {
    text-align: center;
    width: min(85%, 450px);
}

.progress-bar {
    width: 100%;
    height: 18px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin: 18px 0;
    border: 2px solid #555;
}

#progressFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0ff, #00f);
    transition: width 0.2s;
}

#loadingText {
    font-family: var(--font-fredoka);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    margin-top: 10px;
}

/* ========================================================
   SINGLE MODE CROSSHAIR & HUD
   ======================================================== */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(32px, 5vw, 42px);
    height: clamp(32px, 5vw, 42px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 3px solid rgba(0, 255, 0, 0.9);
    border-radius: 50%;
    display: none;
    z-index: 50;
    transition: width 0.1s, height 0.1s, border-color 0.1s;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.6);
}
#crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: red;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
#crosshair.shoot {
    transform: translate(-50%, -50%) scale(1.3);
    border-color: yellow;
    box-shadow: 0 0 20px yellow;
}

.hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: clamp(6px, 1.5vh, 20px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(6px, 1vw, 15px);
    width: 100%;
}

.question-box {
    background: rgba(0, 0, 0, 0.82);
    border: 2px solid #0ff;
    border-radius: clamp(8px, 1.2vw, 14px);
    padding: clamp(8px, 1.4vh, 18px) clamp(12px, 2vw, 36px);
    font-size: clamp(0.95rem, 2.2vw, 1.9rem);
    max-width: 68%;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    margin: 0 auto;
    line-height: 1.25;
    pointer-events: auto;
}

.stats-box {
    background: rgba(0, 0, 0, 0.78);
    border-radius: clamp(8px, 1.2vw, 12px);
    padding: clamp(6px, 1vh, 12px) clamp(8px, 1.2vw, 16px);
    font-size: clamp(0.78rem, 1.5vw, 1.15rem);
    min-width: auto;
    text-align: center;
    border: 1px solid rgba(0, 255, 255, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.stats-box div {
    margin-bottom: 3px;
}

.hud-room-meta {
    font-size: clamp(0.68rem, 1.2vw, 0.82rem);
    color: #00ffcc;
    font-weight: bold;
    margin-top: 4px;
    font-family: 'Courier New', monospace;
}

.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    position: relative;
}

.controls-hint {
    background: rgba(0, 0, 0, 0.65);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: clamp(0.72rem, 1.3vw, 0.9rem);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    line-height: 1.3;
}

.smartboard-controls {
    display: flex;
    pointer-events: auto;
    gap: 15px;
}

.btn-action {
    font-family: var(--font-fredoka);
    background: rgba(220, 20, 40, 0.8);
    border: 2px solid #ff4d6d;
    color: white;
    width: clamp(60px, 12vw, 95px);
    height: clamp(60px, 12vw, 95px);
    border-radius: 50%;
    font-size: clamp(0.85rem, 2vw, 1.15rem);
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 0 16px rgba(255, 51, 68, 0.6);
    pointer-events: auto;
    transition: transform 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.btn-action:active {
    background: #ff1133;
    transform: scale(0.95);
}

#joystickZone {
    position: absolute;
    bottom: clamp(10px, 2vh, 20px);
    left: clamp(10px, 2vw, 20px);
    width: clamp(90px, 16vw, 140px);
    height: clamp(90px, 16vw, 140px);
    pointer-events: auto;
    z-index: 45;
}

/* Pause Button (Single Mode) */
.btn-pause {
    font-family: var(--font-fredoka);
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid #0ff;
    color: white;
    width: clamp(38px, 5.5vw, 54px);
    height: clamp(38px, 5.5vw, 54px);
    border-radius: clamp(8px, 1.2vw, 12px);
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: all 0.2s;
    pointer-events: auto;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.3);
}
.btn-pause:hover {
    background: rgba(0, 255, 255, 0.25);
    transform: scale(1.05);
}

/* ========================================================
   RESPONSIVE 3D TARGET ANIMALS & ANSWER LABELS
   "Ukuran Relatif Skalatis untuk HP hingga Layar Smartboard"
   ======================================================== */
.target-element-single, 
.target-element-duel {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 16;
}

.target-animal-single {
    width: clamp(68px, 12.5cqw, 175px) !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.5));
}

.target-answer-single {
    background: rgba(3, 10, 24, 0.94) !important;
    color: #ffffff !important;
    font-size: clamp(11px, 1.35cqw, 18px) !important;
    font-weight: 900 !important;
    padding: clamp(4px, 0.8vh, 7px) clamp(10px, 1.4vw, 18px) !important;
    border-radius: 14px !important;
    margin-top: -10px !important;
    border: 2px solid #00f0ff !important;
    display: inline-block !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 240, 255, 0.4) !important;
    line-height: 1.25 !important;
    max-width: clamp(110px, 19cqw, 260px) !important;
    word-break: break-word !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.fixed-shoot-btn {
    position: absolute !important;
    bottom: clamp(14px, 3vh, 25px) !important;
    right: clamp(14px, 3vw, 25px) !important;
    width: clamp(65px, 11vw, 90px) !important;
    height: clamp(65px, 11vw, 90px) !important;
    border-radius: 50% !important;
    font-size: clamp(0.85rem, 1.8vw, 1.1rem) !important;
    font-weight: bold !important;
    z-index: 70 !important;
    pointer-events: auto !important;
    box-shadow: 0 0 20px rgba(255, 51, 68, 0.75) !important;
}

.fixed-joystick-zone {
    position: absolute !important;
    bottom: clamp(14px, 3vh, 25px) !important;
    left: clamp(14px, 3vw, 25px) !important;
    width: clamp(90px, 15vw, 130px) !important;
    height: clamp(90px, 15vw, 130px) !important;
    z-index: 70 !important;
    pointer-events: auto !important;
}

.target-animal-duel {
    width: clamp(48px, 8.2cqw, 112px) !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    pointer-events: none !important;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

.target-answer-duel {
    background: rgba(0, 0, 0, 0.88) !important;
    color: white !important;
    font-size: clamp(9px, 1cqw, 14px) !important;
    font-weight: 800 !important;
    padding: clamp(2px, 0.4vh, 4px) clamp(6px, 1vw, 12px) !important;
    border-radius: 12px !important;
    margin-top: clamp(-14px, -1.5vw, -6px) !important;
    display: inline-block !important;
    pointer-events: none !important;
    line-height: 1.2 !important;
    max-width: clamp(70px, 10.5cqw, 130px) !important;
    word-break: break-word !important;
}

/* ========================================================
   DUEL MODE (1 VS 1 SPLIT-SCREEN) SYSTEM
   ======================================================== */
.duel-crosshair {
    position: absolute;
    width: clamp(34px, 5.5vw, 48px);
    height: clamp(34px, 5.5vw, 48px);
    transform: translate(-50%, -50%);
    pointer-events: none !important;
    border-radius: 50%;
    z-index: 55;
    cursor: crosshair;
    transition: transform 0.08s ease-out, border-color 0.1s, box-shadow 0.1s;
}
.duel-crosshair::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.duel-crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 16px;
    transform: translate(-50%, -50%);
    opacity: 0.8;
}

/* Player 1: RED */
.duel-crosshair.ch-red {
    border: 3px solid var(--neon-red);
    box-shadow: 0 0 16px rgba(255, 51, 68, 0.9), inset 0 0 10px rgba(255, 51, 68, 0.4);
}
.duel-crosshair.ch-red::before {
    background: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}
.duel-crosshair.ch-red::after {
    background: var(--neon-red);
}

/* Player 2: BLUE */
.duel-crosshair.ch-blue {
    border: 3px solid var(--neon-cyan);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.9), inset 0 0 10px rgba(0, 229, 255, 0.4);
}
.duel-crosshair.ch-blue::before {
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}
.duel-crosshair.ch-blue::after {
    background: var(--neon-cyan);
}

.duel-crosshair.shoot {
    transform: translate(-50%, -50%) scale(1.3) !important;
    border-color: #ffff00 !important;
    box-shadow: 0 0 25px #ffff00, inset 0 0 15px #ffff00 !important;
}

.ch-tag {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    font-family: var(--font-fredoka);
    font-size: clamp(9px, 1.2vw, 11px);
    font-weight: 900;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    text-transform: uppercase;
}
.ch-tag.tag-red {
    background: rgba(220, 20, 40, 0.95);
    color: #ffffff;
    border: 1px solid #ff6677;
    box-shadow: 0 0 8px rgba(255, 51, 68, 0.6);
}
.ch-tag.tag-blue {
    background: rgba(0, 140, 220, 0.95);
    color: #ffffff;
    border: 1px solid #33eeff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

/* Split Screen Touch/Click Zones */
.duel-screen-zone {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
    touch-action: none;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.2s ease;
}
#screenZone1 { left: 0; }
#screenZone2 { left: 50%; }
#screenZone1.focused { box-shadow: inset 0 0 45px rgba(255, 51, 68, 0.3); }
#screenZone2.focused { box-shadow: inset 0 0 45px rgba(0, 229, 255, 0.3); }

/* Center Divider & VS Badge */
.duel-center-divider {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #ff3344 0%, #ffffff 50%, #00e5ff 100%);
    transform: translateX(-50%);
    z-index: 30;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
    pointer-events: none;
}
.duel-vs-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(36px, 5vw, 50px);
    height: clamp(36px, 5vw, 50px);
    border-radius: 50%;
    background: radial-gradient(circle, #1a2238 0%, #080d1a 100%);
    border: 2px solid #ffd700;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.7);
    color: #ffd700;
    font-family: var(--font-fredoka);
    font-size: clamp(0.9rem, 1.6vw, 1.25rem);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 31;
    pointer-events: none;
}

/* Dedicated Pause Buttons per Screen */
.btn-pause-duel-p1 {
    position: absolute;
    top: clamp(8px, 1.2vh, 15px);
    left: clamp(8px, 1.2vw, 15px);
    padding: clamp(5px, 0.8vh, 8px) clamp(10px, 1.2vw, 18px);
    background: rgba(220, 20, 40, 0.88);
    border: 2px solid #ff4d6d;
    border-radius: clamp(8px, 1vw, 12px);
    color: white;
    font-family: var(--font-fredoka);
    font-size: clamp(0.72rem, 1.5vw, 0.95rem);
    cursor: pointer;
    z-index: 85 !important;
    box-shadow: 0 0 14px rgba(255, 51, 68, 0.6);
    transition: all 0.2s;
    pointer-events: auto !important;
    letter-spacing: 0.5px;
    touch-action: manipulation;
}
.btn-pause-duel-p1:hover {
    background: #ff3344;
    transform: scale(1.05);
    box-shadow: 0 0 22px rgba(255, 51, 68, 0.9);
}

.btn-pause-duel-p2 {
    position: absolute;
    top: clamp(8px, 1.2vh, 15px);
    right: clamp(8px, 1.2vw, 15px);
    padding: clamp(5px, 0.8vh, 8px) clamp(10px, 1.2vw, 18px);
    background: rgba(0, 140, 220, 0.88);
    border: 2px solid #33eeff;
    border-radius: clamp(8px, 1vw, 12px);
    color: white;
    font-family: var(--font-fredoka);
    font-size: clamp(0.72rem, 1.5vw, 0.95rem);
    cursor: pointer;
    z-index: 85 !important;
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
    transition: all 0.2s;
    pointer-events: auto !important;
    letter-spacing: 0.5px;
    touch-action: manipulation;
}
.btn-pause-duel-p2:hover {
    background: #00e5ff;
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.9);
}

/* Dedicated Pause Screens per Player */
.duel-pause-screen {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    z-index: 90 !important;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 25px);
    box-sizing: border-box;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto !important;
    animation: fadeIn 0.2s ease-out;
}
#pauseOverlay1 {
    left: 0;
    background: rgba(22, 5, 12, 0.94);
    border-right: 3px solid #ff3344;
}
#pauseOverlay2 {
    left: 50%;
    background: rgba(5, 15, 30, 0.94);
    border-left: 3px solid #00e5ff;
}
.duel-pause-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: clamp(14px, 2vw, 20px);
    padding: clamp(14px, 2vh, 25px) clamp(10px, 1.5vw, 20px);
    width: 92%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 12px 35px rgba(0,0,0,0.6);
}
.duel-pause-score-box {
    background: rgba(0, 0, 0, 0.55);
    border-radius: 12px;
    padding: clamp(8px, 1.2vh, 14px);
    margin: clamp(10px, 1.5vh, 16px) 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-duel-resume {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-family: var(--font-fredoka);
    padding: clamp(8px, 1.4vh, 12px) clamp(12px, 1.5vw, 20px);
    border-radius: 12px;
    font-size: clamp(0.85rem, 1.8vw, 1.05rem);
    cursor: pointer;
    border: none;
    width: 100%;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.5px;
}
.btn-duel-resume:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.7);
}
.btn-duel-quit {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    font-family: var(--font-fredoka);
    padding: clamp(8px, 1.4vh, 12px) clamp(12px, 1.5vw, 20px);
    border-radius: 12px;
    font-size: clamp(0.82rem, 1.7vw, 1rem);
    cursor: pointer;
    border: none;
    width: 100%;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transition: all 0.2s;
    letter-spacing: 0.5px;
}
.btn-duel-quit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.7);
}
.btn-duel-quit.waiting {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.6) !important;
    animation: pulseButton 1s infinite alternate;
}

/* Floating Cross-Screen Quit Alerts */
.duel-quit-alert {
    position: absolute;
    top: clamp(45px, 8vh, 75px);
    width: 86%;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.95);
    color: #000;
    font-family: var(--font-fredoka);
    font-size: clamp(0.74rem, 1.6vw, 0.9rem);
    line-height: 1.35;
    text-align: center;
    z-index: 50;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 16px rgba(245, 158, 11, 0.8);
    display: none;
    animation: alertBounce 1.2s infinite alternate ease-in-out;
}
#quitAlert1 { left: 7%; }
#quitAlert2 { right: 7%; }

/* Duel HUD Header & Question Boxes */
.question-box-duel {
    position: absolute;
    font-size: clamp(0.72rem, 1.6vw, 1.25rem);
    padding: clamp(6px, 1vh, 12px) clamp(8px, 1.2vw, 16px);
    border-radius: clamp(8px, 1.2vw, 14px);
    color: white;
    text-align: center;
    font-weight: bold;
    line-height: 1.25;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    pointer-events: auto;
}
.duel-question-p1 {
    top: 15px;
    left: clamp(100px, 12vw, 145px);
    right: calc(50% + clamp(10px, 1.5vw, 20px));
    border: 2px solid var(--neon-red);
    background: rgba(40, 5, 15, 0.9);
    box-shadow: 0 0 12px rgba(255, 51, 68, 0.5);
}
.duel-question-p2 {
    top: 15px;
    left: calc(50% + clamp(10px, 1.5vw, 20px));
    right: clamp(100px, 12vw, 145px);
    border: 2px solid var(--neon-cyan);
    background: rgba(5, 25, 45, 0.9);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.duel-stats-box {
    position: absolute;
    font-family: var(--font-fredoka);
    pointer-events: none;
}
.duel-stats-p1 {
    top: clamp(65px, 10vh, 90px);
    left: clamp(10px, 1.5vw, 20px);
    color: #ff4d6d;
    text-align: left;
}
.duel-stats-p2 {
    top: clamp(65px, 10vh, 90px);
    right: clamp(10px, 1.5vw, 20px);
    color: #33eeff;
    text-align: right;
}
.duel-player-tag {
    padding: 3px 10px;
    border-radius: 8px;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 1px;
    color: #fff;
    display: inline-block;
}
.duel-player-tag.tag-red { background: rgba(220, 20, 40, 0.88); }
.duel-player-tag.tag-blue { background: rgba(0, 140, 220, 0.88); }
.duel-score-row {
    margin-top: 4px;
    font-size: clamp(0.95rem, 1.8vw, 1.45rem);
    color: #fff;
    text-shadow: 0 0 8px #000;
}

.duel-joystick-zone {
    position: absolute;
    bottom: clamp(12px, 2vh, 20px);
    width: clamp(85px, 14vw, 130px);
    height: clamp(85px, 14vw, 130px);
    pointer-events: auto;
    z-index: 45;
}
.duel-joystick-p1 { left: clamp(10px, 1.5vw, 20px); }
.duel-joystick-p2 { left: calc(50% + clamp(10px, 1.5vw, 20px)); }

.duel-shoot-btn {
    position: absolute;
    bottom: clamp(18px, 3vh, 30px);
    font-size: clamp(0.78rem, 1.4vw, 1.1rem) !important;
    padding: clamp(8px, 1.2vh, 12px) clamp(12px, 1.8vw, 24px) !important;
    width: auto !important;
    height: auto !important;
    min-width: clamp(65px, 11vw, 110px);
    min-height: clamp(40px, 6vh, 55px);
    border-radius: 999px !important;
}
.duel-shoot-p1 {
    right: calc(50% + clamp(10px, 2vw, 30px));
    border-color: var(--neon-red);
    background: rgba(220, 20, 40, 0.8);
    box-shadow: 0 0 15px rgba(255, 51, 68, 0.6);
}
.duel-shoot-p2 {
    right: clamp(10px, 2vw, 30px);
    border-color: var(--neon-cyan);
    background: rgba(0, 140, 220, 0.8);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
}

/* Result Permainan Screen */
.duel-result-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.96) 0%, rgba(3, 7, 18, 0.98) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 20px);
    box-sizing: border-box;
    animation: fadeIn 0.4s ease-out;
    color: white;
    font-family: var(--font-fredoka);
    pointer-events: auto;
    overflow-y: auto;
}
.duel-winner-banner {
    font-size: clamp(1.4rem, 4.5vw, 2.8rem);
    font-weight: 900;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.duel-res-grid {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 25px);
    margin: clamp(10px, 2vh, 20px) 0;
    max-width: 820px;
    width: 95%;
}
.duel-res-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border-radius: clamp(14px, 2vw, 20px);
    padding: clamp(14px, 2vh, 22px);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    transition: transform 0.3s;
}
.duel-res-card.card-red {
    border: 2.5px solid var(--neon-red);
    box-shadow: 0 0 25px rgba(255, 51, 68, 0.35);
}
.duel-res-card.card-blue {
    border: 2.5px solid var(--neon-cyan);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.35);
}
.duel-res-card.is-winner {
    transform: scale(1.03);
    background: rgba(255, 255, 255, 0.12);
}
.duel-res-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: clamp(0.74rem, 1.4vw, 0.85rem);
    margin-bottom: 8px;
    letter-spacing: 1px;
}
.duel-res-score {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    font-weight: 900;
    margin: 4px 0 10px 0;
    line-height: 1;
}
.duel-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-nunito);
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
}
.btn-duel-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: clamp(10px, 1.8vh, 14px) clamp(16px, 2vw, 28px);
    border-radius: 14px;
    font-family: var(--font-fredoka);
    font-size: clamp(0.9rem, 1.8vw, 1.15rem);
    cursor: pointer;
    border: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}
.btn-duel-rematch {
    background: linear-gradient(135deg, #00e5ff 0%, #0077ff 100%);
    color: #000;
    font-weight: 900;
    box-shadow: 0 4px 18px rgba(0, 229, 255, 0.5);
}
.btn-duel-rematch:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(0, 229, 255, 0.8);
}
.btn-duel-lobby {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}
.btn-duel-lobby:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: #fff;
    transform: translateY(-2px) scale(1.02);
}

/* ========================================================
   FEEDBACK & PAUSE SCREEN (SINGLE)
   ======================================================== */
.feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.8rem, 6vw, 3.8rem);
    font-weight: bold;
    font-size: clamp(1.5rem, 4.2cqw, 3.2rem) !important;
    white-space: nowrap;
    -webkit-text-stroke: 2px #050a18;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 60;
}
.feedback-overlay.show { opacity: 1; }
.feedback-overlay.correct { color: #0f0; }
.feedback-overlay.wrong { color: #f00; }

#pauseMenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
    box-sizing: border-box;
}

.pause-title {
    font-size: clamp(1.8rem, 6vw, 3.8rem);
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px #0ff, 0 0 20px #00f;
    margin-bottom: clamp(15px, 3vh, 35px);
    letter-spacing: 3px;
    text-align: center;
}

.pause-menu-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.8vh, 18px);
    width: min(90%, 340px);
}

#roundNotification {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
    color: #fff;
    font-size: clamp(1.8rem, 6.5vw, 5rem);
    font-weight: bold;
    text-shadow: 0 0 20px #0ff, 0 0 40px #00f;
    letter-spacing: clamp(3px, 1vw, 8px);
    pointer-events: none;
    animation: zoomIn 0.5s ease-out;
}

/* ========================================================
   KEYFRAME ANIMATIONS
   ======================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes zoomIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes alertBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(6px); }
}

@keyframes pulseButton {
    0% { opacity: 0.9; }
    100% { opacity: 1; transform: scale(1.02); }
}

/* ========================================================
   RESPONSIVE MEDIA QUERIES (HP & TABLET ADAPTATIONS)
   ======================================================== */

/* Tablet & Mobile Screens (Lebar <= 850px) */
@media (max-width: 850px) {
    /* Tetap paten 3 kolom */
    .menu-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: clamp(5px, 1vw, 10px) !important;
        max-width: 820px !important;
    }

    /* Single Mode HUD: Grid Ramping 2 Baris */
    .hud-top {
        display: grid;
        grid-template-areas: 
            "pause stats progress"
            "question question question";
        grid-template-columns: auto 1fr auto;
        gap: 6px 10px;
        align-items: center;
    }
    .btn-pause {
        grid-area: pause;
    }
    .stats-box.stats-box-score {
        grid-area: stats;
        display: flex;
        gap: 8px;
        justify-content: center;
        align-items: center;
        padding: 4px 10px;
    }
    .stats-box.stats-box-score div {
        margin-bottom: 0;
    }
    .question-box {
        grid-area: question;
        max-width: 100%;
        padding: 6px 14px;
        font-size: clamp(0.85rem, 2.6vw, 1.15rem);
    }
    .stats-box.stats-box-progress {
        grid-area: progress;
        padding: 4px 10px;
    }

    .controls-hint {
        display: none !important;
    }

    /* Duel Mode Question Re-alignment for narrower width */
    .duel-question-p1 {
        top: 45px;
        left: 8px;
        right: calc(50% + 8px);
    }
    .duel-question-p2 {
        top: 45px;
        left: calc(50% + 8px);
        right: 8px;
    }
    .duel-stats-p1 {
        top: 8px;
        left: 95px;
    }
    .duel-stats-p2 {
        top: 8px;
        right: 95px;
    }
}

/* Mobile Portrait Mode (HP Vertikal) */
@media screen and (orientation: portrait) and (max-width: 900px),
       screen and (max-width: 500px) {
    .mobile-orient-tip {
        display: flex;
    }
    .menu-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: clamp(4px, 1vw, 8px) !important;
        max-width: 820px !important;
    }
    .menu-card {
        padding: 10px 8px;
    }
    .duel-res-grid {
        flex-direction: column;
        gap: 12px;
    }
}

/* Smartphone Landscape Mode (Layar Mendatar Tinggi <= 580px atau Orientasi Landscape) */
@media screen and (max-height: 580px),
       screen and (orientation: landscape) and (max-height: 640px) {
    .mobile-orient-tip {
        display: none !important;
    }
    .lobby-container {
        padding: 6px 10px !important;
        justify-content: flex-start !important;
    }
    .title-glow {
        font-size: clamp(1.25rem, 3.8vw, 1.8rem) !important;
        margin-bottom: 2px !important;
        letter-spacing: 2px !important;
    }
    .tagline {
        font-size: clamp(0.68rem, 1.5vw, 0.84rem) !important;
        margin-bottom: 6px !important;
    }
    .menu-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px 10px !important;
        max-width: 800px !important;
        width: 96% !important;
        padding: 2px !important;
    }
    .menu-card {
        padding: clamp(5px, 1.2vh, 8px) clamp(8px, 1.5vw, 12px) !important;
        font-size: clamp(0.72rem, 1.5vw, 0.86rem) !important;
        border-radius: 10px !important;
        gap: 2px !important;
        min-height: 44px !important;
    }
    .menu-card small {
        font-size: clamp(0.6rem, 1.1vw, 0.72rem) !important;
    }

    /* Compact Low-profile HUD di Landscape */
    .hud-top {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "pause question stats";
        gap: 4px 8px;
        align-items: center;
    }
    .question-box {
        padding: 4px 10px !important;
        font-size: clamp(0.74rem, 1.8vw, 0.92rem) !important;
        border-width: 1.5px !important;
        line-height: 1.2;
    }
    .stats-box {
        padding: 4px 8px !important;
        font-size: 0.74rem !important;
    }
    .stats-box.stats-box-progress {
        display: none !important; /* Ringkas di landscape sempit */
    }
    .btn-action {
        width: 55px !important;
        height: 55px !important;
        font-size: 0.8rem !important;
    }
    #joystickZone {
        width: 85px !important;
        height: 85px !important;
    }
    .duel-shoot-btn {
        min-width: 55px !important;
        min-height: 38px !important;
        font-size: 0.72rem !important;
    }
    .duel-joystick-zone {
        width: 75px !important;
        height: 75px !important;
    }
}


/* ========================================================
   ACCESSIBILITY, FOCUS RINGS & MISSION SUB-SCREEN COMPACT
   ======================================================== */
button:focus-visible,
a:focus-visible,
.menu-card:focus-visible,
.ww-btn:focus-visible {
    outline: 3px solid #fb8500 !important;
    outline-offset: 2px !important;
}

.ww-btn {
    min-height: 40px;
}

@media (pointer: coarse) {
    .ww-btn,
    .btn-pause,
    .btn-close-modal {
        min-height: 44px;
        min-width: 44px;
    }
}

.mission-grid-compact .menu-card {
    padding: clamp(6px, 1.2vh, 12px) clamp(8px, 1.2vw, 14px) !important;
    font-size: clamp(0.68rem, 1.1cqw, 0.88rem) !important;
}
.mission-grid-compact .menu-card h3 {
    font-size: clamp(0.78rem, 1.25cqw, 1.05rem) !important;
    margin-bottom: 4px !important;
}
.mission-grid-compact .menu-card p {
    font-size: clamp(0.62rem, 0.95cqw, 0.78rem) !important;
    line-height: 1.25 !important;
    margin-bottom: 6px !important;
}

#teacherLobby.lobby-container,
#settingsLobby.lobby-container {
    overflow-y: auto !important;
    justify-content: flex-start !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Duel Mode Quick Tutorial Guide Banner (floating cleanly at bottom-center) */
.duel-guide-banner {
    position: absolute;
    top: clamp(66px, 6.8cqw, 92px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 82;
    background: rgba(8, 13, 28, 0.92);
    border: 1.5px solid rgba(0, 229, 255, 0.45);
    border-radius: 12px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f1f5f9;
    font-size: clamp(0.62rem, 0.92cqw, 0.76rem);
    font-weight: 700;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    max-width: 50%;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}
.btn-close-guide {
    background: rgba(255, 255, 255, 0.16);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 900;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-close-guide:hover {
    background: #ef4444;
}
