:root {
  --yellow: #FFD800;
  --yellow-soft: rgba(255, 216, 0, 0.12);
  --yellow-edge: rgba(255, 216, 0, 0.28);
  --ink: #0a0a0a;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --line: rgba(255, 255, 255, 0.07);
  --text: #ececec;
  --dim: #9a9a9a;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--ink);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- HERO ---------- */

.hero {
  background: var(--yellow);
  color: var(--ink);
  padding: env(safe-area-inset-top) 0 0;
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 22px 32px;
}
.logo {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--ink);
  padding: 6px;
  margin-bottom: 18px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.7;
}
.hero h1 {
  margin: 6px 0 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.hero .subtitle {
  margin: 0;
  font-size: 16px;
  color: rgba(10, 10, 10, 0.78);
  max-width: 540px;
}

/* ---------- TOC ---------- */

.toc {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.toc ol {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.toc ol::-webkit-scrollbar { display: none; }
.toc li {
  scroll-snap-align: start;
  flex: 0 0 auto;
  counter-increment: toc;
}
.toc a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.toc a::before {
  content: counter(toc);
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}
.toc a:hover { background: var(--yellow-soft); border-color: var(--yellow-edge); }
.toc ol { counter-reset: toc; }

/* ---------- MAIN ---------- */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------- CHAPTER ---------- */

.chapter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  scroll-margin-top: 72px;
}
.chapter-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 22px 16px;
}
.num {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(255, 216, 0, 0.18);
}
.chapter h2 {
  margin: 4px 0 6px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.chapter-head p {
  margin: 0;
  font-size: 14.5px;
  color: var(--dim);
  line-height: 1.55;
}
.chapter-head em { color: var(--yellow); font-style: normal; font-weight: 600; }

.video-wrap {
  position: relative;
  background: #000;
  margin: 0;
}
.video-wrap video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  background: #000;
}

.notes {
  margin: 0;
  padding: 18px 22px 22px 42px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: #cfcfcf;
}
.notes li {
  position: relative;
  line-height: 1.55;
}
.notes li::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

/* ---------- HELP ---------- */

.help {
  margin-top: 8px;
  padding: 22px;
  background: var(--yellow-soft);
  border: 1px solid var(--yellow-edge);
  border-radius: var(--radius);
  text-align: center;
}
.help h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--yellow);
}
.help p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

/* ---------- FOOTER ---------- */

footer {
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  border-top: 1px solid var(--line);
}
footer p { margin: 0; }

/* ---------- DESKTOP ---------- */

@media (min-width: 720px) {
  .hero h1 { font-size: 42px; }
  .hero-inner { padding: 56px 22px 48px; }
  .chapter-head { padding: 26px 28px 18px; gap: 20px; }
  .chapter h2 { font-size: 22px; }
  .num { width: 44px; height: 44px; font-size: 19px; }
  .notes { padding: 20px 28px 26px 50px; }
}
