/* ==========================================
   QUIZ MODE — 16:9 LANDSCAPE FULLSCREEN
   ========================================== */

/* --- OVERLAY CONTAINER --- */
.quiz-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #050B14;
    display: none;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    color: #E2F1FF;
    overflow: hidden;
}

.quiz-overlay.active {
    display: flex;
}

/* --- SETUP SCREEN --- */
.quiz-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2rem;
    padding: 2rem;
    background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.08) 0%, transparent 70%);
}

.quiz-setup-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #00E5FF;
    text-shadow: 0 0 20px #00E5FF, 0 0 40px #00E5FF;
    text-align: center;
    letter-spacing: 3px;
}

.quiz-setup-subtitle {
    color: #A0B4C4;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    text-align: center;
    max-width: 600px;
}

.quiz-setup-form {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
}

.quiz-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-field label {
    font-size: 0.85rem;
    color: #A0B4C4;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.quiz-field select {
    background: rgba(13, 22, 38, 0.9);
    border: 2px solid #00E5FF;
    color: #E2F1FF;
    font-family: 'Orbitron', sans-serif;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    outline: none;
    min-width: 180px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300E5FF' viewBox='0 0 16 16'%3e%3cpath d='M8 11L2 5h12z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.quiz-field select:focus {
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.quiz-btn {
    font-family: 'Poppins', sans-serif;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.quiz-btn-primary {
    background: linear-gradient(135deg, #00E5FF, #00B8D4);
    color: #050B14;
    box-shadow: 0 6px 0 #0097A7, 0 0 30px rgba(0, 229, 255, 0.3);
}

.quiz-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #0097A7, 0 0 40px rgba(0, 229, 255, 0.5);
}

.quiz-btn-primary:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 transparent;
}

.quiz-btn-secondary {
    background: rgba(124, 139, 156, 0.3);
    color: #A0B4C4;
    border: 2px solid #A0B4C4;
}

.quiz-btn-secondary:hover {
    background: rgba(124, 139, 156, 0.5);
    color: #E2F1FF;
}

.quiz-setup-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.quiz-rules {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 500px;
    font-size: 0.85rem;
    color: #A0B4C4;
    line-height: 1.8;
}

.quiz-rules strong {
    color: #00E5FF;
}

/* --- GAME SCREEN --- */
.quiz-game {
    display: none;
    flex-direction: column;
    height: 100%;
}

/* Timer bar at top */
.quiz-timer-wrap {
    height: 48px;
    background: rgba(13, 22, 38, 0.95);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
    flex-shrink: 0;
}

.quiz-timer-label {
    font-size: 0.8rem;
    color: #A0B4C4;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.quiz-timer-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.quiz-timer-fill {
    height: 100%;
    background: #39FF14;
    border-radius: 6px;
    transition: width 1s linear, background 0.5s;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.quiz-timer-time {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: #39FF14;
    min-width: 80px;
    text-align: right;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

/* --- ARENA (player columns) --- */
.quiz-arena {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Player column */
.player-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 2px solid rgba(0, 229, 255, 0.15);
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(5, 11, 20, 0.95) 0%, rgba(13, 22, 38, 0.9) 100%);
}

.player-column:last-child {
    border-right: none;
}

/* Player header */
.player-header {
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.player-name {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    font-weight: bold;
    letter-spacing: 1px;
}

.player-score-wrap {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.player-score {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.player-score-target {
    font-size: 0.7rem;
    color: #A0B4C4;
}

.score-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.score-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px currentColor;
}

/* --- Question area --- */
.player-question-area {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.q-number {
    font-size: 0.7rem;
    color: #A0B4C4;
    text-transform: uppercase;
    letter-spacing: 2px;
    flex-shrink: 0;
}

.q-text {
    font-size: clamp(0.8rem, 1.8vw, 1.1rem);
    color: #E2F1FF;
    line-height: 1.4;
    font-weight: 600;
    flex-shrink: 0;
}

/* Question image (SVG illustration) */
.q-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 11, 20, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 10px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.q-image svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 28vh;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 2px solid rgba(0, 229, 255, 0.3);
    border-radius: 10px;
    background: rgba(13, 22, 38, 0.7);
    color: #E2F1FF;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.7rem, 1.4vw, 0.95rem);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.q-option:hover {
    border-color: #00E5FF;
    background: rgba(0, 229, 255, 0.1);
    transform: translateX(4px);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.q-option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.15);
    color: #00E5FF;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.q-option-text {
    flex: 1;
}

/* Answer feedback states */
.q-option.correct {
    border-color: #39FF14 !important;
    background: rgba(57, 255, 20, 0.15) !important;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
    animation: correctPulse 0.5s ease;
}

.q-option.correct .q-option-letter {
    background: #39FF14;
    color: #050B14;
}

.q-option.wrong {
    border-color: #FF2A6D !important;
    background: rgba(255, 42, 109, 0.15) !important;
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.3);
    animation: wrongShake 0.4s ease;
}

.q-option.wrong .q-option-letter {
    background: #FF2A6D;
    color: #fff;
}

.q-option[data-used="true"] {
    pointer-events: none;
    opacity: 0.7;
}

.q-option.correct[data-used="true"],
.q-option.wrong[data-used="true"] {
    opacity: 1;
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* Player feedback */
.player-feedback {
    padding: 8px 16px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fb-correct {
    color: #39FF14;
    font-weight: bold;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
    animation: feedbackIn 0.3s ease;
}

.fb-wrong {
    color: #FF2A6D;
    font-weight: bold;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    text-shadow: 0 0 10px rgba(255, 42, 109, 0.5);
    animation: feedbackIn 0.3s ease;
}

.fb-win {
    color: #FFD700;
    font-weight: 900;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    animation: winPulse 1s infinite alternate;
}

@keyframes feedbackIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes winPulse {
    from {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    }

    to {
        text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.5);
    }
}

/* --- Player count layout adjustments --- */
.players-1 .player-column {
    max-width: 100%;
}

.players-1 .q-text {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
}

.players-1 .q-option {
    padding: 14px 20px;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}

.players-1 .player-name {
    font-size: 1.2rem;
}

.players-2 .q-text {
    font-size: clamp(0.85rem, 2vw, 1.15rem);
}

.players-2 .q-option {
    padding: 12px 16px;
}

.players-3 .q-text {
    font-size: clamp(0.75rem, 1.5vw, 1rem);
}

.players-3 .q-option {
    padding: 8px 12px;
    font-size: clamp(0.6rem, 1.2vw, 0.85rem);
}

.players-4 .q-text {
    font-size: clamp(0.65rem, 1.2vw, 0.9rem);
}

.players-4 .q-option {
    padding: 7px 10px;
    font-size: clamp(0.55rem, 1vw, 0.75rem);
}

.players-4 .q-option-letter {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
}

.players-4 .player-header {
    padding: 6px 10px;
}

.players-1 .q-image svg {
    max-height: 35vh;
}

.players-2 .q-image svg {
    max-height: 28vh;
}

.players-3 .q-image svg {
    max-height: 22vh;
}

.players-4 .q-image svg {
    max-height: 18vh;
}

/* --- RESULT SCREEN --- */
.quiz-result {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2rem;
    padding: 2rem;
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.05) 0%, transparent 60%);
}

.result-title {
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    text-align: center;
    animation: winPulse 2s infinite alternate;
}

.result-cards {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.result-card {
    background: rgba(13, 22, 38, 0.9);
    border: 2px solid #A0B4C4;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    text-align: center;
    min-width: 180px;
    transition: all 0.3s;
}

.result-card.winner {
    border-width: 3px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.result-medal {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.result-player-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.result-score {
    font-size: 2rem;
    font-weight: 900;
    color: #FFD700;
    margin-bottom: 0.5rem;
}

.result-score small {
    font-size: 0.8rem;
    color: #A0B4C4;
}

.result-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    font-size: 0.85rem;
    color: #A0B4C4;
}

.result-winner-badge {
    margin-top: 0.75rem;
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #050B14;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* --- RESPONSIVE: force landscape aspect ratio hint --- */
@media (max-aspect-ratio: 4/3) {
    .quiz-overlay.active::before {
        content: '🔄 Putar layar ke LANDSCAPE untuk pengalaman terbaik';
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(255, 215, 0, 0.9);
        color: #050B14;
        padding: 8px 20px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: bold;
        z-index: 10000;
        animation: fadeIn 0.5s;
        white-space: nowrap;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}