:root {
  --paper: #f6f1e8;
  --paper-2: #fffaf4;
  --ink: #241c16;
  --muted: #6a5d52;
  --line: #e4d8c8;
  --pine: #3f2c22;
  --pine-2: #5c4336;
  --lime: #e7b23a;
  --clay: #9c4328;
  --sea: #243f63;
  --warn: #8d2f1f;
  --good: #3f2c22;
  --shadow: 0 16px 40px rgba(36, 28, 22, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; font-weight: 720; letter-spacing: -0.02em; margin: 0 0 0.6rem; }
h1 { font-size: clamp(2.2rem, 5vw, 4.3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
p { margin: 0 0 0.8rem; }
.skip {
  position: absolute; left: 12px; top: -40px; background: var(--lime); padding: 6px 10px;
}
.skip:focus { top: 12px; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px; padding: 12px 7vw;
  background: rgba(246, 241, 232, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; font-weight: 680; padding-left: 12px; border-left: 1px solid var(--line); }
.brand b { font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: 0.04em; }
.foot-logo { height: 32px; width: auto; display: block; margin-bottom: 10px; }
#nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-btn {
  display: none; border: 1px solid var(--line); background: var(--paper-2);
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
nav { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
nav a { text-decoration: none; color: var(--muted); }
nav a.on, nav a:hover { color: var(--ink); }
nav a span { display: block; font-size: 12px; color: var(--pine); }

.hero, .block, .band, .boundary, .narrow, .lesson, .head-block { padding: 48px 7vw; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 36px; align-items: center;
  padding-top: 64px; padding-bottom: 72px;
}
.kicker {
  margin: 0 0 8px; color: var(--pine); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
}
.lede { font-size: 1.12rem; max-width: 38rem; }
.hero-actions, .lesson-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.caption { color: var(--muted); font-size: 14px; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper-2); text-decoration: none;
  border: 0; border-radius: 999px; padding: 11px 18px; font: inherit; cursor: pointer;
}
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
button { font: inherit; }
.text-btn { background: none; border: 0; color: var(--pine); text-decoration: underline; cursor: pointer; padding: 8px 0; }

.stage-wrap { margin: 8px 0 18px; }
.stage {
  position: relative; min-height: 230px; overflow: hidden;
  background: var(--pine); color: var(--paper); border-radius: 22px; padding: 22px;
  box-shadow: var(--shadow);
}
.links { display: grid; gap: 8px; }
.links i { display: block; height: 12px; border-radius: 99px; background: rgba(243, 236, 223, 0.38); }
.links i:nth-child(1) { width: 92%; } .links i:nth-child(2) { width: 74%; }
.links i:nth-child(3) { width: 83%; } .links i:nth-child(4) { width: 61%; }
.links i:nth-child(5) { width: 70%; } .links i:nth-child(6) { width: 48%; }
.stage.is-on .links i { animation: fold 1.15s ease 0.65s forwards; }
.answer-card {
  position: absolute; left: 22px; right: 22px; bottom: 22px;
  background: var(--lime); color: var(--ink); border-radius: 14px; padding: 14px 16px;
  opacity: 0; transform: translateY(14px);
}
.answer-card b, .answer-card small { display: block; }
.answer-card small { color: var(--pine); }
.stage.is-on .answer-card { animation: rise 0.55s ease 1.65s forwards; }
.hero-side .text-btn { color: var(--muted); }

.gaps, .calendar, .sheetpaper { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gaps b, .calendar b, .sheetpaper b, .facts li, .questions b, .questions s {
  display: block; margin: 0; padding: 14px; border-radius: 14px; background: rgba(243, 236, 223, 0.1);
}
.stage.is-on.gaps b { animation: pop 0.45s ease backwards; }
.stage.is-on.gaps b:nth-child(2) { animation-delay: 0.12s; }
.stage.is-on.gaps b:nth-child(3) { animation-delay: 0.24s; }
.stage.is-on.gaps b:nth-child(4) { animation-delay: 0.36s; }
.stage.is-on.signal .spike { transform-origin: left bottom; animation: grow 0.9s ease 0.2s both; }
.stage.is-on.calendar b, .stage.is-on.sheetpaper b { animation: pop 0.4s ease backwards; }
.stage.is-on.calendar b:nth-child(2), .stage.is-on.sheetpaper b:nth-child(2) { animation-delay: 0.15s; }
.stage.is-on.calendar b:nth-child(3), .stage.is-on.sheetpaper b:nth-child(3) { animation-delay: 0.3s; }
.stage.is-on.sheetpaper b:nth-child(4) { animation-delay: 0.45s; }
.gaps b:nth-child(1) { background: var(--lime); color: var(--ink); }
.gaps b:nth-child(2) { background: var(--paper); color: var(--ink); }
.gaps b:nth-child(3) { background: #9c4328; }
.gaps b:nth-child(4) { background: #243f63; }
.calendar b, .sheetpaper b { background: rgba(226, 242, 109, 0.16); }
.calendar small, .sheetpaper { font-weight: 600; }
.calendar small { display: block; color: var(--lime); font-size: 12px; letter-spacing: 0.08em; }
.signal { display: grid; align-content: end; gap: 14px; }
.spike, .flat { display: block; height: 74px; border-radius: 12px 12px 0 0; }
.spike { width: 28%; background: repeating-linear-gradient(90deg, transparent 0 10px, var(--lime) 10px 14px); align-self: end; }
.flat { width: 100%; height: 36px; background: linear-gradient(90deg, rgba(231,178,58,.25), var(--lime)); }
.signal small { color: var(--lime); }
.questions s { text-decoration: line-through; opacity: 0.55; }
.questions b { background: var(--lime); color: var(--ink); }
.facts ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.facts li { background: var(--lime); color: var(--ink); }
.sources { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 1.15rem; }
.sources i { flex: 1; height: 2px; background: var(--lime); position: relative; }
.sources i::after { content: ""; position: absolute; right: 0; top: -4px; border: 5px solid transparent; border-left-color: var(--lime); }

.band { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; background: var(--pine); color: var(--paper); }
main, .hero, .band, .block, .lesson, .narrow, .head-block, .foot, .split, .prices, .doors { min-width: 0; }
.hero > *, .band > *, .split > *, .foot > *, .lesson > * { min-width: 0; }
h1, h2, h3, p, li, .lede { overflow-wrap: anywhere; }
.band .kicker, .col-sea .kicker { color: var(--lime); }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.points li { padding-left: 18px; border-left: 3px solid var(--lime); }
.prices, .doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.price, .col, .door, .doors a {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow);
}
.yen { font-size: 1rem; }
.yen b { font-size: 3rem; letter-spacing: -0.04em; line-height: 1; }
.price .btn { margin-top: 8px; }
.note { color: var(--muted); }
.note a { color: var(--pine); }
.lesson-index { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.lesson-index a {
  display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 12px; align-items: center;
  text-decoration: none; padding: 12px 0; border-top: 1px solid var(--line);
}
.lesson-index em { font-style: normal; font-weight: 720; color: var(--pine); }
.lesson-index small, .lesson-index i { display: block; color: var(--muted); font-style: normal; font-weight: 450; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.col-land { background: #f7f1e4; }
.col-sea { background: var(--sea); color: #f4f7fb; }
.col h2, .col h3 { font-size: 1.25rem; }
.doors a { text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.doors b { font-size: 1.2rem; }
.doors span, .door span { color: var(--muted); }
.boundary {
  margin: 10px 7vw 48px; background: var(--ink); color: var(--paper);
  border-radius: 24px; display: flex; justify-content: space-between; gap: 18px; align-items: center;
}
.boundary p { margin: 0; max-width: 40rem; }

.lesson {
  width: min(1120px, calc(100% - 8vw));
  margin: 0 auto;
  padding: 36px 0 72px;
}
.lesson-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 40px;
  align-items: center;
  margin-bottom: 12px;
}
.lesson-hero h1 { font-size: clamp(2.4rem, 4vw, 3.5rem); }
.lesson-hero .stage-wrap { margin: 0; }
.lesson-hero .stage { min-height: 300px; }
.lesson .prose {
  max-width: none;
  margin: 36px 0 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.lesson .prose article {
  margin: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.lesson .prose span {
  display: block;
  margin-bottom: 10px;
  color: var(--pine);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.14em;
}
.lesson .prose p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.75;
}
.takeaways { padding-left: 1.15rem; margin: 16px 0 0; }
.takeaways li { margin: 0.35rem 0; }
.head-block, .narrow, .paywall, .sheet-doc {
  width: min(880px, calc(100% - 8vw));
  margin-left: auto;
  margin-right: auto;
}
.game, .card-answer, .diagnosis, .work { max-width: none; }
.work { margin-top: 28px; }
.work-table { width: 100%; border-collapse: collapse; background: var(--paper-2); border-radius: 16px; overflow: hidden; }
.work-table th, .work-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.work-table th { width: 11rem; color: var(--pine); font-weight: 680; white-space: nowrap; }
.head-block .lede { max-width: none; }
.homework { margin-top: 12px; padding: 12px 14px; background: var(--lime); border-radius: 14px; }
.homework b { display: block; font-size: 13px; letter-spacing: 0.08em; }
.blanks small { display: block; color: var(--muted); font-weight: 450; margin-top: 4px; }
.quiz {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 8px;
}
.quiz.compact { grid-template-columns: 1fr 1fr; }
.quiz.stack fieldset,
.quiz.checks {
  flex-direction: column;
  align-items: stretch;
}
.quiz.stack label,
.quiz.checks .check {
  flex: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
}
.lock {
  margin-top: 28px;
  padding: 28px 32px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
}
.lock p { margin: 0 0 8px; }
.lock-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.quiz-actions { grid-column: 1 / -1; }
.game fieldset, .check {
  border: 1px solid var(--line); background: var(--paper-2); border-radius: 14px;
  margin: 0; padding: 14px 16px 12px;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
}
.game legend { width: 100%; padding: 0 0 4px; font-weight: 650; }
.game label, .check { display: flex; gap: 8px; align-items: flex-start; margin: 0; flex: 1 1 160px; }
.quiz, .quiz fieldset, .game label, .check { min-width: 0; max-width: 100%; }
.quiz.stack fieldset {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
}
.quiz.stack label {
  flex: none;
  width: 100%;
  overflow-wrap: anywhere;
}
.result, .card-answer, .diagnosis {
  margin-top: 16px; padding: 16px 18px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line);
}
.result ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.result li { display: grid; grid-template-columns: 3rem 1fr; gap: 4px 10px; }
.result b { grid-row: span 2; }
.result .ok b { color: var(--pine); }
.result .bad b { color: var(--warn); }
.result small { color: var(--muted); }
.card-answer { background: #f7f6e4; }
.diagnosis { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--pine); color: var(--paper); }
.diagnosis a { color: var(--lime); }

.stack { display: grid; gap: 12px; margin: 12px 0 18px; }
.stack label { display: grid; gap: 6px; font-weight: 650; }
input, textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: white; color: var(--ink);
}
input[type="radio"], input[type="checkbox"] {
  width: 1.05rem; height: 1.05rem; padding: 0; margin-top: 0.28rem; flex: 0 0 auto;
}
.warn { color: var(--warn); }
.good { color: var(--good); background: #f4ead4; padding: 10px 12px; border-radius: 12px; }
.price { transition: transform 0.2s ease; }
.price:hover { transform: translateY(-2px); }
nav a.on { box-shadow: inset 0 -2px 0 var(--lime); }
.grid { width: 100%; border-collapse: collapse; margin: 8px 0 28px; background: var(--paper-2); }
.grid th, .grid td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.grid button { background: none; border: 0; color: var(--clay); cursor: pointer; text-decoration: underline; }
.code-url { word-break: break-all; font-family: Consolas, monospace; background: white; padding: 12px; border-radius: 12px; }
.blanks { list-style: none; padding: 0; }
.blanks li { margin: 0 0 16px; }
.blanks i { display: block; min-height: 42px; border-bottom: 1px solid var(--ink); }
.sheet-doc { padding-bottom: 48px; }

.foot {
  padding: 28px 7vw 40px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 18px;
}
.foot a { display: block; color: var(--pine); }
.fine { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

input, textarea, select { font-size: 16px; }
.btn, button.btn { min-height: 44px; }
.game label { min-height: 44px; align-items: center; }

@media (max-width: 860px) {
  body { padding-left: 16px; padding-right: 16px; }
  .narrow p, .hero-copy .lede, .hero-copy h1, .foot p, .band h2, .band .points li {
    width: 320px;
    max-width: calc(100vw - 48px);
  }
  .top, .hero, .block, .band, .lesson, .narrow, .head-block, .boundary, .foot { padding-left: 0; padding-right: 0; }
  .hero, .band, .split, .prices, .doors, .foot { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 24px; padding-bottom: 36px; }
  h1 { font-size: 1.85rem; line-height: 1.28; }
  .brand img { height: 30px; }
  .brand span { font-size: 13px; padding-left: 8px; }
  .lesson, .lesson-hero, .head-block, .narrow, .paywall, .sheet-doc { width: auto; max-width: 100%; margin-left: 0; margin-right: 0; }
  .lesson { padding-top: 12px; }
  .lesson-hero, .quiz.compact, .lesson .prose, .lock { grid-template-columns: 1fr; }
  .lock { flex-direction: column; align-items: flex-start; }
  .lesson-hero .stage { min-height: 220px; }
  .top, main, .hero, .narrow, .lesson, .foot, .hero-copy, .prose, .stack, form { min-width: 0; max-width: 100%; }
  h1, h2, h3, p, li, label, .lede, .note, .fine {
    max-width: calc(100vw - 36px);
    overflow-wrap: anywhere;
  }
  input, textarea, select { max-width: 100%; min-width: 0; }
  .work-table, .work-table th, .work-table td { display: block; width: auto; }
  .work-table th { padding-bottom: 0; }
  .stage { min-height: 220px; padding: 16px; }
  .answer-card { left: 16px; right: 16px; bottom: 16px; }
  nav a { padding: 10px 0; }
  .nav-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .boundary { flex-direction: column; align-items: flex-start; }
  .nav-btn { display: inline-flex; }
  nav { display: none; width: 100%; padding-bottom: 8px; }
  #nav-toggle:checked ~ nav { display: flex; flex-direction: column; align-items: flex-start; }
  .lesson-index a { grid-template-columns: 2.4rem 1fr; }
  .lesson-index i { grid-column: 2; }
  .diagnosis { flex-direction: column; align-items: flex-start; }
  .grid { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .stage.is-on .links i,
  .stage.is-on .answer-card,
  .stage.is-on.gaps b,
  .stage.is-on.signal .spike,
  .stage.is-on.calendar b,
  .stage.is-on.sheetpaper b { animation: none; }
  .answer-card { opacity: 1; transform: none; }
  .links { opacity: 0.25; }
}

@keyframes fold {
  to { transform: scaleX(0.15); opacity: 0; }
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleX(0.15); }
  to { transform: none; }
}

@media print {
  .top, .foot, .btn, .text-btn { display: none !important; }
  body { background: white; }
  .sheet-doc { padding: 0; }
}
