:root {
  --paper: #f4f0e8;
  --paper-deep: #ebe5da;
  --ink: #192725;
  --muted: #6b7972;
  --line: #d8d8cc;
  --green: #27665b;
  --green-soft: #dfeae4;
  --orange: #ef6c4a;
  --yellow: #f3c95d;
  --white: #fffdf8;
  --shadow: 0 20px 50px rgba(36, 55, 49, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, a { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }

.page-shell { max-width: 1320px; margin: 0 auto; padding: 0 56px 54px; overflow: hidden; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -0.04em; font-size: 19px; }
.brand-mark { width: 28px; height: 28px; display: inline-flex; align-items: flex-end; gap: 3px; padding: 4px; border: 2px solid var(--ink); border-radius: 8px 8px 8px 2px; transform: rotate(-7deg); }
.brand-mark span { flex: 1; background: var(--orange); border-radius: 2px 2px 0 0; }
.brand-mark span:nth-child(1) { height: 44%; }
.brand-mark span:nth-child(2) { height: 68%; background: var(--green); }
.brand-mark span:nth-child(3) { height: 88%; background: var(--yellow); }
.brand-mark-t { justify-content: center; align-items: center; padding: 0; background: var(--yellow); color: var(--green); font-size: 17px; font-weight: 950; line-height: 1; transform: rotate(-7deg); }
.topbar-note { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pulse-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(239,108,74,0.14); }

.intro-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr); gap: 72px; align-items: end; padding: 84px 0 74px; }
.eyebrow { margin: 0 0 17px; font-size: 10px; font-weight: 900; letter-spacing: 0.17em; text-transform: uppercase; color: var(--orange); }
.eyebrow span { color: var(--muted); margin: 0 7px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 28px; font-size: clamp(46px, 6vw, 82px); line-height: 0.94; letter-spacing: -0.075em; font-weight: 850; }
h1 em { color: var(--green); font-style: normal; }
.intro-text { max-width: 560px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.session-card { background: var(--green); color: var(--white); padding: 27px 28px 23px; border-radius: 2px 26px 2px 26px; box-shadow: var(--shadow); transform: rotate(1.5deg); }
.session-card-top, .session-card-bottom { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; }
.session-card-top { font-size: 13px; font-weight: 700; }
.session-card-top strong { color: var(--yellow); font-size: 22px; letter-spacing: -0.04em; }
.progress-track { height: 8px; margin: 24px 0 15px; background: rgba(255,255,255,0.18); border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--yellow); border-radius: inherit; transition: width 350ms ease; }
.session-card-bottom { color: rgba(255,255,255,0.68); font-size: 11px; }

.lesson-intro { display: grid; grid-template-columns: 145px auto 1fr; gap: 26px; align-items: center; padding: 24px 0 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-marker { display: flex; align-items: center; gap: 14px; color: var(--orange); font-size: 13px; font-weight: 900; letter-spacing: 0.08em; }
.section-line { display: block; height: 1px; width: 54px; background: var(--orange); opacity: 0.6; }
h2 { margin-bottom: 0; font-size: 31px; line-height: 1; letter-spacing: -0.05em; }
.lesson-hint { align-self: end; justify-self: end; margin: 0; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.5; }
.lesson-hint span { color: var(--ink); font-weight: 700; }

.section-tabs { display: inline-flex; gap: 8px; margin-top: 28px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 253, 248, 0.42); }
.section-tab { display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 5px; padding: 11px 15px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.section-tab span { color: var(--orange); font-size: 10px; letter-spacing: 0.08em; }
.section-tab strong { color: inherit; font-size: 10px; opacity: 0.65; }
.section-tab:hover { color: var(--ink); }
.section-tab.active { background: var(--white); color: var(--green); box-shadow: 0 5px 14px rgba(36, 55, 49, 0.08); }

.lesson-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 65px; padding-top: 48px; }
.word-rail { position: sticky; top: 20px; align-self: start; }
.rail-label { margin-bottom: 19px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; font-weight: 900; }
#word-rail-items { display: flex; flex-direction: column; gap: 4px; }
.rail-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); padding: 9px 9px 9px 0; color: var(--muted); background: transparent; text-align: left; transition: color 180ms ease, padding 180ms ease; }
.rail-item:hover, .rail-item.active { color: var(--ink); padding-left: 6px; }
.rail-item.active { font-weight: 800; }
.rail-number { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 800; flex: 0 0 auto; }
.rail-item.active .rail-number { border-color: var(--orange); background: var(--orange); color: white; }
.rail-item.done .rail-number { border-color: var(--green); background: var(--green); color: white; }
.rail-word { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-tip { margin-top: 28px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.rail-tip span { color: var(--orange); font-size: 19px; vertical-align: -2px; margin-right: 3px; }

.cards-column { min-width: 0; max-width: 790px; }
.active-word-banner { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 0 4px 17px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; }
.active-word-banner strong { color: var(--green); font-size: 18px; letter-spacing: -0.04em; }
.word-card { position: relative; scroll-margin-top: 24px; display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 22px; align-items: start; padding: 30px 32px 31px 23px; border-bottom: 1px solid var(--line); transition: background 250ms ease, transform 250ms ease; }
.word-card:first-child { border-radius: 2px 22px 2px 2px; }
.word-card.is-active { background: var(--white); box-shadow: var(--shadow); border: 0; margin: 14px 0; border-radius: 2px 26px 2px 26px; transform: translateX(8px); }
.card-index { width: 48px; height: 48px; display: grid; place-items: center; background: var(--paper-deep); color: var(--green); border-radius: 50%; font-size: 12px; font-weight: 900; }
.is-active .card-index { background: var(--yellow); color: var(--ink); }
.card-kicker { margin-bottom: 10px; color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
.card-title { margin-bottom: 6px; font-size: clamp(25px, 3vw, 39px); line-height: 1; letter-spacing: -0.06em; }
.card-title span { color: var(--green); }
.audio-phrase { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); }
.accent-phrase { color: var(--green); }
.title-arrow { color: var(--muted) !important; }
.speak-button { width: 25px; height: 25px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 4px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--green); vertical-align: middle; transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease; }
.speak-button:hover { border-color: var(--green); background: var(--green-soft); transform: translateY(-1px); }
.speak-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.card-example { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.card-example strong { color: var(--ink); }
.audio-sentence { display: inline-flex; align-items: center; gap: 5px; }
.audio-sentence .speak-button { width: 21px; height: 21px; padding: 3px; }
.audio-sentence .speak-button svg { width: 13px; height: 13px; }
.translation-block { margin-top: 18px; padding-top: 13px; border-top: 1px dashed var(--line); }
.translation-label { display: block; margin-bottom: 7px; color: var(--orange); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.translation-title { margin: 0 0 7px; color: var(--ink); font-size: 24px; line-height: 1.28; font-weight: 800; letter-spacing: -0.025em; }
.translation-title span { color: var(--green); }
.translation-example { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.rule-box { align-self: start; min-width: 235px; display: flex; gap: 11px; padding: 17px 16px; background: #fff2c7; border: 1px solid rgba(243, 201, 93, 0.75); border-left: 5px solid var(--yellow); border-radius: 3px 15px 3px 15px; }
.rule-icon { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--yellow); font-size: 17px; }
.rule-content { min-width: 0; }
.grammar-note-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 8px; color: var(--green); font-size: 11px; letter-spacing: 0.1em; font-weight: 900; text-transform: uppercase; }
.grammar-note-help { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; background: var(--yellow); font-size: 14px; line-height: 1; letter-spacing: 0; }
.rule-label { display: block; margin-bottom: 7px; color: var(--green); font-size: 11px; letter-spacing: 0.1em; font-weight: 900; text-transform: uppercase; }
.rule-text { display: block; color: var(--ink); font-size: 18px; line-height: 1.45; font-weight: 750; }
.rule-ending { color: #c94b52; font-weight: 950; }
.rule-example { display: inline; color: var(--green); font-weight: 850; }
.rule-example > strong { color: var(--green); font-weight: 950; }
.rule-exceptions { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(39,102,91,0.28); color: var(--green); font-size: 16px; line-height: 1.4; font-weight: 800; }
.rule-exceptions strong { color: var(--orange); }
.card-check { grid-column: 2 / -1; display: flex; justify-content: flex-end; gap: 11px; align-items: center; margin-top: -3px; color: var(--muted); font-size: 11px; }
.check-button { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: transparent; font-size: 15px; transition: all 180ms ease; }
.check-button:hover { border-color: var(--green); }
.word-card.is-done .check-button { border-color: var(--green); background: var(--green); color: white; }
.word-card.is-done .card-title { color: var(--muted); }

.closing-note { display: flex; gap: 19px; align-items: center; max-width: 680px; margin: 82px 0 0 275px; padding: 25px 0; border-top: 1px solid var(--line); }
.closing-symbol { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--orange); color: white; font-size: 27px; font-weight: 300; }
.closing-note .eyebrow { margin-bottom: 7px; }
.closing-note p:last-child { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink); }
.speech-status { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 72px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }

@media (max-width: 850px) {
  .page-shell { padding: 0 24px 40px; }
  .intro-grid { grid-template-columns: 1fr; gap: 36px; padding: 62px 0 56px; }
  .session-card { max-width: 470px; transform: none; }
  .lesson-layout { grid-template-columns: 1fr; gap: 28px; padding-top: 30px; }
  .section-tabs { margin-top: 24px; }
  .word-rail { position: static; }
  #word-rail-items { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .rail-item { border: 1px solid var(--line); border-radius: 4px; padding: 7px; justify-content: center; }
  .rail-item:hover, .rail-item.active { padding-left: 7px; }
  .rail-word { display: none; }
  .rail-tip { display: none; }
  .closing-note { margin-left: 0; }
}

@media (max-width: 600px) {
  .topbar { height: 74px; }
  .topbar-note { display: none; }
  .intro-grid { padding-top: 53px; }
  h1 { font-size: clamp(43px, 14vw, 67px); }
  .intro-text { font-size: 15px; }
  .lesson-intro { grid-template-columns: 1fr auto; gap: 14px; }
  .section-marker { grid-column: 1 / -1; }
  .lesson-hint { font-size: 11px; }
  .section-tabs { display: flex; width: 100%; }
  .section-tab { flex: 1; justify-content: center; }
  .word-card { grid-template-columns: 42px minmax(0, 1fr); gap: 15px; padding: 24px 4px; }
  .word-card.is-active { padding: 24px 17px; transform: none; }
  .card-index { width: 38px; height: 38px; font-size: 10px; }
  .card-title { font-size: 29px; }
  .card-example { font-size: 18px; }
  .translation-title { font-size: 23px; }
  .translation-example { font-size: 18px; }
  .audio-phrase { gap: 5px; }
  .speak-button { width: 23px; height: 23px; padding: 3px; }
  .rule-box { grid-column: 2; min-width: 0; width: 100%; }
  .rule-text { font-size: 18px; }
  .card-check { grid-column: 2; }
  .active-word-banner { align-items: flex-start; flex-direction: column; gap: 7px; }
  .footer { flex-direction: column; gap: 7px; }
}
