/* ==============================
   Theme variables
   ============================== */
:root {
    --primary: #667EEA;
    --primary-light: #9F7AEA;
    --success: #48BB78;
    --warning: #F6AD55;
    --danger: #FC8181;
    --background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    --gradient: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    --gradient-warm: linear-gradient(135deg, #F093FB 0%, #F5576C 100%);
    --gradient-success: linear-gradient(135deg, #48BB78 0%, #38B2AC 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
}

/* Ocean */
[data-theme="ocean"] {
    --primary: #0EA5E9;
    --primary-light: #38BDF8;
    --success: #06B6D4;
    --background: linear-gradient(135deg, #0EA5E9 0%, #1E40AF 100%);
    --gradient: linear-gradient(135deg, #0EA5E9 0%, #1E40AF 100%);
    --gradient-warm: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
    --gradient-success: linear-gradient(135deg, #06B6D4 0%, #0E7490 100%);
}

/* Forest */
[data-theme="forest"] {
    --primary: #059669;
    --primary-light: #34D399;
    --success: #10B981;
    --background: linear-gradient(135deg, #059669 0%, #064E3B 100%);
    --gradient: linear-gradient(135deg, #059669 0%, #064E3B 100%);
    --gradient-warm: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #047857 100%);
}

/* Sunset */
[data-theme="sunset"] {
    --primary: #F59E0B;
    --primary-light: #FBBF24;
    --success: #F97316;
    --background: linear-gradient(135deg, #F59E0B 0%, #DC2626 100%);
    --gradient: linear-gradient(135deg, #F59E0B 0%, #DC2626 100%);
    --gradient-warm: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
    --gradient-success: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
}

/* ==============================
   Base
   ============================== */
body {
    font-family: 'Rubik', sans-serif;
    background: var(--background);
    min-height: 100vh;
    transition: all 0.5s ease;
}
.english-font { font-family: 'Quicksand', sans-serif; }

/* ==============================
   Theme selector (in burger menu)
   ============================== */
.theme-selector {
    display: flex;
    gap: 8px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}
.theme-selector.in-menu {
    position: static;
    right: auto; top: auto;
    box-shadow: none;
    background: transparent;
    padding: 0;
    gap: 10px;
}
.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}
.theme-btn:hover { transform: scale(1.1); border-color: rgba(255, 255, 255, 0.5); }
.theme-btn.active { border-color: white; box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.theme-btn[data-theme="default"] { background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%); }
.theme-btn[data-theme="ocean"]   { background: linear-gradient(135deg, #0EA5E9 0%, #1E40AF 100%); }
.theme-btn[data-theme="forest"]  { background: linear-gradient(135deg, #059669 0%, #064E3B 100%); }
.theme-btn[data-theme="sunset"]  { background: linear-gradient(135deg, #F59E0B 0%, #DC2626 100%); }

/* Menu section helpers */
.menu-section { margin-top: 12px; }
.menu-section-title { font-size: 0.9rem; color: #4B5563; margin-bottom: 8px; }

/* ==============================
   Cards & layout
   ============================== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    transition: all 0.3s ease;
}

.skills-tree { display: flex; flex-direction: column; gap: 40px; max-width: 1000px; margin: 0 auto; }
.skill-row { display: flex; justify-content: center; align-items: center; gap: 20px; position: relative; }
.skill-row:not(:last-child)::after {
    content: '';
    position: absolute; bottom: -40px; left: 50%; transform: translateX(-50%);
    width: 3px; height: 40px; background: linear-gradient(to bottom, var(--primary), transparent);
    border-radius: 2px;
}
.skill-connector {
    width: 40px; height: 3px; background: linear-gradient(to right, var(--primary), var(--primary-light));
    border-radius: 2px; position: relative; opacity: 0.7;
}
.skill-connector::before {
    content: ''; position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
    border-left: 8px solid var(--primary-light); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}

/* ==============================
   Skill cards
   ============================== */
.skill-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 280px;
    color: var(--text-primary);
}
.skill-card::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 4px;
    background: var(--gradient); transition: left 0.5s ease;
}
.skill-card:hover::before { left: 0; }
.skill-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}
.skill-card.mastered {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1) 0%, rgba(56, 178, 172, 0.1) 100%);
    border-color: var(--success);
    animation: glow-pulse 3s ease-in-out infinite;
}
.skill-card.mastered::before { background: var(--gradient-success); left: 0; }
.skill-card.locked { opacity: 0.6; pointer-events: none; filter: grayscale(50%); }
.skill-card.locked::after { content: '🔒'; position: absolute; top: 10px; right: 10px; font-size: 20px; }

/* ==============================
   Progress
   ============================== */
.progress-bar {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    height: 8px;
}
.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}
.progress-fill::before {
    content: '';
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progress-shine 2s infinite;
}
@keyframes progress-shine { 0% { left: -100%; } 50% { left: 100%; } 100% { left: 100%; } }

.progress-dot {
    width: 12px; height: 12px; border-radius: 50%; background: #E2E8F0;
    display: inline-block; margin: 0 3px; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative;
}
.progress-dot.completed { background: var(--gradient-success); transform: scale(1.3); box-shadow: 0 0 15px rgba(72,187,120,0.6); }
.progress-dot.pulse { animation: dot-pulse 1.5s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.7; } }

/* ==============================
   Buttons
   ============================== */
.btn-primary {
    background: var(--gradient);
    color: white;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6); }
.btn-primary:active { transform: translateY(-1px); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #667EEA;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    border: 2px solid rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.btn-secondary:hover { background: white; border-color: #667EEA; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2); }
.btn-secondary:active { transform: translateY(0); }

/* Step buttons (activity) */
.step-button {
    background: var(--card-bg);
    border: 2px solid #E2E8F0;
    padding: 12px 24px;
    border-radius: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 130px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.step-button::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--gradient);
    transition: left 0.3s ease; z-index: -1;
}
.step-button:hover:not(:disabled)::before { left: 0; }
.step-button:hover:not(:disabled) { color: white; border-color: transparent; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3); }
.step-button:disabled { opacity: 0.4; cursor: not-allowed; }
.step-button.completed { background: var(--gradient-success); color: white; border-color: transparent; animation: completed-bounce 0.6s ease-out; }
@keyframes completed-bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ==============================
   Effects (faster, auto-clean)
   ============================== */
.floating-emoji {
    position: fixed;
    font-size: 2.5rem;
    animation: float-up-enhanced 1.2s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}
@keyframes float-up-enhanced {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(0.5); }
    10% { transform: translateY(-20px) rotate(10deg) scale(1); }
    90% { opacity: 1; transform: translateY(-180px) rotate(350deg) scale(1.2); }
    100% { opacity: 0; transform: translateY(-220px) rotate(360deg) scale(0.8); }
}

.celebration-particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 999; }
.particle {
    position: absolute; width: 8px; height: 8px; background: var(--primary); border-radius: 50%;
    animation: particle-burst 0.9s ease-out forwards;
}
@keyframes particle-burst {
    0% { opacity: 1; transform: scale(0) rotate(0deg); }
    100% { opacity: 0; transform: scale(2) rotate(720deg) translate(var(--dx), var(--dy)); }
}

.celebration { animation: mega-celebrate 0.8s ease-out; }
@keyframes mega-celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.15) rotate(5deg); }
    50% { transform: scale(1.2) rotate(-3deg); }
    75% { transform: scale(1.15) rotate(5deg); }
}

.pulse { animation: enhanced-pulse 2s infinite; }
@keyframes enhanced-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(72, 187, 120, 0.3); }
    50% { box-shadow: 0 0 30px rgba(72, 187, 120, 0.6); }
}

/* Screen shake */
@keyframes screen-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}
.shake { animation: screen-shake 0.5s ease-in-out; }

/* ==============================
   Modal
   ============================== */
.modal-backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); transition: all 0.3s ease; }
.modal-content { animation: modal-slide-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes modal-slide-in {
    0% { opacity: 0; transform: translateY(50px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==============================
   Option buttons
   ============================== */
.option-button {
    background: var(--card-bg);
    border: 3px solid #E2E8F0;
    padding: 18px 28px;
    border-radius: 18px;
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 160px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}
.option-button::before {
    content: '';
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(159, 122, 234, 0.1) 100%);
    transition: left 0.3s ease;
}
.option-button:hover:not(:disabled)::before { left: 0; }
.option-button:hover:not(:disabled) {
    border-color: var(--primary);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}
.option-button.correct { background: var(--gradient-success); color: white; border-color: transparent; animation: mega-correct-bounce 0.6s ease-out; }
@keyframes mega-correct-bounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1) rotate(2deg); }
    75% { transform: scale(1.1) rotate(-2deg); }
}
.option-button.incorrect { background: linear-gradient(135deg, #FC8181 0%, #F56565 100%); color: white; border-color: transparent; animation: enhanced-shake 0.6s; }
@keyframes enhanced-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px) rotate(-1deg); }
    20%, 40%, 60%, 80% { transform: translateX(8px) rotate(1deg); }
}

/* ==============================
   Speaker button
   ============================== */
.speaker-btn {
    background: var(--gradient-warm);
    width: 70px; height: 70px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    position: relative;
    overflow: hidden;
}
.speaker-btn::before {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0; transition: opacity 0.3s ease;
}
.speaker-btn:hover::before { opacity: 1; }
.speaker-btn:hover { transform: scale(1.15) rotate(10deg); box-shadow: 0 8px 25px rgba(245, 87, 108, 0.6); }
.speaker-btn:active { transform: scale(0.95); animation: audio-wave 0.6s ease-out; }
@keyframes audio-wave {
    0%, 100% { box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4); }
    50% { box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4), 0 0 0 20px rgba(245, 87, 108, 0.1); }
}

/* ==============================
   Achievement badge & header bits
   ============================== */
.achievement-badge {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    padding: 10px 18px;
    border-radius: 25px;
    font-weight: 600;
    display: inline-block;
    animation: badge-glow 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}
.achievement-badge::before {
    content: '';
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: badge-shine 3s infinite;
}
@keyframes badge-glow { 0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); } 50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); } }
@keyframes badge-shine { 0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); } 50% { transform: translateX(100%) translateY(100%) rotate(45deg); } 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); } }

.welcome-title {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 3.5rem;
    font-weight: 700;
    animation: title-glow 4s ease-in-out infinite;
}
@keyframes title-glow { 0%, 100% { filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.3)); } 50% { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6)); } }

.streak-counter {
    background: var(--gradient-warm);
    color: white;
    padding: 6px 15px;
    border-radius: 25px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: streak-pulse 2s ease-in-out infinite;
}
@keyframes streak-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Letter building game (if used) */
.letter-box {
    width: 70px; height: 70px; background: var(--card-bg);
    border: 3px solid #E2E8F0; border-radius: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 700; color: var(--primary);
    margin: 0 6px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.letter-box:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 6px 15px rgba(102, 126, 234, 0.2); }

.letter-choice {
    width: 60px; height: 60px; background: var(--card-bg);
    border: 3px solid #CBD5E0; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 600; color: var(--text-secondary);
    margin: 0 6px; cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.letter-choice:hover { transform: translateY(-3px) scale(1.05); border-color: var(--primary); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.letter-choice:active { cursor: grabbing; transform: scale(1.1) rotate(5deg); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

/* Dashboard button focus */
#teacher-dashboard-btn { z-index: 10; position: relative; pointer-events: auto; display: inline-block; }
#teacher-dashboard-btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Dashboard stats & settings */
.tab-btn { padding: 8px 16px; border: none; background: transparent; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 600; color: #6B7280; transition: all 0.2s ease; }
.tab-btn:hover { color: var(--primary); border-bottom-color: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.stat-card { background: var(--card-bg); padding: 24px; border-radius: 16px; text-align: center; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); transition: transform 0.2s ease; }
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { font-size: 2.5rem; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.stat-label { font-size: 0.875rem; color: #6B7280; }

.setting-item { background: rgba(255, 255, 255, 0.7); padding: 20px; border-radius: 12px; border: 1px solid #E5E7EB; }
.setting-item input[type="range"] { height: 6px; background: #E5E7EB; border-radius: 3px; outline: none; -webkit-appearance: none; }
.setting-item input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--primary); border-radius: 50%; cursor: pointer; }
.setting-item input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; background: var(--primary); border-radius: 50%; cursor: pointer; border: none; }
.setting-item input[type="checkbox"] { accent-color: var(--primary); }

/* Charts & prose */
.chart-placeholder { background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; color: #6B7280; min-height: 200px; }
.prose { line-height: 1.6; }
.prose h4 { margin-bottom: 1rem; font-weight: 600; }
.prose ul { margin-bottom: 1rem; }
.prose li { margin-bottom: 0.5rem; }

/* ==============================
   Responsive
   ============================== */
@media (max-width: 768px) {
    .skills-tree { gap: 30px; }
    .skill-row { flex-direction: column; gap: 15px; }
    .skill-connector { width: 3px; height: 30px; transform: rotate(90deg); }
    .skill-card { min-width: 250px; }
}

/* ==============================
   Loading spinner
   ============================== */
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
/* ===== Mobile FIT (final, safe) — no horizontal scroll ===== */

/* Ensure padding/borders don't increase widths */
*, *::before, *::after { box-sizing: border-box; }

/* Page must never scroll sideways */
html, body { max-width: 100%; overflow-x: hidden; }

/* Modal shell and content respect viewport width */
.container,
.modal,
.modal .surface,
.modal .body { width: 100%; max-width: 100%; }

/* Example/Learn cards can't overflow */
.example-card,
.modal .body .bg-white { max-width: 100%; overflow: hidden; }

/* BEFORE→AFTER rows: allow wrap so words/buttons don't stretch width */
.modal .body [dir="ltr"]{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 100%;
}
.modal .body [dir="ltr"] > * { min-width: 0; }
.modal .body .english-font { max-width: 100%; overflow-wrap: anywhere; }

/* Fix for learning modal examples on mobile */
#modal-body .bg-white {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#modal-body .inline-flex {
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

/* Responsive adjustments for word transformation examples */
@media (max-width: 640px) {
  #modal-body [dir="ltr"] {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  
  #modal-body .inline-flex {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    max-width: 100%;
  }
  
  #modal-body .text-3xl {
    font-size: 1.5rem;
  }
  
  /* Adjust speaker buttons in examples */
  #modal-body .speaker-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
  
  #modal-body .english-font {
    font-size: 1.25rem;
  }
  
  /* Grid adjustment for examples */
  #modal-body .grid {
    grid-template-columns: 1fr;
  }
}

/* Tighten sizes slightly on very small phones */
@media (max-width: 420px){
  .speaker-btn, button[data-speak]{ width: 38px; height: 38px; background-size: 18px 18px; }
  .modal .body .english-font{ font-size: clamp(16px, 5.2vw, 22px); }
  
  #modal-body .speaker-btn {
    width: 35px;
    height: 35px;
    min-width: 35px;
  }
  
  #modal-body .text-3xl {
    font-size: 1.25rem;
  }
  
  #modal-body .english-font {
    font-size: 1.125rem;
  }
}
/* ==============================
   Arrow Transformation Fix (Stronger Version)
   ============================== */
.transformation-arrow {
  /* Ensures the arrow smoothly rotates instead of snapping */
  transition: transform 0.4s ease;
}

@media (max-width: 640px) {
  /*
   * On mobile screens, when the layout becomes a column,
   * we rotate our arrow 90 degrees to point down.
   */
  .transformation-arrow {
    transform: rotate(90deg) !important; /* <-- ADDED !important TO FORCE THE STYLE */
  }
}
/* ==============================
   Question Transition Animation
   ============================== */
#modal-body {
  /* This tells the container to animate any changes to its opacity */
  transition: opacity 0.3s ease-in-out;
}

#modal-body.fade-out {
  /* This class will make the container invisible */
  opacity: 0;
}
