/* ============================================
   Learner Corpus of Kazakh — Premium Theme
   Emil Kowalski design-engineering principles
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --secondary: #10b981;
    --secondary-light: #34d399;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --bg-white: #ffffff;
    --bg-light: #fafaf9;
    --bg-warm: #fffbeb;
    --text-dark: #18181b;
    --text-body: #3f3f46;
    --text-muted: #71717a;
    --text-light: #a1a1aa;
    --border: #e4e4e7;
    --border-light: #f4f4f5;
    --shadow-sm: 0 1px 2px rgba(79,70,229,.04);
    --shadow: 0 4px 6px -1px rgba(79,70,229,.06), 0 2px 4px -2px rgba(79,70,229,.04);
    --shadow-md: 0 10px 20px -4px rgba(79,70,229,.08), 0 4px 8px -4px rgba(79,70,229,.03);
    --shadow-lg: 0 20px 40px -8px rgba(79,70,229,.1), 0 8px 16px -6px rgba(79,70,229,.04);
    --shadow-xl: 0 25px 50px -12px rgba(79,70,229,.18);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --max-width: 1320px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-sans);
    color: var(--text-body);
    background: var(--bg-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--primary-dark); }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* --- Navigation --- */
.site-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(255,255,255,.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(228,228,231,.5);
    transition: background 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}
.site-nav.scrolled { background: rgba(255,255,255,.92); box-shadow: 0 1px 0 var(--border); }
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    max-width: var(--max-width); margin: 0 auto; padding: 0 20px;
    height: 64px; gap: 8px;
}
.nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 1.05rem; color: var(--text-dark);
    letter-spacing: -.025em;
}
.nav-brand img { height: 36px; width: auto; }
.nav-brand span { letter-spacing: -.025em; }
.nav-links {
    display: flex; align-items: center; gap: 0;
    list-style: none; flex-shrink: 1; flex-wrap: nowrap;
}
.nav-links a {
    padding: 6px 10px; border-radius: 8px; white-space: nowrap;
    font-size: .82rem; font-weight: 500; color: var(--text-muted);
    transition: color 150ms ease, background-color 150ms ease, transform 120ms var(--ease-out);
    letter-spacing: -.01em;
}
.nav-links a:hover { color: var(--primary); background: transparent; }
.nav-links a:active { transform: scale(0.97); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.nav-links a.nav-exercise {
    color: var(--secondary); font-weight: 600;
    transition: color 150ms ease, background-color 150ms ease, transform 120ms var(--ease-out);
}
.nav-links a.nav-exercise:hover {
    color: var(--bg-white); background: var(--secondary); border-radius: 100px;
}
.nav-links a.nav-exercise:active { transform: scale(0.97); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.lang-switcher { display: flex; align-items: center; }
.lang-btn {
    display: flex; align-items: center; gap: 2px;
    padding: 5px 10px; border-radius: 8px; font-size: .8rem; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
    transition: border-color 150ms ease, color 150ms ease;
    border: 1px solid var(--border);
}
.lang-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.lang-current { color: var(--primary); font-weight: 700; }
.lang-divider { opacity: .3; margin: 0 2px; }
.lang-other { opacity: .5; }
.nav-mobile-btn {
    display: none; border: none; background: none;
    cursor: pointer; padding: 8px;
}
.nav-mobile-btn span {
    display: block; width: 22px; height: 2px;
    background: var(--text-dark); margin: 5px 0;
    border-radius: 2px; transition: transform 180ms var(--ease-out), opacity 180ms var(--ease-out);
}

/* --- Hero Section --- */
.hero {
    position: relative; min-height: 100vh;
    display: flex; align-items: center;
    background: #0c0a1d;
    overflow: hidden; padding: 100px 0 80px;
}
/* Animated gradient blobs */
.hero-blob {
    position: absolute; border-radius: 50%; filter: blur(100px);
    pointer-events: none; will-change: transform;
}
.hero-blob-1 {
    width: 600px; height: 600px; top: -20%; left: -10%;
    background: radial-gradient(circle, rgba(79,70,229,.5) 0%, transparent 70%);
    animation: blobFloat1 12s ease-in-out infinite;
}
.hero-blob-2 {
    width: 500px; height: 500px; bottom: -15%; right: -5%;
    background: radial-gradient(circle, rgba(16,185,129,.4) 0%, transparent 70%);
    animation: blobFloat2 15s ease-in-out infinite;
}
.hero-blob-3 {
    width: 400px; height: 400px; top: 40%; left: 50%;
    background: radial-gradient(circle, rgba(245,158,11,.25) 0%, transparent 70%);
    animation: blobFloat3 10s ease-in-out infinite;
}
@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, 40px) scale(1.1); }
    66% { transform: translate(-30px, 60px) scale(0.95); }
}
@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -30px) scale(1.08); }
    66% { transform: translate(40px, -50px) scale(0.92); }
}
@keyframes blobFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, -40px) scale(1.15); }
}
/* Floating Kazakh letters */
.hero-letters { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.hero-letter {
    position: absolute; font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800; color: rgba(255,255,255,.06);
    font-family: var(--font-heading); letter-spacing: -.02em;
    animation: letterFloat 8s ease-in-out infinite;
    will-change: transform;
}
@keyframes letterFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(3deg); }
    75% { transform: translateY(15px) rotate(-2deg); }
}
/* Subtle grid overlay */
.hero-grid-overlay {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 70%);
}
.hero-content {
    position: relative; z-index: 2;
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center;
}
.hero-text { color: #fff; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
    padding: 6px 16px; border-radius: 100px;
    font-size: .75rem; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; margin-bottom: 28px;
    backdrop-filter: blur(12px);
}
.hero-badge::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: var(--secondary-light);
    animation: pulse-dot 2s var(--ease-in-out) infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(1.4); }
}
.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.75rem, 5vw, 3.75rem);
    font-weight: 800; line-height: 1.1;
    letter-spacing: -.025em; margin-bottom: 24px;
    animation: heroFadeIn 500ms var(--ease-out) both;
}
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.hero h1 .highlight {
    background: linear-gradient(135deg, var(--secondary-light), var(--accent-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-desc {
    font-size: 1.125rem; line-height: 1.7;
    color: rgba(255,255,255,.75); margin-bottom: 40px;
    max-width: 520px; font-weight: 400;
    animation: heroFadeIn 500ms var(--ease-out) 60ms both;
}
.hero-actions {
    display: flex; gap: 16px; flex-wrap: wrap;
    animation: heroFadeIn 500ms var(--ease-out) 120ms both;
}
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px; border-radius: var(--radius);
    font-weight: 600; font-size: .95rem;
    cursor: pointer; border: none;
    transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    letter-spacing: -.01em;
}
.btn:active { transform: scale(0.97) translateY(0); }
.btn-primary {
    background: #fff; color: var(--primary);
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.btn-primary:hover { color: var(--primary-dark); }
.btn-primary:active { transform: scale(0.97); }
.btn-outline {
    background: transparent; color: #fff;
    border: 1.5px solid rgba(255,255,255,.3);
}
.btn-outline:hover {
    background: rgba(255,255,255,.1); color: #fff;
    border-color: rgba(255,255,255,.5);
}
.btn-outline:active { transform: scale(0.97); }

/* Button hover transforms — touch device protected */
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0,0,0,.2);
    }
    .btn-outline:hover { transform: translateY(-2px); }
}

.hero-logos {
    display: flex; flex-direction: column; align-items: center; gap: 32px;
}
.hero-logo-grid {
    display: flex; gap: 40px; align-items: center;
}
.hero-logo-item {
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius-lg); padding: 24px 32px;
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    min-width: 160px; min-height: 100px;
}
.hero-logo-item img { height: 60px; width: auto; filter: brightness(0) invert(1); opacity: .85; }
.hero-logo-divider {
    width: 2px; height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,.25), transparent);
}
.hero-stats { display: flex; gap: 48px; margin-top: 16px; }
.hero-stat { text-align: center; color: rgba(255,255,255,.7); }
.hero-stat-number {
    font-family: var(--font-heading);
    font-size: 2rem; font-weight: 800; color: #fff;
    display: block; letter-spacing: -.025em;
}
.hero-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 500; }

/* --- Section Styles --- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-light); }
.section-dark { background: #1e1b4b; color: #fff; }
.section-warm { background: var(--bg-warm); }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 64px; }
.section-label {
    display: inline-block;
    font-size: .8rem; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--secondary);
    margin-bottom: 12px;
}
.section-dark .section-label { color: var(--secondary-light); }
.section-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3.5vw, 2.5rem);
    font-weight: 800; color: var(--text-dark);
    line-height: 1.15; margin-bottom: 16px;
    letter-spacing: -.025em;
}
.section-dark .section-title { color: #fff; }
.section-desc {
    font-size: 1.1rem; color: var(--text-muted); line-height: 1.7;
    max-width: 600px; margin: 0 auto;
}
.section-dark .section-desc { color: rgba(255,255,255,.6); }

/* --- About Section --- */
.about-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 80px;
    align-items: center;
}
.about-text h3 {
    font-family: var(--font-heading);
    font-size: 1.75rem; font-weight: 800; color: var(--text-dark);
    margin-bottom: 20px; letter-spacing: -.025em;
}
.about-text p { margin-bottom: 16px; color: var(--text-body); line-height: 1.7; }
.about-feature-list { list-style: none; margin-top: 24px; }
.about-feature-list li {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px; font-size: .95rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    transition: background-color 250ms ease, border-color 250ms ease;
}
.about-feature-list li:hover {
    background: var(--bg-light);
    border-left-color: var(--primary);
}
.about-feature-list li::before {
    content: ''; flex-shrink: 0; width: 22px; height: 22px;
    background: var(--secondary); border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 12px;
    margin-top: 2px;
}
.about-card {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-xl); padding: 48px;
    color: #fff; position: relative; overflow: hidden;
}
.about-card::before {
    content: ''; position: absolute; top: -50%; right: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 60%);
    pointer-events: none;
}
.about-card h4 {
    font-family: var(--font-heading);
    font-size: 1.3rem; font-weight: 700; margin-bottom: 16px;
    position: relative; letter-spacing: -.015em;
}
.about-card p {
    color: rgba(255,255,255,.75); line-height: 1.7;
    position: relative;
}
.level-badges {
    display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap;
    position: relative;
}
.level-badge {
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
    padding: 6px 20px; border-radius: 100px;
    font-size: .85rem; font-weight: 600;
    backdrop-filter: blur(8px);
}

/* --- Timeline --- */
.timeline {
    position: relative; max-width: 800px; margin: 0 auto;
    padding-left: 40px;
}
.timeline::before {
    content: ''; position: absolute; left: 16px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}
.timeline-item { position: relative; padding: 0 0 48px 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -32px; top: 4px;
    width: 12px; height: 12px;
    background: var(--primary); border-radius: 50%;
    border: 3px solid var(--bg-light);
    box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}
.timeline-year {
    font-size: .8rem; font-weight: 700;
    color: var(--primary); text-transform: uppercase;
    letter-spacing: .08em; margin-bottom: 4px;
}
.timeline-title {
    font-size: 1.1rem; font-weight: 700;
    color: var(--text-dark); margin-bottom: 8px; letter-spacing: -.015em;
}
.timeline-desc { font-size: .95rem; color: var(--text-muted); line-height: 1.7; }

/* --- Grammar Section --- */
.grammar-tabs {
    display: flex; gap: 8px; justify-content: center;
    flex-wrap: wrap; margin-bottom: 40px;
}
.grammar-tab {
    padding: 10px 24px; border-radius: 100px;
    font-size: .875rem; font-weight: 600;
    background: var(--bg-white); color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 180ms var(--ease-out), transform 120ms var(--ease-out);
}
.grammar-tab:hover { border-color: var(--primary-light); color: var(--primary); }
.grammar-tab:active { transform: scale(0.97); }
.grammar-tab.active {
    background: var(--primary); color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.grammar-content { display: none; }
.grammar-content.active { display: block; }
.grammar-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-white); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.grammar-table thead th {
    background: var(--primary); color: #fff;
    padding: 14px 20px; text-align: left;
    font-size: .8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
}
.grammar-table tbody td {
    padding: 14px 20px; border-bottom: 1px solid var(--border-light);
    font-size: .95rem;
}
.grammar-table tbody tr:nth-child(even) { background: var(--bg-light); }
.grammar-table tbody tr:hover { background: rgba(79,70,229,.03); }
.grammar-table tbody tr:last-child td { border-bottom: none; }
.grammar-table .kazakh { font-weight: 600; color: var(--primary); }
.grammar-table .example { font-style: italic; color: var(--text-muted); font-size: .9rem; }

/* --- Vocabulary Cards --- */
.vocab-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.vocab-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 32px 24px; text-align: center;
    border: 1px solid var(--border);
    transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), border-color 250ms ease;
    cursor: pointer; position: relative; overflow: hidden;
}
.vocab-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0); transform-origin: left;
    transition: transform 250ms var(--ease-out);
}
.vocab-card:active { transform: scale(0.98); }
.vocab-icon {
    width: 52px; height: 52px; margin: 0 auto 16px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.vocab-card h3 {
    font-size: 1rem; font-weight: 700;
    color: var(--text-dark); margin-bottom: 8px; letter-spacing: -.015em;
}
.vocab-card p { font-size: .85rem; color: var(--text-muted); }
.vocab-expanded { display: none; margin-top: 16px; text-align: left; }
.vocab-expanded.show { display: block; }
.vocab-word-pair {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border-light);
    font-size: .9rem;
}
.vocab-word-pair:last-child { border-bottom: none; }
.vocab-word-pair .kz { font-weight: 600; color: var(--primary); }

/* Vocab card hover — touch device protected */
@media (hover: hover) and (pointer: fine) {
    .vocab-card:hover::before { transform: scaleX(1); }
    .vocab-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: transparent;
    }
}

/* --- Vocabulary Tab Icons & TTS --- */
.vocab-tab-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; }
.vocab-tab-icon i { font-size: .85rem; }
.vocab-tts-btn { background: none; border: none; cursor: pointer; color: var(--primary-light); font-size: .85rem; padding: 4px 6px; border-radius: 6px; transition: color 150ms ease, background-color 150ms ease, transform 120ms cubic-bezier(0.23,1,0.32,1); }
.vocab-tts-btn:hover { color: var(--primary); background: rgba(79,70,229,.08); }
.vocab-tts-btn:active { transform: scale(0.9); }
.vocab-tts-btn.playing { color: var(--secondary); animation: pulse-tts 0.6s ease infinite; }
@keyframes pulse-tts { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* --- Texts Section --- */
.text-level-tabs {
    display: flex; gap: 8px; justify-content: center;
    margin-bottom: 40px;
}
.text-level-tab {
    padding: 10px 28px; border-radius: 100px;
    font-size: .9rem; font-weight: 700;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.5);
    border: 1.5px solid rgba(255,255,255,.12);
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 180ms var(--ease-out), transform 120ms var(--ease-out);
}
.text-level-tab:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.text-level-tab:active { transform: scale(0.97); }
.text-level-tab.active {
    background: var(--accent);
    color: #fff; border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(245,158,11,.3);
}
.text-topics-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.text-topic-card {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-left: 3px solid transparent;
    border-radius: var(--radius-lg); padding: 24px;
    transition: background-color 250ms ease, border-color 250ms var(--ease-out), transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
    cursor: pointer;
}
.text-topic-card:active { transform: scale(0.98); }
.text-topic-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: .75rem; font-weight: 700; margin-bottom: 12px;
}
.text-topic-card h4 {
    font-size: 1rem; font-weight: 600; color: #fff;
    margin-bottom: 8px; letter-spacing: -.01em;
}
.text-topic-card p {
    font-size: .85rem; color: rgba(255,255,255,.55);
    line-height: 1.6;
}
.text-content-panel { display: none; }
.text-content-panel.active { display: block; }

/* Text topic card hover — touch device protected */
@media (hover: hover) and (pointer: fine) {
    .text-topic-card:hover {
        background: rgba(255,255,255,.1);
        border-color: rgba(255,255,255,.2);
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-left-color: var(--primary-light);
    }
}

/* --- Lessons Section --- */
.lessons-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.lesson-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    overflow: hidden; border: 1px solid var(--border);
    transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), border-color 250ms ease;
}
.lesson-card:active { transform: scale(0.98); }
.lesson-card-header {
    padding: 24px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}
.lesson-card-header .lesson-level {
    font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--secondary-light); margin-bottom: 8px;
}
.lesson-card-header h3 { font-size: 1.1rem; font-weight: 600; }
.lesson-card-body { padding: 24px; }
.lesson-card-body p { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

@media (hover: hover) and (pointer: fine) {
    .lesson-card:hover {
        transform: translateY(-4px); box-shadow: var(--shadow-lg);
        border-color: transparent;
    }
}

/* --- Video Grid --- */
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.video-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    overflow: hidden; border: 1px solid var(--border);
    transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), border-color 250ms ease;
}
.video-card:active { transform: scale(0.98); }
.video-thumb { position: relative; padding-top: 56.25%; background: var(--bg-light); }
.video-thumb iframe {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; border: none;
}
.video-card-body { padding: 20px; }
.video-card-body h3 {
    font-size: 1rem; font-weight: 600;
    color: var(--text-dark); margin-bottom: 8px; letter-spacing: -.01em;
}
.video-card-body p { font-size: .85rem; color: var(--text-muted); }

@media (hover: hover) and (pointer: fine) {
    .video-card:hover {
        transform: translateY(-4px); box-shadow: var(--shadow-lg);
        border-color: transparent;
    }
}

/* --- Links Section --- */
.links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.link-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 32px; border: 1px solid var(--border);
    transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), border-color 250ms ease;
    display: flex; flex-direction: column; gap: 16px;
}
.link-card:active { transform: scale(0.98); }
.link-card-icon {
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.15rem;
}
.link-card h3 { font-size: 1rem; font-weight: 600; color: var(--text-dark); letter-spacing: -.01em; }
.link-card p { font-size: .85rem; color: var(--text-muted); line-height: 1.6; flex-grow: 1; }
.link-card .link-arrow {
    font-size: .85rem; font-weight: 600; color: var(--primary);
    display: flex; align-items: center; gap: 6px;
    transition: gap 250ms var(--ease-out);
}
.link-card:hover .link-arrow { gap: 10px; }

@media (hover: hover) and (pointer: fine) {
    .link-card:hover {
        transform: translateY(-4px); box-shadow: var(--shadow-lg);
        border-color: var(--primary-light);
    }
}

/* --- Team Section --- */
.team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.team-card {
    text-align: center; padding: 32px 16px;
    border-radius: var(--radius-lg);
    transition: background-color 250ms ease, box-shadow 250ms var(--ease-out);
}
.team-avatar {
    width: 88px; height: 88px; border-radius: 50%;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.8rem; font-weight: 700;
    font-family: var(--font-heading);
    border: 3px solid var(--bg-white);
    box-shadow: var(--shadow);
}
.team-card h3 {
    font-size: .95rem; font-weight: 600; color: var(--text-dark);
    margin-bottom: 4px;
}
.team-card p { font-size: .8rem; color: var(--text-muted); }

@media (hover: hover) and (pointer: fine) {
    .team-card:hover { background: var(--bg-white); box-shadow: var(--shadow-md); }
}

/* --- Footer --- */
.site-footer {
    background: #18181b; color: rgba(255,255,255,.6);
    padding: 64px 0 32px;
}
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 60px;
    margin-bottom: 48px;
}
.footer-brand h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem; font-weight: 700; color: #fff;
    margin-bottom: 12px; letter-spacing: -.025em;
}
.footer-brand p { font-size: .9rem; line-height: 1.7; max-width: 360px; }
.footer-col h4 {
    font-size: .8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .1em;
    color: #fff; margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul a {
    font-size: .9rem; color: #a1a1aa;
    transition: color 150ms ease, transform 120ms var(--ease-out);
    display: inline-block;
}
.footer-col ul a:hover { color: #fff; transform: translateX(2px); }
.footer-social { display: flex; gap: 10px; margin-top: 24px; }
.footer-social a {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    color: #a1a1aa; font-size: .95rem;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 180ms var(--ease-out);
}
.footer-social a:active { transform: scale(0.97); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 24px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: .8rem;
}

@media (hover: hover) and (pointer: fine) {
    .footer-social a:hover {
        background: var(--primary); border-color: var(--primary);
        color: #fff; transform: translateY(-2px);
    }
}

/* --- Scroll Animations --- */
.fade-up {
    opacity: 0; transform: translateY(20px) scale(0.98);
    transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
}
.fade-up.visible { opacity: 1; transform: translateY(0) scale(1); }
.fade-up-delay-1 { transition-delay: .1s; }
.fade-up-delay-2 { transition-delay: .2s; }
.fade-up-delay-3 { transition-delay: .3s; }
.fade-up-delay-4 { transition-delay: .4s; }

/* Stagger animation for child elements */
.fade-up:nth-child(1) { animation-delay: 0ms; }
.fade-up:nth-child(2) { animation-delay: 60ms; }
.fade-up:nth-child(3) { animation-delay: 120ms; }
.fade-up:nth-child(4) { animation-delay: 180ms; }
.fade-up:nth-child(5) { animation-delay: 240ms; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .hero-content { grid-template-columns: 1fr; gap: 48px; }
    .hero-logos { align-items: flex-start; }
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
    .vocab-grid { grid-template-columns: repeat(2, 1fr); }
    .text-topics-grid { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: repeat(2, 1fr); }
    .links-grid { grid-template-columns: repeat(2, 1fr); }
    .lessons-grid { grid-template-columns: repeat(2, 1fr); }
    .team-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; flex-direction: column;
        position: absolute; top: 64px; left: 0; right: 0;
        background: rgba(255,255,255,.95);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: 16px; box-shadow: var(--shadow-md);
    }
    .nav-mobile-btn { display: block; }
    .hero { min-height: auto; padding: 120px 0 60px; }
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 24px; }
    .hero-logo-grid { flex-direction: column; gap: 20px; }
    .hero-logo-divider { width: 60px; height: 2px; }
    .section { padding: 64px 0; }
    .section-header { margin-bottom: 40px; }
    .vocab-grid { grid-template-columns: 1fr; }
    .lessons-grid { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: 1fr; }
    .links-grid { grid-template-columns: 1fr; }
    .team-grid { grid-template-columns: repeat(2, 1fr); }
    .grammar-tabs { gap: 4px; }
    .grammar-tab { padding: 8px 16px; font-size: .8rem; }
    .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}
@media (max-width: 480px) {
    .team-grid { grid-template-columns: 1fr; }
    .hero-stats { flex-direction: column; gap: 16px; align-items: flex-start; }
}

/* ============================================
   EXERCISE PAGES
   ============================================ */

/* --- Exercise Hero --- */
.exercise-hero {
    padding: 120px 0 60px;
    background: linear-gradient(145deg, #1e1b4b 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: #fff;
    position: relative;
}
.exercise-hero--listening { background: linear-gradient(145deg, #1e1b4b 0%, var(--primary) 40%, #3b82f6 100%); }
.exercise-hero--reading { background: linear-gradient(145deg, #064e3b 0%, #059669 40%, var(--secondary) 100%); }
.exercise-hero--practice { background: linear-gradient(145deg, #78350f 0%, var(--accent) 40%, #fb923c 100%); }
.exercise-back {
    display: inline-flex; align-items: center; gap: 8px;
    color: rgba(255,255,255,.75); font-size: .9rem; margin-bottom: 24px;
    transition: color 150ms ease, transform 180ms var(--ease-out);
}
.exercise-back:hover { color: #fff; transform: translateX(-4px); }
.exercise-back:active { transform: scale(0.97); }
.exercise-hero-content { max-width: 640px; }
.exercise-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.12); backdrop-filter: blur(12px);
    padding: 6px 16px; border-radius: 100px; font-size: .8rem;
    margin-bottom: 16px; font-weight: 600; letter-spacing: .02em;
}
.exercise-hero h1 {
    font-family: var(--font-heading); font-size: 2.5rem;
    margin-bottom: 16px; font-weight: 800; letter-spacing: -.025em;
}
.exercise-hero p { font-size: 1.05rem; opacity: .85; line-height: 1.7; }

/* --- Exercise Main --- */
.exercise-main { padding: 48px 0 80px; background: var(--bg-light); min-height: 60vh; }

/* --- Exercise Controls --- */
.exercise-controls {
    display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 32px;
    padding: 20px 24px; background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.exercise-controls label {
    display: block; font-size: .75rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.level-buttons { display: flex; gap: 6px; }
.level-btn {
    padding: 8px 18px; border: 1.5px solid var(--border); background: #fff;
    border-radius: 100px; font-size: .85rem; font-weight: 600; cursor: pointer;
    color: var(--text-muted);
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out);
}
.level-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.level-btn:active { transform: scale(0.97); }
.level-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* --- Exercise Card --- */
.exercise-card {
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow);
    border: 1px solid var(--border); overflow: hidden;
}
.exercise-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid var(--border-light);
    background: var(--bg-light);
}
.exercise-number { font-weight: 700; color: var(--text-muted); font-size: .9rem; }
.exercise-card-actions { display: flex; gap: 8px; }
.btn-icon {
    width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out);
}
.btn-icon:hover { background: var(--bg-light); color: var(--primary); border-color: var(--primary-light); }
.btn-icon:active { transform: scale(0.97); }

/* --- Audio Player --- */
.audio-player { padding: 32px 24px; }
.audio-player-visual {
    display: flex; align-items: center; gap: 24px;
    padding: 20px 24px; background: var(--bg-light); border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.audio-wave { display: flex; align-items: center; gap: 3px; flex: 1; height: 40px; }
.audio-wave-bar {
    width: 4px; border-radius: 2px; background: var(--primary);
    animation: wave 0.8s var(--ease-in-out) infinite alternate;
    animation-play-state: paused;
}
.audio-wave-bar:nth-child(1) { height: 30%; animation-delay: 0s; }
.audio-wave-bar:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.audio-wave-bar:nth-child(3) { height: 80%; animation-delay: 0.15s; }
.audio-wave-bar:nth-child(4) { height: 100%; animation-delay: 0.2s; }
.audio-wave-bar:nth-child(5) { height: 70%; animation-delay: 0.25s; }
.audio-wave-bar:nth-child(6) { height: 50%; animation-delay: 0.3s; }
.audio-wave-bar:nth-child(7) { height: 90%; animation-delay: 0.35s; }
.audio-wave-bar:nth-child(8) { height: 65%; animation-delay: 0.4s; }
.audio-wave-bar:nth-child(9) { height: 40%; animation-delay: 0.45s; }
.audio-wave-bar:nth-child(10) { height: 75%; animation-delay: 0.5s; }
.audio-wave-bar:nth-child(11) { height: 55%; animation-delay: 0.55s; }
.audio-wave-bar:nth-child(12) { height: 35%; animation-delay: 0.6s; }
@keyframes wave { from { transform: scaleY(0.4); } to { transform: scaleY(1); } }
.audio-play-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: var(--primary); color: #fff; font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background-color 150ms ease, transform 180ms var(--ease-out);
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.audio-play-btn:active { transform: scale(0.95); }
.audio-speed { display: flex; flex-direction: column; gap: 4px; }
.speed-btn {
    padding: 4px 10px; border: 1px solid var(--border); background: #fff;
    border-radius: 4px; font-size: .75rem; cursor: pointer; color: var(--text-muted);
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.speed-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.audio-hint {
    display: flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 12px 16px; background: var(--bg-warm);
    border-radius: 8px; font-size: .9rem; color: var(--accent);
    border: 1px solid rgba(245,158,11,.15);
}

@media (hover: hover) and (pointer: fine) {
    .audio-play-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
}

/* --- Exercise Input --- */
.exercise-input-area { padding: 0 24px 24px; }
.exercise-input-label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-dark); }
.exercise-textarea {
    width: 100%; padding: 16px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-family: var(--font-sans);
    font-size: 1rem; resize: vertical;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms var(--ease-out);
    background: var(--bg-light);
}
.exercise-textarea:focus {
    border-color: var(--primary); outline: none; background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.exercise-input-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.char-count { font-size: .8rem; color: var(--text-muted); }
.shake { animation: shake 0.4s var(--ease-out); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* --- Results --- */
.exercise-results { padding: 24px; }
.results-header {
    display: flex; align-items: center; gap: 32px;
    padding-bottom: 24px; border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px; flex-wrap: wrap;
}
.results-score { text-align: center; }
.score-circle { position: relative; width: 100px; height: 100px; margin: 0 auto 8px; }
.score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-value {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    font-size: 1.4rem; font-weight: 800; color: var(--text-dark);
}
.score-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.results-stats { display: flex; flex-direction: column; gap: 6px; }
.stat-item { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; }
.stat-correct { color: #10b981; }
.stat-wrong { color: #ef4444; }
.stat-missing { color: #f59e0b; }
.stat-extra { color: #8b5cf6; }

.results-diff, .results-expected, .results-transcription { margin-bottom: 20px; }
.results-diff h4, .results-expected h4, .results-transcription h4 {
    font-size: .8rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .04em; margin-bottom: 10px; font-weight: 600;
}
.diff-display {
    padding: 16px; background: var(--bg-light); border-radius: var(--radius-sm);
    line-height: 2; font-size: 1.05rem; border: 1px solid var(--border-light);
}
.diff-word { padding: 2px 4px; border-radius: 4px; display: inline; }
.diff-correct { color: #10b981; background: rgba(16,185,129,.08); }
.diff-missing { color: #f59e0b; background: rgba(245,158,11,.1); text-decoration: underline wavy #f59e0b; }
.diff-extra { color: #8b5cf6; background: rgba(139,92,246,.08); text-decoration: line-through; }
.diff-wrong { color: #ef4444; background: rgba(239,68,68,.06); }
.diff-wrong s { opacity: .5; }
.diff-wrong em { font-style: normal; color: #10b981; font-weight: 600; }
.expected-text, .transcription-text {
    padding: 16px; background: var(--bg-light); border-radius: var(--radius-sm);
    font-size: 1rem; line-height: 1.8; border: 1px solid var(--border-light);
    color: var(--text-body);
}
.results-actions { display: flex; gap: 12px; margin-top: 24px; }

/* --- Reading Text Display --- */
.reading-text-display { padding: 32px 24px; }
.reading-title {
    font-family: var(--font-heading); font-size: 1.4rem;
    margin-bottom: 16px; color: var(--text-dark); font-weight: 700; letter-spacing: -.02em;
}
.reading-passage {
    padding: 24px; background: var(--bg-light); border-radius: var(--radius);
    border-left: 3px solid var(--primary); font-size: 1.15rem; line-height: 2;
    color: var(--text-dark);
}
.reading-hint {
    display: flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 12px 16px; background: var(--bg-warm);
    border-radius: 8px; font-size: .9rem; color: var(--accent);
    border: 1px solid rgba(245,158,11,.15);
}

/* --- Recorder --- */
.recorder-area { padding: 24px; }
.recorder-visual {
    background: #1e1b4b; border-radius: var(--radius); padding: 16px;
    margin-bottom: 24px; overflow: hidden;
}
.recorder-visual canvas { width: 100%; height: 80px; display: block; }
.recorder-controls { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.recorder-timer {
    font-size: 1.8rem; font-weight: 700; color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}
.record-btn {
    width: 80px; height: 80px; border-radius: 50%; border: 4px solid var(--border);
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 180ms ease, transform 120ms var(--ease-out);
    position: relative;
}
.record-btn:active { transform: scale(0.95); }
.record-btn-inner {
    width: 32px; height: 32px; border-radius: 50%; background: #ef4444;
    transition: width 180ms var(--ease-out), height 180ms var(--ease-out), border-radius 180ms var(--ease-out);
}
.record-btn.recording { border-color: #ef4444; animation: pulse-record 1.5s var(--ease-in-out) infinite; }
.record-btn.recording .record-btn-inner { border-radius: 6px; width: 24px; height: 24px; }
@keyframes pulse-record { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.3); } 50% { box-shadow: 0 0 0 16px rgba(239,68,68,0); } }
.record-btn-label {
    display: block; font-size: .85rem; color: var(--text-muted); font-weight: 500;
    position: absolute; bottom: -28px; white-space: nowrap;
}
.recorder-status { font-size: .9rem; color: var(--text-muted); text-align: center; margin-top: 12px; }

/* --- Processing --- */
.processing-indicator {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 24px; gap: 16px;
}
.processing-spinner {
    width: 44px; height: 44px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-indicator p { font-size: 1.1rem; font-weight: 600; color: var(--text-dark); }
.processing-sub { font-size: .85rem; color: var(--text-muted); }

/* --- Exercise Responsive --- */
@media (max-width: 768px) {
    .exercise-hero h1 { font-size: 1.8rem; }
    .exercise-controls { flex-direction: column; gap: 16px; }
    .results-header { flex-direction: column; text-align: center; }
    .audio-player-visual { flex-direction: column; gap: 16px; }
    .audio-wave { width: 100%; justify-content: center; }
    .audio-speed { flex-direction: row; }
    .recorder-visual canvas { height: 60px; }
}
@media (max-width: 480px) {
    .level-buttons { flex-wrap: wrap; }
    .results-actions { flex-direction: column; }
    .results-actions .btn { width: 100%; justify-content: center; }
}

/* ============================================
   PRACTICE PAGE
   ============================================ */

/* --- Gamification Bar --- */
.gamification-bar {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0; position: sticky; top: 64px; z-index: 50;
}
.gam-stats { display: flex; justify-content: center; gap: 48px; }
.gam-stat {
    display: flex; align-items: center; gap: 10px;
    font-size: .95rem; color: var(--text-body);
}
.gam-stat i { font-size: 1.3rem; }
.gam-stat span { font-size: 1.4rem; font-weight: 800; color: var(--text-dark); }
.gam-stat label {
    font-size: .75rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em;
}
.gam-streak i { color: #f59e0b; }
.gam-xp i { color: #8b5cf6; }
.gam-words i { color: #10b981; }

/* --- Exercise Tabs --- */
.exercise-tabs {
    display: flex; gap: 6px; margin-bottom: 24px;
    padding: 4px; background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    overflow-x: auto;
}
.exercise-tab {
    flex: 1; padding: 12px 20px; border: none; background: transparent;
    border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600;
    cursor: pointer; color: var(--text-muted);
    transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms var(--ease-out), transform 120ms var(--ease-out);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    white-space: nowrap;
}
.exercise-tab:hover { color: var(--primary); background: rgba(79,70,229,.04); }
.exercise-tab:active { transform: scale(0.97); }
.exercise-tab.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

/* --- Game Container --- */
.game-container {
    background: #fff; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    padding: 32px; min-height: 400px;
}

/* --- Flashcard --- */
.flashcard-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.flashcard-progress-bar {
    flex: 1; height: 6px; background: var(--border-light);
    border-radius: 3px; overflow: hidden;
}
.flashcard-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px; transition: width 300ms var(--ease-out); width: 0%;
}
#fc-remaining { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }

.flashcard-wrapper { perspective: 1000px; margin: 0 auto 32px; max-width: 480px; }
.flashcard { width: 100%; height: 280px; cursor: pointer; position: relative; }
.flashcard-inner {
    width: 100%; height: 100%;
    transition: transform 0.5s cubic-bezier(.4,0,.2,1);
    transform-style: preserve-3d;
    position: relative;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px; text-align: center;
    box-shadow: var(--shadow-md);
}
.flashcard-front {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
}
.flashcard-back {
    background: linear-gradient(145deg, #059669 0%, var(--secondary) 100%);
    color: #fff;
    transform: rotateY(180deg);
}
.flashcard-lang {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
    opacity: .65; margin-bottom: 12px; font-weight: 600;
}
.flashcard-word { font-size: 2rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -.025em; }
.flashcard-hint { font-size: .9rem; opacity: .65; }

.flashcard.swipe-right { animation: swipeRight .4s var(--ease-out) forwards; }
.flashcard.swipe-left { animation: swipeLeft .4s var(--ease-out) forwards; }
@keyframes swipeRight { to { transform: translateX(120%) rotate(15deg); opacity: 0; } }
@keyframes swipeLeft { to { transform: translateX(-120%) rotate(-15deg); opacity: 0; } }

.flashcard-actions { display: flex; justify-content: center; gap: 16px; }
.fc-btn {
    padding: 12px 24px; border-radius: var(--radius); border: 2px solid;
    font-size: .9rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
    background: #fff;
}
.fc-btn:active { transform: scale(0.97); }
.fc-btn-no { border-color: #ef4444; color: #ef4444; }
.fc-btn-no:hover { background: #ef4444; color: #fff; }
.fc-btn-flip { border-color: var(--primary); color: var(--primary); }
.fc-btn-flip:hover { background: var(--primary); color: #fff; }
.fc-btn-yes { border-color: #10b981; color: #10b981; }
.fc-btn-yes:hover { background: #10b981; color: #fff; }

/* --- Word Matching --- */
.match-header { display: flex; justify-content: space-between; margin-bottom: 24px; }
.match-timer, .match-score { font-size: 1.1rem; font-weight: 700; color: var(--text-dark); }
.match-timer i { color: #f59e0b; margin-right: 4px; }
.match-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
    max-width: 600px; margin: 0 auto;
}
.match-card {
    padding: 20px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
    text-align: center; font-size: .95rem; font-weight: 600;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
    background: #fff; user-select: none; min-height: 60px;
    display: flex; align-items: center; justify-content: center;
}
.match-card:active { transform: scale(0.97); }
.match-card.selected {
    border-color: var(--primary); background: rgba(79,70,229,.06);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.match-card.matched { border-color: #10b981; background: rgba(16,185,129,.06); color: #10b981; pointer-events: none; opacity: .7; }
.match-card.wrong { animation: shake .4s var(--ease-out); border-color: #ef4444; }
.match-card[data-lang="kz"] { border-left: 3px solid var(--primary); }
.match-card[data-lang="en"] { border-left: 3px solid var(--accent); }
.match-complete { text-align: center; padding: 48px; }
.match-complete-icon { font-size: 3rem; color: #f59e0b; margin-bottom: 16px; }
.match-complete h3 { font-size: 1.5rem; margin-bottom: 8px; font-weight: 700; }

@media (hover: hover) and (pointer: fine) {
    .match-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow); }
}

/* --- Sentence Builder --- */
.sentence-prompt { margin-bottom: 24px; }
.sentence-english {
    font-size: 1.2rem; color: var(--text-dark); font-weight: 600;
    padding: 16px 24px; background: var(--bg-warm);
    border-radius: var(--radius); border-left: 3px solid var(--accent);
}
.sentence-slots {
    display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px;
    padding: 16px; border: 2px dashed var(--border); border-radius: var(--radius);
    margin-bottom: 16px; background: var(--bg-light);
}
.sentence-slot {
    padding: 10px 20px; border: 2px solid var(--primary); border-radius: 8px;
    font-weight: 600; color: var(--primary); cursor: pointer;
    background: rgba(79,70,229,.04);
    transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.sentence-slot:hover { background: rgba(79,70,229,.1); }
.sentence-slot:active { transform: scale(0.97); }
.sentence-bank {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
    padding: 16px; background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.word-chip {
    padding: 10px 20px; border: 1.5px solid var(--border); border-radius: 8px;
    font-weight: 600; color: var(--text-body); cursor: pointer;
    background: #fff; user-select: none;
    transition: border-color 150ms ease, color 150ms ease, transform 180ms var(--ease-out);
}
.word-chip:active { transform: scale(0.97); }
.word-chip.used { opacity: .3; pointer-events: none; }
.sentence-feedback {
    padding: 16px; border-radius: var(--radius); margin-bottom: 16px;
    font-weight: 600; text-align: center;
}
.sentence-feedback.correct { background: rgba(16,185,129,.08); color: #10b981; border: 1px solid rgba(16,185,129,.15); }
.sentence-feedback.incorrect { background: rgba(239,68,68,.08); color: #ef4444; border: 1px solid rgba(239,68,68,.15); }
.sentence-actions { display: flex; gap: 12px; justify-content: center; }

@media (hover: hover) and (pointer: fine) {
    .word-chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
}

/* --- Fill in the Blank --- */
.fill-sentence {
    font-size: 1.3rem; line-height: 2; padding: 24px;
    background: var(--bg-light); border-radius: var(--radius);
    margin-bottom: 24px; text-align: center; color: var(--text-dark);
}
.fill-blank {
    display: inline-block; min-width: 100px; border-bottom: 3px solid var(--primary);
    margin: 0 4px; padding: 2px 8px; font-weight: 700; color: var(--primary);
}
.fill-options {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
    max-width: 500px; margin: 0 auto 24px;
}
.fill-option {
    padding: 14px 20px; border: 1.5px solid var(--border); border-radius: var(--radius);
    text-align: center; font-size: 1rem; font-weight: 600;
    cursor: pointer; background: #fff;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.fill-option:hover { border-color: var(--primary); background: rgba(79,70,229,.04); }
.fill-option:active { transform: scale(0.97); }
.fill-option.correct { border-color: #10b981; background: rgba(16,185,129,.08); color: #10b981; }
.fill-option.wrong { border-color: #ef4444; background: rgba(239,68,68,.06); color: #ef4444; }
.fill-feedback {
    padding: 16px; border-radius: var(--radius); margin-bottom: 16px;
    font-weight: 600; text-align: center;
}
.fill-feedback.correct { background: rgba(16,185,129,.08); color: #10b981; }
.fill-feedback.incorrect { background: rgba(239,68,68,.08); color: #ef4444; }
.fill-actions { display: flex; gap: 12px; justify-content: center; }

/* --- XP Popup --- */
.xp-popup {
    position: fixed; top: 80px; right: 24px; z-index: 9999;
    padding: 12px 24px; border-radius: var(--radius);
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff; font-weight: 800; font-size: 1.1rem;
    box-shadow: 0 8px 24px rgba(139,92,246,.3);
    animation: xpPopup 1.5s var(--ease-out) forwards;
    pointer-events: none;
}
@keyframes xpPopup {
    0% { opacity: 0; transform: translateY(20px) scale(0.96); }
    20% { opacity: 1; transform: translateY(0) scale(1.05); }
    40% { transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px); }
}

/* @starting-style for modern browsers — XP popup entry */
@supports (selector(:has(*))) {
    .xp-popup {
        @starting-style {
            opacity: 0;
            transform: translateY(20px) scale(0.96);
        }
    }
}

/* --- Practice Responsive --- */
@media (max-width: 768px) {
    .gam-stats { gap: 24px; }
    .gam-stat label { display: none; }
    .exercise-tabs { gap: 4px; }
    .exercise-tab { padding: 10px 14px; font-size: .8rem; }
    .match-grid { grid-template-columns: repeat(3, 1fr); }
    .flashcard { height: 240px; }
    .flashcard-word { font-size: 1.5rem; }
    .fill-options { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .gam-stats { gap: 16px; }
    .match-grid { grid-template-columns: repeat(2, 1fr); }
    .flashcard-actions { flex-direction: column; align-items: center; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
