/* ==========================================================
   Beginner Russian (beginnerrussian.com): Russian for English speakers
   ========================================================== */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee5;
  --ink: #1c1b22;
  --ink-2: #4f4c58;
  --muted: #85808f;
  --line: #e7e0d4;
  --brand: #1d3f8f;
  --brand-2: #2f5bc2;
  --accent: #c8312f;
  --good: #1d7f55;
  --good-soft: #e2f3eb;
  --bad: #be3a30;
  --bad-soft: #fbe8e6;
  --tip-soft: #fff5d9;
  --tip-line: #f0d68a;
  --c1: #2452b5; --c1-soft: #e6edfb;
  --c2: #c8312f; --c2-soft: #fbe9e7;
  --c3: #17805a; --c3-soft: #e1f3ea;
  --c4: #7340b8; --c4-soft: #efe7fa;
  --c5: #b35a10; --c5-soft: #fcefe2;
  --c6: #0e7385; --c6-soft: #dff1f4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 27, 34, .05), 0 6px 20px rgba(28, 27, 34, .06);
  --shadow-lg: 0 2px 4px rgba(28, 27, 34, .05), 0 16px 40px rgba(28, 27, 34, .10);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ru: "PT Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14141a;
    --surface: #1d1d25;
    --surface-2: #262631;
    --ink: #f1eff5;
    --ink-2: #c4c0cf;
    --muted: #8f8a9c;
    --line: #33333f;
    --brand: #8fb0ff;
    --brand-2: #a9c2ff;
    --accent: #ff7a6b;
    --good: #5fd39f;
    --good-soft: #17352a;
    --bad: #ff8a7d;
    --bad-soft: #3d1f1d;
    --tip-soft: #34301f;
    --tip-line: #6b5d2a;
    --c1: #8fb0ff; --c1-soft: #1f2a45;
    --c2: #ff8a7d; --c2-soft: #3d2322;
    --c3: #5fd39f; --c3-soft: #16352a;
    --c4: #c7a6ff; --c4-soft: #2a2140;
    --c5: #ffb36e; --c5-soft: #3a2a1b;
    --c6: #6fd3e2; --c6-soft: #15323a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; outline: none; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.ru { font-family: var(--font-ru); }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 780px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header & footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-family: var(--font-ru); font-weight: 700; font-size: 1.35rem;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-ru); font-weight: 700; font-size: 1.2rem; }
.brand-sub { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.main-nav { display: flex; gap: 4px; flex-shrink: 0; }
.main-nav a {
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a.active { background: var(--surface-2); color: var(--ink); }
.nav-short { display: none; }

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 22px; padding-bottom: 28px; }
.footer-inner p { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem/1 var(--font-ui); padding: 14px 22px; border-radius: 999px;
  background: var(--brand); color: #fff; transition: transform .12s ease, filter .12s ease, background .12s;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.btn-ghost) { color: #0f1630; } }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-good { background: var(--good); }
.btn-bad { background: var(--bad); }
.btn-sm { padding: 9px 14px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }
.link-btn:hover { color: var(--ink); }

/* Speaker button used everywhere a word can be heard */
.speak {
  appearance: none; border: 0; cursor: pointer; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--surface-2); color: var(--brand);
  transition: background .12s, transform .12s;
}
.speak:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface-2)); }
.speak:active { transform: scale(.94); }
.speak.playing { background: var(--brand); color: var(--surface); }
.speak svg { width: 17px; height: 17px; }
.speak-lg { width: 56px; height: 56px; }
.speak-lg svg { width: 26px; height: 26px; }

/* ---------- Home ---------- */
.hero { padding: 56px 0 36px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 40px; align-items: center; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.5rem); margin-bottom: 16px; }
.hero h1 .ru { color: var(--brand); }
.hero-lead { font-size: 1.15rem; color: var(--ink-2); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 28px; color: var(--ink-2); font-size: .92rem; }
.hero-stats strong { color: var(--ink); font-size: 1.05rem; }

.hero-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg);
  padding: 26px; position: relative; overflow: hidden;
}
.hero-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, #ffffff 0 33.3%, #2452b5 33.3% 66.6%, #c8312f 66.6%);
  opacity: .9;
}
.hero-word { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.hero-word:last-child { border-bottom: 0; }
.hero-word .ru { font-size: 1.6rem; font-weight: 700; }
.hero-word small { display: block; color: var(--muted); font-size: .85rem; }

.section { padding: 28px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--ink-2); }

.course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.course-card {
  --c: var(--c1); --c-soft: var(--c1-soft);
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.course-card[data-color="c2"] { --c: var(--c2); --c-soft: var(--c2-soft); }
.course-card[data-color="c3"] { --c: var(--c3); --c-soft: var(--c3-soft); }
.course-card[data-color="c4"] { --c: var(--c4); --c-soft: var(--c4-soft); }
.course-card[data-color="c5"] { --c: var(--c5); --c-soft: var(--c5-soft); }
.course-card[data-color="c6"] { --c: var(--c6); --c-soft: var(--c6-soft); }
.course-art {
  background: var(--c-soft); color: var(--c); padding: 22px 22px 18px; position: relative;
  font-family: var(--font-ru); font-weight: 700; font-size: 3rem; line-height: 1; min-height: 120px;
  display: flex; align-items: end; justify-content: space-between;
}
.course-num { font-family: var(--font-ui); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; position: absolute; top: 16px; left: 22px; opacity: .85; }
.course-body { padding: 18px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.course-body h3 { font-size: 1.25rem; margin-bottom: 4px; }
.course-body .ru-sub { font-family: var(--font-ru); color: var(--c); font-size: 1.05rem; margin-bottom: 10px; }
.course-body p { color: var(--ink-2); font-size: .95rem; }
.course-meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--muted); gap: 12px; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; flex: 1; }
.progress > span { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: inherit; transition: width .4s ease; }

.how-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.how-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.how-item .how-icon { font-family: var(--font-ru); font-weight: 700; font-size: 1.6rem; color: var(--accent); }
.how-item h3 { margin: 6px 0 4px; font-size: 1rem; }
.how-item p { margin: 0; color: var(--ink-2); font-size: .92rem; }

/* ---------- Course page ---------- */
.course-hero { --c: var(--c1); --c-soft: var(--c1-soft); background: var(--c-soft); border-bottom: 1px solid var(--line); padding: 36px 0 30px; }
.course-hero[data-color="c2"] { --c: var(--c2); --c-soft: var(--c2-soft); }
.course-hero[data-color="c3"] { --c: var(--c3); --c-soft: var(--c3-soft); }
.course-hero[data-color="c4"] { --c: var(--c4); --c-soft: var(--c4-soft); }
.course-hero[data-color="c5"] { --c: var(--c5); --c-soft: var(--c5-soft); }
.course-hero[data-color="c6"] { --c: var(--c6); --c-soft: var(--c6-soft); }
.crumbs { font-size: .88rem; color: var(--ink-2); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--ink-2); }
.course-hero .ru-title { font-family: var(--font-ru); color: var(--c); font-size: 1.35rem; margin: -4px 0 10px; }
.course-hero .lead { color: var(--ink-2); max-width: 44em; font-size: 1.05rem; }
.course-hero .progress-row { display: flex; align-items: center; gap: 14px; max-width: 420px; margin-top: 14px; font-size: .9rem; color: var(--ink-2); }
.course-hero .progress { background: color-mix(in srgb, var(--c) 18%, var(--surface)); }

.course-layout { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; padding-top: 28px; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lesson-item a {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 16px; align-items: center;
  text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
.lesson-item a:hover { transform: translateX(3px); box-shadow: var(--shadow-lg); }
.lesson-num {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700; color: var(--ink-2);
}
.lesson-item.done .lesson-num { background: var(--good); color: #fff; }
.lesson-item h3 { margin: 0; font-size: 1.05rem; }
.lesson-item .ru-small { font-family: var(--font-ru); color: var(--muted); font-size: .95rem; }
.lesson-item p { margin: 2px 0 0; color: var(--ink-2); font-size: .9rem; }
.lesson-side { text-align: right; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.score-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-weight: 600; }

.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: sticky; top: 84px; }
.side-card h3 { font-size: 1rem; margin-bottom: 10px; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .93rem; color: var(--ink-2); }
.check-list li { padding-left: 26px; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--good); font-weight: 700; }

/* ---------- Lesson page ---------- */
.lesson-head { padding: 30px 0 8px; }
.lesson-head .ru-title { font-family: var(--font-ru); font-size: 1.3rem; color: var(--brand); margin: -4px 0 8px; }
.lesson-head .lead { color: var(--ink-2); font-size: 1.05rem; }
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 999px; width: fit-content; margin: 14px 0 6px; }
.tabs button {
  appearance: none; border: 0; background: transparent; cursor: pointer; font: 600 .92rem var(--font-ui); color: var(--ink-2);
  padding: 9px 18px; border-radius: 999px;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.block { margin: 26px 0; }
.block > h2 { font-size: 1.3rem; margin-bottom: 10px; }
.prose { font-size: 1.02rem; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--ink); }
.prose .ru { font-size: 1.08em; }

.tip {
  border-radius: var(--radius-sm); padding: 14px 16px 14px 48px; position: relative;
  background: var(--tip-soft); border: 1px solid var(--tip-line); font-size: .97rem;
}
.tip::before { content: "💡"; position: absolute; left: 16px; top: 13px; font-size: 1.1rem; }
.tip.culture::before { content: "🪆"; }
.tip.warn::before { content: "⚠️"; }
.tip strong.tip-title { display: block; margin-bottom: 2px; }
.tip p:last-child { margin-bottom: 0; }

/* Letter cards */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.letter-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.letter-top { display: flex; align-items: center; justify-content: space-between; }
.letter-glyph { font-family: var(--font-ru); font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; }
.letter-glyph .lower { font-weight: 400; color: var(--ink-2); margin-left: 4px; }
.letter-sound { font-size: .92rem; color: var(--ink-2); }
.letter-sound b { color: var(--accent); }
.letter-example { display: flex; align-items: center; gap: 8px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: .9rem; }
.letter-example .ru { font-size: 1.15rem; font-weight: 700; }
.letter-example small { color: var(--muted); display: block; line-height: 1.3; }

/* Vocabulary lists */
.vocab { display: grid; gap: 8px; }
.vocab-row {
  display: grid; grid-template-columns: 34px minmax(140px, 1.1fr) 1.3fr; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px;
}
.vocab-ru { font-family: var(--font-ru); font-size: 1.2rem; font-weight: 700; }
.vocab-tr { display: block; font-family: var(--font-ui); font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.vocab-en { color: var(--ink-2); font-size: .95rem; }
.vocab-en small { display: block; color: var(--muted); font-size: .82rem; }

/* Grammar tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table.grammar { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.grammar th, table.grammar td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grammar tr:last-child td { border-bottom: 0; }
table.grammar th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
table.grammar td.ru, table.grammar td .ru { font-family: var(--font-ru); font-size: 1.1rem; }
.table-caption { font-size: .88rem; color: var(--muted); margin-top: 8px; }

/* Dialogues */
.dialogue { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; }
.dialogue-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .95rem; }
.line { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.line .who { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.line .ru { font-size: 1.15rem; display: block; }
.line .en { color: var(--muted); font-size: .9rem; }

/* ---------- Practice ---------- */
.practice { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 24px; margin-top: 18px; }
.practice-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.practice-top .progress { --c: var(--accent); }
.practice-count { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.q-kind { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.q-prompt { font-size: 1.2rem; font-weight: 600; margin-bottom: 16px; }
.q-ru { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.q-ru .ru { font-size: 2.2rem; font-weight: 700; line-height: 1.15; }
.q-listen { display: flex; justify-content: center; margin: 8px 0 20px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  appearance: none; text-align: left; cursor: pointer; font: 500 1.02rem var(--font-ui); color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px;
  transition: border-color .12s, background .12s, transform .1s;
}
.option:hover:not([disabled]) { border-color: var(--brand-2); }
.option.ru-opt { font-family: var(--font-ru); font-size: 1.25rem; font-weight: 700; }
.option.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option[disabled] { cursor: default; }
.opt-key {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 10px; vertical-align: 2px;
  border: 1.5px solid var(--line); border-radius: 6px; font: 600 .72rem var(--font-ui); color: var(--muted);
}
@media (hover: none) { .opt-key { display: none; } }

.text-answer {
  width: 100%; font: 500 1.15rem var(--font-ui); padding: 14px 16px; border-radius: 14px; color: var(--ink);
  border: 2px solid var(--line); background: var(--surface); outline: none;
}
.text-answer:focus { border-color: var(--brand-2); }
.text-answer.correct { border-color: var(--good); background: var(--good-soft); }
.text-answer.wrong { border-color: var(--bad); background: var(--bad-soft); }
.hint { font-size: .85rem; color: var(--muted); margin-top: 8px; }

.build-line {
  min-height: 62px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 0; margin-bottom: 16px;
}
.build-line.correct { border-color: var(--good); }
.build-line.wrong { border-color: var(--bad); }
.tile-bank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.tile {
  appearance: none; cursor: pointer; font: 700 1.1rem var(--font-ru); color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; padding: 8px 14px;
  transition: transform .08s;
}
.tile:hover:not([disabled]) { border-color: var(--brand-2); }
.tile:active { transform: translateY(1px); }
.tile.used { visibility: hidden; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item {
  appearance: none; cursor: pointer; font: 600 1rem var(--font-ui); color: var(--ink); text-align: center;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 12px 10px; min-height: 50px;
  transition: border-color .12s, background .12s, opacity .2s;
}
.match-item.ru-opt { font-family: var(--font-ru); font-size: 1.2rem; font-weight: 700; }
.match-item.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.match-item.matched { border-color: var(--good); background: var(--good-soft); opacity: .55; cursor: default; }
.match-item.shake { animation: shake .35s; border-color: var(--bad); background: var(--bad-soft); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.feedback {
  display: none; margin-top: 18px; border-radius: 14px; padding: 14px 16px; font-size: .98rem;
}
.feedback.show { display: block; }
.feedback.good { background: var(--good-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.feedback.bad { background: var(--bad-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.feedback .fb-title { font-weight: 700; display: block; margin-bottom: 2px; }
.feedback.good .fb-title { color: var(--good); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback .ru { font-size: 1.1em; font-weight: 700; }

.practice-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.results { text-align: center; padding: 18px 4px 6px; }
.results .big-score { font-size: 3.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; margin: 8px 0; }
.results .stars { font-size: 2rem; letter-spacing: 6px; }
.results p { color: var(--ink-2); }
.results-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

/* ---------- About ---------- */
.about h2 { margin-top: 1.6em; }
.about ul { padding-left: 1.2em; }
.about li { margin: 6px 0; }
.sources li { color: var(--ink-2); }

/* ---------- Reading practice ---------- */
.read-hero {
  background: linear-gradient(180deg, var(--c1-soft), color-mix(in srgb, var(--c1-soft) 35%, var(--bg)));
  border-bottom: 1px solid var(--line); padding: 36px 0 30px;
}
.read-hero .ru-title { font-family: var(--font-ru); color: var(--brand); font-size: 1.35rem; margin: -4px 0 10px; }
.read-hero .lead { color: var(--ink-2); max-width: 44em; font-size: 1.05rem; }
.read-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.read-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 16px; min-width: 132px; }
.read-stats strong { display: block; font-size: 1.45rem; line-height: 1.15; }
.read-stats span { font-size: .85rem; color: var(--muted); }

.read-layout { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; padding-top: 28px; }
.read-section { margin-bottom: 30px; }
.read-section h2 { font-size: 1.3rem; margin-bottom: 14px; }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.deck-card {
  appearance: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); position: relative;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px 12px;
  display: flex; flex-direction: column; gap: 1px; transition: border-color .12s, box-shadow .12s, background .12s;
}
.deck-card:hover { border-color: var(--brand-2); }
.deck-card[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); box-shadow: var(--shadow); }
.deck-ru { font-family: var(--font-ru); font-weight: 700; font-size: 1.12rem; color: var(--brand); line-height: 1.25; }
.deck-title { font-weight: 600; font-size: .93rem; line-height: 1.3; }
.deck-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.deck-bar { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.deck-bar span { display: block; height: 100%; background: var(--good); border-radius: inherit; }
.deck-tag {
  align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer; font: 600 .9rem var(--font-ui); color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-sm button { padding: 6px 16px; }
.seg-help { color: var(--ink-2); font-size: .93rem; margin: 10px 0 14px; }

.abc-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.abc-key {
  appearance: none; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: 10px;
  padding: 6px 0 5px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; color: var(--ink);
  transition: background .1s, border-color .1s;
}
.abc-key:hover { border-color: var(--brand-2); }
.abc-key .ru { font-size: 1.15rem; font-weight: 700; letter-spacing: .02em; }
.abc-key small { font-size: .68rem; color: var(--muted); }
.abc-key[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.abc-key[aria-pressed="true"] small { color: rgba(255, 255, 255, .82); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .abc-key[aria-pressed="true"] { color: #0f1630; }
  :root:not([data-theme="light"]) .abc-key[aria-pressed="true"] small { color: rgba(15, 22, 48, .75); }
}
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.preset-row .ru { font-weight: 700; letter-spacing: .04em; color: var(--brand); }

.read-side .match-count { font-size: .95rem; color: var(--ink-2); }
.read-side .match-count strong { display: block; font-size: 2.2rem; color: var(--ink); line-height: 1.1; letter-spacing: -.02em; }
.match-note { font-size: .85rem; color: var(--accent); margin: 4px 0 0; min-height: 1.2em; }
.side-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: .92rem; color: var(--ink-2); margin: 16px 0; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.read-start { width: 100%; }
.read-start.is-disabled { opacity: .45; cursor: not-allowed; filter: none; }
.tricky-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tricky-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; color: var(--bad);
  background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
}
.tricky-chip .ru { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.side-small { font-size: .84rem; color: var(--muted); margin: 16px 0 0; }
.read-side .side-small .ru { color: var(--ink); font-weight: 700; }

/* A round */
.read-practice { margin-top: 6px; }
.read-head { padding-bottom: 0; }
.read-word .ru { font-size: 2.6rem; letter-spacing: .01em; }
.misread {
  color: var(--bad); text-decoration: underline wavy color-mix(in srgb, var(--bad) 70%, transparent);
  text-decoration-thickness: 2px; text-underline-offset: 7px;
}
.streak { font-size: .85rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.read-actions { align-items: center; flex-wrap: wrap; }
.read-actions .spacer { flex: 1; }
.read-actions .ru { font-weight: 700; }
.hint-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hint-chip {
  display: inline-flex; align-items: baseline; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 12px; font-size: .9rem; color: var(--ink-2);
}
.hint-chip .ru { font-size: 1.1rem; color: var(--ink); }
.reveal { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.reveal-en { font-size: 1.5rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
.reveal-tr { color: var(--ink-2); }
.reveal-tr b { color: var(--ink); font-weight: 700; letter-spacing: .01em; }

.abc-ref { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 16px; }
.abc-ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.abc-cell {
  appearance: none; cursor: pointer; background: var(--surface-2); border: 0; border-radius: 10px; padding: 6px 0 5px;
  display: flex; flex-direction: column; align-items: center; color: var(--ink); line-height: 1.15;
}
.abc-cell:hover { background: color-mix(in srgb, var(--brand) 12%, var(--surface-2)); }
.abc-cell .ru { font-size: 1.05rem; font-weight: 700; }
.abc-cell small { font-size: .68rem; color: var(--muted); }
.abc-cell.in-word { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--brand-2); }

.round-head { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 24px 0 10px; }
.round-list { display: grid; gap: 8px; }
.round-list .vocab-row.missed { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface)); }
.round-list .vocab-en small { color: var(--good); font-weight: 600; }
.round-total { text-align: center; color: var(--ink-2); margin: 22px 0 0; }

/* Home page promo */
.read-promo {
  display: grid; grid-template-columns: .95fr 1.05fr; gap: 30px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.read-promo:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.read-promo h2 { margin-bottom: 10px; }
.read-promo p { color: var(--ink-2); }
.read-promo-words { display: flex; flex-wrap: wrap; gap: 10px; }
.read-promo-words > span {
  display: inline-flex; flex-direction: column; background: var(--c1-soft); border-radius: 14px; padding: 8px 14px 7px; line-height: 1.2;
}
.read-promo-words .ru { font-size: 1.35rem; font-weight: 700; color: var(--brand); }
.read-promo-words small { font-size: .78rem; color: var(--muted); }
.read-promo-words > span:nth-child(3n + 2) { background: var(--c2-soft); }
.read-promo-words > span:nth-child(3n + 2) .ru { color: var(--c2); }
.read-promo-words > span:nth-child(3n) { background: var(--c3-soft); }
.read-promo-words > span:nth-child(3n) .ru { color: var(--c3); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: .92rem; max-width: calc(100% - 32px);
  box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; z-index: 50; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr 1fr; }
  .course-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .read-layout { grid-template-columns: 1fr; }
  .read-promo { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .brand-sub { display: none; }
  .main-nav a { padding: 8px 9px; font-size: .9rem; }
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .hero { padding-top: 34px; }
  .how-grid { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
  .vocab-row { grid-template-columns: 34px 1fr; }
  .vocab-en { grid-column: 2; }
  .lesson-item a { grid-template-columns: 40px 1fr; }
  .lesson-num { width: 40px; height: 40px; }
  .lesson-side { grid-column: 2; text-align: left; }
  .practice { padding: 18px 16px; border-radius: 18px; }
  .q-ru .ru { font-size: 1.8rem; }
  .letter-grid { grid-template-columns: 1fr 1fr; }
  .letter-glyph { font-size: 2.1rem; }
  .read-word .ru { font-size: 2.1rem; }
  .deck-grid { grid-template-columns: 1fr 1fr; }
  .abc-keys, .abc-ref-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .read-promo { padding: 20px; }
  .read-stats div { min-width: 0; flex: 1 1 40%; }
}

@media (max-width: 480px) {
  .brand-text { display: none; }
  .main-nav { gap: 2px; }
  .main-nav a { padding: 8px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Printable pack: sales page, promo and lesson note ---------- */
.btn-lg { padding: 15px 26px; font-size: 1.05rem; }
.btn.is-disabled { opacity: .5; cursor: default; pointer-events: none; }
.pack-hero { padding: 30px 0 36px; background: linear-gradient(180deg, var(--c1-soft), transparent); }
.pack-hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 40px; align-items: center; }
.pack-hero h1 { margin: 0 0 12px; }
.pack-hero .lead { color: var(--ink-2); font-size: 1.1rem; max-width: 36em; }
.pack-cover { width: 100%; max-width: 300px; height: auto; justify-self: center; border-radius: 8px; box-shadow: var(--shadow-lg); transform: rotate(2deg); }
.pack-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 20px; }
.pack-note { color: var(--muted); font-size: .9rem; }
.pack-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pack-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.pack-item h3 { margin: 0 0 6px; }
.pack-item p { margin: 0; color: var(--ink-2); }
.pack-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; }
.pack-gallery figure { margin: 0; }
.pack-gallery img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.pack-gallery figcaption { margin-top: 8px; font-size: .88rem; color: var(--ink-2); }
.pack-faq h3 { margin: 22px 0 6px; }
.pack-faq p { color: var(--ink-2); }
.pack-promo { display: grid; grid-template-columns: 120px 1fr; gap: 26px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.pack-promo img { width: 100%; height: auto; border-radius: 4px; box-shadow: var(--shadow); transform: rotate(-2deg); }
.pack-promo h2 { margin: 0 0 6px; }
.pack-promo p { margin: 0 0 14px; color: var(--ink-2); }
.pack-cta { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; margin: 18px 0; padding: 14px 18px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); color: var(--ink-2); }
@media (max-width: 760px) {
  .pack-hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .pack-cover { max-width: 200px; }
  .pack-promo { grid-template-columns: 80px 1fr; gap: 18px; padding: 18px; }
}
