:root {
  color-scheme: light;
  --bg: #e8eef5;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d8dee8;
  --blue: #3f7df4;
  --green: #16a34a;
  --red: #9f2f2f;
  --nav: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.8;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 328px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px 24px;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #102033;
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.35;
}

.steps {
  display: grid;
  gap: 12px;
  padding-top: 22px;
}

.step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  background: var(--nav);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e5e7eb;
  font-weight: 800;
}

.step strong {
  line-height: 1.3;
}

.step small {
  color: var(--muted);
  line-height: 1.4;
}

.step.active {
  border-color: var(--blue);
  background: #edf4ff;
}

.step.active span {
  background: var(--blue);
  color: white;
}

.step-primary {
  border-color: #bfd4f7;
  background: #f4f8ff;
  color: #102033;
}

.step-primary span {
  background: #dbeafe;
  color: #1d4ed8;
}

.step-primary small {
  color: #64748b;
}

.content {
  max-width: 1060px;
  margin-left: 328px;
  padding: 48px 56px 96px;
}

.hero {
  padding: 24px 0 34px;
}

.hero-thumb {
  padding-top: 0;
}

.progress {
  margin-bottom: 40px;
}

.progress > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 800;
}

.progress span {
  color: var(--muted);
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.chapter-label {
  display: inline-block;
  margin-bottom: 18px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  color: #374151;
  font-size: 19px;
}

.thumb-stage {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.52), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.35), transparent 22%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 18px, transparent 18px 46px),
    linear-gradient(135deg, #ff7a18 0%, #ff9f1c 43%, #f24a18 100%);
  box-shadow: 0 16px 36px rgba(159, 47, 47, 0.22);
}

.thumb-stage::before {
  content: "";
  position: absolute;
  inset: 18px 28px auto;
  height: 72px;
  transform: rotate(-3deg);
  background: rgba(255, 255, 255, 0.92);
  clip-path: polygon(0 12%, 100% 0, 96% 100%, 3% 86%);
}

.thumb-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  max-width: 680px;
  margin: 0 auto;
  padding: 34px 26px 30px;
  text-align: center;
}

.thumb-kicker {
  position: relative;
  z-index: 3;
  margin: 0 0 30px;
  color: #2a170b;
  font-size: clamp(18px, 2.4vw, 30px);
  font-weight: 900;
  line-height: 1.2;
}

.thumb-copy h2 {
  margin: 0;
  color: #fff7ed;
  font-size: clamp(44px, 6.4vw, 84px);
  font-weight: 950;
  line-height: 1.04;
  letter-spacing: 0;
  text-shadow:
    0 5px 0 #9f2f2f,
    0 10px 20px rgba(67, 20, 7, 0.38);
  -webkit-text-stroke: 3px #b83218;
}

.usage-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 24px;
}

.usage-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(80, 24, 7, 0.5);
}

.thumb-bottom {
  margin: 0;
  padding: 14px 26px 16px;
  transform: rotate(-1deg);
  background: #2a1608;
  color: white;
  font-size: clamp(24px, 3.6vw, 44px);
  font-weight: 950;
  line-height: 1.18;
  box-shadow: 0 10px 18px rgba(42, 22, 8, 0.32);
}

.thumb-bottom strong {
  color: #ffeb3b;
}

.character {
  position: absolute;
  z-index: 1;
  bottom: -30px;
  width: 230px;
  height: 390px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center bottom;
  filter: drop-shadow(0 12px 10px rgba(65, 24, 5, 0.32));
  mix-blend-mode: multiply;
}

.character-hayate {
  left: 2px;
  background-image: url("hayate-hero.png");
}

.character-anne {
  right: 0;
  background-image: url("anne-hero.png");
}

.audio-card,
.article-section {
  margin-bottom: 32px;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.audio-card {
  display: grid;
  grid-template-columns: auto 54px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
}

.audio-card h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.audio-card button {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.audio-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.audio-line span {
  display: block;
  width: 18%;
  height: 100%;
  background: var(--green);
}

.article-section {
  padding: 34px;
}

.article-section h3 {
  margin-bottom: 14px;
  font-size: 28px;
  line-height: 1.35;
}

.article-section p {
  color: #374151;
  font-size: 17px;
}

.article-section a {
  color: #2563eb;
  font-weight: 800;
}

.article-section h4 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.45;
}

.character-intro {
  border: 2px solid #d8c3a5;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(255, 255, 255, 0.98)),
    #fff7ed;
}

.character-grid,
.card-grid,
.case-grid {
  display: grid;
  gap: 18px;
  margin: 18px 0;
}

.character-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.case-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-card {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid #6f8f66;
  border-radius: 8px;
  background: #f8faf7;
}

.mini-card p {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.75;
}

.phase-list {
  display: grid;
  gap: 16px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: phase;
}

.phase-list li {
  position: relative;
  padding: 18px 18px 18px 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.phase-list li::before {
  counter-increment: phase;
  content: counter(phase);
  position: absolute;
  top: 18px;
  left: 18px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.phase-list strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
}

.phase-list p {
  margin-bottom: 0;
  font-size: 15px;
}

.pattern-map {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}

.pattern-map span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #263548;
  font-size: 14px;
  font-weight: 800;
}

.prompt-box {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #d8c3a5;
  border-radius: 8px;
  background: #fffaf0;
}

.prompt-box p:last-child {
  margin-bottom: 0;
}

pre {
  max-width: 100%;
  margin: 14px 0 0;
  overflow-x: auto;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

pre code {
  display: block;
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

details {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

details:last-child {
  border-bottom: 1px solid var(--line);
}

summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

details p {
  margin: 12px 0 0;
}

figure {
  margin: 24px 0 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.reading-entry {
  border-color: #102033;
}

.text-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 8px;
  background: #102033;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.textbook-sidebar {
  width: 360px;
}

.textbook-content {
  max-width: 1180px;
  margin-left: 360px;
}

.textbook-toc {
  display: grid;
  gap: 6px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.textbook-toc a {
  padding: 7px 10px;
  border-radius: 6px;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
}

.textbook-toc a:hover {
  background: #edf4ff;
  color: #1d4ed8;
}

.textbook-toc .toc-level-1 {
  margin-top: 8px;
  font-weight: 800;
}

.textbook-toc .toc-level-2 {
  padding-left: 22px;
  color: var(--muted);
}

.textbook-article {
  max-width: 920px;
  padding: 44px 52px;
}

.textbook-article h1,
.textbook-article h2,
.textbook-article h3,
.textbook-article h4 {
  scroll-margin-top: 24px;
  letter-spacing: 0;
}

.textbook-article h1 {
  margin: 10px 0 34px;
  color: #0f172a;
  font-size: 46px;
  font-weight: 760;
  line-height: 1.25;
}

.textbook-article h2 {
  margin: 72px 0 26px;
  padding: 26px 28px;
  border-top: 0;
  border-left: 8px solid var(--blue);
  border-radius: 8px;
  background: #edf4ff;
  color: #102033;
  font-size: 34px;
  font-weight: 760;
  line-height: 1.35;
}

.textbook-article h3 {
  margin: 48px 0 18px;
  padding-bottom: 10px;
  border-bottom: 3px solid #dbeafe;
  color: #12345b;
  font-size: 27px;
  font-weight: 740;
  line-height: 1.45;
}

.textbook-article h4 {
  margin: 34px 0 12px;
  color: #111827;
  font-size: 22px;
  font-weight: 740;
}

.textbook-article p,
.textbook-article li {
  color: #243044;
  font-size: 19px;
  font-weight: 500;
  line-height: 2.05;
}

.textbook-article p {
  margin-bottom: 24px;
}

.textbook-article strong {
  color: #0f172a;
  font-size: 1.03em;
  font-weight: 680;
  letter-spacing: 0;
}

.textbook-article .marker {
  padding: 0 0.08em 0.03em;
  background: linear-gradient(transparent 64%, #fff0a8 64%);
  color: #111827;
  font-weight: 680;
}

.textbook-article .fine-print {
  margin: 18px 0 30px;
  color: #78828f;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.8;
}

.textbook-article code {
  padding: 0.16em 0.42em;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #b42318;
  font-size: 0.94em;
  font-weight: 800;
}

.textbook-article ul,
.textbook-article ol {
  margin: 18px 0 28px;
  padding-left: 1.5em;
}

.textbook-article li {
  margin-bottom: 10px;
  padding-left: 0.15em;
}

.textbook-article hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid #d8dee8;
}

.textbook-article figure {
  margin: 38px 0;
}

.textbook-article img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #fff;
}

.textbook-article .premium-figure {
  margin: 48px 0 56px;
}

.textbook-article .premium-figure img {
  width: 100%;
  max-height: none;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.character-infographic {
  position: relative;
  display: grid;
  grid-template-columns: 120px 1fr 128px;
  gap: 22px;
  align-items: end;
  margin: 42px 0 48px;
  padding: 26px 28px;
  overflow: hidden;
  border: 1px solid #d7e1ef;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.92)),
    linear-gradient(90deg, rgba(95, 127, 86, 0.12), rgba(63, 125, 244, 0.10));
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.character-infographic::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  pointer-events: none;
}

.character-infographic > * {
  position: relative;
  z-index: 1;
}

.character-infographic .character {
  align-self: stretch;
  display: grid;
  align-items: end;
  justify-items: center;
  min-height: 240px;
}

.character-infographic .character img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 250px;
  object-fit: contain;
  background: transparent;
}

.character-infographic .character.hayate img {
  max-height: 260px;
}

.character-infographic .info-main {
  display: grid;
  gap: 18px;
}

.character-infographic .info-label {
  display: inline-flex;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0;
}

.character-infographic h4 {
  margin: 0;
  padding: 0;
  border: 0;
  color: #102033;
  font-size: 25px;
  font-weight: 740;
  line-height: 1.4;
}

.character-infographic .info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.character-infographic .info-card {
  min-height: 132px;
  padding: 16px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #ffffff;
}

.character-infographic .info-card strong {
  display: block;
  margin-bottom: 8px;
  color: #102033;
  font-size: 18px;
  font-weight: 720;
  line-height: 1.45;
}

.character-infographic .info-card span {
  display: block;
  color: #536173;
  font-size: 15px;
  font-weight: 520;
  line-height: 1.65;
}

.character-infographic .dialogue {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.character-infographic .talk {
  margin: 0;
  padding: 13px 15px;
  border-radius: 8px;
  background: #f8fafc;
  color: #243044;
  font-size: 15px;
  font-weight: 560;
  line-height: 1.7;
}

.character-infographic .talk b {
  display: block;
  margin-bottom: 3px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 760;
}

.character-infographic .talk.anne {
  border-left: 5px solid #5f7f56;
}

.character-infographic .talk.hayate {
  border-left: 5px solid #31566d;
}

.textbook-article pre {
  margin: 28px 0;
  padding: 22px 24px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #0f172a;
  color: #e5edf8;
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.textbook-article pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
}

.note-box {
  padding: 18px 20px;
  border: 2px solid #f3d18b;
  border-radius: 8px;
  background: #fff8e6;
  color: #6f4b00;
  font-weight: 900;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 20px;
  }

  .content {
    margin-left: 0;
    padding: 28px 18px 64px;
  }

  .textbook-content {
    margin-left: 0;
  }

  .textbook-article {
    max-width: none;
    padding: 24px 18px;
  }

  .textbook-article h1 {
    font-size: 32px;
  }

  .textbook-article h2 {
    margin-top: 52px;
    padding: 20px 18px;
    font-size: 26px;
  }

  .textbook-article h3 {
    font-size: 22px;
  }

  .textbook-article p,
  .textbook-article li {
    font-size: 17px;
    line-height: 1.95;
  }

  .character-infographic {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 32px 0 38px;
    padding: 20px 18px;
  }

  .character-infographic .character {
    display: none;
  }

  .character-infographic .info-grid,
  .character-infographic .dialogue {
    grid-template-columns: 1fr;
  }

  .character-infographic h4 {
    font-size: 22px;
  }

  .textbook-toc {
    max-height: 320px;
    overflow-y: auto;
  }

  .audio-card {
    grid-template-columns: 54px 1fr auto;
  }

  .audio-card > div:first-child {
    grid-column: 1 / -1;
  }

  .character-grid,
  .card-grid,
  .card-grid.three,
  .case-grid {
    grid-template-columns: 1fr;
  }

  .thumb-stage {
    min-height: 520px;
  }

  .thumb-stage::before {
    inset: 16px 14px auto;
    height: 86px;
  }

  .thumb-copy {
    padding: 34px 16px 28px;
  }

  .thumb-kicker {
    max-width: 88%;
    margin-bottom: 32px;
    font-size: 18px;
  }

  .thumb-copy h2 {
    font-size: clamp(36px, 10.4vw, 48px);
    -webkit-text-stroke: 2px #b83218;
  }

  .thumb-bottom {
    padding-inline: 18px;
    font-size: 22px;
    white-space: nowrap;
  }

  .character {
    width: 136px;
    height: 280px;
    bottom: -20px;
  }

  .character-hayate {
    left: -18px;
  }

  .character-anne {
    right: -24px;
  }
}

/* ── Section audio player ── */
.section-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 18px;
  padding: 6px 12px;
  background: var(--nav);
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
}

.audio-char {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}
