/* ===== CSS Variables & Theme ===== */
:root {
    /* Warm, friendly color palette */
    --primary: #FF6B6B;
    --primary-dark: #E85555;
    --primary-light: #FF8A8A;
    --secondary: #4ECDC4;
    --secondary-dark: #3DB8B0;
    --accent: #FFE66D;
    --accent-dark: #FFD93D;
    
    /* Neutral colors (not red/green to avoid correct/incorrect confusion) */
    --neutral: #7C8CE0;
    --neutral-light: #A8B4F0;
    --neutral-bg: #F0F2FF;
    
    /* Neutrals */
    --bg-main: #FFF9F5;
    --bg-card: #FFFFFF;
    --bg-question: #FFF5F0;
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-light: #B2BEC3;
    --border-light: #F0E6E0;
    
    /* Feedback colors - ONLY for correct/incorrect feedback */
    --correct: #00B894;
    --correct-bg: #E8F8F5;
    --incorrect: #E55050;
    --incorrect-bg: #FFEFEF;
    --skipped: #FDCB6E;
    --skipped-bg: #FFF8E7;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(45, 52, 54, 0.08);
    --shadow-md: 0 4px 20px rgba(45, 52, 54, 0.12);
    --shadow-lg: 0 8px 40px rgba(45, 52, 54, 0.16);
    --shadow-glow: 0 0 30px rgba(124, 140, 224, 0.3);
    
    /* Typography - Lexend for readability, Poppins for display */
    --font-display: 'Poppins', sans-serif;
    --font-body: 'Lexend', sans-serif;
    
    /* Spacing */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 20px; /* INCREASED base font for classroom visibility */
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(124, 140, 224, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 230, 109, 0.06) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* ===== Screen States ===== */
.screen {
    display: none;
    height: 100%;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

/* Welcome screen needs relative positioning for back button */
#welcome-screen {
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Welcome Screen ===== */
.welcome-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-illustration {
    position: relative;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--neutral-light), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    flex-shrink: 0;
}

.floating-elements {
    position: absolute;
    width: 100%;
    height: 100%;
}

.float-item {
    position: absolute;
    font-size: 3.5rem;
    animation: float 3s ease-in-out infinite;
}

.float-item.book { top: -10%; left: 50%; animation-delay: 0s; }
.float-item.star { top: 20%; right: -15%; animation-delay: 0.5s; }
.float-item.pencil { bottom: 20%; right: -10%; animation-delay: 1s; }
.float-item.globe { bottom: -5%; left: 30%; animation-delay: 1.5s; }
.float-item.speech { top: 30%; left: -15%; animation-delay: 2s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.welcome-content {
    max-width: 600px;
}

.level-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.welcome-content h1 {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.welcome-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

/* Welcome Screen Back Button */
.welcome-back-btn {
    position: absolute;
    top: 2rem;
    left: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.welcome-back-btn:hover {
    background: var(--neutral-bg);
    border-color: var(--neutral);
    color: var(--neutral);
}

.welcome-back-btn svg {
    width: 22px;
    height: 22px;
}

.test-info {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.info-icon {
    font-size: 1.75rem;
}

/* ===== Buttons - LARGER for Classroom ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 1.25rem 2.5rem;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 24px;
    height: 24px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 1.1rem 2rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--neutral);
    color: var(--neutral);
    background: var(--neutral-bg);
}

.btn-secondary svg {
    width: 22px;
    height: 22px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    background: var(--bg-question);
    transform: scale(1.05);
}

.icon-btn svg {
    width: 28px;
    height: 28px;
    stroke: var(--text-secondary);
}

/* ===== Quiz Screen Layout - Optimized for 16:9 ===== */
#quiz-screen {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.quiz-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 2.5rem;
    background: rgba(255, 249, 245, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
    flex-shrink: 0;
}

/* Back Button */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.back-btn:hover {
    background: var(--neutral-bg);
    border-color: var(--neutral);
}

.back-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-secondary);
}

.back-btn:hover svg {
    stroke: var(--neutral);
}

.progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    height: 14px;
    background: var(--border-light);
    border-radius: 14px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary), var(--neutral));
    border-radius: 14px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.score-display #current-score {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Restart Button */
.restart-btn {
    background: var(--bg-question);
    border: 2px solid var(--border-light);
}

.restart-btn:hover {
    background: #FFEFEF;
    border-color: var(--incorrect);
}

.restart-btn:hover svg {
    stroke: var(--incorrect);
}

/* ===== Question Sidebar ===== */
.question-sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    width: 330px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.question-sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-primary);
}

.question-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    align-content: start;
}

.nav-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--bg-question);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    border-color: var(--primary);
    background: var(--incorrect-bg);
}

.nav-item.current {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.nav-item.answered {
    background: var(--correct-bg);
    border-color: var(--correct);
    color: var(--correct);
}

.nav-item.skipped {
    background: var(--skipped-bg);
    border-color: var(--skipped);
    color: var(--text-secondary);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 150;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ===== Question Container - FULL SCREEN, NO EXTRA CONTAINER ===== */
.quiz-main {
    flex: 1;
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

.question-container {
    width: 100%;
    max-width: 1800px;
    display: flex;
    flex-direction: column;
}

/* ===== Question Card - TRANSPARENT, NO BOX ===== */
.question-card {
    background: transparent;
    overflow: visible;
    animation: slideIn 0.4s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.question-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.question-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.question-type-badge span {
    font-size: 1.2rem;
}

.question-number {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--neutral);
    margin-left: auto;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.question-body {
    display: flex;
    flex-direction: column;
}

.question-text {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.question-instruction {
    font-size: 1.85rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

/* ===== Question Content - Horizontal Layout ===== */
.question-content {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    width: 100%;
}

/* ===== CONSISTENT Image Sizing - LARGE 16:9 ===== */
.question-media {
    flex: 1.4;
    max-width: 900px;
    min-width: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-media img {
    width: 100%;
    height: auto;
    min-height: 380px;
    max-height: calc(100vh - 280px);
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 16 / 10;
}

/* Image placeholder */
.image-placeholder {
    width: 100%;
    height: calc(100vh - 320px);
    max-height: 500px;
    background: linear-gradient(135deg, #FFE66D, #4ECDC4);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
}

.question-options {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 450px;
    max-width: 650px;
}

/* ===== Fill-in-Blank Horizontal Layout with Image Support ===== */
.fib-layout {
    display: flex;
    gap: 3rem;
    align-items: center;
    flex: 1;
}

/* Fill-in-blank with image - WIDE image layout to fill space */
.fib-with-image {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    flex: 1;
    width: 100%;
}

.fib-with-image .fib-image-panel {
    flex: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 450px;
    max-width: 750px;
}

.fib-with-image .fib-image-panel img {
    width: 100%;
    height: auto;
    min-height: 350px;
    max-height: calc(100vh - 280px);
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 4 / 3;
}

.fib-with-image .fib-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: center;
    min-width: 400px;
}

.fib-sentence-panel {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 3rem 3.5rem;
    min-height: 320px;
    border: 3px solid #c7d2fe;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

/* Sentence panel in image layout - LEFT ALIGNED text */
.fib-with-image .fib-sentence-panel {
    min-height: 150px;
    padding: 2rem 2.5rem;
    flex: none;
    justify-content: flex-start;
    background: #ffffff;
    border: 3px solid #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.fib-with-image .fill-blank-sentence {
    font-size: 2.1rem;
    text-align: left;
    line-height: 1.8;
}

/* Word bank improvements for 2x2 grid */
.fib-with-image .word-bank {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    border: 2px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.fib-with-image .word-bank-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.fib-with-image .word-chip {
    padding: 1.15rem 1.5rem;
    font-size: 1.45rem;
    text-align: center;
    justify-content: center;
}

.fib-options-panel {
    flex: 1;
    display: flex;
    align-items: center;
}

/* ===== Option Styles - WHITE background for contrast ===== */
.option-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.6rem 2.25rem;
    background: #ffffff;
    border: 3px solid #d1d5db;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.option-item:hover {
    border-color: var(--neutral);
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.option-item.selected {
    border-color: var(--neutral);
    background: #f0f4ff;
    box-shadow: 0 0 0 4px rgba(124, 140, 224, 0.2);
}

.option-radio {
    width: 32px;
    height: 32px;
    border: 3px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.option-item:hover .option-radio {
    border-color: var(--neutral);
}

.option-item.selected .option-radio {
    border-color: var(--neutral);
    background: var(--neutral);
}

.option-item.selected .option-radio::after {
    content: '';
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
}

.option-text {
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Statement Box for True/False - HIGH CONTRAST WHITE with dark text */
.statement-box {
    background: #ffffff;
    border: 4px solid #3b82f6;
    border-radius: var(--radius-lg);
    padding: 2.5rem 3rem;
    margin-bottom: 2rem;
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.2);
}

.statement-text {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: #1e293b;
    font-style: italic;
    margin: 0;
    line-height: 1.5;
    text-align: center;
}

/* ===== Matching Question - LARGER & MORE ALIGNED ===== */
.matching-area {
    display: flex;
    gap: 5rem;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 2rem 0 2rem 2rem;
    width: 100%;
}

.matching-pairs {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.matching-pairs-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.match-pair-row {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100px;
}

/* Left word - WIDE enough for phrasal verbs on ONE line */
.left-word {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.75rem;
    width: 240px;
    min-width: 240px;
    height: 100%;
    background: #ffffff;
    border: 3px solid #d1d5db;
    border-radius: 14px 0 0 14px;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: #1E293B;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.left-word:hover:not(.matched) {
    background: #E0E7FF;
    border-color: #818CF8;
}

.left-word.selected {
    background: #C7D2FE;
    border-color: #6366F1;
    color: #3730A3;
}

.left-word.matched {
    background: #F1F5F9;
    border-color: #94A3B8;
    border-right: none;
    cursor: default;
}

/* Match slot - WIDE enough for definitions on ONE line */
.match-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    width: 520px;
    min-width: 520px;
    height: 100%;
    background: #f8fafc;
    border: 3px dashed #d1d5db;
    border-left: none;
    border-radius: 0 14px 14px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.match-slot.drag-over {
    background: #E0E7FF;
    border-color: #6366F1;
    border-style: solid;
}

/* Filled slot - dark background, light text (opposite style) */
.match-slot.filled {
    background: #334155;
    border: 3px solid #334155;
    border-left: 3px solid #94A3B8;
    border-radius: 0 14px 14px 0;
}

.match-slot.filled:hover {
    background: #475569;
}

.slot-placeholder {
    font-size: 1.7rem;
    color: #9CA3AF;
    font-weight: 500;
}

.placed-answer {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: #F8FAFC;
    white-space: nowrap;
}

/* Answer Bank - aligned with match slots */
.answer-bank {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    align-self: flex-start;
}

.bank-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.bank-items {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

/* Answer chips - WIDE enough for definitions on ONE line */
.answer-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    width: 520px;
    min-width: 520px;
    height: 100px;
    background: #334155;
    border: 3px solid #475569;
    border-radius: 14px;
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: #F8FAFC;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.answer-chip:hover {
    background: #475569;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.answer-chip.selected {
    background: #6366F1;
    border-color: #4F46E5;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.answer-chip.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.answer-chip.used {
    display: none;
}

/* ===== Fill in the Blank - LARGER ===== */
.fill-blank-container {
    display: flex;
    flex-direction: column;
}

.fill-blank-sentence {
    font-family: var(--font-display);
    font-size: 2.4rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 0;
    text-align: center;
    font-weight: 500;
}

.fib-sentence-panel .fill-blank-sentence {
    margin-bottom: 0;
}

.blank-input {
    display: inline-block;
    min-width: 160px;
    max-width: 100%;
    padding: 0.5rem 1.5rem;
    border: none;
    border-bottom: 5px solid var(--neutral);
    background: rgba(124, 140, 224, 0.12);
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    color: var(--neutral);
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
    border-radius: 4px 4px 0 0;
    box-sizing: border-box;
}

.blank-input:focus {
    background: white;
    box-shadow: 0 4px 12px rgba(124, 140, 224, 0.2);
}

.blank-input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

/* Blank box for multiple choice fill-in sentences */
.blank-box {
    display: inline-block;
    min-width: 140px;
    padding: 0.4rem 2rem;
    background: var(--neutral-bg);
    border: 3px solid var(--neutral);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--neutral);
    text-align: center;
    margin: 0 0.25rem;
}

/* Badge icon in question headers */
.badge-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* Word bank for fill-in-blank - WHITE background */
.word-bank {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    width: 100%;
    border: 2px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.word-bank-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.word-bank-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.word-chip {
    padding: 1.35rem 2rem;
    background: #ffffff;
    border: 3px solid #d1d5db;
    border-radius: var(--radius-xl);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.word-chip:hover {
    border-color: var(--neutral);
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.word-chip.selected {
    background: var(--neutral);
    border-color: var(--neutral);
    color: white;
}

.word-chip.used {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Audio Question - FULL WIDTH Layout ===== */
.audio-layout {
    align-items: stretch;
    gap: 3rem;
    width: 100%;
}

/* Audio layout options should expand */
.audio-layout .question-options {
    flex: 1;
    min-width: 380px;
    max-width: none;
    justify-content: center;
}

.media-column {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 400px;
    max-width: 800px;
}

.media-column .question-media {
    flex: 1;
    max-width: none;
    min-width: 0;
}

.media-column .question-media img {
    height: 100%;
    min-height: 280px;
    max-height: 420px;
    width: 100%;
    object-fit: cover;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    border-radius: var(--radius-lg);
}

.play-btn {
    width: 80px;
    height: 80px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    width: 36px;
    height: 36px;
    fill: var(--secondary-dark);
}

.play-btn .play-icon {
    margin-left: 5px;
}

.play-btn.playing {
    background: var(--secondary-dark);
}

.play-btn.playing svg {
    fill: white;
}

.audio-info {
    flex-shrink: 0;
    color: white;
}

.audio-title {
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.audio-duration {
    font-size: 1.1rem;
    opacity: 0.8;
}

.audio-progress {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.audio-progress-fill {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: 10px;
    transition: width 0.1s linear;
}

/* ===== Video Question - LARGER ===== */
.video-layout {
    align-items: flex-start;
    gap: 2rem;
    width: 100%;
}

.video-container {
    flex: 1.2;
    max-width: 1000px;
    min-width: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.video-container video {
    width: 100%;
    display: block;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.video-replay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-question);
    border: none;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-replay-btn:hover {
    background: var(--neutral-bg);
    color: var(--neutral);
}

.video-replay-btn svg {
    width: 22px;
    height: 22px;
}

/* Video fill-in-blank panel - WIDE to use horizontal space */
.video-fill-panel {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2.5rem 3rem;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 3px solid #c7d2fe;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
    justify-content: center;
    min-width: 580px;
}

.video-fill-panel .fill-blank-sentence {
    font-size: 2.1rem;
    text-align: center;
    line-height: 1.6;
    padding: 0.5rem 0;
}

.video-fill-panel .blank-input {
    min-width: 160px;
    max-width: 280px;
    font-size: 1.9rem;
    padding: 0.5rem 1.25rem;
}

.video-fill-panel .word-bank {
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 1.75rem 2.5rem;
    border: 2px solid #d1d5db;
}

.video-fill-panel .word-bank-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.video-fill-panel .word-chip {
    padding: 1.15rem 1.5rem;
    font-size: 1.5rem;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
}

/* ===== Reading Passage - Image Above Story Layout ===== */
.reading-layout {
    display: flex;
    gap: 2.5rem;
    flex: 1;
    min-height: 0;
}

.reading-left {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.reading-image {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.reading-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.reading-passage {
    flex: 1;
    background: var(--bg-question);
    border-left: 5px solid var(--secondary);
    padding: 1.5rem 2rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    overflow-y: auto;
}

.passage-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--secondary-dark);
    margin-bottom: 0.75rem;
}

.passage-text {
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
}

.reading-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.reading-question-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.reading-right .question-options {
    flex: 1;
    min-width: 0;
}

/* ===== Quiz Footer - LARGER for Classroom ===== */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    flex-shrink: 0;
    gap: 1.5rem;
}

.footer-center {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    justify-content: center;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Skipped questions indicator */
.skip-indicator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    color: var(--text-secondary);
    background: var(--skipped-bg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.skip-indicator .count {
    font-weight: 700;
    color: #D68910;
}

/* Hide skip indicator on mobile to save vertical space */
@media (max-width: 768px) {
    .skip-indicator {
        display: none !important;
    }
}

/* Finish Test button */
.btn-finish {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--skipped-bg);
    color: #B7791F;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    padding: 1.1rem 1.75rem;
    border: 2px solid #D69E2E;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-finish:hover {
    background: #D69E2E;
    color: white;
}

/* ===== Results Screen - FULL WIDTH HORIZONTAL LAYOUT ===== */
#results-screen {
    align-items: center;
    justify-content: center;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.results-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.results-header {
    text-align: center;
    position: relative;
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.result-level {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.results-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.result-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Results Main Grid - Score + Skills side by side */
.results-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.75rem;
}

/* Score Card */
.score-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-card);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 8;
}

.score-fg {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s ease;
}

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.score-value span:first-child {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.score-total {
    font-size: 1.15rem;
    color: var(--text-secondary);
}

.score-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-question);
    border-radius: var(--radius-sm);
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.detail-value {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
}

.detail-value.correct { color: var(--correct); }
.detail-value.incorrect { color: var(--incorrect); }
.detail-value.skipped { color: var(--skipped); }

/* Skills Breakdown - Horizontal layout */
.skills-breakdown {
    background: var(--bg-card);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.skills-breakdown h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skill-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-icon {
    font-size: 1.25rem;
}

.skill-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.skill-bar {
    height: 12px;
    background: var(--border-light);
    border-radius: 12px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    width: 0%;
    background: var(--skill-color);
    border-radius: 12px;
    transition: width 1s ease;
}

.skill-score {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    align-self: flex-end;
}

/* Verb Mastery Section for Final Test */
.verb-mastery {
    background: var(--bg-card);
    padding: 2rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.verb-mastery h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.verb-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.verb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--bg-question);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    text-align: center;
}

.verb-item.mastered {
    background: var(--correct-bg);
    border-color: var(--correct);
}

.verb-item.partial {
    background: var(--skipped-bg);
    border-color: var(--skipped);
}

.verb-item.missed {
    background: var(--incorrect-bg);
    border-color: var(--incorrect);
}

.verb-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.verb-item.mastered .verb-icon {
    background: var(--correct);
    color: white;
}

.verb-item.partial .verb-icon {
    background: var(--skipped);
    color: white;
}

.verb-item.missed .verb-icon {
    background: var(--incorrect);
    color: white;
}

.verb-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Level Recommendation - Inline with actions */
.results-bottom {
    display: flex;
    gap: 1.75rem;
    align-items: stretch;
}

.level-recommendation {
    flex: 1;
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.level-recommendation h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.level-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-question);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    flex: 1;
}

.level-indicator {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    min-width: 70px;
    height: 70px;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: white;
    flex-shrink: 0;
    white-space: nowrap;
    text-align: center;
}

.level-indicator.a1 {
    background: linear-gradient(135deg, #FF6B6B, #ee5253);
}

.level-indicator.a2 {
    background: linear-gradient(135deg, #FECA57, #FF9F43);
}

.level-info h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.level-info p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* Results Actions - Vertical on right side */
.results-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

.results-actions .btn-secondary,
.results-actions .btn-primary {
    min-width: 200px;
    justify-content: center;
    padding: 1.1rem 1.75rem;
}

/* ===== Review Screen ===== */
#review-screen {
    flex-direction: column;
}

.review-header {
    position: sticky;
    top: 0;
    background: rgba(255, 249, 245, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.75rem 2.25rem;
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--primary);
}

.btn-back svg {
    width: 22px;
    height: 22px;
}

.review-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.review-filters {
    display: flex;
    gap: 0.6rem;
}

.filter-btn {
    padding: 0.6rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-light);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.review-container {
    flex: 1;
    padding: 2.25rem;
    overflow-y: auto;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Review Item */
.review-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
    overflow: hidden;
    border-left: 5px solid var(--border-light);
}

.review-item.correct {
    border-left-color: var(--correct);
}

.review-item.incorrect {
    border-left-color: var(--incorrect);
}

.review-item.skipped {
    border-left-color: var(--skipped);
}

.review-item-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.75rem;
    background: var(--bg-question);
    border-bottom: 1px solid var(--border-light);
}

.review-q-number {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.review-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
}

.review-status.correct {
    background: var(--correct-bg);
    color: var(--correct);
}

.review-status.incorrect {
    background: var(--incorrect-bg);
    color: var(--incorrect);
}

.review-status.skipped {
    background: var(--skipped-bg);
    color: var(--text-secondary);
}

.review-item-body {
    padding: 1.75rem;
}

.review-question-text {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.review-question-text em {
    font-weight: 400;
    font-size: 1.1rem;
}

.review-answers {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.review-answer {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 1.1rem;
}

.review-answer.user-answer {
    background: var(--incorrect-bg);
    border: 2px solid var(--incorrect);
}

.review-answer.correct-answer {
    background: var(--correct-bg);
    border: 2px solid var(--correct);
}

.review-answer.user-correct {
    background: var(--correct-bg);
    border: 2px solid var(--correct);
}

.answer-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ===== ZOOM PROTECTION & OVERFLOW HANDLING ===== */
/* Ensure content scrolls instead of being cut off */
html, body {
    overflow-x: hidden;
}

.quiz-main {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.question-card {
    overflow: visible;
}

.question-body {
    overflow-y: auto;
    overflow-x: hidden;
}

.question-content {
    min-width: 0;
    overflow: visible;
}

/* Prevent zoom on mobile */
@media (max-width: 1024px) {
    html {
        touch-action: manipulation;
    }
}

@media (min-width: 1024px) {
    .question-media {
        flex-shrink: 0;
    }
    
    .question-options {
        flex-shrink: 1;
        min-width: 350px;
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    html {
        font-size: 18px;
    }
    
    .quiz-header {
        padding: 1rem 1.5rem;
        gap: 1rem;
    }
    
    .quiz-main {
        padding: 1rem 2rem;
    }
    
    .quiz-footer {
        padding: 1rem 1.5rem;
    }
    
    .question-media {
        min-width: 380px;
        max-width: 550px;
    }
    
    .question-options {
        min-width: 320px;
    }
    
    .fib-sentence-panel {
        min-height: 250px;
        padding: 2rem;
    }
    
    .fill-blank-sentence {
        font-size: 2rem;
    }
    
    .verb-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    html {
        font-size: 17px;
    }
    
    .quiz-header {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .quiz-main {
        padding: 1rem;
    }
    
    .quiz-footer {
        padding: 0.75rem 1rem;
    }
    
    .question-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .question-media {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }
    
    .question-media img {
        max-height: 350px;
        min-height: 0;
    }
    
    .question-options {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    
    /* Reading layout responsive */
    .reading-layout {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .reading-left {
        flex: none;
    }
    
    .reading-right {
        flex: none;
        min-width: 0;
    }
    
    .video-layout {
        flex-direction: column;
    }
    
    .video-container {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }
    
    .video-fill-panel {
        min-width: 0;
        width: 100%;
        padding: 1.5rem;
        gap: 1.25rem;
    }
    
    .video-fill-panel .word-bank {
        padding: 1.25rem;
    }
    
    .video-fill-panel .word-chip {
        white-space: normal;
        font-size: 1.25rem;
        padding: 0.85rem 1rem;
    }
    
    .video-fill-panel .fill-blank-sentence {
        font-size: 1.5rem;
    }
    
    .audio-layout {
        flex-direction: column;
    }
    
    .audio-layout .question-options {
        min-width: 0;
        width: 100%;
    }
    
    .media-column {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }
    
    .fib-layout {
        flex-direction: column;
    }
    
    .fib-sentence-panel {
        width: 100%;
        min-height: 150px;
    }
    
    .fib-options-panel {
        width: 100%;
    }
    
    /* Prevent horizontal overflow on all question types */
    .question-container,
    .question-card,
    .question-body,
    .question-content,
    .video-layout,
    .audio-layout,
    .fib-layout,
    .fib-with-image {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .results-main-grid {
        grid-template-columns: 1fr;
    }
    
    .verb-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    /* Welcome back button mobile */
    .welcome-back-btn {
        top: 1rem;
        left: 1rem;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }
    
    .welcome-back-btn span {
        display: none;
    }
    
    .welcome-back-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .welcome-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        padding: 1.5rem;
        padding-top: 4rem;
    }
    
    .welcome-illustration {
        width: 220px;
        height: 220px;
    }
    
    .float-item {
        font-size: 2rem;
    }
    
    .welcome-content h1 {
        font-size: 2.5rem;
    }
    
    .welcome-subtitle {
        font-size: 1.15rem;
    }
    
    .test-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .quiz-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .back-btn {
        width: 40px;
        height: 40px;
    }
    
    .back-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .icon-btn {
        width: 40px;
        height: 40px;
    }
    
    .progress-bar {
        height: 10px;
    }
    
    .score-display {
        padding: 0.5rem 0.75rem;
    }
    
    .score-display #current-score {
        font-size: 1.5rem;
    }
    
    .quiz-main {
        padding: 0.75rem;
        align-items: flex-start;
    }
    
    .question-text {
        font-size: 1.5rem;
        margin-bottom: 0.35rem;
    }
    
    .question-instruction {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Tighter question content gap */
    .question-content {
        gap: 1rem;
    }
    
    .question-header {
        margin-bottom: 0.5rem;
    }
    
    .question-media img {
        max-height: 170px;
        min-height: 0;
    }
    
    .fib-with-image .fib-image-panel img {
        max-height: 160px;
        min-height: 0;
    }
    
    /* Media column mobile - audio questions */
    .media-column {
        min-width: 0;
        width: 100%;
    }
    
    .media-column .question-media img {
        max-height: 150px;
        min-height: 0;
    }
    
    /* Audio layout mobile */
    .audio-layout .question-options {
        min-width: 0;
        width: 100%;
    }
    
    /* Video layout mobile */
    .video-container {
        min-width: 0;
        width: 100%;
    }
    
    .video-fill-panel {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        padding: 1.25rem;
        gap: 1rem;
        box-sizing: border-box;
    }
    
    .video-fill-panel .fill-blank-sentence {
        font-size: 1.35rem;
        line-height: 1.5;
    }
    
    .video-fill-panel .blank-input {
        min-width: 80px;
        max-width: 140px;
        font-size: 1.2rem;
        padding: 0.35rem 0.75rem;
    }
    
    .video-fill-panel .word-bank {
        padding: 1rem;
    }
    
    .video-fill-panel .word-chip {
        white-space: normal;
        font-size: 1.1rem;
        padding: 0.7rem 0.85rem;
    }
    
    /* Matching mobile - flexible widths */
    .matching-area {
        padding: 1rem 0;
    }
    
    .left-word {
        white-space: normal;
        text-align: center;
    }
    
    .match-slot {
        flex: 1;
    }
    
    .slot-placeholder {
        font-size: 1.2rem;
    }
    
    .answer-chip {
        white-space: normal;
        text-align: center;
    }
    
    /* Compact options for mobile */
    .option-item {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        border-width: 2px;
    }
    
    .option-text {
        font-size: 1.15rem;
    }
    
    .option-radio {
        width: 24px;
        height: 24px;
    }
    
    .fill-blank-sentence {
        font-size: 1.5rem;
    }
    
    .blank-input {
        min-width: 120px;
        font-size: 1.35rem;
    }
    
    .word-chip {
        padding: 0.75rem 1.25rem;
        font-size: 1.15rem;
    }
    
    .audio-player {
        flex-wrap: wrap;
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }
    
    .play-btn {
        width: 48px;
        height: 48px;
    }
    
    .play-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .audio-title {
        font-size: 1.05rem;
    }
    
    .audio-duration {
        font-size: 0.9rem;
    }
    
    /* Fill-in-blank with image mobile */
    .fib-with-image {
        flex-direction: column;
        gap: 1rem;
    }
    
    .fib-with-image .fib-image-panel {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    
    .fib-with-image .fib-image-panel img {
        max-height: 160px;
        min-height: 0;
        aspect-ratio: 16 / 10;
    }
    
    .fib-with-image .fib-sentence-panel {
        min-height: 80px;
        padding: 1rem;
        justify-content: flex-start;
    }
    
    .fib-with-image .fill-blank-sentence {
        font-size: 1.4rem;
        line-height: 1.6;
        text-align: left;
    }
    
    .fib-with-image .fib-content-panel {
        min-width: 0;
    }
    
    /* Word bank mobile - keep 2x2 grid */
    .word-bank-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .word-chip {
        padding: 1rem 1.25rem;
        font-size: 1.2rem;
    }
    
    .fib-with-image .word-bank-options,
    .video-fill-panel .word-bank-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Matching mobile */
    .matching-area {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }
    
    .matching-pairs {
        width: 100%;
        max-width: 100%;
    }
    
    .match-pair-row {
        height: auto;
        min-height: 50px;
    }
    
    .left-word {
        width: 110px;
        min-width: 110px;
        font-size: 1rem;
        padding: 0.75rem 0.5rem;
    }
    
    .match-slot {
        width: auto;
        min-width: 0;
        flex: 1;
        font-size: 1rem;
        padding: 0.75rem 0.5rem;
    }
    
    .placed-answer {
        font-size: 1rem;
        white-space: normal;
    }
    
    .answer-bank {
        width: 100%;
        max-width: 100%;
    }
    
    .bank-items {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: center;
    }
    
    .answer-chip {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        max-width: 100%;
        height: auto;
        min-height: 48px;
        font-size: 1.05rem;
        padding: 0.75rem 1rem;
    }
    
    /* Statement box mobile */
    .statement-box {
        padding: 1.25rem 1.5rem;
        margin-bottom: 1rem;
        border-width: 3px;
    }
    
    .statement-text {
        font-size: 1.25rem;
    }
    
    .reading-passage {
        padding: 1.25rem;
    }
    
    .passage-text {
        font-size: 1.15rem;
    }
    
    .quiz-footer {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .footer-center {
        display: none;
    }
    
    .footer-right {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-left: auto;
    }
    
    .btn-primary {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    .btn-secondary {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .btn-finish {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .skip-indicator {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Results Screen Mobile */
    .score-card {
        flex-direction: column;
        text-align: center;
        padding: 1.75rem;
        gap: 1.75rem;
    }
    
    .score-circle {
        width: 140px;
        height: 140px;
    }
    
    .score-value span:first-child {
        font-size: 2.75rem;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    .results-main-grid {
        grid-template-columns: 1fr;
    }
    
    .results-bottom {
        flex-direction: column;
    }
    
    .results-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }
    
    .results-actions .btn-secondary,
    .results-actions .btn-primary {
        min-width: 0;
        flex: 1 1 auto;
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }
    
    /* Results screen mobile padding */
    #results-screen {
        padding: 1.5rem 1rem;
    }
    
    .results-container {
        gap: 1.25rem;
    }
    
    .verb-mastery {
        padding: 1.5rem 1rem;
    }
    
    .verb-grid {
        gap: 0.75rem;
    }
    
    .verb-item {
        padding: 0.75rem 0.5rem;
    }
    
    .verb-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .verb-name {
        font-size: 0.9rem;
    }
    
    .review-filters {
        flex-wrap: wrap;
    }
    
    .review-header {
        padding: 1.25rem;
    }
    
    .review-container {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }
    
    .welcome-illustration {
        width: 180px;
        height: 180px;
    }
    
    .welcome-content h1 {
        font-size: 2rem;
    }
    
    .level-badge {
        font-size: 1.05rem;
        padding: 0.5rem 1rem;
    }
    
    .question-text {
        font-size: 1.25rem;
    }
    
    .question-media img {
        max-height: 140px;
    }
    
    .media-column .question-media img {
        max-height: 120px;
    }
    
    .fib-with-image .fib-image-panel img {
        max-height: 130px;
    }
    
    .option-item {
        padding: 0.6rem 0.85rem;
        gap: 0.6rem;
    }
    
    .option-text {
        font-size: 1.05rem;
    }
    
    .option-radio {
        width: 20px;
        height: 20px;
    }
    
    .play-btn {
        width: 42px;
        height: 42px;
    }
    
    .video-fill-panel .fill-blank-sentence {
        font-size: 1.2rem;
    }
    
    .word-chip {
        padding: 0.6rem 0.85rem;
        font-size: 1rem;
    }
    
    .quiz-footer {
        padding: 0.6rem 0.75rem;
    }
    
    .btn-secondary span {
        display: none;
    }
    
    .btn-secondary {
        padding: 0.75rem;
    }
    
    .btn-primary span {
        font-size: 1rem;
    }
}

/* ===== Animations ===== */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes confettiFall {
    0% { transform: translateY(-100%) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    animation: confettiFall 3s ease-out forwards;
}

/* Hover effects */
.option-item:hover .option-radio {
    border-color: var(--neutral-light);
}

/* Focus states for accessibility */
.option-item:focus-within {
    outline: 3px solid var(--neutral);
    outline-offset: 2px;
}

.blank-input:focus {
    outline: none;
}

button:focus-visible {
    outline: 3px solid var(--neutral);
    outline-offset: 2px;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-question);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ===== 16:9 Aspect Ratio Optimization for Classroom Displays ===== */
@media (min-aspect-ratio: 16/10) and (min-width: 1024px) {
    .question-content {
        flex-direction: row !important;
        align-items: center;
    }
    
    .fib-layout {
        flex-direction: row !important;
    }
    
    .fib-with-image {
        flex-direction: row !important;
    }
    
    .audio-layout {
        flex-direction: row !important;
    }
    
    .video-layout {
        flex-direction: row !important;
    }
    
    .question-media img {
        max-height: calc(100vh - 280px);
    }
    
    .fib-with-image .fib-image-panel img {
        max-height: calc(100vh - 280px);
    }
}

/* Force horizontal on large desktop screens */
@media (min-width: 1200px) {
    .question-content,
    .fib-layout,
    .fib-with-image,
    .audio-layout,
    .video-layout {
        flex-direction: row;
    }
    
    .question-media {
        min-width: 550px;
    }
    
    .question-media img {
        min-height: 400px;
    }
    
    .fib-with-image .fib-image-panel {
        min-width: 500px;
    }
    
    .fib-with-image .fib-image-panel img {
        min-height: 380px;
    }
}

/* Matching — 1280px-friendly sizes */
@media (min-width: 1200px) and (max-width: 1399px) {
    .matching-area {
        gap: 2.5rem;
        padding-left: 1.5rem;
    }
    
    .match-pair-row {
        height: 95px;
    }
    
    .left-word {
        width: 210px;
        min-width: 210px;
        font-size: 1.65rem;
    }
    
    .match-slot {
        width: 400px;
        min-width: 400px;
    }
    
    .answer-chip {
        width: 400px;
        min-width: 400px;
        height: 95px;
    }
    
    .slot-placeholder,
    .placed-answer,
    .answer-chip {
        font-size: 1.5rem;
    }
}

/* Matching — extra wide screens only (1400px+) */
@media (min-width: 1400px) {
    .matching-area {
        gap: 6rem;
        padding-left: 3rem;
    }
    
    .match-pair-row {
        height: 105px;
    }
    
    .left-word {
        width: 260px;
        min-width: 260px;
        font-size: 1.85rem;
    }
    
    .match-slot {
        width: 540px;
        min-width: 540px;
    }
    
    .answer-chip {
        width: 460px;
        min-width: 460px;
        height: 105px;
    }
    
    .slot-placeholder,
    .placed-answer,
    .answer-chip {
        font-size: 1.75rem;
    }

    .question-media {
        min-width: 550px;
    }
    
    .question-media img {
        min-height: 400px;
    }
    
    .fib-with-image .fib-image-panel {
        min-width: 500px;
    }
    
    .fib-with-image .fib-image-panel img {
        min-height: 380px;
    }
}

/* Short viewports — 1280×800 / Nest Hub Max */
@media (max-height: 820px) and (min-width: 769px) {
    html {
        font-size: 15px;
    }
    /* Welcome screen */
    .welcome-container {
        gap: 3rem;
        padding: 1.5rem;
    }
    .welcome-illustration {
        width: 240px;
        height: 240px;
    }
    .float-item {
        font-size: 2rem;
    }
    .level-badge {
        font-size: 1.1rem;
        padding: 0.5rem 1.25rem;
        margin-bottom: 0.5rem;
    }
    .welcome-content h1 {
        font-size: 2.75rem;
        margin-bottom: 0.4rem;
    }
    .welcome-subtitle {
        font-size: 1.15rem;
        margin-bottom: 1.5rem;
    }
    .test-info {
        gap: 1.5rem;
        margin-bottom: 1.75rem;
    }
    /* Quiz header */
    .quiz-header {
        padding: 0.5rem 2rem;
    }
    .icon-btn {
        width: 42px;
        height: 42px;
    }
    .progress-bar {
        height: 10px;
    }
    /* Quiz main — scroll so nothing clips */
    .quiz-main {
        overflow-y: auto;
        align-items: flex-start;
        padding: 0.75rem 1.5rem 1rem;
    }
    .question-text {
        font-size: 1.85rem;
        margin-bottom: 0.25rem;
    }
    .question-instruction {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }
    .option-item {
        padding: 0.875rem 1.5rem;
    }
    .option-text {
        font-size: 1.35rem;
    }
    .question-options {
        gap: 0.625rem;
        min-width: 380px;
    }
    /* Kill all fixed min-heights that override at 1200px+ */
    .question-media img {
        min-height: 0 !important;
        max-height: 340px;
        height: auto;
    }
    .question-media {
        min-width: 380px !important;
    }
    .fib-with-image .fib-image-panel img {
        min-height: 0 !important;
        max-height: 320px;
        height: auto;
    }
    .fib-with-image .fib-image-panel {
        min-width: 380px !important;
    }
    .media-column .question-media img {
        min-height: 0 !important;
        max-height: 200px;
    }
    .image-placeholder {
        height: 260px;
        max-height: 260px;
    }
    /* FIB */
    .fib-sentence-panel {
        min-height: 0;
        padding: 1.5rem 2rem;
    }
    .word-bank {
        padding: 1.25rem 1.75rem;
    }
    .word-chip {
        padding: 0.875rem 1.25rem;
        font-size: 1.35rem;
    }
    .fill-blank-sentence {
        font-size: 1.85rem;
    }
    .blank-input {
        font-size: 1.6rem;
    }
    /* Video */
    .video-fill-panel {
        min-width: 460px;
        padding: 1.5rem 2rem;
        gap: 1.25rem;
    }
    .video-fill-panel .fill-blank-sentence {
        font-size: 1.6rem;
    }
    /* Matching */
    .match-pair-row {
        height: 72px;
    }
    .matching-area {
        padding: 0.5rem 0 0.5rem 1rem;
        gap: 2rem;
    }
    /* Audio */
    .play-btn {
        width: 56px;
        height: 56px;
    }
    /* Statement box */
    .statement-box {
        padding: 1.5rem 2rem;
        margin-bottom: 1rem;
    }
    .statement-text {
        font-size: 1.6rem;
    }
    /* Footer */
    .quiz-footer {
        padding: 0.5rem 2rem;
    }
    .btn-primary {
        padding: 0.75rem 1.5rem;
        font-size: 1.05rem;
    }
    .btn-secondary {
        padding: 0.65rem 1.1rem;
        font-size: 0.95rem;
    }
    .btn-finish {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* Very tight — extra compression below 700px height */
@media (max-height: 700px) and (min-width: 769px) {
    html {
        font-size: 13px;
    }
    .welcome-illustration {
        width: 200px;
        height: 200px;
    }
}

/* ========================================
   V4 RESPONSIVE CLIP/SCROLL SAFETY PATCH
   Same principle as Definitions V4:
   shrink first, then scroll the real content area instead of clipping.
   This patch is intentionally last so it wins the cascade.
   ======================================== */
@media (min-width: 900px) {
    html,
    body,
    #quiz-screen {
        height: 100dvh;
        overflow: hidden;
    }

    .screen.active {
        min-height: 0;
    }

    .quiz-main {
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-gutter: stable;
        overscroll-behavior: contain;
        align-items: flex-start;
    }

    .question-container,
    .question-card,
    .question-content,
    .fib-layout,
    .fib-with-image,
    .video-layout,
    .reading-layout,
    .audio-layout {
        min-height: 0;
    }

    .question-options,
    .fib-content-panel,
    .matching-area,
    .review-container,
    .results-container {
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-gutter: stable;
    }

    .quiz-header,
    .quiz-footer {
        flex-shrink: 0;
    }
}

/* Medium teacher-laptop/projector heights, including responsive test panes around 1058px tall. */
@media (min-width: 900px) and (max-height: 1100px) {
    html {
        font-size: clamp(16px, 1.55vh, 20px);
    }

    .quiz-header {
        padding-top: clamp(0.45rem, 0.8vh, 0.85rem);
        padding-bottom: clamp(0.45rem, 0.8vh, 0.85rem);
    }

    .quiz-main {
        padding-top: clamp(0.55rem, 1vh, 0.9rem);
        padding-bottom: clamp(0.65rem, 1.1vh, 1.1rem);
    }

    .question-header {
        margin-bottom: clamp(0.55rem, 0.9vh, 0.9rem);
    }

    .question-text {
        font-size: clamp(1.8rem, 4vh, 2.35rem);
        line-height: 1.2;
    }

    .question-instruction {
        font-size: clamp(1.25rem, 3vh, 1.75rem);
        margin-bottom: clamp(0.75rem, 1.1vh, 1rem);
    }

    .question-content,
    .fib-layout,
    .fib-with-image,
    .video-layout,
    .audio-layout {
        gap: clamp(1rem, 1.8vw, 2rem);
    }

    .question-media img,
    .fib-with-image .fib-image-panel img {
        min-height: 0;
        max-height: min(440px, calc(100dvh - 270px));
    }

    .question-media,
    .fib-with-image .fib-image-panel,
    .video-container {
        min-width: min(420px, 48vw);
    }

    .question-options,
    .fib-content-panel {
        min-width: min(380px, 42vw);
        gap: clamp(0.75rem, 1.2vh, 1.1rem);
    }

    .option-item,
    .word-chip,
    .answer-chip,
    .match-slot,
    .left-word {
        padding-top: clamp(0.85rem, 1.25vh, 1.25rem);
        padding-bottom: clamp(0.85rem, 1.25vh, 1.25rem);
    }

    .option-text {
        font-size: clamp(1.35rem, 3vh, 1.85rem);
        line-height: 1.25;
    }

    .quiz-footer {
        padding-top: clamp(0.5rem, 0.9vh, 0.85rem);
        padding-bottom: clamp(0.5rem, 0.9vh, 0.85rem);
    }
}

@media (min-width: 900px) and (max-height: 820px) {
    html {
        font-size: 15px;
    }

    .quiz-main {
        padding-top: 0.5rem;
        padding-bottom: 0.75rem;
    }

    .question-media img,
    .fib-with-image .fib-image-panel img {
        max-height: min(360px, calc(100dvh - 240px));
    }

    .option-item {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

@media (min-width: 900px) and (max-height: 720px) {
    html {
        font-size: 13px;
    }

    .quiz-header,
    .quiz-footer {
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }

    .question-media img,
    .fib-with-image .fib-image-panel img {
        max-height: min(300px, calc(100dvh - 210px));
    }
}
