/* ============================================================================
 * QUIZ BUZZER PRO - MODERN STAGE GAME SHOW THEME
 * Deep Slate / Midnight Navy (#0b1120) + High Contrast Team Identities
 * ============================================================================ */

:root {
    color-scheme: dark;
    --bg-stage: #0b1120;
    --bg-surface: #111827;
    --bg-card: #1e293b;
    --bg-card-hover: #26354d;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.22);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Identitas Warna Regu */
    --team-a: #ef4444; /* Merah */
    --team-b: #3b82f6; /* Biru */
    --team-c: #10b981; /* Hijau */
    --team-d: #f59e0b; /* Kuning/Amber */
    --team-e: #a855f7; /* Ungu */
    --team-f: #ec4899; /* Pink */
    --team-g: #06b6d4; /* Cyan */
    --team-h: #f97316; /* Oranye */

    --target-size: 24px;
    --scrollbar-thumb: #475569;
    --scrollbar-track: #0f172a;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

@media (pointer: coarse) {
    :root {
        --target-size: 44px;
    }
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-stage);
    background-image:
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(239, 68, 68, 0.10) 0%, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-block-size: 100vh;
    overflow-wrap: break-word;
    margin: 0;
}

h1, h2, h3 {
    text-wrap: balance;
    letter-spacing: -0.02em;
}

p, li {
    text-wrap: pretty;
}

:where(button, select, textarea, input:not([type="checkbox"], [type="radio"]), [role="button"]) {
    min-block-size: var(--target-size);
    min-inline-size: var(--target-size);
}

/* Stage Cards & Panels */
.stage-card {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.stage-card:hover {
    border-color: var(--border-highlight);
}

.stage-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Custom Inputs for Dark Stage */
.form-control-stage,
.form-select-stage {
    background-color: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #f8fafc !important;
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-size: 1rem;
}

.form-control-stage:focus,
.form-select-stage:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
    outline: none;
}

.form-control-stage::placeholder {
    color: #64748b;
}

/* Monospace Digital Display (Timer, Room Code, Scores) */
.font-digital {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
}

/* Room Code Pill */
.room-code-pill {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    letter-spacing: 0.15em;
    padding: 0.35rem 0.85rem;
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #38bdf8;
}

/* Team Identity Badges */
.team-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 10px currentColor;
}

.shortcut-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: #f8fafc;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-bottom-width: 3px;
    border-radius: 0.45rem;
}

/* Status Badges */
.status-badge-open {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.45);
}

.status-badge-locked {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-badge-buzzed {
    background: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.5);
    animation: pulseGlow 1.2s infinite alternate;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    100% {
        box-shadow: 0 0 18px 4px rgba(245, 158, 11, 0.35);
    }
}

/* Sound Test Toolbar Buttons */
.btn-sound-test {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-sound-test:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #60a5fa;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-sound-test:active {
    transform: translateY(0);
}

/* ============================================================================
 * HOST & PROJECTOR SCREEN STYLES (host.php)
 * ============================================================================ */

/* Giant Timer Display */
.timer-display-box {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(11, 17, 32, 0.96) 100%);
    border: 2px solid rgba(56, 189, 248, 0.25);
    border-radius: 1.5rem;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.75),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.timer-digits {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    font-size: clamp(4rem, 9vw, 7.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #f8fafc;
    text-shadow: 0 0 32px rgba(56, 189, 248, 0.35);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.timer-digits .timer-tenths {
    font-size: 0.55em;
    opacity: 0.9;
}

/* State Normal (Putih/Cyan) */
.timer-state-normal {
    color: #38bdf8;
    text-shadow: 0 0 32px rgba(56, 189, 248, 0.4);
}

/* State Warning <= 10s (Kuning Amber) */
.timer-state-warning {
    color: #fbbf24 !important;
    text-shadow: 0 0 36px rgba(245, 158, 11, 0.55) !important;
}

.timer-box-warning {
    border-color: rgba(245, 158, 11, 0.6) !important;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.2) !important;
}

/* State Critical <= 5s or TIMEUP (Merah Berkedip) */
.timer-state-danger {
    color: #ef4444 !important;
    text-shadow: 0 0 42px rgba(239, 68, 68, 0.75) !important;
}

.timer-box-danger {
    border-color: rgba(239, 68, 68, 0.85) !important;
    box-shadow: 0 0 45px rgba(239, 68, 68, 0.35) !important;
}

.animate-pulse {
    animation: criticalPulse 0.55s ease-in-out infinite alternate;
}

@keyframes criticalPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.55;
        transform: scale(0.985);
    }
}

/* Spotlight Winner Banner */
.buzzer-banner {
    border-radius: 1.5rem;
    padding: 1.5rem 2rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.buzzer-banner-locked {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

.buzzer-banner-open {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.88), rgba(16, 185, 129, 0.28));
    border: 2px solid #10b981;
    color: #ecfdf5;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.35);
    animation: openBannerGlow 1.3s ease-in-out infinite alternate;
}

@keyframes openBannerGlow {
    0% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
    }
    100% {
        box-shadow: 0 0 45px rgba(16, 185, 129, 0.55);
    }
}

.buzzer-banner-buzzed {
    border-width: 3px;
    border-style: solid;
    color: #ffffff;
    transform: translateY(-2px);
    animation: winnerSpotlight 0.9s ease-in-out infinite alternate;
}

@keyframes winnerSpotlight {
    0% {
        filter: brightness(1);
    }
    100% {
        filter: brightness(1.12);
    }
}

/* Team Scoreboard Cards */
.team-score-card {
    background: rgba(15, 23, 42, 0.88);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-width: 6px;
    border-radius: 1.25rem;
    padding: 1.25rem;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, opacity 0.22s ease;
    position: relative;
}

.team-score-card.is-winner {
    transform: translateY(-6px) scale(1.015);
    z-index: 3;
}

.team-score-card.is-locked-out {
    opacity: 0.65;
    background: rgba(15, 23, 42, 0.55);
}

.team-giant-score {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-variant-numeric: tabular-nums;
    font-size: clamp(2.75rem, 4.8vw, 4.25rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease;
    display: inline-block;
}

.score-pop-up {
    animation: scorePopUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #34d399 !important;
}

.score-pop-down {
    animation: scorePopDown 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #f87171 !important;
}

@keyframes scorePopUp {
    0% { transform: scale(1); }
    40% { transform: scale(1.28); }
    100% { transform: scale(1); }
}

@keyframes scorePopDown {
    0% { transform: scale(1); }
    30% { transform: scale(0.82) rotate(-3deg); }
    60% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Floating Bottom Action Bar */
.host-floating-dock {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    background: rgba(11, 17, 32, 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.85rem 0;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -15px 35px rgba(0, 0, 0, 0.6);
}

/* QR Code Container */
.qr-box-wrapper {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.qr-box-wrapper img,
.qr-box-wrapper canvas {
    display: block !important;
    max-width: 100%;
    height: auto !important;
}

/* ============================================================================
 * MOBILE-FIRST PLAYER BUZZER SCREEN STYLES (player.php)
 * Full Viewport 100dvh, Anti-Zoom, Zero-Delay Touch Action
 * ============================================================================ */

.player-viewport {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    transition: background-color 0.25s ease;
}

/* Lobi Pemilihan Regu boleh scroll jika daftar regu banyak */
.player-lobby-viewport {
    min-height: 100dvh;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
}

.team-select-btn {
    background: rgba(30, 41, 59, 0.88);
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-left-width: 8px;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    text-align: left;
    color: #f8fafc;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
}

.team-select-btn:hover,
.team-select-btn:active {
    transform: translateY(-2px);
    background: rgba(38, 53, 77, 0.95);
}

/* Giant Mobile Buzzer Button (~70% Screen Area) */
.giant-buzzer-pad {
    width: 100%;
    height: 100%;
    min-height: 62dvh;
    border-radius: 2rem;
    border: 4px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

.giant-buzzer-pad:focus {
    outline: none;
}

.giant-buzzer-pad.is-pressing {
    transform: scale(0.95) !important;
}

/* 1. Status LOCKED (Abu-abu redup) */
.buzzer-pad-locked {
    background: radial-gradient(circle at 50% 35%, #1e293b 0%, #0f172a 85%);
    border-color: rgba(148, 163, 184, 0.25);
    color: #94a3b8;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.6);
    cursor: not-allowed;
}

/* 2. Status LOCKED_OUT (Merah gelap terkunci karena sudah salah) */
.buzzer-pad-locked-out {
    background: radial-gradient(circle at 50% 35%, #450a0a 0%, #1f0606 90%);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    box-shadow: inset 0 0 35px rgba(239, 68, 68, 0.25);
    cursor: not-allowed;
}

/* 3. Status OPEN (Menyala terang sesuai warna regu + denyut glow) */
.buzzer-pad-open {
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    animation: mobileBuzzerPulse 1.15s ease-in-out infinite alternate;
}

@keyframes mobileBuzzerPulse {
    0% {
        transform: scale(0.99);
        filter: brightness(1);
    }
    100% {
        transform: scale(1.01);
        filter: brightness(1.12);
    }
}

/* 4. Status BUZZED - WON (Regu Ini Pemenangnya! Berkedip cerah hijau/emas) */
.buzzer-pad-won {
    background: radial-gradient(circle at 50% 30%, #10b981 0%, #059669 55%, #047857 100%) !important;
    border-color: #fde047 !important;
    border-width: 5px !important;
    color: #ffffff !important;
    box-shadow: 0 0 65px rgba(16, 185, 129, 0.8), inset 0 0 30px rgba(253, 224, 71, 0.45) !important;
    animation: winnerFlashMobile 0.55s ease-in-out infinite alternate;
}

@keyframes winnerFlashMobile {
    0% {
        filter: brightness(1);
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.7);
    }
    100% {
        filter: brightness(1.18);
        box-shadow: 0 0 75px rgba(250, 204, 21, 0.9);
    }
}

/* 5. Status BUZZED - LOST (Keduluan Regu Lain) */
.buzzer-pad-lost {
    background: radial-gradient(circle at 50% 40%, #3b0d0d 0%, #180909 90%) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fecaca !important;
    cursor: not-allowed;
}

/* Ring Indikator Dalam Tombol Bel */
.buzzer-inner-ring {
    width: clamp(130px, 34vw, 185px);
    height: clamp(130px, 34vw, 185px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 3px solid rgba(255, 255, 255, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease;
}

/* ============================================================================
 * REKAPITULASI & PRINT BERITA ACARA STYLES (rekap.php)
 * ============================================================================ */

.podium-card {
    border-radius: 1.25rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    background: rgba(30, 41, 59, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.12);
}

.podium-gold {
    border-color: #fbbf24;
    background: linear-gradient(160deg, rgba(245, 158, 11, 0.22) 0%, rgba(30, 41, 59, 0.92) 70%);
    box-shadow: 0 18px 40px -12px rgba(245, 158, 11, 0.3);
}

.podium-silver {
    border-color: #94a3b8;
    background: linear-gradient(160deg, rgba(148, 163, 184, 0.2) 0%, rgba(30, 41, 59, 0.92) 70%);
}

.podium-bronze {
    border-color: #d97706;
    background: linear-gradient(160deg, rgba(217, 119, 6, 0.2) 0%, rgba(30, 41, 59, 0.92) 70%);
}

/* Sembunyikan bagian tanda tangan cetak saat di layar normal */
.print-only-header,
.print-only-signature {
    display: none;
}

@media print {
    :root {
        color-scheme: light !important;
    }

    body {
        background: #ffffff !important;
        background-image: none !important;
        color: #000000 !important;
        font-size: 11pt;
    }

    .no-print,
    nav,
    header .btn,
    .btn {
        display: none !important;
    }

    .print-only-header {
        display: block !important;
        border-bottom: 3px double #000;
        padding-bottom: 12px;
        margin-bottom: 20px;
        text-align: center;
        color: #000 !important;
    }

    .print-only-signature {
        display: block !important;
        margin-top: 36px;
        page-break-inside: avoid;
        color: #000 !important;
    }

    .stage-card,
    .podium-card {
        background: #ffffff !important;
        border: 1px solid #333333 !important;
        box-shadow: none !important;
        color: #000000 !important;
        break-inside: avoid;
    }

    .text-white,
    .text-light,
    .text-secondary,
    .text-info,
    h1, h2, h3, h4, h5, h6,
    table, th, td {
        color: #000000 !important;
    }

    .table {
        border-color: #333333 !important;
    }

    .table th,
    .table td {
        background: transparent !important;
        border: 1px solid #666666 !important;
        color: #000000 !important;
    }
}


