/* ══════════════════════════════════════════════════════
   EnglishFlow — American 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: #c0392b;
    --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-1485738422979-f5c462d49f04?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; }
