/* ========================================================
   InfoTest Dars — Proportional Mobile Responsive Layout
   Mobile Viewport Auto-fit & Scaling Stylesheet
   (Supports Portrait & Landscape 2-Column Mode)
   ======================================================== */

:root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* Ensure html & body handle full viewport */
html {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Base body responsiveness */
body {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ========================================================
   QUESTION IMAGES & LIGHTBOX ZOOM (ALL SCREENS & MOBILE)
   ======================================================== */
#q-img-box, .question-img-box, .q-img-box, #modal-q-img-box, #quiz-q-img-wrap {
    text-align: center;
    margin: 4px auto !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    justify-content: center !important;
    align-items: center !important;
}

#q-img, #quiz-q-img, #modal-q-img, #q-img-blue, #q-img-red {
    display: block !important;
    margin: 0 auto !important;
    max-height: clamp(80px, 18vh, 140px) !important;
    max-width: 95% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    border: 1.5px solid rgba(56, 189, 248, 0.6) !important;
    background: rgba(0, 0, 0, 0.45) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;
}

#q-img-box span, .q-img-zoom-btn, #modal-q-img-box span {
    position: absolute !important;
    bottom: 5px !important;
    right: 8px !important;
    background: rgba(15, 23, 42, 0.88) !important;
    color: #38bdf8 !important;
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    padding: 2px 7px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(56, 189, 248, 0.5) !important;
    pointer-events: none !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

/* ========================================================
   RESPONSIVE MEDIA QUERIES (Mobile Phones & Small Tablets)
   ======================================================== */
@media screen and (max-width: 768px), screen and (max-height: 750px) {
    /* Allow smooth vertical scroll so NO button is EVER clipped */
    html, body {
        height: auto !important;
        min-height: 100% !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Game container adapts proportionally */
    .game-container, 
    .arena-container, 
    .main-container, 
    .quiz-arena, 
    .quiz-container,
    .page-wrapper {
        height: auto !important;
        min-height: calc(100dvh - 36px) !important;
        max-height: none !important;
        padding: 4px 8px calc(var(--safe-bottom) + 14px) 8px !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Top navbar / header bar compact */
    .top-navbar, .topbar, .header-bar, .game-header {
        height: 36px !important;
        min-height: 36px !important;
        padding: 2px 8px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .brand-icon {
        width: 24px !important;
        height: 24px !important;
        font-size: 13px !important;
    }

    .brand-title {
        font-size: 0.82rem !important;
        line-height: 1.1 !important;
    }

    .brand-subtitle {
        display: none !important;
    }

    .topic-badge, #btn-topic-picker {
        font-size: 0.7rem !important;
        padding: 2px 8px !important;
        max-width: 130px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .nav-btn, .btn-action, .back-btn, .exit-btn {
        padding: 3px 8px !important;
        font-size: 0.72rem !important;
        border-radius: 6px !important;
    }

    /* Scoreboard compact */
    .scoreboard-row, .scoreboard, .score-board, .duel-header {
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        height: auto !important;
        min-height: 38px !important;
        padding: 2px 6px !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
    }

    .team-card, .team-box {
        height: 40px !important;
        min-height: 40px !important;
        padding: 2px 6px !important;
        gap: 4px !important;
        border-radius: 8px !important;
    }

    .team-badge-title, .team-badge {
        font-size: 0.66rem !important;
    }

    .team-student-name {
        font-size: 0.76rem !important;
        max-width: 90px !important;
    }

    .team-score-badge, .match-score-num {
        font-size: 1.15rem !important;
    }

    .score-sublabel {
        font-size: 0.55rem !important;
    }

    .vs-badge {
        font-size: 0.7rem !important;
        padding: 2px 7px !important;
    }

    .round-indicator, .match-round-text {
        font-size: 0.6rem !important;
    }

    .shots-tracker {
        gap: 2px !important;
    }

    .shot-ring-dot, .pen-dot {
        width: 13px !important;
        height: 13px !important;
        font-size: 8px !important;
    }

    /* Turn banner & Hide redundant solo skip button */
    .turn-banner, .active-turn-banner {
        height: 24px !important;
        min-height: 24px !important;
        padding: 2px 8px !important;
        flex-shrink: 0 !important;
    }

    .turn-text {
        font-size: 0.72rem !important;
    }

    .btn-skip-turn {
        display: none !important; /* Hide redundant "Kelmagan" button on mobile */
    }

    /* Game Stadium / Arena Illustration — Proportional scaling (fits without dominating) */
    .archery-arena,
    .stadium-arena, 
    .arena-stadium, 
    .target-arena, 
    .race-track-wrapper, 
    .space-arena, 
    .tug-arena,
    .wheel-arena,
    .mystery-arena {
        height: clamp(65px, 12vh, 90px) !important;
        min-height: 65px !important;
        max-height: 90px !important;
        padding: 2px 14px !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    /* Archery specific mobile proportions */
    .archery-arena .shooting-station {
        width: 50px !important;
        height: 70px !important;
    }

    .archery-arena .bow-rig {
        width: 42px !important;
        height: 70px !important;
    }

    .archery-arena .nocked-arrow {
        width: 50px !important;
        height: 10px !important;
    }

    .archery-arena .flying-arrow {
        left: 45px !important;
        width: 50px !important;
        height: 10px !important;
    }

    .archery-arena .target-station {
        width: 72px !important;
        height: 75px !important;
    }

    .archery-arena .target-face-container {
        width: 66px !important;
        height: 66px !important;
    }

    .archery-arena .target-tripod {
        width: 66px !important;
        height: 72px !important;
    }

    .archery-arena .field-grass-line,
    .archery-arena .range-distance-marker {
        display: none !important;
    }

    .archery-arena .hit-score-badge {
        font-size: 0.88rem !important;
        padding: 3px 9px !important;
    }

    /* Football specific mobile proportions */
    .penalty-box-outline {
        height: 55px !important;
        width: 170px !important;
        top: 4px !important;
    }

    .goalpost-wrapper {
        width: 120px !important;
        height: 50px !important;
        top: 6px !important;
    }

    .goalkeeper {
        width: 26px !important;
        height: 26px !important;
        top: 24px !important;
    }

    .goalkeeper.dive-left {
        transform: translate(-38px, 4px) rotate(-30deg) !important;
    }
    .goalkeeper.dive-right {
        transform: translate(38px, 4px) rotate(30deg) !important;
    }

    .football-ball {
        width: 18px !important;
        height: 18px !important;
        bottom: 4px !important;
    }

    .football-ball.shoot-goal-left {
        transform: translate(-38px, -50px) scale(0.65) rotate(720deg) !important;
    }
    .football-ball.shoot-goal-right {
        transform: translate(38px, -50px) scale(0.65) rotate(-720deg) !important;
    }
    .football-ball.shoot-goal-top {
        transform: translate(0px, -54px) scale(0.6) rotate(540deg) !important;
    }
    .football-ball.shoot-miss {
        transform: translate(0px, -40px) scale(0.7) rotate(360deg) !important;
    }

    /* Question Box & Text — Proportional readable typography */
    .question-arena, 
    .q-arena, 
    .question-card, 
    .question-box {
        padding: 6px 10px !important;
        gap: 5px !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
        border-radius: 10px !important;
    }

    .q-shot-title {
        font-size: 0.8rem !important;
    }

    .q-breadcrumb {
        font-size: 0.65rem !important;
    }

    .timer-text {
        font-size: 0.72rem !important;
    }

    .q-body-text, 
    .question-text {
        font-size: clamp(0.85rem, 3.4vw, 1rem) !important;
        line-height: 1.35 !important;
        padding: 6px 10px !important;
        min-height: 38px !important;
        max-height: 120px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Options grid — 2x2 grid on mobile, touch targets */
    .options-grid, 
    .opts-grid, 
    .answers-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 6px !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .option-btn, 
    .quiz-opt-btn, 
    .opt-btn {
        min-height: 44px !important;
        height: auto !important;
        padding: 6px 8px !important;
        font-size: clamp(0.78rem, 2.9vw, 0.9rem) !important;
        gap: 6px !important;
        border-radius: 8px !important;
        align-items: center !important;
    }

    .option-letter,
    .option-key, 
    .opt-badge, 
    .key-badge {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
    }

    .option-text, 
    .opt-text {
        font-size: inherit !important;
        line-height: 1.25 !important;
        word-break: break-word !important;
    }

    /* Feedback bar & Action buttons */
    .feedback-box, .feedback-bar {
        padding: 6px 10px !important;
        gap: 4px !important;
        border-radius: 8px !important;
    }

    .feedback-status {
        font-size: 0.85rem !important;
    }

    .feedback-explanation, .feedback-text {
        font-size: 0.82rem !important;
        line-height: 1.35 !important;
        padding: 6px 10px !important;
        max-height: 100px !important;
    }

    .btn-continue, 
    .btn-next-shot, 
    .btn-next-q {
        min-height: 42px !important;
        padding: 8px 14px !important;
        font-size: 0.92rem !important;
        width: 100% !important;
        justify-content: center !important;
    }

    /* In-Game Live Leaderboard Ticker */
    .battle-live-rank-ticker {
        padding: 4px 8px !important;
        font-size: 0.76rem !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    /* Victory Debrief Modal (Mobile Overflow Fix) */
    .victory-modal {
        padding: 10px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .victory-card {
        max-height: 90dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 14px 12px !important;
        border-radius: 18px !important;
        gap: 6px !important;
        max-width: 440px !important;
        width: 100% !important;
    }

    .victory-trophy {
        font-size: 42px !important;
        animation: none !important;
        margin: 0 auto !important;
    }

    .victory-title {
        font-size: 1.25rem !important;
        margin: 2px 0 !important;
    }

    .victory-score {
        font-size: 1.6rem !important;
        margin: 2px 0 !important;
    }

    .victory-winner-name {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
        margin: 2px 0 !important;
    }

    .victory-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
        margin-top: 6px !important;
        justify-content: center !important;
    }

    .btn-restart, .btn-home {
        flex: 1 1 45% !important;
        padding: 10px 10px !important;
        font-size: 0.88rem !important;
        border-radius: 10px !important;
        text-align: center !important;
    }
}

/* ========================================================
   LANDSCAPE 2-COLUMN RESPONSIVE LAYOUT (Kahoot / Quizizz Mode)
   (When rotating phone sideways: max-height: 520px)
   ======================================================== */
@media screen and (orientation: landscape) and (max-height: 520px) {
    html, body {
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
    }

    .top-navbar, .topbar {
        height: 26px !important;
        min-height: 26px !important;
        padding: 1px 8px !important;
        flex-shrink: 0 !important;
    }

    .brand-icon {
        width: 18px !important;
        height: 18px !important;
        font-size: 10px !important;
    }

    .brand-title {
        font-size: 0.75rem !important;
    }

    .brand-subtitle {
        display: none !important;
    }

    .topic-badge {
        font-size: 0.62rem !important;
        max-width: 130px !important;
        padding: 1px 6px !important;
    }

    .nav-btn {
        padding: 1px 6px !important;
        font-size: 0.66rem !important;
    }

    /* Container: Clean Flex Column (Zero Empty Void!) */
    .game-container, .arena-container, .quiz-arena, .quiz-container, .page-wrapper {
        display: flex !important;
        flex-direction: column !important;
        height: calc(100dvh - 26px) !important;
        max-height: calc(100dvh - 26px) !important;
        padding: 2px 8px calc(var(--safe-bottom) + 2px) 8px !important;
        gap: 3px !important;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Scoreboard: Compact Top Bar across 100% width */
    .scoreboard-row, .scoreboard, .duel-header {
        height: 28px !important;
        min-height: 28px !important;
        padding: 1px 6px !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr auto 1fr !important;
        align-items: center !important;
    }

    .team-card, .team-box {
        height: 28px !important;
        min-height: 28px !important;
        padding: 1px 6px !important;
    }

    .team-student-name {
        font-size: 0.72rem !important;
        max-width: 120px !important;
    }

    .team-score-badge, .match-score-num {
        font-size: 0.95rem !important;
    }

    .turn-banner, .active-turn-banner {
        display: none !important; /* Save vertical height in landscape */
    }

    /* Game Stadium / Arena: Compact 38px Banner at Top */
    .archery-arena, 
    .stadium-arena, 
    .arena-stadium, 
    .target-arena, 
    .race-track-wrapper, 
    .space-arena, 
    .tug-arena {
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        flex-shrink: 0 !important;
        padding: 1px 10px !important;
        border-radius: 8px !important;
    }

    .archery-arena .shooting-station,
    .archery-arena .bow-rig {
        width: 26px !important;
        height: 36px !important;
    }

    .archery-arena .target-station,
    .archery-arena .target-face-container,
    .archery-arena .target-tripod {
        width: 38px !important;
        height: 38px !important;
    }

    .archery-arena .hit-score-badge {
        font-size: 0.75rem !important;
        padding: 1px 6px !important;
    }

    /* 2-COLUMN QUESTION CARD: Left = Question & Image (48%), Right = Options Grid (52%) */
    .question-card, 
    .question-arena, 
    .q-arena,
    .quiz-card {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        display: grid !important;
        grid-template-columns: 46% 54% !important;
        grid-template-rows: auto 1fr !important;
        gap: 3px 8px !important;
        padding: 4px 8px !important;
        overflow: hidden !important;
        border-radius: 10px !important;
    }

    .q-header {
        grid-column: 1 / -1 !important;
        padding-bottom: 2px !important;
        flex-shrink: 0 !important;
    }

    .q-shot-title {
        font-size: 0.72rem !important;
    }

    .q-breadcrumb {
        font-size: 0.6rem !important;
        max-width: 220px !important;
    }

    .timer-container {
        height: 2px !important;
    }

    /* Left Column: Image (if any) + Question Prompt Text */
    #q-img-box, .q-img-box {
        grid-column: 1 !important;
        max-height: 70px !important;
        margin: 1px auto !important;
    }

    #q-img, #quiz-q-img, #modal-q-img {
        max-height: 65px !important;
        border-width: 1px !important;
    }

    .q-body-text, .question-text {
        grid-column: 1 !important;
        font-size: 0.8rem !important;
        line-height: 1.25 !important;
        padding: 4px 6px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: 100% !important;
        min-height: 0 !important;
        display: block !important;
    }

    /* Right Column: 2x2 Options Grid (Takes 100% Height of Right Column) */
    .options-grid, .opts-grid, .answers-grid {
        grid-column: 2 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 4px !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
    }

    .option-btn, .quiz-opt-btn, .opt-btn {
        height: 100% !important;
        min-height: 0 !important;
        padding: 3px 6px !important;
        font-size: 0.78rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        border-radius: 6px !important;
        gap: 4px !important;
    }

    .option-letter, .option-key, .opt-badge {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        font-size: 0.72rem !important;
        border-radius: 4px !important;
    }

    .option-text, .opt-text {
        font-size: inherit !important;
        line-height: 1.2 !important;
        word-break: break-word !important;
    }

    /* Feedback Box in Right Column */
    .feedback-box, .feedback-bar {
        grid-column: 2 !important;
        height: 100% !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        padding: 4px 8px !important;
        overflow-y: auto !important;
    }

    .feedback-status {
        font-size: 0.8rem !important;
    }

    .feedback-explanation {
        font-size: 0.74rem !important;
        line-height: 1.2 !important;
        max-height: 55px !important;
        overflow-y: auto !important;
        padding: 3px 6px !important;
    }

    .btn-continue, .btn-next-shot, .btn-next-q {
        min-height: 34px !important;
        padding: 4px 10px !important;
        font-size: 0.82rem !important;
        width: 100% !important;
    }
}

/* ========================================================
   IN-GAME LIVE LEADERBOARD STYLING (Kahoot Style)
   ======================================================== */
.battle-live-rank-ticker {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid rgba(251, 191, 36, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    padding: 6px 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    animation: slideDownRank 0.3s ease-out;
}

@keyframes slideDownRank {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.battle-live-rank-badge {
    font-size: 0.85rem;
    font-weight: 900;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.battle-live-top-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.battle-live-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.battle-live-pill.me {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
    color: #34d399;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}


/* ========================================================
   MODAL DIALOG RESPONSIVENESS (MOBILE & DESKTOP AUTO-FIT)
   Prevents any modal from exceeding screen or hiding buttons
   ======================================================== */
.modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 99999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(6px, 2vw, 14px) !important;
    box-sizing: border-box !important;
}

.modal-overlay.active, .modal-overlay.show {
    display: flex !important;
}

.modal-box {
    max-height: 92dvh !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    width: 100% !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45) !important;
    background: #ffffff !important;
}

.modal-header {
    flex-shrink: 0 !important;
    padding: 10px 14px !important;
}

.modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 14px !important;
}

.modal-footer {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 8px 14px !important;
    z-index: 10 !important;
}

#setup-attendance-list {
    max-height: 130px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

@media screen and (max-width: 640px) {
    .modal-box {
        max-height: 95dvh !important;
        border-radius: 12px !important;
    }
    .modal-body {
        padding: 8px 10px !important;
        gap: 0.7rem !important;
    }
    .setup-mode-grid {
        grid-template-columns: 1fr !important;
        gap: 5px !important;
    }
    .setup-mode-card {
        padding: 6px 10px !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: 8px !important;
    }
    .setup-mode-card .mode-icon {
        font-size: 1.2rem !important;
    }
    .count-pills {
        gap: 4px !important;
    }
    .count-pill {
        padding: 4px 7px !important;
        font-size: 0.74rem !important;
    }
}

/* ========================================================
   UNIVERSAL QUESTION & ANSWERS AUTO-FIT (ALL SCREENS & SMARTBOARDS)
   Elektron doska, proyektor va barcha ekranlarga avtomatik moslashish
   ======================================================== */

/* 1. SAVOL MATNI (QUESTION BOX / BODY) — CHEKLOVSIZ TO'LIQ KENGAYISH */
.q-body-text, 
.question-text, 
.question-title, 
.quiz-question-title,
#question-text, 
#q-body-text-el, 
#q-text {
    max-height: none !important;
    height: auto !important;
    min-height: clamp(52px, 7vh, 80px) !important;
    font-size: clamp(1.28rem, 1.85vw, 1.68rem) !important;
    font-weight: 800 !important;
    line-height: 1.42 !important;
    color: #ffffff !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    padding: clamp(8px, 1.4vh, 14px) clamp(12px, 1.6vw, 20px) !important;
    border-radius: 12px !important;
    word-break: break-word !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Savol ichidagi dasturlash kodlari (pre, code) */
.q-body-text pre, .question-text pre, .quiz-question-title pre,
.q-body-text code, .question-text code, .quiz-question-title code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace !important;
    font-size: 0.95em !important;
    line-height: 1.4 !important;
    border-radius: 6px !important;
}

/* O'rta va uzun savollarni avtomatik proporsional moslashtirish */
.q-body-text.q-long,
.question-text.q-long,
.question-title.q-long,
.quiz-question-title.q-long,
#question-text.q-long,
#q-body-text-el.q-long,
#q-text.q-long,
.q-bubble.q-long {
    font-size: clamp(1.15rem, 1.6vw, 1.45rem) !important;
    line-height: 1.38 !important;
}

.q-body-text.q-very-long,
.question-text.q-very-long,
.question-title.q-very-long,
.quiz-question-title.q-very-long,
#question-text.q-very-long,
#q-body-text-el.q-very-long,
#q-text.q-very-long,
.q-bubble.q-very-long {
    font-size: clamp(1.05rem, 1.35vw, 1.28rem) !important;
    line-height: 1.32 !important;
    max-height: clamp(140px, 30vh, 220px) !important;
    overflow-y: auto !important;
}

/* 2. JAVOBLAR RO'YXATI (OPTIONS GRID) — 2x2 TABIIY BALANDLIK (BO'SHLIQSIZ) */
.options-grid, 
.quiz-options-grid, 
.opts-grid, 
.answers-grid, 
.pods-grid,
#options-container, 
#options-grid-el {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    gap: clamp(8px, 1.2vh, 12px) clamp(10px, 1.4vw, 16px) !important;
    width: 100% !important;
    flex: 0 1 auto !important;
    min-height: 0 !important;
    margin-top: auto !important;
}

/* 3. JAVOB TUGMALARI (OPTION BUTTONS) — ANIQ, KATTA SHIRIFT, BOSISHGA QULAY */
.option-btn, 
.quiz-tile, 
.million-opt-btn, 
.opt-btn, 
.cargo-card {
    min-height: clamp(50px, 6.5vh, 66px) !important;
    height: auto !important;
    padding: clamp(8px, 1vh, 12px) clamp(12px, 1.2vw, 18px) !important;
    font-size: clamp(1.02rem, 1.25vw, 1.2rem) !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    display: flex !important;
    align-items: center !important;
    gap: clamp(8px, 1vw, 14px) !important;
    box-sizing: border-box !important;
    transition: transform 0.15s, background-color 0.15s, border-color 0.15s !important;
}

/* Javob harfi nishoni (A, B, C, D) */
.option-btn .option-key,
.option-btn .opt-letter,
.option-btn .option-letter,
.quiz-tile .quiz-key,
.million-opt-btn .opt-letter,
.opt-btn .opt-char,
.cargo-card .option-letter-badge {
    min-width: 28px !important;
    height: 28px !important;
    font-size: 0.95rem !important;
    font-weight: 900 !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* 4. O'YIN ANIMATSIYA MAYDONLARI — MOSLASHUVCHAN IXCHAM BALANDLIK */
.archery-arena {
    height: clamp(100px, 15vh, 150px) !important;
    min-height: 95px !important;
    max-height: 155px !important;
    flex-shrink: 0 !important;
    padding: 0 clamp(20px, 4vw, 45px) !important;
}

.stadium-arena {
    height: clamp(100px, 15vh, 150px) !important;
    min-height: 95px !important;
    max-height: 155px !important;
    flex-shrink: 0 !important;
}

.track-arena {
    height: auto !important;
    min-height: 95px !important;
    max-height: 155px !important;
    flex-shrink: 0 !important;
}

/* Kamon va Nishon proporsional o'lchamlari */
.archery-arena .shooting-station {
    height: clamp(90px, 14vh, 140px) !important;
    width: clamp(70px, 10vh, 85px) !important;
}
.archery-arena .bow-rig {
    height: clamp(90px, 14vh, 140px) !important;
    width: clamp(65px, 9vh, 75px) !important;
}
.archery-arena .target-station {
    width: clamp(90px, 14vh, 140px) !important;
    height: clamp(90px, 14vh, 140px) !important;
}
.archery-arena .target-face-container {
    width: clamp(90px, 14vh, 140px) !important;
    height: clamp(90px, 14vh, 140px) !important;
}

/* 5. SAVOL KARTASI (QUESTION CARD) — AVTO-MOSLASHISH VA TO'LIQ SIG'ISH */
.question-card, 
.question-arena, 
.quiz-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: clamp(8px, 1.2vh, 14px) clamp(12px, 1.5vw, 20px) !important;
    overflow-y: auto !important;
}

/* ========================================================
   📺 ELEKTRON DOSKA / KATTA EKRAN MAXSUS REJIMI (.doska-mode)
   Katta sinfxonalarda orqa qatordan ham o'qiladigan yirik shriftlar
   ======================================================== */
body.doska-mode .q-body-text,
body.doska-mode .question-text,
body.doska-mode .question-title,
body.doska-mode .quiz-question-title,
body.doska-mode #question-text,
body.doska-mode #q-body-text-el,
body.doska-mode #q-text,
body.doska-mode .q-bubble {
    font-size: clamp(1.55rem, 2.4vw, 2.15rem) !important;
    font-weight: 900 !important;
    line-height: 1.38 !important;
    letter-spacing: -0.01em !important;
    padding: clamp(12px, 1.8vh, 20px) clamp(16px, 2vw, 28px) !important;
    border-width: 2px !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
    background: rgba(0, 0, 0, 0.45) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

body.doska-mode .q-body-text.q-long,
body.doska-mode .question-text.q-long,
body.doska-mode .question-title.q-long,
body.doska-mode .quiz-question-title.q-long,
body.doska-mode #question-text.q-long,
body.doska-mode #q-body-text-el.q-long,
body.doska-mode #q-text.q-long,
body.doska-mode .q-bubble.q-long {
    font-size: clamp(1.38rem, 2.0vw, 1.8rem) !important;
    line-height: 1.35 !important;
}

body.doska-mode .q-body-text.q-very-long,
body.doska-mode .question-text.q-very-long,
body.doska-mode .question-title.q-very-long,
body.doska-mode .quiz-question-title.q-very-long,
body.doska-mode #question-text.q-very-long,
body.doska-mode #q-body-text-el.q-very-long,
body.doska-mode #q-text.q-very-long,
body.doska-mode .q-bubble.q-very-long {
    font-size: clamp(1.2rem, 1.6vw, 1.55rem) !important;
    line-height: 1.3 !important;
}

body.doska-mode .option-btn,
body.doska-mode .quiz-tile,
body.doska-mode .million-opt-btn,
body.doska-mode .opt-btn,
body.doska-mode .cargo-card {
    font-size: clamp(1.15rem, 1.55vw, 1.38rem) !important;
    font-weight: 800 !important;
    min-height: clamp(56px, 7.5vh, 76px) !important;
    padding: clamp(10px, 1.2vh, 16px) clamp(14px, 1.5vw, 22px) !important;
    border-width: 2.5px !important;
}

body.doska-mode .option-btn .option-key,
body.doska-mode .option-btn .opt-letter,
body.doska-mode .option-btn .option-letter,
body.doska-mode .quiz-tile .quiz-key,
body.doska-mode .million-opt-btn .opt-letter,
body.doska-mode .opt-btn .opt-char,
body.doska-mode .cargo-card .option-letter-badge {
    min-width: 34px !important;
    height: 34px !important;
    font-size: 1.15rem !important;
    font-weight: 900 !important;
}

body.doska-mode .archery-arena,
body.doska-mode .stadium-arena,
body.doska-mode .track-arena {
    height: clamp(80px, 12vh, 120px) !important;
    min-height: 80px !important;
    max-height: 125px !important;
}

body.doska-mode .archery-arena .bow-rig {
    height: clamp(70px, 10vh, 90px) !important;
}
body.doska-mode .archery-arena .target-station,
body.doska-mode .archery-arena .target-face-container {
    width: clamp(70px, 10vh, 90px) !important;
    height: clamp(70px, 10vh, 90px) !important;
}

/* Doska rejimi faol bo'lgandagi tugma uslubi */
.doska-toggle.active,
#doska-btn.active {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    color: #ffffff !important;
    border-color: #34d399 !important;
    font-weight: 800 !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.5) !important;
}

