/* ══════════════════════════════════════════════════════
   EspanholFlow — Spanish Premium Light Theme
   Mobile-first · Top Nav · Bottom Tabs
   ══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #1b2e4b;
    --navy-light: #2d4a7a;
    --navy-dark: #0f1d32;
    --red: #c60b1e;
    --red-light: #e74c3c;
    --blue: #2980b9;
    --blue-light: #5dade2;
    --gold: #d4a017;
    --gold-light: #f0c75e;

    --bg: #f5f6fa;
    --bg-white: #ffffff;
    --bg-warm: #faf8f5;
    --bg-hero: linear-gradient(135deg, #1b2e4b 0%, #2d4a7a 100%);

    --text: #1a1d26;
    --text-secondary: #5a6275;
    --text-muted: #9098a9;
    --text-on-dark: #ffffff;
    --text-on-dark-muted: rgba(255,255,255,0.7);

    --border: #e2e5ed;
    --border-light: #eef0f5;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);

    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: all 0.25s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    --nav-height: 64px;
    --tab-height: 72px;
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--navy); }
img { max-width: 100%; display: block; }

::selection { background: rgba(41,128,185,0.2); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   TOP NAVBAR
   ══════════════════════════════════════════════════════ */
.topnav {
    position: sticky; top: 0; z-index: 100;
    height: var(--nav-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}
.topnav-logo {
    font-family: var(--font-display); font-size: 1.4rem; font-weight: 800;
    color: var(--navy); display: flex; align-items: center; gap: 0.5rem;
}
.topnav-logo img { height: 32px; }
.topnav-flag { font-size: 1.4rem; }
.topnav-links {
    display: flex; gap: 0.25rem; align-items: center;
}
.topnav-link {
    padding: 0.5rem 0.9rem; border-radius: 10px;
    font-weight: 600; font-size: 0.85rem; color: var(--text-secondary);
    transition: var(--transition); display: flex; align-items: center; gap: 0.4rem;
}
.topnav-link:hover { background: var(--bg); color: var(--text); }
.topnav-link.active { background: var(--navy); color: white; }
.topnav-link svg { width: 18px; height: 18px; }
.topnav-user {
    display: flex; align-items: center; gap: 0.6rem;
}
.topnav-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-hero); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.topnav-xp {
    font-size: 0.75rem; font-weight: 700; color: var(--gold);
    background: rgba(212,160,23,0.1); padding: 0.2rem 0.6rem; border-radius: 50px;
}

/* ── Mobile: hide desktop nav links, show hamburger ── */
@media (max-width: 768px) {
    .topnav-links { display: none; }
    .topnav-user .topnav-xp { display: none; }
}

/* ══════════════════════════════════════════════════════
   BOTTOM TAB BAR (Mobile)
   ══════════════════════════════════════════════════════ */
.bottom-tabs {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--tab-height);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    justify-content: space-around; align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    color: var(--text-muted); font-size: 0.65rem; font-weight: 600;
    padding: 0.4rem 0.6rem; border-radius: 12px;
    transition: var(--transition); text-decoration: none;
    min-width: 56px;
}
.tab-item svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--navy); }
.tab-item.active svg { stroke-width: 2.5; }

@media (max-width: 768px) {
    .bottom-tabs { display: flex; }
}

/* ══════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════ */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
@media (max-width: 768px) {
    .main-content { padding: 1.25rem 1rem 6rem; }
}

/* ══════════════════════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════════════════════ */
.landing-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: var(--transition);
}
.landing-logo {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 800;
    color: var(--navy); display: flex; align-items: center; gap: 0.5rem;
}
.landing-nav-links { display: flex; gap: 1rem; align-items: center; }
.landing-nav-links > a { color: var(--text-secondary); font-weight: 500; font-size: 0.9rem; }

/* ── Hero ──────────────────────────────────────────── */
.hero {
    position: relative; overflow: hidden;
    min-height: 100vh; display: flex; align-items: center;
    background: var(--navy-dark);
    padding: 6rem 2rem 4rem;
}
.hero-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(to bottom, rgba(15,29,50,0.55), rgba(27,46,75,0.75)),
        url('https://images.unsplash.com/photo-1583422409516-2895a77efded?w=1600&q=80');
    background-size: cover; background-position: center 40%;
}
.hero-content {
    position: relative; z-index: 2;
    max-width: 680px; margin: 0 auto; text-align: center;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 1.2rem; border-radius: 50px;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.15);
    color: var(--gold-light); font-size: 0.8rem; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    margin-bottom: 1.5rem; backdrop-filter: blur(4px);
    animation: fadeInUp 0.6s ease;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4.2rem);
    font-weight: 900; color: white; line-height: 1.15;
    margin-bottom: 1.25rem;
    animation: fadeInUp 0.6s ease 0.1s both;
}
.hero h1 .accent { color: var(--gold-light); }
.hero p {
    font-size: 1.15rem; color: var(--text-on-dark-muted);
    margin-bottom: 2rem; line-height: 1.7; max-width: 540px; margin-inline: auto;
    animation: fadeInUp 0.6s ease 0.2s both;
}
.hero-buttons {
    display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap;
    animation: fadeInUp 0.6s ease 0.3s both;
}

/* Hero culture images strip */
.hero-images {
    display: flex; gap: 1rem; justify-content: center; margin-top: 3.5rem;
    animation: fadeInUp 0.6s ease 0.4s both;
}
.hero-img-card {
    width: 140px; height: 100px; border-radius: 14px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3); position: relative;
    transition: var(--transition);
}
.hero-img-card:hover { transform: translateY(-4px) scale(1.03); }
.hero-img-card img {
    width: 100%; height: 100%; object-fit: cover;
}
.hero-img-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 0.3rem; text-align: center;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    font-size: 0.65rem; color: white; font-weight: 600; letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .hero { min-height: auto; padding: 7rem 1.5rem 3rem; }
    .hero-images { gap: 0.5rem; }
    .hero-img-card { width: 90px; height: 65px; border-radius: 10px; }
}

/* ── Features ──────────────────────────────────────── */
.features-section {
    padding: 5rem 2rem; max-width: 1100px; margin: 0 auto;
}
.section-header { text-align: center; margin-bottom: 3rem; }
.section-tag {
    display: inline-block; padding: 0.35rem 1rem; border-radius: 50px;
    background: rgba(41,128,185,0.08); border: 1px solid rgba(41,128,185,0.15);
    color: var(--blue); font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.75rem;
}
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800;
    color: var(--navy); margin-bottom: 0.75rem;
}
.section-subtitle { color: var(--text-secondary); font-size: 1.05rem; max-width: 550px; margin: 0 auto; }

.features-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem;
}
.feature-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 0; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); overflow: hidden;
    transition: var(--transition);
}
.feature-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.feature-card-img {
    height: 160px; background-size: cover; background-position: center;
    position: relative;
}
.feature-card-img::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 50%; background: linear-gradient(transparent, rgba(0,0,0,0.3));
}
.feature-card-body { padding: 1.5rem; }
.feature-card-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem; margin-top: -2.25rem; position: relative; z-index: 2;
    box-shadow: var(--shadow-md);
}
.feature-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--navy); }
.feature-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* ── CTA ───────────────────────────────────────────── */
/* ── Stats Bar ─────────────────────────────────────── */
.stats-bar {
    background: var(--bg-white); border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 2.5rem 2rem;
}
.stats-bar-inner {
    max-width: 800px; margin: 0 auto;
    display: flex; justify-content: space-around; gap: 1.5rem;
    text-align: center;
}
.stat-item-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--navy); }
.stat-item-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; margin-top: 0.1rem; }

@media (max-width: 768px) {
    .stats-bar { padding: 1.5rem 1rem; }
    .stat-item-value { font-size: 1.5rem; }
}

/* ── CTA ───────────────────────────────────────────── */
.cta-section {
    position: relative; overflow: hidden;
    padding: 5rem 2rem;
    text-align: center; color: white;
}
.cta-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(135deg, rgba(27,46,75,0.92), rgba(15,29,50,0.92)),
        url('https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=1600&q=80');
    background-size: cover; background-position: center;
}
.cta-content { position: relative; z-index: 2; max-width: 600px; margin: 0 auto; }
.cta-section h2 {
    font-family: var(--font-display); font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem;
}
.cta-section p { color: var(--text-on-dark-muted); margin-bottom: 2rem; font-size: 1.05rem; }

.landing-footer {
    text-align: center; padding: 2.5rem; color: var(--text-muted); font-size: 0.85rem;
    background: var(--bg-white); border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.7rem 1.5rem; border-radius: 12px;
    font-weight: 600; font-size: 0.9rem; border: none;
    cursor: pointer; transition: var(--transition); font-family: var(--font);
}
.btn-primary {
    background: var(--red); color: white;
    box-shadow: 0 4px 14px rgba(192,57,43,0.3);
}
.btn-primary:hover { background: var(--red-light); transform: translateY(-1px); color: white; box-shadow: 0 6px 20px rgba(192,57,43,0.35); }

.btn-white {
    background: white; color: var(--navy);
    box-shadow: var(--shadow-md);
}
.btn-white:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); color: var(--navy); }

.btn-secondary {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: white; border-color: var(--navy); color: var(--navy); }

.btn-navy { background: var(--navy); color: white; box-shadow: 0 4px 14px rgba(27,46,75,0.25); }
.btn-navy:hover { background: var(--navy-light); color: white; transform: translateY(-1px); }

.btn-red { background: var(--red); color: white; box-shadow: 0 4px 14px rgba(192,57,43,0.3); }
.btn-red:hover { background: var(--red-light); color: white; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(192,57,43,0.35); }

.btn-glass {
    background: rgba(255,255,255,0.15); color: white;
    border: 1px solid rgba(255,255,255,0.25); backdrop-filter: blur(4px);
}
.btn-glass:hover { background: rgba(255,255,255,0.25); color: white; }

.btn-outline {
    background: transparent; color: var(--navy);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy); background: var(--bg); }

.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; border-radius: 8px; }

/* ══════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════ */
.card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 1.5rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--navy); }

.page-header { margin-bottom: 2rem; }
.page-title {
    font-family: var(--font-display); font-size: 1.75rem; font-weight: 800;
    color: var(--navy); margin-bottom: 0.25rem;
}
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════
   STATS
   ══════════════════════════════════════════════════════ */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 1.25rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); text-align: center;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 46px; height: 46px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.75rem; font-size: 1.3rem;
}
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* XP Bar */
.xp-bar-container {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.5rem;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-card);
}
.xp-bar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.xp-bar-level { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.xp-bar-xp { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.xp-bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.xp-bar-fill {
    height: 100%; border-radius: 5px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    transition: width 1s ease;
}

.streak-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 1rem; border-radius: 50px;
    background: rgba(212,160,23,0.1); border: 1px solid rgba(212,160,23,0.2);
    color: var(--gold); font-weight: 700; font-size: 0.85rem;
}

.dashboard-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   AUTH
   ══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1.15rem; }
.form-label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.form-input {
    width: 100%; padding: 0.75rem 1rem; border-radius: 12px;
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); font-size: 0.95rem; font-family: var(--font);
    transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41,128,185,0.15); background: white; }
.form-input::placeholder { color: var(--text-muted); }
.form-error { color: var(--red); font-size: 0.85rem; margin-bottom: 1rem; font-weight: 500; }

.auth-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 2rem;
}
.auth-card {
    background: var(--bg-white); border-radius: var(--radius-xl);
    padding: 2.5rem; width: 100%; max-width: 420px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-lg);
}
.auth-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; text-align: center; color: var(--navy); margin-bottom: 0.4rem; }
.auth-subtitle { color: var(--text-secondary); text-align: center; margin-bottom: 1.75rem; font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════
   AUDIOBOOKS
   ══════════════════════════════════════════════════════ */
.books-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem;
}
.book-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); overflow: hidden;
    box-shadow: var(--shadow-card); transition: var(--transition);
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.book-cover {
    height: 180px; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.book-cover::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(transparent, rgba(0,0,0,0.25));
}
.book-level {
    position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2;
    padding: 0.25rem 0.7rem; border-radius: 50px;
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    background: rgba(255,255,255,0.9); color: var(--navy); backdrop-filter: blur(4px);
}
.book-info { padding: 1.25rem; }
.book-title { font-weight: 700; font-size: 1rem; color: var(--navy); margin-bottom: 0.2rem; }
.book-author { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.5rem; }
.book-meta { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-secondary); align-items: center; }

/* Player */
.player-container { max-width: 800px; margin: 0 auto; }
.player-hero {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 2rem; margin-bottom: 1.25rem;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-card);
    display: flex; gap: 1.5rem; align-items: flex-start;
}
.player-cover {
    width: 120px; height: 120px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
}
.player-controls {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 1.5rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); margin-bottom: 1.25rem;
}
.player-progress {
    width: 100%; height: 6px; background: var(--bg);
    border-radius: 3px; cursor: pointer; margin: 1rem 0;
}
.player-progress-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width 0.1s linear; }
.player-buttons { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.player-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1.3rem; cursor: pointer; padding: 0.5rem; border-radius: 10px;
    transition: var(--transition);
}
.player-btn:hover { color: var(--navy); background: var(--bg); }
.player-btn-play {
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--navy); color: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(27,46,75,0.3);
}
.player-btn-play:hover { background: var(--navy-light); transform: scale(1.05); }
.player-time { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

.transcript-container {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 2rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); max-height: 400px; overflow-y: auto; line-height: 2;
}
.transcript-word { cursor: pointer; padding: 0.1rem 0.2rem; border-radius: 4px; transition: var(--transition); }
.transcript-word:hover { background: rgba(41,128,185,0.1); }
.transcript-word.highlight { background: rgba(41,128,185,0.15); color: var(--blue); font-weight: 600; }

@media (max-width: 768px) {
    .player-hero { flex-direction: column; align-items: center; text-align: center; }
}

/* ══════════════════════════════════════════════════════
   FLASHCARDS
   ══════════════════════════════════════════════════════ */
.decks-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem;
}
.deck-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 1.5rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); transition: var(--transition); cursor: pointer;
}
.deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--blue); }
.deck-icon { font-size: 2.2rem; margin-bottom: 0.75rem; }
.deck-title { font-weight: 700; color: var(--navy); margin-bottom: 0.2rem; }
.deck-desc { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 1rem; line-height: 1.5; }
.deck-meta { display: flex; justify-content: space-between; align-items: center; }
.deck-count { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.deck-due {
    padding: 0.25rem 0.65rem; border-radius: 50px; font-size: 0.72rem; font-weight: 700;
    background: rgba(41,128,185,0.1); color: var(--blue);
}

/* Study */
.study-container { max-width: 560px; margin: 0 auto; text-align: center; }
.study-progress { margin-bottom: 1.5rem; }
.study-progress-text { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 500; }
.study-progress-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.study-progress-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.5s; }

.flashcard {
    width: 100%; min-height: 300px; perspective: 1200px;
    cursor: pointer; margin-bottom: 1.5rem;
}
.flashcard-inner {
    position: relative; width: 100%; height: 300px;
    transition: transform 0.6s ease; transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
    position: absolute; inset: 0; backface-visibility: hidden;
    background: var(--bg-white); border-radius: var(--radius-xl);
    border: 1px solid var(--border-light); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2.5rem;
}
.flashcard-back { transform: rotateY(180deg); background: var(--bg-warm); }
.flashcard-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.flashcard-text { font-size: 1.8rem; font-weight: 800; color: var(--navy); margin-bottom: 0.4rem; }
.flashcard-phonetic { color: var(--blue); font-size: 0.95rem; }
.flashcard-example { color: var(--text-secondary); font-size: 0.9rem; font-style: italic; margin-top: 0.4rem; }

.rating-buttons { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.rating-btn {
    padding: 0.65rem 1.25rem; border-radius: 12px;
    font-weight: 700; font-size: 0.85rem; border: none;
    cursor: pointer; transition: var(--transition); font-family: var(--font); color: white;
}
.rating-btn.again { background: var(--red); }
.rating-btn.hard { background: #e67e22; }
.rating-btn.good { background: var(--blue); }
.rating-btn.easy { background: #27ae60; }
.rating-btn:hover { transform: translateY(-2px); }

/* ══════════════════════════════════════════════════════
   QUESTIONS
   ══════════════════════════════════════════════════════ */
.quiz-container { max-width: 680px; margin: 0 auto; }
.category-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.category-card {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 1.25rem 1rem; text-align: center; cursor: pointer;
    border: 2px solid var(--border-light); transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.category-card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.category-card.active { border-color: var(--navy); background: rgba(27,46,75,0.04); }
.category-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.category-name { font-weight: 700; font-size: 0.88rem; color: var(--navy); }
.category-count { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

.question-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 2rem; margin-bottom: 1.25rem;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-card);
}
.question-number { font-size: 0.75rem; color: var(--blue); font-weight: 700; margin-bottom: 0.6rem; text-transform: uppercase; letter-spacing: 1px; }
.question-text { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; line-height: 1.6; color: var(--navy); }
.question-options { display: flex; flex-direction: column; gap: 0.6rem; }
.question-option {
    padding: 0.9rem 1.25rem; border-radius: 12px;
    border: 2px solid var(--border); cursor: pointer;
    transition: var(--transition); display: flex; align-items: center; gap: 0.75rem;
    background: var(--bg-white);
}
.question-option:hover { border-color: var(--blue); background: rgba(41,128,185,0.03); }
.question-option.selected { border-color: var(--navy); background: rgba(27,46,75,0.04); }
.question-option.correct { border-color: #27ae60; background: rgba(39,174,96,0.06); }
.question-option.wrong { border-color: var(--red); background: rgba(192,57,43,0.06); }
.option-letter {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--bg); display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.82rem; color: var(--text-secondary); flex-shrink: 0;
}

.fill-blank-input {
    display: inline-block; min-width: 150px; padding: 0.4rem 0.75rem;
    border: none; border-bottom: 2px solid var(--navy);
    background: transparent; color: var(--text); font-size: 1.1rem;
    font-family: var(--font); outline: none; text-align: center;
}
.fill-blank-input:focus { border-bottom-color: var(--blue); }

.feedback-card {
    border-radius: var(--radius); padding: 1.25rem; margin-top: 1rem;
    border: 1px solid var(--border-light); animation: slideUp 0.3s ease;
}
.feedback-card.correct { background: rgba(39,174,96,0.06); border-color: rgba(39,174,96,0.2); }
.feedback-card.wrong { background: rgba(192,57,43,0.06); border-color: rgba(192,57,43,0.2); }
.feedback-title { font-weight: 700; margin-bottom: 0.4rem; font-size: 0.95rem; }
.feedback-text { color: var(--text-secondary); line-height: 1.6; font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════
   AI CHAT
   ══════════════════════════════════════════════════════ */
.chat-layout {
    display: flex; flex-direction: column;
    height: calc(100vh - var(--nav-height) - 4rem);
    background: var(--bg-white); border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); box-shadow: var(--shadow-card);
    overflow: hidden;
}
@media (max-width: 768px) {
    .chat-layout { height: calc(100vh - var(--nav-height) - var(--tab-height) - 2rem); border-radius: var(--radius); }
}

.chat-header {
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-white);
}
.chat-header-title { font-weight: 700; color: var(--navy); }
.chat-header-sub { font-size: 0.78rem; color: var(--text-muted); }

.chat-topics-bar {
    display: flex; gap: 0.4rem; padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto; background: var(--bg);
    -webkit-overflow-scrolling: touch;
}
.chat-topics-bar::-webkit-scrollbar { display: none; }
.chat-topic-btn {
    white-space: nowrap; padding: 0.4rem 0.85rem; border-radius: 50px;
    background: var(--bg-white); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer;
    font-family: var(--font); font-size: 0.78rem; font-weight: 600;
    transition: var(--transition); display: flex; align-items: center; gap: 0.3rem;
}
.chat-topic-btn:hover { border-color: var(--navy); color: var(--navy); }
.chat-topic-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; }
.chat-message { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; animation: slideUp 0.3s ease; }
.chat-message.user { flex-direction: row-reverse; }
.chat-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 700; color: white;
}
.chat-message.assistant .chat-avatar { background: var(--navy); }
.chat-message.user .chat-avatar { background: var(--blue); }
.chat-bubble {
    max-width: 72%; padding: 0.85rem 1.15rem; border-radius: 18px;
    line-height: 1.55; font-size: 0.92rem;
}
.chat-message.assistant .chat-bubble {
    background: var(--bg); border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px; color: var(--text);
}
.chat-message.user .chat-bubble {
    background: var(--navy); color: white;
    border-bottom-right-radius: 4px;
}

.chat-corrections {
    background: rgba(212,160,23,0.08); border-radius: 12px;
    padding: 0.85rem 1rem; margin-top: 0.6rem; max-width: 72%;
    font-size: 0.82rem; border-left: 3px solid var(--gold); color: var(--text);
}
.chat-corrections strong { color: var(--gold); }
.chat-suggestions {
    background: rgba(39,174,96,0.06); border-radius: 12px;
    padding: 0.85rem 1rem; margin-top: 0.4rem; max-width: 72%;
    font-size: 0.82rem; border-left: 3px solid #27ae60; color: var(--text);
}

.chat-input-area {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; gap: 0.6rem; background: var(--bg-white);
}
.chat-input {
    flex: 1; padding: 0.7rem 1rem; border-radius: 12px;
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); font-size: 0.92rem; font-family: var(--font); resize: none;
}
.chat-input:focus { outline: none; border-color: var(--blue); background: white; }
.chat-send {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--navy); border: none; color: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.chat-send:hover { background: var(--navy-light); }

.chat-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ══════════════════════════════════════════════════════
   RECOMMENDATIONS
   ══════════════════════════════════════════════════════ */
.recommendation-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.85rem 1rem; border-radius: 12px;
    background: var(--bg); margin-bottom: 0.5rem;
    border-left: 3px solid var(--blue);
}
.recommendation-card.high { border-left-color: var(--red); }
.recommendation-card.medium { border-left-color: var(--gold); }
.recommendation-card.low { border-left-color: #27ae60; }

/* ══════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════ */
.badge {
    display: inline-block; padding: 0.2rem 0.65rem; border-radius: 50px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-beginner { background: rgba(41,128,185,0.1); color: var(--blue); }
.badge-intermediate { background: rgba(27,46,75,0.08); color: var(--navy); }
.badge-advanced { background: rgba(212,160,23,0.12); color: var(--gold); }

/* ══════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade { animation: fadeInUp 0.4s ease; }

.typing-indicator { display: inline-flex; gap: 4px; padding: 0.4rem 0; }
.typing-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted); animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════════ */
.toast-container { position: fixed; top: calc(var(--nav-height) + 0.75rem); right: 1rem; z-index: 1000; }
.toast {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: 12px; padding: 0.7rem 1.25rem;
    margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem;
    animation: slideUp 0.3s ease; box-shadow: var(--shadow-lg);
    font-size: 0.85rem; font-weight: 600;
}
.toast.success { border-left: 3px solid #27ae60; }
.toast.xp { border-left: 3px solid var(--gold); color: var(--gold); }

/* ── Legacy compat ─────────────────────────────────── */
.sidebar, .sidebar-toggle, .sidebar-overlay, .app-layout { display: contents; }

/* ══════════════════════════════════════════════════════
   DASHBOARD — TRAIL CARDS
   ══════════════════════════════════════════════════════ */
.section-heading {
    font-family: var(--font-display); font-size: 1.25rem; font-weight: 800;
    color: var(--navy); display: flex; align-items: center; gap: 0.5rem;
}
.xp-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.85rem; border-radius: 50px;
    background: rgba(27,46,75,0.06); font-weight: 700; font-size: 0.8rem;
    color: var(--navy);
}

.trails-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
}
@media (max-width: 900px) { .trails-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .trails-grid { grid-template-columns: 1fr; } }

.trail-card {
    display: block; color: inherit;
    background: var(--bg-white); border-radius: var(--radius-lg);
    overflow: hidden; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); transition: var(--transition);
}
.trail-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.trail-card-locked { opacity: 0.7; }
.trail-card-locked:hover { transform: none; box-shadow: var(--shadow-card); }

.trail-card-header {
    position: relative; padding: 1.75rem 1.5rem 1.25rem;
    color: white; display: flex; justify-content: space-between; align-items: flex-start;
}
.trail-card-level {
    font-family: var(--font-display); font-size: 1.8rem; font-weight: 900;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.trail-card-icon { font-size: 2rem; }
.trail-card-lock {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.8);
}

.trail-card-body { padding: 1.25rem 1.5rem 1.5rem; }
.trail-card-title { font-weight: 800; color: var(--navy); font-size: 1.05rem; margin-bottom: 0.15rem; }
.trail-card-subtitle { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.85rem; line-height: 1.5; }

.trail-card-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
}
.trail-card-status {
    padding: 0.2rem 0.65rem; border-radius: 50px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.trail-card-status-active { background: rgba(39,174,96,0.1); color: #27ae60; }
.trail-card-status-locked { background: var(--bg); color: var(--text-muted); }

.trail-card-progress {
    height: 4px; border-radius: 2px; background: var(--bg); margin-top: 0.85rem; overflow: hidden;
}
.trail-card-progress-fill { height: 100%; border-radius: 2px; transition: width 0.8s ease; }

/* ── Bonus Grid ──────────────────────────────────────── */
.bonus-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
}
@media (max-width: 768px) { .bonus-grid { grid-template-columns: repeat(2, 1fr); } }

.bonus-card {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 1.5rem 1rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); transition: var(--transition); color: inherit;
}
.bonus-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.bonus-card-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem;
}
.bonus-card-title { font-weight: 700; color: var(--navy); font-size: 0.92rem; margin-bottom: 0.2rem; }
.bonus-card-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* ══════════════════════════════════════════════════════
   TRAIL DETAIL PAGE
   ══════════════════════════════════════════════════════ */
.trail-hero {
    border-radius: var(--radius-xl); padding: 2.5rem 2rem 2rem;
    color: white; margin-bottom: 2.5rem; position: relative;
}
.trail-hero-back {
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: rgba(255,255,255,0.75); font-size: 0.85rem; font-weight: 600;
    margin-bottom: 1.25rem;
}
.trail-hero-back:hover { color: white; }
.trail-hero-content { max-width: 560px; }
.trail-hero-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.trail-hero-level {
    font-family: var(--font-display); font-size: 3rem; font-weight: 900;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15); margin-bottom: 0.25rem;
}
.trail-hero-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; margin-bottom: 0.4rem; }
.trail-hero-subtitle { font-size: 0.92rem; color: rgba(255,255,255,0.8); line-height: 1.6; margin-bottom: 1.5rem; }
.trail-hero-progress-text { font-size: 0.82rem; margin-bottom: 0.4rem; font-weight: 600; color: rgba(255,255,255,0.85); }
.trail-hero-progress-bar { height: 6px; background: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; }
.trail-hero-progress-fill { height: 100%; background: white; border-radius: 3px; transition: width 0.8s ease; }

@media (max-width: 768px) {
    .trail-hero { padding: 1.75rem 1.25rem 1.5rem; border-radius: var(--radius-lg); }
    .trail-hero-level { font-size: 2.2rem; }
    .trail-hero-title { font-size: 1.25rem; }
}

/* ── Lesson Timeline ─────────────────────────────────── */
.lessons-container { max-width: 680px; margin: 0 auto; }

.lesson-timeline { display: flex; flex-direction: column; gap: 0; }

.lesson-item {
    display: flex; align-items: flex-start; gap: 1.25rem; position: relative;
    padding-bottom: 0.5rem;
}
.lesson-connector {
    position: absolute; left: 19px; top: 42px; bottom: -2px; width: 2px;
    background: var(--border); z-index: 0;
}
.lesson-number {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.9rem; z-index: 1;
    background: var(--bg-white); border: 2.5px solid var(--border);
    color: var(--text-muted); transition: var(--transition);
}

.lesson-content {
    flex: 1; display: flex; align-items: center; gap: 1rem;
    background: var(--bg-white); border-radius: var(--radius);
    padding: 1.25rem 1.5rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); transition: var(--transition);
    margin-bottom: 0.75rem; color: inherit; text-decoration: none;
}
a.lesson-content:hover { box-shadow: var(--shadow-md); transform: translateX(4px); }
.lesson-locked .lesson-content { opacity: 0.55; }

.lesson-icon { font-size: 1.8rem; flex-shrink: 0; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-title { font-weight: 700; color: var(--navy); font-size: 0.98rem; margin-bottom: 0.15rem; }
.lesson-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 0.4rem; }
.lesson-meta { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.lesson-xp { font-size: 0.72rem; font-weight: 700; color: var(--gold); }
.lesson-badge {
    font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.6rem;
    border-radius: 50px; text-transform: uppercase; letter-spacing: 0.5px;
}
.lesson-badge-done { background: rgba(39,174,96,0.1); color: #27ae60; }
.lesson-badge-locked { background: var(--bg); color: var(--text-muted); }
.lesson-badge-available { border: 1.5px solid currentColor; background: transparent; }
.lesson-arrow { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   LESSON PAGE
   ══════════════════════════════════════════════════════ */
.lesson-page { max-width: 760px; margin: 0 auto; }

.lesson-breadcrumb {
    display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1.25rem;
    font-size: 0.82rem; color: var(--text-muted); flex-wrap: wrap;
}
.lesson-breadcrumb a { color: var(--text-secondary); font-weight: 500; }
.lesson-breadcrumb a:hover { color: var(--navy); }
.lesson-breadcrumb span { color: var(--navy); font-weight: 600; }

.lesson-header {
    border-radius: var(--radius-xl); padding: 2.5rem 2rem 1.75rem;
    color: white; margin-bottom: 2rem; text-align: center;
}
.lesson-header-badge {
    display: inline-block; padding: 0.3rem 1rem; border-radius: 50px;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(4px);
    font-size: 0.75rem; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; margin-bottom: 0.75rem;
    border: 1px solid rgba(255,255,255,0.2);
}
.lesson-header-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 900; margin-bottom: 0.6rem; }
.lesson-header-meta {
    display: flex; gap: 1.25rem; justify-content: center; align-items: center;
    font-size: 0.85rem; color: rgba(255,255,255,0.85); font-weight: 500;
}
.lesson-header-meta span { display: flex; align-items: center; gap: 0.3rem; }

.lesson-nav-dots {
    display: flex; gap: 0.4rem; justify-content: center; margin-top: 1.25rem;
}
.lesson-nav-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.3); border: none; cursor: pointer;
    transition: var(--transition);
}
.lesson-nav-dot.active { background: white; transform: scale(1.2); }
.lesson-nav-dot:hover { background: rgba(255,255,255,0.6); }

@media (max-width: 768px) {
    .lesson-header { padding: 1.75rem 1.25rem 1.25rem; border-radius: var(--radius-lg); }
    .lesson-header-title { font-size: 1.35rem; }
}

/* ── Objectives ──────────────────────────────────────── */
.lesson-objectives {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card); margin-bottom: 1.75rem;
}
.lesson-objectives h3 { font-size: 0.95rem; font-weight: 700; color: var(--navy); margin-bottom: 0.85rem; }
.objectives-list { display: flex; flex-direction: column; gap: 0.5rem; }
.objective-item {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.88rem; color: var(--text-secondary); line-height: 1.4;
}
.objective-item svg { flex-shrink: 0; }

/* ── Section cards ───────────────────────────────────── */
.lesson-section { margin-bottom: 1.75rem; animation: fadeInUp 0.5s ease; }

.section-card {
    background: var(--bg-white); border-radius: var(--radius-lg);
    padding: 2rem; border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
}
.section-title {
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 800;
    color: var(--navy); margin-bottom: 0.35rem;
}
.section-subtitle { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 1.25rem; }
.section-text { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 1rem; }
.section-tip {
    background: rgba(212,160,23,0.06); border-left: 3px solid var(--gold);
    padding: 0.85rem 1.15rem; border-radius: 0 10px 10px 0;
    font-size: 0.88rem; color: var(--text); line-height: 1.6; margin-top: 1.25rem;
}
.section-tip strong { color: var(--gold); }

/* ── Vocabulary ──────────────────────────────────────── */
.vocab-filters {
    display: flex; gap: 0.4rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.vocab-filter {
    padding: 0.35rem 0.85rem; border-radius: 50px;
    background: var(--bg); border: 1px solid var(--border);
    font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; font-family: var(--font); transition: var(--transition);
}
.vocab-filter:hover { border-color: var(--navy); color: var(--navy); }
.vocab-filter.active { background: var(--navy); color: white; border-color: var(--navy); }

.vocab-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.85rem;
}

.vocab-card {
    perspective: 600px; cursor: pointer; height: 130px;
}
.vocab-card-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform 0.5s ease; transform-style: preserve-3d;
}
.vocab-card.flipped .vocab-card-inner { transform: rotateY(180deg); }

.vocab-card-front, .vocab-card-back {
    position: absolute; inset: 0; backface-visibility: hidden;
    border-radius: 14px; padding: 1rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
}
.vocab-card-front { background: var(--bg-white); }
.vocab-card-back { background: var(--bg-warm); transform: rotateY(180deg); }
.vocab-phrase { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 0.2rem; }
.vocab-phonetic { font-size: 0.75rem; color: var(--blue); font-family: monospace; }
.vocab-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; font-style: italic; }
.vocab-translation { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 0.3rem; }
.vocab-usage { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }

/* ── Dialogue ────────────────────────────────────────── */
.dialogue-scenario {
    display: flex; align-items: center; gap: 0.5rem;
    background: rgba(41,128,185,0.06); border-radius: 10px;
    padding: 0.65rem 1rem; margin-bottom: 1.25rem;
    font-size: 0.85rem; color: var(--blue); font-weight: 600;
}
.dialogue-container { display: flex; flex-direction: column; gap: 0.75rem; }
.dialogue-line { display: flex; flex-direction: column; gap: 0.25rem; max-width: 85%; }
.dialogue-you { align-self: flex-end; align-items: flex-end; }
.dialogue-other { align-self: flex-start; align-items: flex-start; }
.dialogue-speaker { display: flex; align-items: center; gap: 0.4rem; }
.dialogue-speaker-name { font-size: 0.75rem; font-weight: 700; color: var(--navy); }
.dialogue-speaker-role { font-size: 0.68rem; color: var(--text-muted); }
.dialogue-bubble {
    padding: 0.75rem 1.15rem; border-radius: 18px; font-size: 0.92rem; line-height: 1.5;
}
.dialogue-other .dialogue-bubble {
    background: var(--bg); color: var(--text); border-bottom-left-radius: 4px;
}
.dialogue-you .dialogue-bubble {
    background: var(--navy); color: white; border-bottom-right-radius: 4px;
}
.dialogue-translation {
    font-size: 0.78rem; color: var(--text-muted); font-style: italic;
    padding: 0.2rem 0.5rem; margin-top: 0.1rem;
}

/* ── Grammar ─────────────────────────────────────────── */
.grammar-table-wrap { overflow-x: auto; margin: 1.25rem 0; }
.grammar-table {
    width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
.grammar-table th {
    background: var(--navy); color: white;
    padding: 0.75rem 1rem; text-align: left;
    font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.grammar-table th:first-child { border-radius: 10px 0 0 0; }
.grammar-table th:last-child { border-radius: 0 10px 0 0; }
.grammar-table td {
    padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-light);
}
.grammar-table tr:last-child td { border-bottom: none; }
.grammar-table tr:hover td { background: rgba(41,128,185,0.03); }
.grammar-contraction { color: var(--blue); font-weight: 600; }
.grammar-example { font-style: italic; color: var(--text-secondary); }

/* ── Culture ─────────────────────────────────────────── */
.section-culture { background: rgba(27,46,75,0.02); border-color: rgba(27,46,75,0.1); }
.culture-notes { display: flex; flex-direction: column; gap: 1rem; }
.culture-note {
    background: var(--bg-white); border-radius: 12px; padding: 1.15rem 1.25rem;
    border: 1px solid var(--border-light);
}
.culture-note h4 { font-weight: 700; color: var(--navy); font-size: 0.92rem; margin-bottom: 0.3rem; }
.culture-note p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }

/* ── Exercises ───────────────────────────────────────── */
.exercise-progress-bar {
    height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden;
    margin-bottom: 0.4rem;
}
.exercise-progress-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.5s ease; }
.exercise-progress-text { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-bottom: 1.5rem; }

.exercise-item { animation: fadeInUp 0.4s ease; }
.exercise-prompt {
    font-size: 1.1rem; font-weight: 700; color: var(--navy);
    margin-bottom: 1.25rem; line-height: 1.5;
}
.exercise-options { display: flex; flex-direction: column; gap: 0.6rem; }
.exercise-option {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.9rem 1.25rem; border-radius: 12px;
    border: 2px solid var(--border); background: var(--bg-white);
    cursor: pointer; transition: var(--transition);
    font-family: var(--font); font-size: 0.92rem; color: var(--text);
    text-align: left; width: 100%;
}
.exercise-option:hover { border-color: var(--navy); background: rgba(27,46,75,0.02); }
.exercise-option.correct { border-color: #27ae60; background: rgba(39,174,96,0.06); }
.exercise-option.wrong { border-color: var(--red); background: rgba(192,57,43,0.06); }
.exercise-option-letter {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--bg); display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.82rem; color: var(--text-secondary); flex-shrink: 0;
}

.exercise-fill { display: flex; gap: 0.6rem; align-items: center; }
.exercise-fill-input {
    flex: 1; padding: 0.75rem 1rem; border-radius: 12px;
    background: var(--bg); border: 2px solid var(--border);
    font-size: 1rem; font-family: var(--font); color: var(--text);
    transition: var(--transition);
}
.exercise-fill-input:focus { outline: none; border-color: var(--blue); background: white; }
.exercise-fill-input.fill-correct { border-color: #27ae60; background: rgba(39,174,96,0.04); }
.exercise-fill-input.fill-wrong { border-color: var(--red); background: rgba(192,57,43,0.04); color: var(--red); }

.exercise-feedback {
    margin-top: 1rem; padding: 1rem 1.25rem; border-radius: 12px;
    display: flex; align-items: flex-start; gap: 0.75rem;
    animation: slideUp 0.3s ease;
}
.exercise-feedback.feedback-correct { background: rgba(39,174,96,0.06); border: 1px solid rgba(39,174,96,0.15); }
.exercise-feedback.feedback-wrong { background: rgba(192,57,43,0.06); border: 1px solid rgba(192,57,43,0.15); }
.exercise-feedback-icon { flex-shrink: 0; margin-top: 0.1rem; }
.exercise-feedback-text { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

.exercise-nav { text-align: center; margin-top: 1.25rem; }

/* ── Completion ──────────────────────────────────────── */
.lesson-completion { animation: fadeInUp 0.5s ease; }
.completion-card {
    background: var(--bg-white); border-radius: var(--radius-xl);
    padding: 3rem 2rem; text-align: center;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-lg);
}
.completion-icon {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.completion-title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; color: var(--navy); margin-bottom: 0.5rem; }
.completion-score { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.completion-score strong { color: var(--navy); }
.completion-xp { font-size: 1rem; color: var(--gold); font-weight: 700; margin-bottom: 1.75rem; }
.completion-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════
   ANIMATED DIALOGUE
   ══════════════════════════════════════════════════════ */
.dialogue-container.animated .dialogue-line {
    opacity: 0; transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.dialogue-container.animated .dialogue-line.visible {
    opacity: 1; transform: translateY(0);
}
.dialogue-typing {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.6rem 1rem; border-radius: 18px;
    background: var(--bg); border-bottom-left-radius: 4px;
    margin-bottom: 0.5rem;
}
.dialogue-typing .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}
.dialogue-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.dialogue-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ══════════════════════════════════════════════════════
   NEW EXERCISE: MATCH PAIRS
   ══════════════════════════════════════════════════════ */
.match-container {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
}
.match-column { display: flex; flex-direction: column; gap: 0.5rem; }
.match-column-header {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); margin-bottom: 0.25rem;
    text-align: center;
}
.match-item {
    padding: 0.75rem 1rem; border-radius: 12px;
    border: 2px solid var(--border); background: var(--bg-white);
    cursor: pointer; transition: var(--transition);
    font-size: 0.9rem; text-align: center; font-weight: 600;
    user-select: none;
}
.match-item:hover { border-color: var(--navy); background: rgba(27,46,75,0.02); }
.match-item.selected { border-color: var(--blue); background: rgba(41,128,185,0.08); color: var(--blue); box-shadow: 0 0 0 3px rgba(41,128,185,0.15); }
.match-item.matched { border-color: #27ae60; background: rgba(39,174,96,0.08); color: #27ae60; pointer-events: none; opacity: 0.7; }
.match-item.wrong-flash {
    animation: wrongShake 0.4s ease;
    border-color: var(--red); background: rgba(192,57,43,0.06);
}
@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
@media (max-width: 480px) {
    .match-container { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   NEW EXERCISE: REORDER SENTENCE
   ══════════════════════════════════════════════════════ */
.reorder-drop-zone {
    min-height: 56px; padding: 0.75rem;
    border: 2px dashed var(--border); border-radius: 14px;
    background: rgba(41,128,185,0.03);
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-bottom: 1rem; transition: var(--transition);
    align-items: center;
}
.reorder-drop-zone.has-items { border-style: solid; border-color: var(--blue); background: rgba(41,128,185,0.04); }
.reorder-drop-zone.correct { border-color: #27ae60; background: rgba(39,174,96,0.06); }
.reorder-drop-zone.wrong { border-color: var(--red); background: rgba(192,57,43,0.04); }
.reorder-drop-zone-placeholder {
    font-size: 0.85rem; color: var(--text-muted); font-style: italic; width: 100%; text-align: center;
}
.reorder-bank {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
    padding: 0.5rem 0;
}
.reorder-word {
    padding: 0.55rem 1rem; border-radius: 10px;
    background: var(--bg-white); border: 2px solid var(--border);
    font-size: 0.9rem; font-weight: 600; color: var(--navy);
    cursor: pointer; transition: var(--transition);
    user-select: none;
}
.reorder-word:hover { border-color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.reorder-word.placed { opacity: 0.3; pointer-events: none; }
.reorder-word.in-zone {
    background: var(--blue); color: white; border-color: var(--blue);
}
.reorder-word.in-zone:hover { background: var(--navy); border-color: var(--navy); }
.reorder-check-btn { margin-top: 0.75rem; }

/* ══════════════════════════════════════════════════════
   NEW EXERCISE: LISTEN & SPEAK
   ══════════════════════════════════════════════════════ */
.listen-container { text-align: center; padding: 1rem 0; }
.listen-btn {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--navy));
    border: none; cursor: pointer; color: white;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(41,128,185,0.3);
    transition: var(--transition); margin-bottom: 1rem;
}
.listen-btn:hover { transform: scale(1.08); box-shadow: 0 8px 28px rgba(41,128,185,0.4); }
.listen-btn:active { transform: scale(0.95); }
.listen-btn.playing {
    animation: listenPulse 1s infinite;
}
@keyframes listenPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(41,128,185,0.3); }
    50% { box-shadow: 0 6px 30px rgba(41,128,185,0.6), 0 0 0 12px rgba(41,128,185,0.1); }
}
.listen-hint {
    font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem;
}
.listen-input-row { display: flex; gap: 0.6rem; max-width: 400px; margin: 0 auto; }
.listen-input {
    flex: 1; padding: 0.75rem 1rem; border-radius: 12px;
    background: var(--bg); border: 2px solid var(--border);
    font-size: 1rem; font-family: var(--font); color: var(--text);
    text-align: center; transition: var(--transition);
}
.listen-input:focus { outline: none; border-color: var(--blue); background: white; }
.listen-input.correct { border-color: #27ae60; background: rgba(39,174,96,0.04); }
.listen-input.wrong { border-color: var(--red); background: rgba(192,57,43,0.04); }
.listen-word-display {
    font-size: 1.5rem; font-weight: 800; color: var(--navy); margin: 0.75rem 0;
    min-height: 2rem;
}
.listen-slow-btn {
    font-size: 0.78rem; color: var(--blue); background: none; border: none;
    cursor: pointer; font-weight: 600; margin-top: 0.5rem; font-family: var(--font);
}
.listen-slow-btn:hover { text-decoration: underline; }
