:root {
  --ink: #1d1b19;
  --muted: #645d56;
  --bg: #fbf7f3;
  --card: #ffffff;
  --line: #e8dfd6;
  --cream: #fff1e6;
  --orange: #b8401a;
  --orange-d: #972f10;
  --bright: #f0701c;
  --gold: #c79a32;
  --dark: #1f1f1f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 25, 10, .06), 0 10px 28px rgba(40, 25, 10, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Montserrat, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--orange); }
a:hover { color: var(--orange-d); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 64px; padding: 0 clamp(16px, 4vw, 40px);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--dark);
  border-bottom: 1px solid #000;
}
.brand { display: block; line-height: 0; }
.brand img { height: 30px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.linkbtn {
  background: none; border: 0; padding: 6px 2px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: #e9d9a8;
}
.linkbtn:hover { color: #fff; }

/* Buttons */
.btn {
  display: inline-block; text-align: center; text-decoration: none; cursor: pointer;
  background: var(--orange); color: #fff; border: 2px solid var(--orange);
  padding: 12px 22px; border-radius: 10px;
  font: inherit; font-weight: 700; font-size: 15px; line-height: 1.3;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--orange-d); border-color: var(--orange-d); color: #fff; }
.btn.ghost { background: transparent; color: var(--orange); }
.btn.ghost:hover { background: var(--cream); color: var(--orange-d); }
.btn.block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }

.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--orange);
}

/* Gate */
.gate { min-height: calc(100vh - 64px - 70px); display: grid; place-items: center; padding: 40px 20px; }
.gate-card {
  width: 100%; max-width: 440px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 36px clamp(22px, 5vw, 40px);
}
.gate-card h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; font-weight: 800; }
.gate-card form { margin-top: 22px; }
.gate-card label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.gate-card input {
  width: 100%; padding: 13px 14px; margin-bottom: 14px;
  border: 1.5px solid #cfc3b8; border-radius: 10px; font: inherit; background: #fff;
}
.gate-card input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px rgba(184, 64, 26, .18); }
.error { color: #a32612; font-size: 14px; font-weight: 600; min-height: 1.4em; margin: 12px 0 0; }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

/* Home */
.hero { padding: clamp(32px, 6vw, 64px) 0 28px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -.01em; }
.hero p.lead { margin: 0 0 22px; max-width: 620px; font-size: 18px; color: var(--muted); }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.overall { min-width: 220px; max-width: 320px; flex: 1 1 220px; }
.overall .label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.bar { height: 8px; border-radius: 99px; background: #eadfd4; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--orange); border-radius: 99px; transition: width .3s; }

.mods-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 18px; }
.mods-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.mods-head svg { width: 22px; height: 22px; color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; padding-bottom: 56px; }
.card {
  display: flex; flex-direction: column; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.thumb { display: block; aspect-ratio: 16 / 9; background: var(--cream); text-decoration: none; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gen {
  height: 100%; padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #fff6ee 0%, #ffe9d8 100%);
}
.gen { align-items: flex-start; }
.gen .n { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--orange); }
.gen .t { font-size: clamp(34px, 4vw, 44px); line-height: 1.05; font-weight: 800; color: var(--bright); }
.card-body { padding: 18px 20px 6px; flex: 1; }
.track { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.card h3 { margin: 0 0 12px; font-size: 17px; line-height: 1.3; font-weight: 700; }
.card details { border-top: 1px solid var(--line); margin: 0 -20px; }
.card summary {
  cursor: pointer; list-style: none; padding: 11px 20px; font-size: 14px; font-weight: 600; color: var(--orange);
  display: flex; align-items: center; justify-content: space-between;
}
.card summary::-webkit-details-marker { display: none; }
.card summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
.card details[open] summary::after { transform: rotate(-135deg); }
.lessons { list-style: none; margin: 0; padding: 0; background: #f4f1f5; background: #f5f2ef; }
.lessons li a {
  display: flex; gap: 12px; align-items: flex-start; padding: 9px 20px; font-size: 14px;
  color: var(--ink); text-decoration: none; border-top: 1px solid #ebe4dc;
}
.lessons li a:hover { background: #fff; color: var(--orange); }
.num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: #fff; border: 1px solid #cfc3b8; color: var(--muted);
}
.num.done { background: var(--orange); border-color: var(--orange); color: #fff; }
.card-foot { padding: 14px 20px 20px; }
.card-foot .bar { margin-bottom: 14px; }
.soon-tag { display: block; text-align: center; padding: 12px; border-radius: 10px; background: #f1ebe5; color: var(--muted); font-weight: 600; font-size: 14px; }

/* Lesson page */
.crumbs { padding: 22px 0 6px; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--orange); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.crumbs .here { color: var(--ink); font-weight: 600; }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; padding: 10px 0 64px; align-items: start; }
.lesson-main h1 { margin: 10px 0 18px; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.notice { margin: 18px 0 0; padding: 12px 16px; border-radius: 10px; background: #fff7e0; border: 1px solid #ecd9a0; font-size: 14px; }

.lesson-body { margin-top: 26px; font-size: 16px; }
.lesson-body h2 { font-size: 22px; margin: 32px 0 10px; line-height: 1.25; }
.lesson-body h3 { font-size: 18px; margin: 26px 0 8px; line-height: 1.3; }
.lesson-body p { margin: 0 0 14px; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin: 0 0 16px; }
.lesson-body li { margin-bottom: 6px; }
.lesson-body iframe { width: 100%; height: min(1000px, 85vh); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.lesson-body img { border-radius: 10px; }
.lesson-body .copybox {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; word-break: break-all;
  background: #fff; border: 1px dashed #cdbfb2; border-radius: 10px; padding: 12px 14px; user-select: all;
}

.reflect, .ask { margin-top: 38px; padding-top: 26px; border-top: 1px solid var(--line); }
.reflect h2, .ask h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; }
.reflect ol { padding-left: 22px; margin: 12px 0 0; }
.reflect li { margin-bottom: 10px; }
.askform { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.askform .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.askform .field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.askform input, .askform textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid #cfc3b8; border-radius: 10px;
}
.askform textarea { resize: vertical; min-height: 130px; }
.askform input:focus, .askform textarea:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px rgba(184, 64, 26, .18); }
.askform .btn { align-self: flex-start; }
.askform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 600; }
.form-status.ok { color: #2f6b3a; }
.form-status.bad { color: #a32612; }
.ask-empty {
  margin-top: 14px; padding: 22px; border: 2px dashed #d4c6b9; border-radius: 12px; color: var(--muted);
  background: rgba(255, 255, 255, .6); font-size: 15px;
}
.ask-empty code { background: #f0e8e0; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

.lesson-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--line); }

.lesson-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.side-card .head { padding: 18px 20px 14px; }
.side-card h2 { margin: 0 0 12px; font-size: 16px; line-height: 1.3; font-weight: 700; }
.side-card .pct { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--orange); margin-bottom: 6px; }
.side-card .lessons li a { padding: 11px 20px; }
.side-card .lessons li a[aria-current="page"] { background: #fff; color: var(--orange); font-weight: 700; box-shadow: inset 3px 0 0 var(--orange); }
.jump {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 14px; color: var(--ink);
  border: 1.5px solid #cfc3b8; border-radius: 10px; background: #fff;
}

.footer { text-align: center; padding: 26px 16px 34px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; gap: 28px; }
  .lesson-side { position: static; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .askform .row2 { grid-template-columns: 1fr; }
  .askform .btn { align-self: stretch; }
  .lesson-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
