﻿/* 
 * IELTS Master - Soft UI Evolution Design System
 * Inspired by premium educational apps
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Purple/Blue Theme - Matching Junior English King */
    --primary: #6366f1;
    /* Indigo/Purple */
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #8b5cf6;
    /* Purple accent */
    --gold: #22c55e;
    /* Green for success buttons */
    --gold-glow: rgba(34, 197, 94, 0.3);
    --bg-main: #e8eef8;
    --bg-soft: #f1f5f9;
    /* Soft background for inner elements */
    /* Light blue-gray background */
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-purple: #6366f1;
    --radius: 16px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 30px rgba(99, 102, 241, 0.15);
    --glass: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --danger: #ef4444;
    --success: #22c55e;
    --border-blue: 2px solid var(--primary);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   LAYOUT REWRITE - Simple Block Layout
   No flexbox centering - content flows from top
   ============================================ */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: #f0f2f5;
    color: var(--text-main);
    line-height: 1.5;
    /* NO FLEX - just normal block layout */
}

.app-container {
    max-width: 650px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 60px;
    /* NO FLEX, NO MIN-HEIGHT - just a simple centered container */
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1100px;
    }
}

/* Typography Overrides */
h1 {
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.025em;
}

h2 {
    font-weight: 600;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

h3 {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Glassmorphism Header */
header {
    background: var(--card-bg);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}

/* Hide header in quiz mode to maximize space */
#quiz-screen.active~header,
body:has(#quiz-screen.active) header {
    display: none !important;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 span {
    font-size: 0.85rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 10px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Glass Panels */
.search-container,
.mode-selection,
.dashboard,
.question-box,
.result-card,
.modal-container {
    background: var(--card-bg);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

/* Search Box - Blue Border Style */
.search-container {
    border: var(--border-blue);
    border-radius: 12px;
    background: white;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box span {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
    white-space: nowrap;
}

input[type="text"] {
    padding: 14px 18px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
}

input[type="text"]:focus {
    outline: none;
}

/* =============== HOME SCREEN LAYOUT =============== */
#home-screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

#home-screen>* {
    width: 100%;
}

/* 2. 涓绘寜閽尯锛氬叏瀹藉爢鍙?*/
#home-screen .challenge-section,
#home-screen #resume-section {
    width: 100%;
    margin-bottom: 16px;
}

/* 3. 澶ф寜閽粺涓€鏍峰紡 */
#home-screen .btn-random-challenge,
#home-screen #btn-resume {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Green Random Challenge Button */
#home-screen .btn-random-challenge {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

#home-screen #btn-resume {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

#home-screen .btn-random-challenge:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

#home-screen #btn-resume:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* 4. A-Z 瀛楁瘝缃戞牸 - 8 columns on desktop */
#home-screen .az-grid,
#home-screen .button-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 16px;
    width: 100%;
    margin-top: 24px;
}

/* Section Titles */
.section-title {
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 20px;
}

.mode-selection h3 {
    text-align: center;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 20px;
}

/* 5. 閫氱敤澶ф寜閽牱寮?*/
.action-button-large {
    width: 100% !important;
    margin-bottom: 15px;
    padding: 18px !important;
    display: block !important;
    border-radius: 16px;
    text-align: center;
    font-weight: bold;
    box-sizing: border-box;
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.action-button-large.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.action-button-large.gold {
    background: white !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    color: #92400e !important;
    box-shadow: var(--shadow-soft) !important;
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(to right, rgba(251, 191, 36, 0.05), transparent) !important;
}

.action-button-large.gold::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--gold);
}

.action-button-large:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Bento Grid: Game Modes - Centered Layout */
.mode-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.mode-card {
    border: var(--border-blue);
    cursor: pointer;
    background: white;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    /* Vertical centering */
    align-items: center;
    gap: 12px;
    border-radius: var(--radius);
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.mode-card.selected {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.mode-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.mode-icon-wrapper svg {
    width: 28px;
    height: 28px;
}

.mode-info {
    text-align: center;
}

.mode-info h3 {
    color: var(--text-main);
    margin-bottom: 4px;
}

.mode-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Bento Grid: A-Z Letters - White Cards with Purple Text */

.btn-letter {
    border: none;
    cursor: pointer;
    background: white;
    height: 80px !important;
    border-radius: 12px;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-letter:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    background: var(--primary-light);
}

.btn-letter.locked {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
}

.letter-label {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    /* Purple text */
}

.letter-count {
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0.7;
}

/* Sticky Bottom Bar */
.feedback-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px;
    /* Reduced from 20px to 15px */
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Reduced from 15px to 12px */
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
    border-radius: 20px 20px 0 0;
    max-width: 800px;
    margin: 0 auto;
}

/* Word Card (Question Box) */
.question-box {
    background: white;
    padding: 20px;
    /* Reduced from 30px to 20px for mobile */
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    margin-bottom: 0;
    /* Managed by grid gap in desktop */
}

/* Mobile Quiz Screen Padding */
#quiz-screen {
    padding-bottom: 180px;
    /* Reduced from 200px to minimize whitespace */
}

/* Desktop Centered Card Layout */
@media (min-width: 1024px) {
    #quiz-screen {
        width: 100%;
        min-height: 100vh;
        /* Allow growth */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        /* Use flex-start instead of center to prevent vertical centering */
        padding: 20px 0 180px !important;
        /* Reduced bottom padding from 200px to 180px */
        margin: 0 !important;
    }

    /* result-screen desktop layout */
    #result-screen.active {
        width: 100%;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 60px 20px 100px !important;
        margin: 0 !important;
    }

    #quiz-container {
        width: 900px;
        max-width: 95vw;
        background: white;
        border-radius: 24px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
        padding: 25px;
        /* Further reduced for compactness */
        display: flex !important;
        flex-direction: column;
        gap: 15px;
        /* Further reduced gap */
    }

    /* Hide the media side since we removed images */
    #quiz-media-side {
        display: none !important;
    }

    #quiz-info-side {
        width: 100%;
    }

    .question-box {
        text-align: center;
        margin-bottom: 15px;
        /* Reduced from 30px to 15px */
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .option-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
        width: 100%;
        margin: 0 !important;
    }

    .option-btn {
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.word-image-container:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.word-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.audio-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.audio-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.audio-btn:active {
    transform: scale(0.96);
}

.audio-btn.playing {
    background: var(--primary);
    color: white;
    animation: pulse-audio 1s infinite;
}

.playing-highlight {
    background-color: #fef08a !important;
    /* Yellow-200 */
    border-radius: 4px;
    padding: 2px 4px;
    transition: background-color 0.3s ease;
}

@keyframes pulse-audio {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Quiz Option Cards */
.option-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    /* Force 2 columns */
    gap: 16px;
    margin-top: 24px;
}

/* Random 20 Button - Full Width Styling */
.btn-random-challenge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    /* Amber/Gold gradient */
    color: white;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    transition: var(--transition);
    width: 100%;
}

.btn-random-challenge:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.btn-random-challenge .mode-info h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.btn-random-challenge .mode-info p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 0.9rem;
}

.option-btn {
    border: 2px solid transparent;
    cursor: pointer;
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    text-align: left;
    position: relative;
    overflow: hidden;

    /* Requested: Adaptive height */
    height: auto;
    min-height: 80px;
    /* Increased slightly */
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    /* Align text to start, icon handles spacing */
    white-space: normal;
    /* Force wrap */
    word-wrap: break-word;
    /* Break long words if needed */
}

.option-btn:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-hover);
    background: #f8fafc;
}

.option-btn:active {
    transform: scale(0.98);
    background: #e2e8f0;
}

.opt-label {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-right: 12px;
    font-size: 0.9rem;
}

.opt-text {
    flex: 1;
}

.option-btn.correct {
    background: #dcfce7;
    border-color: var(--success);
    color: #166534;
}

.option-btn.wrong {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

/* Medal Wall Visual Upgrade */
.medal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.medal-card {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius);
    background: white;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-soft);
}

.medal#home-screen .btn-random-challenge {
    background: white !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    color: #92400e !important;
    box-shadow: var(--shadow-soft) !important;
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(to right, rgba(251, 191, 36, 0.05), transparent) !important;
}

#home-screen .btn-random-challenge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--gold);
}

.medal-card.unlocked {
    background: linear-gradient(145deg, #ffffff, #fffbeb);
    border: 1px solid var(--gold);
    box-shadow: 0 8px 15px var(--gold-glow);
}

.medal-card.unlocked .medal-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 10px var(--gold));
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.medal-card.locked {
    filter: grayscale(1) opacity(0.4);
}

/* Buttons Enhancement */
.btn {
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-blue {
    background: var(--primary);
    color: white;
}

.btn-blue:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-red {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-light);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

/* Quiz Displays */
.large-word {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

.phonetic {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
}

.sentence {
    background: #f1f5f9;
    padding: 20px;
    border-radius: 12px;
    font-style: italic;
    color: var(--text-main);
    font-size: 1.1rem;
}

/* ============================================
   SCREEN VISIBILITY - Simple Block Layout
   ============================================ */
.hidden {
    display: none !important;
}

.screen {
    display: none !important;
}

.screen.active {
    display: block !important;
}

/* EXPLICIT: Force hide screens by ID when not active */
#quiz-screen:not(.active),
#result-screen:not(.active) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Quiz screen styling (only applies when active) */
#quiz-screen.active {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    text-align: center;
}

#quiz-screen .quiz-card {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

/* Result screen - simple block */
#result-screen {
    text-align: center;
    padding-top: 40px;
}

.result-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

.result-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.result-card h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 20px;
    font-weight: 600;
}

.score-display {
    font-size: 3rem;
    font-weight: 700;
    color: #2563eb;
    margin: 30px 0;
}

.score-label {
    color: #64748b;
    margin-bottom: 30px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Override previous conflicting rules */
#result-screen.active {
    display: block !important;
    opacity: 1;
}

/* Utility Animations */
.pulse-animation {
    animation: pulse-glow 2s infinite;
}

/* Stats Bar (Progress Indicator) */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: var(--glass);
    padding: 10px 16px;
    /* Reduced padding */
    border-radius: 12px;
    margin-bottom: 15px;
    /* Reduced from 20px to 15px */
    box-shadow: var(--shadow-soft);
    /* Make sticky on mobile so it stays visible when scrolling */
    position: sticky;
    top: 10px;
    z-index: 100;
}

.stats-bar .stat-item {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* REMOVED: Conflicting result-screen centering rule that was overriding flex-start fixes */

.result-card {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    /* Force to top - override any inherited centering */
    margin-top: 0 !important;
    align-self: flex-start !important;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.speak-btn-mini {
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary);
    transition: var(--transition);
    opacity: 0.7;
}

.speak-btn-mini:hover {
    transform: scale(1.2);
    opacity: 1;
}

.speak-btn-mini.playing {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Cleanup: Redundant Image rules removed */

.audio-btn.playing {
    animation: pulse 1s infinite !important;
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.speak-btn.playing,
.speak-btn-mini.playing {
    animation: pulse 1s infinite !important;
    color: var(--primary) !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .app-container {
        padding: 10px;
        padding-bottom: 80px;
    }

    .large-word {
        font-size: 2rem;
    }

    .button-grid,
    .az-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    /* ===== COMPACT QUIZ LAYOUT FOR MOBILE ===== */

    /* Reduce stats bar size */
    .stats-bar {
        padding: 8px 15px;
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    /* Compact question box */
    .question-box {
        padding: 15px !important;
        margin-bottom: 10px !important;
    }

    /* Smaller sentence display */
    .sentence {
        font-size: 1rem !important;
        padding: 10px !important;
        margin: 10px 0 !important;
    }

    /* Compact hint button */
    #hint-container {
        margin: 5px 0 !important;
    }

    #btn-hint {
        padding: 8px 15px !important;
        font-size: 0.9rem !important;
    }

    /* Compact audio controls */
    .audio-controls {
        margin: 5px 0 !important;
        gap: 5px !important;
    }

    .audio-btn {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }

    /* Compact option buttons - CRITICAL for fitting all options */
    .option-btn {
        padding: 12px 15px !important;
        min-height: 50px !important;
        font-size: 0.95rem !important;
        margin-bottom: 8px !important;
    }

    .option-grid {
        gap: 8px !important;
    }

    /* Hide image on mobile to save space */
    #word-image-container {
        display: none !important;
    }

    /* Compact quiz container */
    #quiz-container {
        padding: 0 !important;
    }

    /* Reduce spacing in quiz info side */
    #quiz-info-side {
        padding: 0 !important;
    }
}

/* =========================================
   CRITICAL LAYOUT FIXES - DO NOT MODIFY 
   ========================================= */

/* Force 2-column layout for options on ALL screens */
.option-grid,
#options-container,
div.option-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    margin-top: 20px !important;
    box-sizing: border-box !important;
}

/* Ensure buttons don't overflow */
.option-btn {
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    min-height: 70px !important;
    /* Compact height */
}

/* Audio buttons styling adjustment */
.audio-btn {
    margin: 0 !important;
    white-space: nowrap;
}