:root {
  --bg: #f6f3ee; --card: #ffffff; --ink: #1d1b19; --muted: #6f6a63; --line: #e6e0d7;
  --accent: #c2410c; --accent-ink: #ffffff; --accent-soft: #fdeee4;
  --ok: #15803d; --ok-soft: #e7f5ec; --wait: #a16207; --wait-soft: #fbf3dc; --redo: #b91c1c; --redo-soft: #fdeaea;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px; --shadow: 0 1px 2px rgba(29, 27, 25, .05), 0 6px 20px rgba(29, 27, 25, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161412; --card: #201d1a; --ink: #f1ece5; --muted: #a39b91; --line: #34302b;
    --accent: #f97316; --accent-ink: #1d1208; --accent-soft: #3a2415;
    --ok: #4ade80; --ok-soft: #173322; --wait: #facc15; --wait-soft: #352d10; --redo: #f87171; --redo-soft: #3a1a1a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; overflow-wrap: break-word; }
h1 { font-size: clamp(26px, 6vw, 34px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 21px; font-weight: 700; }
h3, h4 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.pad { padding: 48px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.stack > * + * { margin-top: 16px; }

button, .btn { font: 600 16px/1 var(--font); border: 0; border-radius: 12px; padding: 14px 20px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; transition: transform .12s ease, opacity .12s ease; }
button:hover, .btn:hover { opacity: .92; }
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input, textarea { font: 16px/1.5 var(--font); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; width: 100%; }
textarea { min-height: 160px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.error { color: var(--redo); font-weight: 600; }

/* вход */
.login { max-width: 420px; margin: 8vh auto 0; }
.login .code { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; font-size: 20px; text-align: center; }
.login button { width: 100%; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.top .brand { font-weight: 800; text-decoration: none; }
.top button { min-height: 40px; padding: 8px 14px; font-size: 14px; }

/* прогресс */
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transform-origin: left; }

/* список уроков */
.module h2 { margin-top: 8px; }
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons a { display: flex; align-items: center; gap: 14px; padding: 14px 4px; text-decoration: none; border-top: 1px solid var(--line); }
.lessons li:first-child a { border-top: 0; }
.lessons a:hover .lt { color: var(--accent); }
.num { flex: 0 0 auto; font-weight: 800; color: var(--muted); min-width: 30px; }
.lt { flex: 1 1 auto; font-weight: 600; min-width: 0; }
.pill { flex: 0 0 auto; font-size: 13px; font-weight: 700; border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.pill.wait { background: var(--wait-soft); color: var(--wait); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.redo { background: var(--redo-soft); color: var(--redo); }
.pill.new { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* урок */
.back { display: inline-block; margin-bottom: 16px; text-decoration: none; color: var(--muted); font-weight: 600; }
.video { aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: #0f0e0d; display: grid; place-items: center; color: #d8d2c9; text-align: center; padding: 16px; }
.video iframe, .video video { width: 100%; height: 100%; border: 0; display: block; }
.rich ul, .rich ol { padding-left: 1.3em; margin: 0 0 .8em; }
.rich li + li { margin-top: 4px; }
.rich blockquote { margin: 0 0 .8em; padding: 10px 14px; background: var(--accent-soft); border-radius: 10px; }
.feedback { border-radius: 12px; padding: 14px 16px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.redo { background: var(--redo-soft); }
.feedback.wait { background: var(--wait-soft); }
.nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

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