/* =========================================================================
   Somvato Grammar Practice — Professional Design System
   Tech: Tailwind (CDN utilities) + this shared stylesheet + Phosphor icons
   Brand: Somvato Blue (#2f86cc) + Somvato Orange (#f2871f)
   ========================================================================= */

:root {
    --som-blue-50: #eef6fc;
    --som-blue-100: #d4e8f7;
    --som-blue-200: #a9d0ef;
    --som-blue-500: #2f86cc;
    --som-blue-600: #1f6fb2;
    --som-blue-700: #195c94;
    --som-orange-50: #fef4ea;
    --som-orange-500: #f2871f;
    --som-orange-600: #db7212;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e8edf3;
    --bg: #f6f9fc;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
}

.font-display { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; }

/* Subtle professional section background */
.bg-soft { background-color: var(--bg); }
.section-pattern {
    background-image:
        radial-gradient(circle at 1px 1px, rgba(47, 134, 204, 0.06) 1px, transparent 0);
    background-size: 28px 28px;
}

/* ── Navbar (Somvato style) ──────────────────────────────────────────────── */
.som-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.som-logo-mark {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    display: block;
}
.som-logo-img {
    height: 40px;
    width: auto;
    display: block;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .som-logo-img { height: 34px; }
}

.som-brand-name {
    font-family: 'Inter', sans-serif; letter-spacing: -0.01em;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    color: #0f2a44;
}

.som-brand-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--som-orange-500);
}

.som-navlink {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    padding: 0.5rem 0.25rem;
    position: relative;
    transition: color 0.15s;
}
.som-navlink:hover { color: var(--som-blue-600); }
.som-navlink.active { color: var(--som-blue-600); }
.som-navlink.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: var(--som-orange-500);
}

/* Mobile menu */
.som-mobile-menu { display: none; }
.som-mobile-menu.open { display: block; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.65rem 1.25rem;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--som-blue-500);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(47, 134, 204, 0.6);
}
.btn-primary:hover { background: var(--som-blue-600); }

.btn-accent {
    background: var(--som-orange-500);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(242, 135, 31, 0.6);
}
.btn-accent:hover { background: var(--som-orange-600); }

.btn-outline {
    background: #fff;
    color: #334155;
    border-color: var(--line);
}
.btn-outline:hover { border-color: var(--som-blue-200); color: var(--som-blue-600); }

.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { color: var(--som-blue-600); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card-hover { transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 40px -20px rgba(16, 24, 40, 0.18);
    border-color: var(--som-blue-200);
}

/* ── Badges / pills ──────────────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}
.pill-blue { background: var(--som-blue-50); color: var(--som-blue-700); }
.pill-orange { background: var(--som-orange-50); color: var(--som-orange-600); }
.pill-green { background: #ecfdf5; color: #047857; }
.pill-slate { background: #f1f5f9; color: #475569; }

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid var(--line);
    color: #334155;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.55rem 0.95rem;
    border-radius: 0.85rem;
    transition: transform 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}
.cat-chip:hover { transform: translateY(-2px); border-color: var(--som-blue-200); color: var(--som-blue-600); }

/* ── Level accent helpers (professional, muted) ──────────────────────────── */
.lvl-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }

/* ── Reusable Quiz Engine ────────────────────────────────────────────────── */
.quiz { }
.quiz-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.quiz-progress-track {
    height: 8px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
    flex: 1;
}
.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--som-blue-500), var(--som-orange-500));
    border-radius: 999px;
    transition: width 0.4s ease;
    width: 0;
}
.quiz-question {
    font-family: 'Inter', sans-serif; letter-spacing: -0.01em;
    font-weight: 700;
    font-size: 1.15rem;
    color: #0f2a44;
    line-height: 1.4;
    margin-bottom: 1.1rem;
}
.quiz-options { display: grid; gap: 0.65rem; }

.quiz-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    font-size: 0.95rem;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--som-blue-200); background: var(--som-blue-50); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt .tick {
    width: 22px; height: 22px; border-radius: 999px;
    border: 2px solid #cbd5e1;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 0.8rem; color: #fff;
}
.quiz-opt.correct { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.quiz-opt.correct .tick { background: #10b981; border-color: #10b981; }
.quiz-opt.wrong { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.quiz-opt.wrong .tick { background: #ef4444; border-color: #ef4444; }

.quiz-feedback {
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.5;
}
.quiz-feedback.good { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.quiz-feedback.bad { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

.quiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
}
.quiz-score { font-size: 0.85rem; font-weight: 600; color: var(--muted); }

.quiz-result {
    text-align: center;
    padding: 1.5rem 1rem;
}
.quiz-result .score-ring {
    width: 108px; height: 108px;
    margin: 0 auto 1rem;
    border-radius: 999px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; letter-spacing: -0.01em;
    background: var(--som-blue-50);
    border: 3px solid var(--som-blue-200);
    color: var(--som-blue-700);
}

/* ── Sentence builder ────────────────────────────────────────────────────── */
.word-chip {
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--som-blue-100);
    background: var(--som-blue-50);
    color: var(--som-blue-700);
}
.word-chip:hover { transform: translateY(-2px); border-color: var(--som-blue-200); box-shadow: 0 6px 16px -8px rgba(47, 134, 204, 0.4); }
.word-chip:active { transform: scale(0.96); }
.word-chip.placed {
    background: #fff;
    border-color: var(--som-blue-200);
    color: #1e293b;
}
.word-chip.placed:hover { border-color: #fca5a5; color: #dc2626; }

.drop-zone {
    border: 2px dashed #cbd5e1;
    transition: border-color 0.2s, background 0.2s;
    border-radius: 1rem;
}
.drop-zone.filled { border-color: var(--som-blue-500); background: var(--som-blue-50); }

/* ── Memory / flip cards ─────────────────────────────────────────────────── */
.mem-card { perspective: 700px; cursor: pointer; }
.mem-card-inner {
    position: relative; width: 100%; height: 84px;
    transform-style: preserve-3d; transition: transform 0.5s;
}
.mem-card.flipped .mem-card-inner { transform: rotateY(180deg); }
.mem-front, .mem-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; border-radius: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
}
.mem-front { background: #f1f5f9; border: 2px solid var(--line); color: #334155; }
.mem-back {
    background: var(--som-blue-50); border: 2px solid var(--som-blue-200);
    color: var(--som-blue-700); transform: rotateY(180deg);
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline-bar { position: relative; height: 4px; background: #e2e8f0; border-radius: 99px; margin: 2rem 0; }
.timeline-bar::after {
    content: ''; position: absolute; left: 0; top: -3px;
    width: 55%; height: 10px;
    background: linear-gradient(90deg, var(--som-orange-500), var(--som-blue-500));
    border-radius: 99px;
}
.timeline-dot { position: absolute; top: -7px; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ── Lesson step accordions ──────────────────────────────────────────────── */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.reveal-content { display: none; }
input[type="radio"]:checked ~ .reveal-content { display: block; animation: fadeUp 0.3s ease; }

/* ── Roadmap nodes ───────────────────────────────────────────────────────── */
.node-link { transition: transform 0.2s, box-shadow 0.2s; }
.node-link:hover { transform: scale(1.06); }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.45s ease both; }

@keyframes bounceIn { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.bounce-in { animation: bounceIn 0.4s ease forwards; }

.stat-bar-fill { transition: width 1s ease-in-out; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Lesson two-column layout ────────────────────────────────────────────── */
.lesson-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.75rem;
    align-items: start;
}
@media (max-width: 900px) {
    .lesson-layout { grid-template-columns: 1fr; gap: 1.25rem; }
}
.lesson-rail { position: sticky; top: 84px; }
@media (max-width: 900px) {
    .lesson-rail { position: static; }
}

.rail-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    box-shadow: 0 1px 2px rgba(16,24,40,0.04);
    padding: 1.25rem;
}
.rail-title {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: #94a3b8; margin-bottom: 0.75rem;
}

.lesson-tabs { display: flex; flex-direction: column; gap: 0.4rem; }
@media (max-width: 900px) {
    .lesson-tabs { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.35rem; }
}
.lesson-tab {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    color: #475569;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.lesson-tab i:first-child { flex-shrink: 0; }
.lesson-tab .tab-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.lesson-tab:hover { border-color: var(--som-blue-200); color: var(--som-blue-600); }
.lesson-tab.active { background: var(--som-blue-500); border-color: var(--som-blue-500); color: #fff; }
.lesson-tab.done:not(.active) { border-color: #a7f3d0; color: #047857; background: #f0fdf9; }
.lesson-tab .tab-check { display: inline-flex; align-items: center; font-size: 1rem; }

.lesson-progress { margin-bottom: 1rem; }
.lesson-progress .lp-label { font-size: 0.78rem; font-weight: 700; color: #64748b; display: flex; justify-content: space-between; margin-bottom: 0.4rem; }

/* Mastery banner */
.mastery-banner {
    background: linear-gradient(120deg, #ecfdf5, #eef6fc);
    border: 1px solid #a7f3d0;
    border-radius: 1.25rem;
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.25rem;
}
.mastery-banner .mb-icon {
    width: 44px; height: 44px; border-radius: 999px; flex-shrink: 0;
    background: #10b981; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}

/* Locked screen */
.locked-card {
    background: #fff; border: 1px solid var(--line); border-radius: 1.5rem;
    padding: 3rem 2rem; text-align: center; max-width: 460px; margin: 1rem auto;
}
.locked-card .lock-icon {
    width: 64px; height: 64px; border-radius: 999px; margin: 0 auto 1.25rem;
    background: #f1f5f9; color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}

/* ── Quiz answer review ──────────────────────────────────────────────────── */
.review { text-align: left; margin-top: 1.75rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.review-item {
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
}
.review-item.good { border-left-color: #10b981; background: #f6fdfa; }
.review-item.bad { border-left-color: #ef4444; background: #fef7f7; }
.review-q { font-weight: 700; color: #0f2a44; font-size: 0.92rem; margin-bottom: 0.5rem; display: flex; gap: 0.5rem; }
.review-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 0.72rem; display: inline-flex; align-items: center; justify-content: center; }
.review-item.good .review-num { background: #10b981; color: #fff; }
.review-item.bad .review-num { background: #ef4444; color: #fff; }
.review-line { font-size: 0.85rem; margin-top: 0.15rem; }
.review-line.you-wrong { color: #b91c1c; }
.review-line.you-right { color: #047857; }
.review-line.correct-ans { color: #047857; font-weight: 600; }
.review-exp { font-size: 0.82rem; color: #64748b; margin-top: 0.35rem; }
.result-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Marketing / course cards ────────────────────────────────────────────── */
.promo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 800px) { .promo-grid { grid-template-columns: 1fr; } }
.promo-card {
    display: block; background: #fff; border: 1px solid var(--line);
    border-radius: 1.25rem; padding: 1.5rem; text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.promo-card:hover { transform: translateY(-4px); box-shadow: 0 24px 40px -20px rgba(16,24,40,0.18); border-color: var(--som-blue-200); }
.promo-icon { width: 46px; height: 46px; border-radius: 0.85rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 1rem; }

.level-card { position: relative; transition: opacity 0.2s, filter 0.2s; overflow: hidden; }
.level-card.is-locked { opacity: 0.72; }
.level-card.is-locked:hover { opacity: 1; }
.level-card.is-mastered { border-color: #a7f3d0; }

/* ── CEFR colour system ──────────────────────────────────────────────────── */
.cefr-a1 { --cefr: #ef4444; --cefr-soft: #fef2f2; }
.cefr-a2 { --cefr: #f97316; --cefr-soft: #fff7ed; }
.cefr-b1 { --cefr: #d97706; --cefr-soft: #fffbeb; }
.cefr-b2 { --cefr: #16a34a; --cefr-soft: #f0fdf4; }
.cefr-c1 { --cefr: #2563eb; --cefr-soft: #eff6ff; }
.cefr-c2 { --cefr: #7c3aed; --cefr-soft: #f5f3ff; }

.level-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: var(--cefr, var(--som-blue-500));
}
.cefr-badge {
    color: #fff !important; background: var(--cefr, var(--som-blue-500)) !important;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.cefr-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--cefr-soft, #eef6fc); color: var(--cefr, var(--som-blue-600));
    font-weight: 700; font-size: 0.72rem; padding: 0.3rem 0.7rem; border-radius: 999px;
}

/* ── Level cards (home) ──────────────────────────────────────────────────── */
.lvl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 1.35rem;
    padding: 1.6rem 1.6rem 1.4rem;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 4px 6px -2px rgba(16,24,40,0.06), 0 12px 24px -12px rgba(16,24,40,0.12);
    transition: transform 0.28s cubic-bezier(.2,.7,.3,1), box-shadow 0.28s ease, border-color 0.28s ease;
}
.lvl-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, var(--cefr), var(--cefr-soft));
}
.lvl-card::after {
    content: ""; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px;
    border-radius: 50%; background: radial-gradient(circle, var(--cefr-soft), transparent 70%);
    opacity: 0.85; z-index: -1; transition: transform 0.4s ease, opacity 0.3s ease;
}
.lvl-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 28px 50px -24px rgba(16,24,40,0.32);
    border-color: var(--cefr);
}
.lvl-card:hover::after { transform: scale(1.35); opacity: 1; }

.lvl-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.1rem; }
.lvl-badge {
    width: 52px; height: 52px; border-radius: 16px; font-size: 1.1rem;
    box-shadow: 0 12px 22px -8px var(--cefr);
    transition: transform 0.28s ease;
}
.lvl-card:hover .lvl-badge { transform: scale(1.06) rotate(-4deg); }
.lvl-status { align-self: center; }

.lvl-title { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; font-weight: 700; font-size: 1.22rem; color: #0f2a44; margin-bottom: 0.25rem; line-height: 1.25; }
.lvl-sub { color: #94a3b8; font-size: 0.86rem; margin-bottom: 1.05rem; }

.lvl-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.15rem; }
.lvl-tag {
    background: #f1f5f9; color: #64748b; font-size: 0.72rem; font-weight: 600;
    padding: 0.28rem 0.62rem; border-radius: 0.55rem; transition: background 0.2s ease, color 0.2s ease;
}
.lvl-card:hover .lvl-tag { background: var(--cefr-soft); color: var(--cefr); }

.lvl-progress { margin-bottom: 1.1rem; }
.lvl-progress-head { display: flex; justify-content: space-between; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8; margin-bottom: 0.4rem; }
.lvl-count { color: var(--cefr); }
.lvl-track { height: 7px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.lvl-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cefr), var(--cefr)); border-radius: 999px; transition: width 0.6s cubic-bezier(.2,.7,.3,1); }

.lvl-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 1rem; border-top: 1px solid var(--line); }
.lvl-cta { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--cefr); font-weight: 700; font-size: 0.9rem; transition: gap 0.2s ease; }
.lvl-card:hover .lvl-cta { gap: 0.65rem; }
.lvl-qmeta { display: inline-flex; align-items: center; gap: 0.3rem; color: #94a3b8; font-size: 0.78rem; font-weight: 600; }

/* States */
.lvl-card.is-locked { opacity: 0.78; background: #fcfcfd; }
.lvl-card.is-locked::after { opacity: 0.4; }
.lvl-card.is-locked .lvl-badge { filter: grayscale(0.55); box-shadow: none; }
.lvl-card.is-locked .lvl-cta { color: #94a3b8; font-weight: 600; font-size: 0.82rem; }
.lvl-card.is-locked:hover { transform: none; border-color: var(--line); box-shadow: 0 6px 16px -8px rgba(16,24,40,0.12); }
.lvl-card.is-locked:hover .lvl-tag { background: #f1f5f9; color: #64748b; }
.lvl-card.is-locked:hover .lvl-badge { transform: none; }
.lvl-card.is-locked:hover::after { transform: none; }

.lvl-card.is-mastered { border-color: #a7f3d0; }
.lvl-card.is-mastered::before { background: linear-gradient(90deg, #10b981, #6ee7b7); }

/* ── Rich study content ──────────────────────────────────────────────────── */
.study-lead { font-size: 1.03rem; color: #334155; line-height: 1.75; margin-bottom: 1rem; }
.study-lead b { color: #0f2a44; }
.study-h { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; font-weight: 700; color: #0f2a44; font-size: 1rem; margin: 1.4rem 0 0.6rem; display: flex; align-items: center; gap: 0.45rem; }
.study-h i { color: var(--cefr, var(--som-blue-500)); }
.study-rules { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.study-rules li { position: relative; padding-left: 1.4rem; margin-bottom: 0.55rem; color: #475569; line-height: 1.65; }
.study-rules li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 7px; height: 7px; border-radius: 2px; background: var(--cefr, var(--som-blue-400)); }
.study-rules b { color: #0f2a44; }
.ex-list { display: grid; gap: 0.5rem; margin: 0.25rem 0 0.5rem; }
.ex-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 0.65rem; padding: 0.6rem 0.85rem; font-size: 0.94rem; color: #334155; line-height: 1.5; }
.ex-item b { color: var(--cefr, var(--som-blue-700)); }
.ex-item .ex-x { color: #ef4444; font-weight: 700; }
.ex-item .ex-arrow { color: #94a3b8; margin: 0 0.35rem; }
.study-tip { background: #fffbeb; border: 1px solid #fde68a; border-radius: 0.85rem; padding: 0.8rem 1rem; color: #92400e; font-size: 0.9rem; margin-top: 1.1rem; display: flex; gap: 0.55rem; line-height: 1.55; }
.study-tip i { color: #d97706; font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
.study-tip b { color: #78350f; }

/* ── Lesson flow (one topic at a time) ───────────────────────────────────── */
.lesson-shell { width: 100%; max-width: 100%; margin: 0; }
/* keep paragraphs readable but let examples fill the wider card */
.study-lead, .study-rules, .study-h { max-width: 860px; }
@media (min-width: 760px) {
    .ex-list { grid-template-columns: repeat(2, 1fr); }
}
.lesson-topbar {
    background: #fff; border: 1px solid var(--line); border-radius: 1.25rem;
    padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(16,24,40,0.04);
}
.lesson-topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.points-pill {
    display: inline-flex; align-items: center; gap: 0.4rem; background: #fff7ed; color: #db7212;
    font-weight: 700; font-size: 0.85rem; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid #fed7aa;
}
.topic-count { font-size: 0.85rem; font-weight: 700; color: #64748b; }

/* Stepper */
.topic-stepper { margin-bottom: 1.25rem; }
.step-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
/* Mobile topic dropdown (hidden on desktop) */
.topic-select-wrap { display: none; }
.topic-select-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #94a3b8; margin-bottom: 0.45rem; }
.topic-select {
    width: 100%;
    -webkit-appearance: none; appearance: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%232f86cc' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 0.95rem center;
    border: 1.5px solid var(--som-blue-200);
    border-radius: 0.85rem;
    padding: 0.85rem 2.6rem 0.85rem 1rem;
    font-family: inherit; font-weight: 600; font-size: 0.95rem; color: #0f2a44;
    cursor: pointer; box-shadow: 0 1px 2px rgba(16,24,40,0.05);
}
.topic-select:focus { outline: none; border-color: var(--som-blue-500); box-shadow: 0 0 0 3px rgba(47,134,204,0.15); }
.step-chip {
    display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
    background: #fff; border: 1px solid var(--line); color: #64748b;
    font-weight: 600; font-size: 0.82rem; padding: 0.5rem 0.8rem; border-radius: 0.7rem;
    transition: all 0.15s;
}
.step-chip .step-n { width: 20px; height: 20px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 0.72rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.step-chip:hover { border-color: var(--som-blue-200); color: var(--som-blue-600); }
.step-chip.active { background: var(--som-blue-500); border-color: var(--som-blue-500); color: #fff; }
.step-chip.active .step-n { background: rgba(255,255,255,0.25); color: #fff; }
.step-chip.done { border-color: #a7f3d0; color: #047857; background: #f0fdf9; }
.step-chip.done .step-n { background: #10b981; color: #fff; }

/* Stage cards */
.lesson-stage { }
.learn-view, .quiz-view, .complete-view {
    background: #fff; border: 1px solid var(--line); border-radius: 1.5rem;
    padding: 1.75rem 2rem; box-shadow: 0 1px 2px rgba(16,24,40,0.04);
}
@media (max-width: 640px) { .learn-view, .quiz-view, .complete-view { padding: 1.35rem 1.15rem; } }
/* Quiz card gets a branded background so it stands apart from the study view */
.quiz-view {
    background: linear-gradient(180deg, #eaf3fb 0%, #f6fbff 45%, #ffffff 100%);
    border-color: var(--som-blue-100);
    box-shadow: 0 10px 28px -14px rgba(47,134,204,0.30);
}
.quiz-view .quiz-question { color: #0f2a44; }

/* ── Mobile-only lesson behaviour ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .topic-select-wrap { display: block; }
    .step-chips { display: none; }
    /* During a quiz, hide the topbar + topic list so only the quiz shows */
    .lesson-shell.quiz-active .lesson-topbar,
    .lesson-shell.quiz-active .topic-stepper { display: none; }
    .lesson-shell.quiz-active .lesson-stage { margin-top: 0; }
}
.learn-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.learn-head .lh-badge { width: 44px; height: 44px; border-radius: 0.85rem; font-size: 0.95rem; flex-shrink: 0; }
.learn-head h2 { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; font-weight: 700; font-size: 1.35rem; color: #0f2a44; line-height: 1.2; }
.learn-actions { margin-top: 1.6rem; padding-top: 1.35rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.quiz-back { background: none; border: none; color: #64748b; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; margin-bottom: 1rem; }
.quiz-back:hover { color: var(--som-blue-600); }

/* Complete screen */
.complete-view { text-align: center; }
.complete-view .cv-trophy { width: 76px; height: 76px; border-radius: 999px; margin: 0 auto 1.25rem; background: linear-gradient(135deg,#f2871f,#f59b3f); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; box-shadow: 0 12px 24px -8px rgba(242,135,31,0.5); }
.cv-stats { display: flex; justify-content: center; gap: 2.5rem; margin: 1.5rem 0; flex-wrap: wrap; }
.cv-stat .n { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; font-weight: 800; font-size: 1.8rem; color: #0f2a44; }
.cv-stat .l { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8; }
.cv-courses { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); text-align: left; }

.study-note { color: #475569; font-size: 0.92rem; line-height: 1.6; }
.study-note b { color: #0f2a44; }
.study-examples {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 1rem 1.15rem;
    font-size: 0.9rem;
    line-height: 1.7;
    margin-top: 0.85rem;
}
.study-tag {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--som-blue-100);
    color: var(--som-blue-700);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.15rem 0.55rem;
    border-radius: 0.4rem;
    margin: 0.15rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.som-footer { border-top: 1px solid var(--line); background: #fff; }
