:root {
  color-scheme: light;
  --paper: #f7f5ee;
  --card: #fffdf8;
  --ink: #182e28;
  --green: #185343;
  --muted: #485d53;
  --line: #d6dcd0;
  --pale: #e1eadc;
  --gold: #f2c052;
  --correct: #17523c;
  --correct-bg: #e3f1e5;
  --wrong: #872f27;
  --wrong-bg: #f8e9e4;
  --review: #755211;
  --review-bg: #faf0d7;
  --text: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  font: 16px/1.55 var(--text);
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font: 400 2rem/1.11 var(--display); letter-spacing: -.035em; }
a { color: var(--green); text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; }
button, summary, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #8c590d; outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
img { max-width: 100%; }
p + p { margin-top: .65em; }

.shell { width: min(100% - 88px, 1160px); margin-inline: auto; }
.masthead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 74px; gap: 14px; }
.header { border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; color: var(--ink); text-decoration: none; white-space: nowrap; font-size: .94rem; }
.brand-mark, .feature-icon { display: inline-grid; grid-auto-flow: column; place-content: center; width: 38px; height: 38px; border-radius: 9px; background: var(--ink); color: var(--card); font: bold 23px var(--display); flex: none; }
.brand-mark span, .feature-icon span { color: var(--gold); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .chapter-tabs a { border-radius: 8px; color: var(--muted); padding: 8px 14px; text-decoration: none; font-weight: 700; font-size: .9rem; }
.nav a:hover, .chapter-tabs a:hover { color: var(--ink); background: #eeede4; }
.nav [aria-current], .chapter-tabs [aria-current] { color: var(--green); background: var(--pale); }
.completion { justify-self: end; color: var(--muted); font-size: .84rem; white-space: nowrap; margin: 0; }
.main { min-height: calc(100vh - 152px); padding-block: 49px 66px; }
.footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-block: 16px 24px; color: var(--muted); font-size: .82rem; }

.hero { display: grid; grid-template-columns: 1.04fr 1fr; align-items: center; gap: 36px; }
.hero-copy { padding-bottom: 25px; }
.hero h1 { font-size: clamp(2.5rem, 5.5vw, 5rem); line-height: .99; letter-spacing: -.06em; }
.hero h1 em { color: var(--green); }
.lead { max-width: 45ch; margin-top: 15px; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.15rem); line-height: 1.52; }
.primary, .secondary, .check-button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; min-height: 45px; padding: 8px 15px; border: 1px solid var(--green); border-radius: 9px; background: var(--green); color: var(--card); font-weight: 700; text-decoration: none; }
.primary:hover, .check-button:hover { background: var(--ink); border-color: var(--ink); }
.secondary { border-color: var(--line); background: var(--card); color: var(--green); }
.secondary:hover { border-color: var(--green); }
.hero .primary { margin-top: 27px; }
.hero-visual { position: relative; padding-bottom: 36px; }
.hero-image { display: block; width: 100%; height: auto; aspect-ratio: 1.62; object-fit: cover; border-radius: 16px; background: var(--ink); }
.featured { position: absolute; inset: auto 7% 0 7%; display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); box-shadow: 0 12px 35px #18322818; }
.featured strong, .featured div span { display: block; }
.featured strong { font: 600 clamp(1.08rem, 2vw, 1.4rem) var(--display); }
.featured div span { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.course { margin-top: 42px; }
.course h2 { font-size: clamp(1.85rem, 3.5vw, 2.75rem); }
.course-list { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.course-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 24px; align-items: center; gap: 15px; min-height: 76px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.course-card:hover { background: var(--card); }
.course-index { color: var(--green); background: var(--pale); padding-block: 8px; border-radius: 8px; text-align: center; font: 700 1.12rem var(--display); }
.course-name > * { display: block; }
.course-name span, .course-info { color: var(--muted); font-size: .87rem; }
.course-info { display: flex; align-items: center; gap: 9px; }
.course-info progress { width: 69px; height: 8px; accent-color: var(--green); }
.arrow { color: var(--green); font-size: 1.25rem; }

.back { display: inline-flex; align-items: center; min-height: 40px; font-size: .9rem; font-weight: 700; }
.section-head { margin-bottom: 28px; }
.section-head h1 { font-size: clamp(2.5rem, 5.4vw, 4.25rem); }
.eyebrow { color: var(--muted); font-weight: 750; font-size: .79rem; letter-spacing: .035em; margin-bottom: 8px; }
.level-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.level-start p { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.contents-card { padding: clamp(15px, 3vw, 29px); border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.level-chapters { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; align-items: start; }
.chapter-group { margin-top: 15px; min-width: 0; }
.chapter-group h3 { color: var(--muted); font-size: .79rem; font-weight: 750; padding: 3px 8px; overflow-wrap: anywhere; }
.chapter-group ol { padding: 0; margin: 0; list-style: none; }
.chapter-group a { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 8px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.chapter-group a:hover, .chapter-group a[aria-current] { background: var(--pale); }
.unit-number { width: 25px; flex: none; text-align: center; border-radius: 4px; color: var(--green); background: #e8ede3; font-size: .76rem; font-weight: 700; }
.done-mark { margin-left: auto; color: var(--correct); font-weight: 750; }

.reader { display: grid; grid-template-columns: minmax(200px, 245px) minmax(0, 1fr); gap: clamp(15px, 4vw, 45px); align-items: start; }
.reader-aside { position: sticky; top: 14px; }
.reader-contents { border: 1px solid var(--line); border-radius: 11px; background: var(--card); overflow: hidden; }
.reader-contents > summary { padding: 12px; font-size: .88rem; }
.sidebar-content { padding: 0 10px 10px; }
.sidebar-content input { width: 100%; padding: 8px; }
.chapter-menu { max-height: min(60vh, 670px); overflow: auto; scrollbar-width: thin; margin-top: 6px; font-size: .86rem; }
.empty-chapters { padding: 8px; color: var(--muted); font-size: .85rem; }
.reader-main { min-width: 0; }
.reader-main > .back { margin-top: -12px; }
.chapter-head { margin-bottom: 25px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chapter-head h1 { font-size: clamp(2.15rem, 4.7vw, 3.8rem); overflow-wrap: anywhere; }
.chapter-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 17px; }
.chapter-tabs a { padding-inline: 10px; }
.unit-body { display: grid; gap: 13px; min-width: 0; }
.lesson-section, .lesson-note, .rule-russian { border: 1px solid var(--line); border-radius: 12px; padding: clamp(12px, 2.5vw, 20px); background: var(--card); min-width: 0; }
.lesson-section h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); margin-bottom: 12px; }
.lesson-note { background: #e7eee3; }
.note-gold, .watch { background: #faf1d7; }
.rule-russian p { margin-top: 8px; }
summary { color: var(--green); font-weight: 700; }
.hint, .example { color: var(--muted); font-size: .92rem; margin-block: 5px 9px; }
.bank { padding: 8px 10px; background: var(--pale); font-size: .94rem; border-radius: 6px; }
.table-scroll { overflow-x: auto; margin-block: 8px; }
table { width: 100%; min-width: 260px; border-collapse: collapse; font-size: .91rem; }
th, td { padding: 7px 10px; border: 1px solid var(--line); vertical-align: top; text-align: left; overflow-wrap: anywhere; }
thead th { background: var(--pale); }
.model-lines { margin: 0; padding-left: 23px; }
.model-reply { color: var(--green); }
.reading-text { max-width: 75ch; margin-top: 12px; }
.reading-text p + p { margin-top: 9px; }
.reading-audio { display: flex; gap: 7px; flex-wrap: wrap; }
.listen-transcript { margin-top: 10px; }
.transcript { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; }
.transcript dt { font-weight: 700; }
.transcript dd { margin: 0; }
.source-graphic { display: block; max-width: min(100%, 625px); margin: 5px auto 10px; }
.label-picture { display: grid; align-items: start; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.source-graphic + p { margin-top: 9px; }

.vocabulary { display: flex; flex-wrap: wrap; align-items: start; list-style: none; margin: 0; padding: 0; gap: 8px; }
.vocabulary li { display: flex; flex-direction: column; font-size: .79rem; color: var(--muted); }
.vocabulary li > span:nth-child(2) { padding-inline: 5px; max-width: 50ch; }
.listen, .pronunciation { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 40px; padding: 5px 10px; border: 1px solid transparent; border-radius: 8px; background: var(--pale); color: var(--green); font-weight: 700; line-height: 1.28; text-align: start; }
.listen { font-size: .82rem; white-space: nowrap; }
.listen-icon { min-width: 40px; }
.listen:hover, .pronunciation:hover { border-color: var(--green); }
[data-voice][aria-pressed="true"] { background: var(--green); color: var(--card); }
.play-icon { width: 0; height: 0; flex: none; border-block: 5px solid transparent; border-left: 8px solid currentColor; }
[aria-pressed="true"] .play-icon { height: 9px; width: 8px; border: 0; background: currentColor; }
.word-cards { display: grid; gap: 9px; }
.word-detail { padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.word-detail h3 { font-size: 1.04rem; margin-bottom: 7px; }
.word-detail h3 .ipa { color: var(--muted); font-weight: 400; font-size: .85rem; }
.word-samples { margin: 6px 0; padding-left: 20px; }
.watch { margin-top: 8px; border-radius: 6px; padding: 8px; font-size: .92rem; }
.word-questions { margin-top: 10px; }

.exercise-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; margin: 9px 0 0; padding: 0 0 0 25px; }
.exercise-list > li { min-width: 0; }
.exercise-list > li::marker { color: var(--muted); font-size: .83rem; font-weight: 700; }
.question { margin: 0; min-width: 0; }
.question-prompt { margin-bottom: 5px; font-weight: 670; overflow-wrap: anywhere; }
input[type="text"], input[type="search"], textarea, select { min-height: 41px; border: 1px solid #8b9b90; border-radius: 7px; padding: 6px 8px; background: var(--card); color: var(--ink); }
textarea { width: 100%; resize: vertical; }
.answer-editor { display: flex; gap: 5px; max-width: 100%; }
.answer-editor input, .answer-editor textarea { flex: 1; min-width: 0; }
.answer-editor textarea + button { align-self: start; }
.check-button { min-height: 41px; padding: 6px 10px; font-size: .84rem; }
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.option { min-height: 42px; text-align: left; color: var(--ink); background: var(--paper); border: 1px solid #87988b; border-radius: 7px; padding: 6px 10px; }
.option:hover { border-color: var(--green); }
.question[data-state="correct"] :is(input, textarea, .option[aria-pressed="true"]) { color: var(--correct); border-color: #588165; background: var(--correct-bg); }
.question[data-state="wrong"] :is(input, textarea, .option[aria-pressed="true"]) { color: var(--wrong); border-color: #b75346; background: var(--wrong-bg); }
.question[data-state="review"] :is(input, textarea) { color: var(--review); border-color: #ac8038; background: var(--review-bg); }
.feedback { font-size: .88rem; margin-top: 6px; padding: 7px 9px; border-radius: 6px; background: #eeeee7; color: var(--muted); overflow-wrap: anywhere; }
.question[data-state="correct"] .feedback { background: var(--correct-bg); color: var(--correct); }
.question[data-state="wrong"] .feedback { background: var(--wrong-bg); color: var(--wrong); }
.question[data-state="review"] .feedback { background: var(--review-bg); color: var(--review); }
.feedback .expected { display: block; margin-top: 4px; }
.expected b { margin-right: 4px; }
.answer-audio, .model-answer { display: block; margin-top: 6px; }
.model-answer { color: var(--muted); font-size: .88rem; }
.gap-line { line-height: 2.35; }
.gap-line .inline-question { display: inline-block; max-width: 100%; vertical-align: middle; line-height: 1.5; }
.gap-line input { width: 105px; }
.inline-question .feedback { min-width: min(210px, 100%); max-width: min(250px, 100%); }
.gap-table .answer-editor input { min-width: 100px; }
.deck { background: #f2f4eb; border: 1px solid var(--line); padding: 9px 12px 13px; margin-top: 8px; border-radius: 9px; }
.deck-content { margin-top: 8px; }
.deck-nav { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .84rem; }
.deck-nav button { min-width: 40px; min-height: 37px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--green); font-weight: 750; }
.deck-nav button:disabled { color: #657268; opacity: .62; }
.deck > .secondary { margin-top: 9px; }
.quiz-picture { display: block; font-size: 3.5rem; line-height: 1.35; }
.quiz-graphic { display: block; max-width: 150px; max-height: 88px; margin-bottom: 6px; }
.color-sample { display: block; width: 62px; height: 40px; border: 1px solid #7b8580; border-radius: 8px; background: var(--sample); margin-bottom: 7px; }
.step-location { color: var(--green); font-weight: 750; }
.step-location + p { margin-bottom: 7px; }
.chart-card { min-width: 0; margin-block: 8px 12px; background: var(--card); padding: 8px; border-radius: 7px; border: 1px solid var(--line); }
.chart-card figcaption span { display: block; color: var(--muted); font-size: .82rem; }
.chart-card canvas { display: block; width: 100%; max-width: 760px; height: auto; }
.chapter-next { display: flex; justify-content: space-between; align-items: start; gap: 9px; margin-top: 18px; }
.chapter-next .primary { text-align: left; }
.chapter-next small { display: block; font-weight: 450; }

.word-browser { max-width: 860px; }
.word-filters { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(0, 1.6fr); gap: 10px; margin-bottom: 12px; }
.word-filters label span { display: block; color: var(--muted); font-size: .83rem; font-weight: 700; }
.word-filters :is(select, input) { width: 100%; }
.word-count { color: var(--muted); font-size: .85rem; }
.word-results { display: grid; gap: 8px; padding: 0; margin: 9px 0; list-style: none; }
.word-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; background: var(--card); }
.word-row strong { font: 700 1.18rem var(--display); }
.word-row p { margin-block: 4px; }
.word-row a { font-size: .82rem; }
.word-row > div:last-child { display: flex; gap: 5px; }

.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; z-index: 2; top: 6px; left: 6px; padding: 10px 14px; background: var(--card); }
@media (max-width: 820px) {
  .shell { width: calc(100% - 42px); }
  .hero { gap: 16px; }
  .reader { display: block; }
  .reader-aside { position: static; margin-bottom: 15px; }
  .chapter-menu { max-height: 55vh; }
  .reader-main > .back { margin-top: 0; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 30px); }
  .masthead { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; gap: 7px; padding-block: 8px; }
  .nav { grid-row: 2; grid-column: 1 / -1; }
  .nav a { text-align: center; flex: 1; padding-inline: 7px; }
  .main { padding-block: 23px 42px; }
  .hero, .level-chapters, .label-picture, .word-filters { grid-template-columns: 1fr; }
  .hero-copy { padding-bottom: 0; }
  .hero h1 { font-size: clamp(2.55rem, 11vw, 3.7rem); }
  .hero .primary { margin-top: 15px; }
  .hero-image { aspect-ratio: 1.79; }
  .featured { inset-inline: 4%; min-height: 64px; padding: 8px 10px; }
  .course { margin-top: 29px; }
  .course-card { grid-template-columns: 39px minmax(0, 1fr) auto 15px; gap: 7px; padding-inline: 4px; }
  .course-info progress { display: none; }
  .level-head { display: block; }
  .level-start { margin-top: 14px; }
  .chapter-tabs a { padding-inline: 7px; }
  .chapter-next .primary { word-break: normal; min-width: 0; }
  .footer { flex-wrap: wrap; }
}
@media (max-width: 365px) {
  .brand { gap: 7px; font-size: .86rem; }
  .completion { max-width: 110px; white-space: normal; text-align: right; font-size: .76rem; }
}
