:root {
  --ink: #1e1a16;
  --muted: #6d645b;
  --paper: #f4efe6;
  --card: #fffaf2;
  --line: #e0d6c8;
  --walnut: #6a4530;
  --teal: #2c6b66;
  --good: #2f6b46;
  --bad: #8f3b2c;
  --side: #231e1a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
button, input { font: inherit; color: inherit; }
.app { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }

.side { background: var(--side); color: #f3ebe1; padding: 28px 22px; }
.brand { margin: 0; letter-spacing: 0.14em; text-transform: uppercase; font-size: 11px; color: #b9a898; }
.side h1 { margin: 8px 0 0; font-size: 28px; font-weight: 650; }
.name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 8px; }
.name-row h1 { margin: 0; }
.name-row .menu-exit { margin: 0; }
.menu-exit {
  margin: 10px 0 0;
  background: transparent;
  border: 1px solid #5a4e46;
  color: #f3ebe1;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
}
.menu-exit:hover { border-color: #f3ebe1; }
.muted { margin: 0 0 22px; color: #b9a898; font-size: 14px; }
.stat { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.stat span { color: #b9a898; }
.xp-bar { height: 6px; background: #3a322c; margin: 4px 0 18px; }
.xp-bar i { display: block; height: 100%; background: var(--teal); }
.side nav { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 22px; }
.side a {
  color: #f3ebe1;
  text-decoration: none;
  padding: 8px 10px;
  font-size: 14px;
  border-left: 2px solid transparent;
}
.side a.is-on { border-left-color: var(--teal); background: #2e2722; }
.side a.dim { color: #b9a898; }
.footnote { font-size: 12px; line-height: 1.45; color: #8d8278; }
.made-by { margin: 28px 0 0; text-align: center; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }
.quiet {
  margin-top: 18px;
  background: transparent;
  border: 0;
  color: #8d8278;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
}

main { padding: 28px 36px 64px; max-width: 980px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--walnut); }
h2 { margin: 0 0 12px; font-size: 30px; line-height: 1.2; font-weight: 650; }
.lead { margin: 0; color: var(--muted); line-height: 1.55; }
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 28px; align-items: center; margin-bottom: 28px; }
.hero img, .lesson-pic { width: 100%; display: block; background: #efe6d8; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border: 0;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.is-on { background: var(--teal); color: #fff; border-color: var(--teal); }
.audio-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 18px; }
.audio-row .caption { margin: 0; max-width: 460px; }
.speeds { display: flex; gap: 6px; }
.speed { padding: 8px 10px; }
body.is-gate .app { display: block; }
body.is-gate .side { display: none; }
body.is-gate main { max-width: 1280px; margin: 0 auto; width: 100%; }
.start-page { margin: 8px 0 48px; }
.start-page .lead { margin-bottom: 22px; }
.start-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: start;
}
.start-layout.logo-side { align-items: center; }
.side-logo { display: block; width: min(420px, 100%); height: auto; margin: 0 auto; }
.course-banner {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #f6f1e6;
}
.test-invite { margin: 4px 0 10px; line-height: 1.45; }
#startForm a.btn { display: block; width: fit-content; margin: 0 0 14px; }
.test-wrap { max-width: 760px; margin: 8px auto 64px; }
.test-wrap .task p { line-height: 1.45; }
.level-score { margin: 8px 0 12px; font-size: 56px; line-height: 1; letter-spacing: 0.04em; }
.test-wrap h3 { margin: 28px 0 12px; font-size: 22px; }
.answer-rule { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.task .pill { margin-right: 6px; }
.start-field {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  margin: 8px 0 18px;
}
.start-field[readonly] { background: #f6f1e6; }
.site-logo { display: block; width: min(380px, 100%); height: auto; margin: 0 auto 28px; }
.site-title { font-size: 40px; line-height: 1.15; margin-bottom: 28px; }
.login-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.login-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.course-collage { display: block; width: 100%; height: auto; }
.gate-home { margin: 0 0 24px; }
.gate-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.gate-logo { display: block; width: 168px; height: auto; }
.gate-home .enter { display: flex; align-items: flex-end; justify-content: flex-end; gap: 8px; margin: 0; flex-wrap: wrap; }
.gate-home .enter label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.gate-home .enter .start-field { width: 168px; margin: 0; }
.gate-home .enter-reg { color: var(--walnut); text-decoration: none; padding: 10px 4px; white-space: nowrap; }
.gate-home .login-note, .gate-home .form-error { flex: 1 0 100%; margin: 0; text-align: right; }
.gate-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr); gap: 32px; align-items: center; padding: 48px 0 28px; }
.gate-home .hero-copy h2 { margin: 6px 0 14px; font-size: clamp(32px, 4vw, 46px); line-height: 1.12; letter-spacing: -0.03em; max-width: 12em; }
.gate-home .hero-copy .lead { max-width: 38rem; }
.gate-home .hero-note { margin: 12px 0 0; color: var(--muted); }
.gate-home .hero-copy .btn { margin-top: 18px; }
.gate-reasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; padding: 22px 0 8px; border-top: 1px solid var(--line); }
.gate-reasons h3 { margin: 0 0 6px; font-size: 17px; }
.gate-reasons p { margin: 0; color: var(--muted); line-height: 1.5; }
.gate-levels { margin-top: 28px; }
.gate-levels h3 { margin: 0 0 14px; font-size: 22px; }
.level-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.level-cards article { background: #fff; border: 1px solid var(--line); padding: 14px 16px; }
.level-cards strong { display: block; margin-bottom: 4px; }
.level-cards span { color: var(--muted); }
.register-form { max-width: 520px; }
.admin-page { max-width: none; }
.people { width: 100%; border-collapse: collapse; background: #fff; }
.people th, .people td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.people th { color: var(--muted); font-size: 13px; font-weight: 650; }
.people .btn { white-space: nowrap; }
.menu-exit { text-decoration: none; }
.form-error { min-height: 1.3em; margin: 12px 0 0; color: var(--bad); }
.level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 18px; }
.level-pick {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  cursor: pointer;
}
.level-pick strong { display: block; margin-bottom: 4px; }
.level-pick span { color: var(--muted); font-size: 14px; }
.level-pick.is-on { border-color: var(--teal); background: #e7f1ef; }
@media (max-width: 640px) {
  .level-grid { grid-template-columns: 1fr; }
}

.panel { background: var(--card); border: 1px solid var(--line); padding: 18px 20px; margin: 16px 0; }
.panel h3 { margin: 0 0 6px; font-size: 18px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.mods { display: grid; gap: 10px; }
.mod-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.mod-row strong { display: block; }
.mod-row span { color: var(--muted); font-size: 13px; }
.pill { font-size: 12px; color: var(--walnut); }

.lesson-kicker { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.goal { font-size: 18px; margin: 0 0 18px; }
.prose h3 { margin: 22px 0 8px; font-size: 18px; }
.prose p { margin: 0 0 10px; line-height: 1.55; }
.scheme { margin: 16px 0; }
.scheme h3 { margin: 0 0 10px; font-size: 16px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; padding: 10px 12px; }
.arrow { width: 18px; height: 1px; background: var(--walnut); position: relative; }
.arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  border: 4px solid transparent;
  border-left-color: var(--walnut);
}
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair div, .time-item { border: 1px solid var(--line); background: #fff; padding: 12px; }
.pair h4, .time-item strong { margin: 0 0 6px; font-size: 14px; }
.pair li, .examples li { margin: 4px 0; }
.caption { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 650; }
.examples { margin: 8px 0 0; padding: 0; list-style: none; }
.say {
  margin-left: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--teal);
}
.quiz { margin-top: 8px; }
.quiz .actions { margin-top: 4px; }
.task { border: 1px solid var(--line); background: #fff; padding: 12px; margin-bottom: 10px; }
.task p { margin: 0 0 8px; }
.task label { display: block; padding: 7px 8px; margin-bottom: 6px; border: 1px solid var(--line); cursor: pointer; }
.task label:has(input:checked) { border-color: var(--teal); background: #e7f1ef; }
.task input[type="text"], .task textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffaf2;
  padding: 8px 10px;
}
.task textarea { min-height: 88px; resize: vertical; }
.task.is-good { border-color: var(--good); }
.task.is-bad { border-color: var(--bad); }
.why { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.why.good { color: var(--good); }
.why.bad { color: var(--bad); }
.home-note { margin-top: 8px; color: var(--muted); }
.map-lesson { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.map-lesson small { color: var(--muted); }
.later { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.later article { border: 1px solid var(--line); padding: 12px; background: #fff; }
.later h3 { margin: 0 0 6px; font-size: 15px; }
.later p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

@media (max-width: 860px) {
  .app { display: block; }
  .hero, .pair, .later, .start-layout, .gate-hero, .gate-reasons { grid-template-columns: 1fr; }
  .gate-bar { align-items: stretch; flex-wrap: wrap; }
  .gate-home .enter { width: 100%; justify-content: flex-start; }
  .gate-home .enter .start-field { width: 100%; }
  .level-cards { grid-template-columns: 1fr 1fr; }
  .course-banner { height: auto; min-height: 0; object-fit: contain; }
  main { padding: 20px 16px 48px; }
  .side nav { flex-direction: row; overflow: auto; }
}
