/* ============================================
   Learner Corpus of Kazakh — UChicago-Inspired Theme
   Academic, formal, serif-forward design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary: #800000;
    --primary-light: #9a1818;
    --primary-dark: #5a0000;
    --secondary: #d6001c;
    --accent: #c16c18;
    --accent-light: #d4952b;
    --bg-white: #ffffff;
    --bg-light: #f7f5f2;
    --bg-warm: #f0ebe4;
    --bg-dark: #222222;
    --text-dark: #1a1a1a;
    --text-body: #333333;
    --text-muted: #767676;
    --text-light: #999999;
    --border: #d9d4cd;
    --border-light: #e8e4de;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,.15);
    --radius: 2px;
    --radius-sm: 2px;
    --radius-lg: 2px;
    --radius-xl: 2px;
    --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-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Helvetica Neue', 'Arial', sans-serif;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --max-width: 1200px;
}

/* --- 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.7;
    -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); text-decoration: underline; }
.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: var(--bg-white);
    border-bottom: 1px solid var(--border);
    transition: box-shadow 250ms ease;
}
.site-nav::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 4px; background: var(--primary);
}
.site-nav.scrolled { box-shadow: var(--shadow-sm); }
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
    height: 68px; gap: 8px;
}
.nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-serif); font-weight: normal; font-size: 1.1rem;
    color: var(--text-dark); letter-spacing: -.01em;
}
.nav-brand img { height: 36px; width: auto; }
.nav-brand span { letter-spacing: -.01em; }
.nav-links {
    display: flex; align-items: center; gap: 0;
    list-style: none; flex-shrink: 1; flex-wrap: nowrap;
}
.nav-links a {
    padding: 22px 14px; white-space: nowrap;
    font-family: var(--font-sans);
    font-size: .75rem; font-weight: 500; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .1em;
    transition: color 150ms ease;
    border-bottom: 2px solid transparent;
    text-decoration: none;
}
.nav-links a:hover { color: var(--primary); text-decoration: none; border-bottom-color: var(--primary); }
.nav-links a.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-links a.nav-exercise {
    color: var(--primary); font-weight: 600;
    transition: color 150ms ease;
}
.nav-links a.nav-exercise:hover { color: var(--primary-dark); background: none; }
.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; font-size: .75rem; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
    transition: color 150ms ease;
    border: 1px solid var(--border);
}
.lang-btn:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.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;
    transition: transform 180ms ease, opacity 180ms ease;
}

/* --- Hero Section --- */
.hero {
    position: relative; min-height: 70vh;
    display: flex; align-items: center;
    background: var(--primary-dark);
    overflow: hidden; padding: 120px 0 80px;
}
.hero-blob { display: none; }
.hero-blob-1 { display: none; }
.hero-blob-2 { display: none; }
.hero-blob-3 { display: none; }
.hero-letters { display: none; }
.hero-letter { display: none; }
.hero-grid-overlay { display: none; }
.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;
    border: 1px solid rgba(255,255,255,.25);
    padding: 6px 16px;
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 500; letter-spacing: .12em;
    text-transform: uppercase; margin-bottom: 28px;
    color: rgba(255,255,255,.8);
}
.hero-badge::before {
    content: ''; width: 6px; height: 6px;
    background: var(--accent-light);
}
.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: normal; line-height: 1.15;
    letter-spacing: -.01em; margin-bottom: 24px;
    animation: heroFadeIn 600ms ease both;
}
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.hero h1 .highlight {
    color: var(--accent-light);
    -webkit-text-fill-color: var(--accent-light);
    background: none; -webkit-background-clip: unset; background-clip: unset;
}
.hero-desc {
    font-size: 1.05rem; line-height: 1.8;
    color: rgba(255,255,255,.7); margin-bottom: 40px;
    max-width: 520px; font-weight: 400;
    animation: heroFadeIn 600ms ease 80ms both;
}
.hero-actions {
    display: flex; gap: 16px; flex-wrap: wrap;
    animation: heroFadeIn 600ms ease 160ms both;
}
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px;
    font-family: var(--font-sans); font-weight: 600; font-size: .9rem;
    cursor: pointer; border: none;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    letter-spacing: .02em; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { opacity: .85; }
.btn-primary {
    background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline {
    background: transparent; color: #fff;
    border: 1.5px solid rgba(255,255,255,.4);
}
.btn-outline:hover {
    background: rgba(255,255,255,.1); color: #fff;
    border-color: rgba(255,255,255,.7);
}

.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,.15);
    padding: 24px 32px;
    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: 1px; height: 60px; background: rgba(255,255,255,.2);
}
.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: normal; color: #fff;
    display: block; letter-spacing: -.01em;
}
.hero-stat-label {
    font-family: var(--font-sans);
    font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 500;
}

/* --- Section Styles --- */
.section { padding: 120px 0; }
.section-alt { background: var(--bg-light); }
.section-dark { background: var(--bg-dark); 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-family: var(--font-sans);
    font-size: .7rem; font-weight: 600; letter-spacing: .15em;
    text-transform: uppercase; color: var(--primary);
    margin-bottom: 16px;
}
.section-dark .section-label { color: var(--accent-light); }
.section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: normal; color: var(--text-dark);
    line-height: 1.2; margin-bottom: 16px;
}
.section-title::after {
    content: ''; display: block; width: 40px; height: 2px;
    background: var(--primary); margin: 20px auto 0;
}
.section-dark .section-title { color: #fff; }
.section-dark .section-title::after { background: var(--accent-light); }
.section-desc {
    font-size: 1.05rem; color: var(--text-muted); line-height: 1.8;
    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: normal; color: var(--text-dark);
    margin-bottom: 20px;
}
.about-text p { margin-bottom: 16px; color: var(--text-body); line-height: 1.8; }
.about-feature-list { list-style: none; margin-top: 24px; }
.about-feature-list li {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0; font-size: .95rem;
    border-bottom: 1px solid var(--border-light);
    transition: color 250ms ease;
}
.about-feature-list li:hover { color: var(--primary); }
.about-feature-list li::before {
    content: ''; flex-shrink: 0; width: 6px; height: 6px;
    background: var(--primary); margin-top: 8px;
}
.about-card {
    background: var(--primary);
    padding: 48px; color: #fff;
    position: relative; overflow: hidden;
}
.about-card::before { display: none; }
.about-card h4 {
    font-family: var(--font-heading);
    font-size: 1.3rem; font-weight: normal; margin-bottom: 16px;
}
.about-card p { color: rgba(255,255,255,.75); line-height: 1.8; }
.level-badges { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.level-badge {
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
    padding: 6px 20px; font-size: .8rem; font-weight: 600;
    letter-spacing: .05em;
}

/* --- 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: 1px; background: var(--border);
}
.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: 10px; height: 10px;
    background: var(--primary);
    border: 2px solid var(--bg-light);
}
.timeline-year {
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 600;
    color: var(--primary); text-transform: uppercase;
    letter-spacing: .12em; margin-bottom: 4px;
}
.timeline-title {
    font-family: var(--font-heading);
    font-size: 1.1rem; font-weight: normal;
    color: var(--text-dark); margin-bottom: 8px;
}
.timeline-desc { font-size: .95rem; color: var(--text-muted); line-height: 1.8; }

/* --- Grammar Section --- */
.grammar-tabs {
    display: flex; gap: 0; justify-content: center;
    flex-wrap: wrap; margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}
.grammar-tab {
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: .8rem; font-weight: 500;
    background: transparent; color: var(--text-muted);
    border: none; border-bottom: 2px solid transparent;
    cursor: pointer; text-transform: uppercase; letter-spacing: .06em;
    transition: color 150ms ease, border-color 150ms ease;
}
.grammar-tab:hover { color: var(--primary); }
.grammar-tab.active {
    color: var(--primary); border-bottom-color: var(--primary);
    background: transparent;
}
.grammar-content { display: none; }
.grammar-content.active { display: block; }
.grammar-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-white);
    border: 1px solid var(--border);
}
.grammar-table thead th {
    background: var(--bg-light); color: var(--text-dark);
    padding: 14px 20px; text-align: left;
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    border-bottom: 2px solid var(--primary);
}
.grammar-table tbody td {
    padding: 14px 20px; border-bottom: 1px solid var(--border-light);
    font-size: .95rem;
}
.grammar-table tbody tr:hover { background: var(--bg-light); }
.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); padding: 28px 24px; text-align: center;
    border: 1px solid var(--border);
    transition: border-color 250ms ease;
    cursor: pointer; position: relative; overflow: hidden;
}
.vocab-card::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0;
    width: 3px; background: var(--primary);
    transform: scaleY(0); transform-origin: top;
    transition: transform 250ms ease;
}
.vocab-icon {
    width: 48px; height: 48px; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.vocab-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem; font-weight: normal;
    color: var(--text-dark); margin-bottom: 8px;
}
.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); }

@media (hover: hover) and (pointer: fine) {
    .vocab-card:hover::before { transform: scaleY(1); }
    .vocab-card:hover { border-color: var(--primary); }
}

/* --- 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); font-size: .85rem; padding: 4px 6px; transition: color 150ms ease; }
.vocab-tts-btn:hover { color: var(--primary-dark); }
.vocab-tts-btn.playing { color: var(--secondary); }
@keyframes pulse-tts { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* --- Texts Section --- */
.text-level-tabs {
    display: flex; gap: 0; justify-content: center;
    margin-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,.15);
}
.text-level-tab {
    padding: 12px 28px;
    font-family: var(--font-sans);
    font-size: .8rem; font-weight: 600;
    background: transparent; color: rgba(255,255,255,.5);
    border: none; border-bottom: 2px solid transparent;
    cursor: pointer; text-transform: uppercase; letter-spacing: .08em;
    transition: color 150ms ease, border-color 150ms ease;
}
.text-level-tab:hover { color: rgba(255,255,255,.85); }
.text-level-tab.active {
    color: var(--accent-light); border-bottom-color: var(--accent-light);
    background: transparent;
}
.text-topics-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.text-topic-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-left: 3px solid transparent;
    padding: 24px;
    transition: background-color 250ms ease, border-color 250ms ease;
    cursor: pointer;
}
.text-topic-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: .7rem; font-weight: 700; margin-bottom: 12px;
}
.text-topic-card h4 {
    font-family: var(--font-heading);
    font-size: 1rem; font-weight: normal; color: #fff;
    margin-bottom: 8px;
}
.text-topic-card p {
    font-size: .85rem; color: rgba(255,255,255,.55); line-height: 1.7;
}
.text-content-panel { display: none; }
.text-content-panel.active { display: block; }

@media (hover: hover) and (pointer: fine) {
    .text-topic-card:hover {
        background: rgba(255,255,255,.08);
        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);
    overflow: hidden; border: 1px solid var(--border);
    transition: border-color 250ms ease;
}
.lesson-card-header {
    padding: 24px; background: var(--primary); color: #fff;
}
.lesson-card-header .lesson-level {
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--accent-light); margin-bottom: 8px;
}
.lesson-card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem; font-weight: normal;
}
.lesson-card-body { padding: 24px; }
.lesson-card-body p { font-size: .9rem; color: var(--text-muted); line-height: 1.8; }

@media (hover: hover) and (pointer: fine) {
    .lesson-card:hover { border-color: var(--primary); }
}

/* --- Video Grid --- */
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.video-card {
    background: var(--bg-white);
    overflow: hidden; border: 1px solid var(--border);
    transition: border-color 250ms ease;
}
.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-family: var(--font-heading);
    font-size: 1rem; font-weight: normal;
    color: var(--text-dark); margin-bottom: 8px;
}
.video-card-body p { font-size: .85rem; color: var(--text-muted); }

@media (hover: hover) and (pointer: fine) {
    .video-card:hover { border-color: var(--primary); }
}

/* --- Links Section --- */
.links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.link-card {
    background: var(--bg-white); padding: 32px;
    border: 1px solid var(--border);
    transition: border-color 250ms ease;
    display: flex; flex-direction: column; gap: 16px;
}
.link-card-icon {
    width: 44px; height: 44px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.15rem;
}
.link-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem; font-weight: normal; color: var(--text-dark);
}
.link-card p { font-size: .85rem; color: var(--text-muted); line-height: 1.7; 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 ease;
}
.link-card:hover .link-arrow { gap: 10px; }

@media (hover: hover) and (pointer: fine) {
    .link-card:hover { border-color: var(--primary); }
}

/* --- Team Section --- */
.team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.team-card {
    text-align: center; padding: 32px 16px;
    transition: background-color 250ms ease;
}
.team-avatar {
    width: 88px; height: 88px; border-radius: 50%;
    margin: 0 auto 16px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.8rem; font-weight: normal;
    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-light); }
}

/* --- Footer --- */
.site-footer {
    background: var(--bg-dark); color: rgba(255,255,255,.6);
    padding: 80px 0 32px;
    border-top: 3px solid var(--primary);
}
.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: normal; color: #fff;
    margin-bottom: 12px;
}
.footer-brand p { font-size: .9rem; line-height: 1.8; max-width: 360px; }
.footer-col h4 {
    font-family: var(--font-sans);
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    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: rgba(255,255,255,.5);
    transition: color 150ms ease; display: inline-block;
    text-decoration: none;
}
.footer-col ul a:hover { color: #fff; text-decoration: underline; }
.footer-social { display: flex; gap: 10px; margin-top: 24px; }
.footer-social a {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.5); font-size: .95rem;
    transition: background-color 150ms ease, color 150ms ease;
    text-decoration: none;
}
.footer-social a:hover { text-decoration: none; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    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); color: #fff; }
}

/* --- Scroll Animations --- */
.fade-up {
    opacity: 0; transform: translateY(16px);
    transition: opacity 400ms ease, transform 400ms ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }
.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; }
.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: 68px; left: 0; right: 0;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border);
        padding: 16px; box-shadow: var(--shadow-md);
    }
    .nav-links.open a { border-bottom: none; padding: 12px 16px; }
    .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: 1px; }
    .section { padding: 80px 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: 0; }
    .grammar-tab { padding: 10px 16px; font-size: .75rem; }
    .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: var(--primary);
    color: #fff; position: relative;
}
.exercise-hero--listening { background: var(--primary-dark); }
.exercise-hero--reading { background: var(--primary); }
.exercise-hero--practice { background: var(--bg-dark); }
.exercise-back {
    display: inline-flex; align-items: center; gap: 8px;
    color: rgba(255,255,255,.7); font-size: .9rem; margin-bottom: 24px;
    transition: color 150ms ease; text-decoration: none;
}
.exercise-back:hover { color: #fff; text-decoration: underline; }
.exercise-hero-content { max-width: 640px; }
.exercise-badge {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid rgba(255,255,255,.25);
    padding: 6px 16px; font-size: .7rem;
    margin-bottom: 16px; font-weight: 500; letter-spacing: .1em;
    text-transform: uppercase;
}
.exercise-hero h1 {
    font-family: var(--font-heading); font-size: 2.5rem;
    margin-bottom: 16px; font-weight: normal;
}
.exercise-hero p { font-size: 1.05rem; opacity: .8; line-height: 1.8; }

/* --- 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: 1px solid var(--border);
}
.exercise-controls label {
    display: block; font-family: var(--font-sans);
    font-size: .7rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}
.level-buttons { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.level-btn {
    padding: 8px 18px; border: none; background: transparent;
    font-size: .8rem; font-weight: 600; cursor: pointer;
    color: var(--text-muted); border-bottom: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease;
    text-transform: uppercase; letter-spacing: .04em;
}
.level-btn:hover { color: var(--primary); }
.level-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }

/* --- Exercise Card --- */
.exercise-card {
    background: #fff; 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: 600; color: var(--text-muted); font-size: .9rem; }
.exercise-card-actions { display: flex; gap: 8px; }
.btn-icon {
    width: 36px; height: 36px; 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;
}
.btn-icon:hover { color: var(--primary); border-color: var(--primary); }

/* --- 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: 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: 1px; 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;
}
.audio-play-btn:hover { background: var(--primary-dark); }
.audio-speed { display: flex; flex-direction: column; gap: 4px; }
.speed-btn {
    padding: 4px 10px; border: 1px solid var(--border); background: #fff;
    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);
    font-size: .9rem; color: var(--accent);
    border: 1px solid rgba(193,108,24,.15);
}

/* --- 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: 1px solid var(--border);
    font-family: var(--font-sans); font-size: 1rem; resize: vertical;
    transition: border-color 180ms ease, box-shadow 180ms ease;
    background: var(--bg-light);
}
.exercise-textarea:focus {
    border-color: var(--primary); outline: none; background: #fff;
    box-shadow: 0 0 0 2px rgba(128,0,0,.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 ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* --- 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-family: var(--font-heading);
    font-size: 1.4rem; font-weight: normal; color: var(--text-dark);
}
.score-label { font-size: .75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.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: #2d6a4f; }
.stat-wrong { color: #c1121f; }
.stat-missing { color: var(--accent); }
.stat-extra { color: #6c567b; }

.results-diff, .results-expected, .results-transcription { margin-bottom: 20px; }
.results-diff h4, .results-expected h4, .results-transcription h4 {
    font-family: var(--font-sans);
    font-size: .7rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .08em; margin-bottom: 10px; font-weight: 600;
}
.diff-display {
    padding: 16px; background: var(--bg-light);
    line-height: 2; font-size: 1.05rem; border: 1px solid var(--border-light);
}
.diff-word { padding: 2px 4px; display: inline; }
.diff-correct { color: #2d6a4f; background: rgba(45,106,79,.06); }
.diff-missing { color: var(--accent); background: rgba(193,108,24,.08); text-decoration: underline wavy var(--accent); }
.diff-extra { color: #6c567b; background: rgba(108,86,123,.06); text-decoration: line-through; }
.diff-wrong { color: #c1121f; background: rgba(193,18,31,.05); }
.diff-wrong s { opacity: .5; }
.diff-wrong em { font-style: normal; color: #2d6a4f; font-weight: 600; }
.expected-text, .transcription-text {
    padding: 16px; background: var(--bg-light);
    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: normal;
}
.reading-passage {
    padding: 24px; background: var(--bg-light);
    border-left: 3px solid var(--primary); font-size: 1.1rem; 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);
    font-size: .9rem; color: var(--accent);
    border: 1px solid rgba(193,108,24,.15);
}

/* --- Recorder --- */
.recorder-area { padding: 24px; }
.recorder-visual {
    background: var(--bg-dark); 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-family: var(--font-heading);
    font-size: 1.8rem; font-weight: normal; color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}
.record-btn {
    width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--border);
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 180ms ease;
    position: relative;
}
.record-btn-inner {
    width: 32px; height: 32px; border-radius: 50%; background: #c1121f;
    transition: width 180ms ease, height 180ms ease, border-radius 180ms ease;
}
.record-btn.recording { border-color: #c1121f; animation: pulse-record 1.5s ease infinite; }
.record-btn.recording .record-btn-inner { border-radius: 4px; width: 24px; height: 24px; }
@keyframes pulse-record { 0%,100% { box-shadow: 0 0 0 0 rgba(193,18,31,.3); } 50% { box-shadow: 0 0 0 12px rgba(193,18,31,0); } }
.record-btn-label {
    display: block; font-size: .8rem; 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: 40px; height: 40px; border: 2px 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.05rem; 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: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 14px 0; position: sticky; top: 68px; 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: 600; color: var(--text-dark); font-family: var(--font-heading); }
.gam-stat label {
    font-family: var(--font-sans);
    font-size: .7rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .08em;
}
.gam-streak i { color: var(--accent); }
.gam-xp i { color: var(--primary); }
.gam-words i { color: #2d6a4f; }

/* --- Exercise Tabs --- */
.exercise-tabs {
    display: flex; gap: 0; margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    overflow-x: auto;
}
.exercise-tab {
    flex: 1; padding: 14px 20px; border: none; background: transparent;
    font-family: var(--font-sans);
    font-size: .8rem; font-weight: 500; cursor: pointer;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
    transition: color 150ms ease, border-color 150ms ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    white-space: nowrap; border-bottom: 2px solid transparent;
}
.exercise-tab:hover { color: var(--primary); }
.exercise-tab.active {
    color: var(--primary); border-bottom-color: var(--primary);
    background: transparent;
}

/* --- Game Container --- */
.game-container {
    background: #fff; 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: 4px; background: var(--border-light); overflow: hidden;
}
.flashcard-progress-fill {
    height: 100%; background: var(--primary);
    transition: width 300ms ease; 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;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px; text-align: center;
}
.flashcard-front { background: var(--primary); color: #fff; }
.flashcard-back { background: #2d6a4f; color: #fff; transform: rotateY(180deg); }
.flashcard-lang {
    font-family: var(--font-sans);
    font-size: .65rem; text-transform: uppercase; letter-spacing: .15em;
    opacity: .6; margin-bottom: 12px; font-weight: 600;
}
.flashcard-word {
    font-family: var(--font-heading);
    font-size: 2rem; font-weight: normal; margin-bottom: 8px;
}
.flashcard-hint { font-size: .9rem; opacity: .6; }

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

.flashcard-actions { display: flex; justify-content: center; gap: 16px; }
.fc-btn {
    padding: 12px 24px; border: 2px solid;
    font-family: var(--font-sans);
    font-size: .85rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background-color 150ms ease, color 150ms ease;
    background: #fff;
}
.fc-btn-no { border-color: #c1121f; color: #c1121f; }
.fc-btn-no:hover { background: #c1121f; 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: #2d6a4f; color: #2d6a4f; }
.fc-btn-yes:hover { background: #2d6a4f; 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: 600; color: var(--text-dark); }
.match-timer i { color: var(--accent); 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: 1px solid var(--border);
    text-align: center; font-size: .95rem; font-weight: 600;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
    background: #fff; user-select: none; min-height: 60px;
    display: flex; align-items: center; justify-content: center;
}
.match-card.selected {
    border-color: var(--primary); background: rgba(128,0,0,.04);
    box-shadow: 0 0 0 2px rgba(128,0,0,.1);
}
.match-card.matched { border-color: #2d6a4f; background: rgba(45,106,79,.04); color: #2d6a4f; pointer-events: none; opacity: .7; }
.match-card.wrong { animation: shake .4s ease; border-color: #c1121f; }
.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: var(--accent); margin-bottom: 16px; }
.match-complete h3 { font-family: var(--font-heading); font-size: 1.5rem; margin-bottom: 8px; font-weight: normal; }

@media (hover: hover) and (pointer: fine) {
    .match-card:hover { border-color: var(--primary); }
}

/* --- Sentence Builder --- */
.sentence-prompt { margin-bottom: 24px; }
.sentence-english {
    font-size: 1.15rem; color: var(--text-dark); font-weight: 500;
    padding: 16px 24px; background: var(--bg-warm);
    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);
    margin-bottom: 16px; background: var(--bg-light);
}
.sentence-slot {
    padding: 10px 20px; border: 2px solid var(--primary);
    font-weight: 600; color: var(--primary); cursor: pointer;
    background: rgba(128,0,0,.03);
    transition: background-color 150ms ease;
}
.sentence-slot:hover { background: rgba(128,0,0,.08); }
.sentence-bank {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
    padding: 16px; background: #fff;
    border: 1px solid var(--border-light);
}
.word-chip {
    padding: 10px 20px; border: 1px solid var(--border);
    font-weight: 600; color: var(--text-body); cursor: pointer;
    background: #fff; user-select: none;
    transition: border-color 150ms ease, color 150ms ease;
}
.word-chip.used { opacity: .3; pointer-events: none; }
.sentence-feedback {
    padding: 16px; margin-bottom: 16px;
    font-weight: 600; text-align: center;
}
.sentence-feedback.correct { background: rgba(45,106,79,.06); color: #2d6a4f; border: 1px solid rgba(45,106,79,.15); }
.sentence-feedback.incorrect { background: rgba(193,18,31,.06); color: #c1121f; border: 1px solid rgba(193,18,31,.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); }
}

/* --- Fill in the Blank --- */
.fill-sentence {
    font-size: 1.25rem; line-height: 2; padding: 24px;
    background: var(--bg-light);
    margin-bottom: 24px; text-align: center; color: var(--text-dark);
}
.fill-blank {
    display: inline-block; min-width: 100px; border-bottom: 2px solid var(--primary);
    margin: 0 4px; padding: 2px 8px; font-weight: 600; 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: 1px solid var(--border);
    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;
}
.fill-option:hover { border-color: var(--primary); background: rgba(128,0,0,.03); }
.fill-option.correct { border-color: #2d6a4f; background: rgba(45,106,79,.06); color: #2d6a4f; }
.fill-option.wrong { border-color: #c1121f; background: rgba(193,18,31,.05); color: #c1121f; }
.fill-feedback {
    padding: 16px; margin-bottom: 16px;
    font-weight: 600; text-align: center;
}
.fill-feedback.correct { background: rgba(45,106,79,.06); color: #2d6a4f; }
.fill-feedback.incorrect { background: rgba(193,18,31,.06); color: #c1121f; }
.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;
    background: var(--primary); color: #fff;
    font-weight: 700; font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
    animation: xpPopup 1.5s ease forwards;
    pointer-events: none;
}
@keyframes xpPopup {
    0% { opacity: 0; transform: translateY(12px); }
    20% { opacity: 1; transform: translateY(0); }
    40% { transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* --- Practice Responsive --- */
@media (max-width: 768px) {
    .gam-stats { gap: 24px; }
    .gam-stat label { display: none; }
    .exercise-tabs { gap: 0; }
    .exercise-tab { padding: 10px 14px; font-size: .75rem; }
    .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; }
}

/* --- Animated Hero — Kazakh Letter Flow ---
   Drop the AnimatedHeroBg partial into any <section data-anim-hero>.
   The hero recolors to primary maroon with white text; a layer of white
   Kazakh-Cyrillic glyphs drifts slowly upward through the frame.

   Specificity note: section-level overrides use `section[data-anim-hero]`
   (specificity 0,1,1) so they beat per-page `.X-hero` rules (0,1,0).
*/
section[data-anim-hero] {
    position: relative;
    overflow: hidden;
    background: var(--primary);
    color: #fff;
    border-bottom: none;
}
section[data-anim-hero] h1,
section[data-anim-hero] h2,
section[data-anim-hero] h3 { color: #fff; }
section[data-anim-hero] p { color: rgba(255, 255, 255, 0.85); }
section[data-anim-hero] a { color: #fff; }
section[data-anim-hero] a:hover {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: underline;
}
section[data-anim-hero] [class*="breadcrumb"] { color: rgba(255, 255, 255, 0.75); }
section[data-anim-hero] [class*="breadcrumb"] span { color: rgba(255, 255, 255, 0.45); }
section[data-anim-hero] [class*="hero-desc"],
section[data-anim-hero] [class*="hero-counter"] { color: rgba(255, 255, 255, 0.85); }
section[data-anim-hero] [class*="level-tab"] { color: rgba(255, 255, 255, 0.65); }
section[data-anim-hero] [class*="level-tab"]:hover { color: #fff; }
section[data-anim-hero] [class*="level-tab"].active {
    color: #fff;
    border-bottom-color: #fff;
}

/* Layer order: letters at z:0, all hero content at z:1 */
section[data-anim-hero] > .lc-hero-letters { z-index: 0; }
section[data-anim-hero] > *:not(.lc-hero-letters) { position: relative; z-index: 1; }

.lc-hero-letters {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.lc-letter {
    position: absolute;
    left: var(--x, 50%);
    bottom: -1em;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    font-size: var(--size, 56px);
    line-height: 1;
    user-select: none;
    will-change: transform, opacity;
    animation: lcLetterDrift var(--duration, 16s) linear infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes lcLetterDrift {
    0%   { transform: translateY(0);     opacity: 0; }
    15%  { opacity: var(--peak, 0.10); }
    85%  { opacity: var(--peak, 0.10); }
    100% { transform: translateY(-340px); opacity: 0; }
}

/* Shrink letters on narrow viewports so they don't dominate the hero */
@media (max-width: 600px) {
    .lc-letter { font-size: calc(var(--size, 56px) * 0.55); }
}

/* Reduced motion: keep the maroon hero, hide the drifting layer */
@media (prefers-reduced-motion: reduce) {
    .lc-hero-letters { display: none; }
}

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