/* The illustrated edition uses strong color blocks and quiet reading surfaces. */
:root {
  --ink: #18171d;
  --muted: #504c54;
  --red: #ff4b46;
  --deep-red: #a72e2a;
  --yellow: #fbd34d;
  --cyan: #54b8c6;
  --blue: #1743a5;
  --orange: #ff9952;
  --surface: #fff;
  --line: #d9d3d1;
  --purple: var(--deep-red);
  --dark-purple: #86231f;
  --lavender: #fff1ec;
  --gold: var(--yellow);
  --radius: 15px;
  --shadow: 4px 5px 0 var(--ink);
}

body { background: #fffdf8; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.top { border-bottom: 2px solid var(--ink); background: #fff; }
.brand-mark { border: 2px solid var(--ink); border-radius: 9px; background: var(--red); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
#site-nav a { color: var(--ink); }
#site-nav a:hover, #site-nav a[aria-current] { color: var(--deep-red); }
#site-nav a[aria-current]::after { background: var(--red); height: 4px; }
.nav-ready .nav-toggle { border-color: var(--ink); background: var(--yellow); }
.eyebrow { color: var(--deep-red); }
.button {
  border: 2px solid var(--ink);
  border-radius: 9px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 3px 4px 0 var(--ink);
}
.button:hover { color: var(--ink); background: #fff0ac; transform: translateY(-1px); }
.button.secondary { border-color: var(--ink); color: var(--ink); background: white; box-shadow: 3px 4px 0 var(--ink); }
.button.secondary:hover { background: #e7f5f7; }
.button.small { background: var(--red); }
.button.small:hover { background: #ff7773; }
.risk-strip { background: #fff4d5; border-color: #e2b645; color: var(--ink); }
.start-band { background: #e9f7f9; border-color: var(--cyan); }
.next-card, .starter-card, .character-card {
  border: 2px solid var(--ink);
  box-shadow: 3px 4px 0 var(--ink);
}
.next-card:hover { border-color: var(--deep-red); }
.next-icon, .next-icon.mint { background: var(--yellow); color: var(--ink); }
.next-icon.mint { background: var(--cyan); }
.filter { border-color: var(--ink); color: var(--ink); }
.filter[aria-pressed=true] { border-color: var(--ink); background: var(--yellow); color: var(--ink); }
.footer { border-top: 2px solid var(--ink); background: #fff2c8; }
.footer-base { border-top-color: #cbb77b; color: #40392f; }

.cover-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(24px, 4vw, 52px) clamp(32px, 5vw, 60px);
  border-bottom: 2px solid var(--ink);
  background:
    radial-gradient(circle at 3px 3px, #18171d1b 1.1px, transparent 1.4px) 0 0 / 16px 16px,
    linear-gradient(124deg, var(--yellow) 0 29%, var(--red) 29% 72%, var(--cyan) 72% 100%);
}
.cover-hero > .wrap { position: relative; max-width: 1110px; }
.cover-frame {
  position: relative;
  margin-inline: auto;
  overflow: hidden;
  padding: clamp(5px, 1vw, 11px);
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: white;
  box-shadow: 8px 10px 0 var(--ink);
}
.cover-visual {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 10px;
}
.cover-mark {
  position: absolute;
  z-index: 1;
  inset: auto clamp(11px, 2vw, 23px) clamp(11px, 2vw, 23px) auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 22px);
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: clamp(10px, 1.3vw, 14px);
  font-weight: 850;
  box-shadow: 2px 3px 0 var(--ink);
}
.cover-copy {
  position: relative;
  max-width: 910px;
  margin: clamp(20px, 3.5vw, 38px) auto 0;
  padding: clamp(16px, 3vw, 28px);
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 5px 6px 0 var(--ink);
  text-align: center;
}
.cover-kicker {
  color: var(--deep-red);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
}
.cover-copy h1 { margin-top: 3px; font-size: clamp(34px, 5vw, 62px); line-height: 1.16; text-wrap: balance; }
.cover-copy h1 em { font-style: normal; text-decoration: underline .13em var(--red); text-underline-offset: .14em; }
.cover-dek { margin: 10px auto 0; color: var(--muted); font-size: clamp(14px, 2vw, 18px); line-height: 1.65; }
.cover-copy .actions { justify-content: center; margin-top: 18px; }

.topic-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.topic-link {
  --topic-bg: var(--yellow);
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--topic-bg);
  color: var(--ink);
  box-shadow: 3px 4px 0 var(--ink);
}
.topic-stock { --topic-bg: var(--cyan); }
.topic-markets { --topic-bg: var(--red); }
.topic-judgment { --topic-bg: #9ad976; }
.topic-account { --topic-bg: var(--orange); }
.topic-link:hover { border-color: var(--ink); transform: translateY(-3px); }
.topic-link :is(.topic-index, .topic-detail, svg) { color: var(--ink); }
.lesson-card { border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 4px 5px 0 var(--ink); }
.lesson-card:hover, .lesson-card:focus-within { border-color: var(--ink); }
.card-art { border-bottom: 2px solid var(--ink); }
.episode-chip { border: 2px solid var(--ink); background: var(--yellow); }
.card-meta span:first-child { background: #ffeae4; color: #722321; }

.article:has(.chapter-cover) { max-width: var(--wrap); }
.chapter-basics { --chapter-accent: var(--yellow); }
.chapter-stock { --chapter-accent: var(--cyan); }
.chapter-markets { --chapter-accent: var(--red); }
.chapter-judgment { --chapter-accent: #9ad976; }
.chapter-cover { margin-bottom: clamp(24px, 4vw, 42px); }
.chapter-visual {
  position: relative;
  width: min(100%, 840px);
  margin-inline: auto;
  overflow: hidden;
  padding: clamp(6px, 1.2vw, 13px);
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--chapter-accent, var(--cyan));
  box-shadow: 6px 7px 0 var(--ink);
}
.chapter-visual .lesson-cover { border-radius: 9px; }
.chapter-ribbon {
  position: absolute;
  z-index: 1;
  inset: clamp(10px, 2vw, 23px) auto auto clamp(10px, 2vw, 23px);
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--yellow);
  color: var(--ink);
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 850;
  line-height: 1.3;
  box-shadow: 2px 3px 0 var(--ink);
}
.chapter-intro { max-width: 820px; margin-top: clamp(22px, 4vw, 42px); }
.chapter-intro h1 { margin-block: 5px 11px; font-size: clamp(34px, 5vw, 58px); line-height: 1.21; text-wrap: balance; }
.chapter-intro .lead { font-size: clamp(15px, 2vw, 19px); }
.chapter-intro :is(.chapter-meta, .subtle) { display: block; margin-top: 10px; }
.chapter-summary {
  margin-block: 15px;
  padding: 12px 15px;
  border-inline-start: 5px solid var(--chapter-accent, var(--cyan));
  background: #fff;
  color: var(--ink);
  font-size: clamp(15px, 1.75vw, 17px);
}
.chapter-jumps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; margin-top: 15px; }
.chapter-jumps a { min-height: 40px; }
.chapter-layout { display: grid; grid-template-columns: minmax(200px, .75fr) minmax(0, 740px); align-items: start; justify-content: space-between; gap: clamp(19px, 4.4vw, 60px); }
.chapter-rail { position: sticky; top: 96px; min-width: 0; max-height: calc(100dvh - 115px); overflow-y: auto; overflow-x: hidden; padding: 3px 5px 6px 3px; }
.chapter-nav {
  min-width: 0;
  padding: 14px 16px 13px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff5d8;
  box-shadow: 3px 4px 0 var(--ink);
}
.chapter-nav :is(h2, summary) { color: var(--ink); font-weight: 850; font-size: 17px; }
.chapter-nav > p { color: var(--muted); font-size: 13px; }
.chapter-nav-list { display: grid; gap: 2px; margin: 9px 0 0; padding: 0; list-style: none; }
.chapter-nav-list > li { min-width: 0; }
.chapter-nav-list a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 34px;
  padding: 6px 3px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.48;
  overflow-wrap: anywhere;
}
.chapter-nav-list a:hover, .chapter-nav-list a:focus-visible { color: var(--deep-red); text-decoration: underline; }
.chapter-nav-list :is(.section-index, .nav-index) { flex: none; color: var(--deep-red); }
.chapter-body { min-width: 0; width: 100%; max-width: 740px; margin-inline: 0; }
.chapter-body .sources a { overflow-wrap: anywhere; }
.chapter-manga :is(.comic-title, h2) { margin-bottom: 13px; }
.chapter-manga .panels { margin-bottom: 24px; }
.chapter-manga .panel { border-color: var(--ink); box-shadow: 2px 3px 0 var(--ink); }
.chapter-section { margin: clamp(34px, 5vw, 65px) 0; }
.chapter-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0 0 23px;
  padding: 10px 13px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--cyan);
  box-shadow: 4px 4px 0 var(--ink);
}
.chapter-section:nth-of-type(3n + 2) .chapter-heading { background: var(--yellow); }
.chapter-section:nth-of-type(3n + 3) .chapter-heading { background: var(--orange); }
.chapter-heading h2 { margin: 0; font-size: clamp(21px, 3vw, 31px); line-height: 1.35; }
.chapter-heading .section-index {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 38px;
  padding-inline: 5px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}
.dialogue { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.dialogue-scene { padding-block: 4px; }
.reading-illustration {
  width: min(100%, 580px);
  margin: 16px auto;
  border: 2px solid var(--ink);
  border-radius: 13px;
  overflow: hidden;
  background: #fff5db;
  box-shadow: 3px 4px 0 var(--ink);
}
.dialogue-scene .reading-illustration { margin-block: 0; }
.reading-illustration img { display: block; width: 100%; height: auto; }
.illustration-focus {
  background: radial-gradient(ellipse at center, #fff 5%, transparent 70%), repeating-conic-gradient(from 4deg at 50% 59%, #e9dece 0deg 1.4deg, #fff7e7 1.4deg 12deg);
}
.illustration-plain { background: #e9f3fb; }
.chapter-basics .illustration-plain { background: #fff4dc; }
.chapter-markets .illustration-plain { background: #f1e7fb; }
.chapter-judgment .illustration-plain { background: #e6f4ec; }
.illustration-color { background: #e5f3f1; }
.chapter-basics .illustration-color { background: #fff0c7; }
.chapter-markets .illustration-color { background: #f1e7fb; }
.chapter-judgment .illustration-color { background: #e9f3dc; }
.reading-bust {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: clamp(132px, 29vw, 202px);
  padding: 6px 6px 0;
}
.reading-bust .character-bust { position: relative; flex: 0 1 210px; min-width: 0; max-width: 210px; }
.reading-bust .character-bust:nth-of-type(2) { transform: scaleX(-1); }
.reading-bust .reading-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 53%;
}

.dialogue-turn {
  --avatar-size: 46px;
  --bubble-bg: #f1fbfd;
  --avatar-bg: var(--cyan);
  display: grid;
  grid-template-columns: var(--avatar-size) minmax(0, 1fr);
  align-items: start;
  gap: 13px;
}
.dialogue-turn.speaker-senpai {
  --bubble-bg: #fff7de;
  --avatar-bg: var(--yellow);
}
.dialogue-turn.speaker-ken { --bubble-bg: #eaf8ea; --avatar-bg: #82c88f; }
.dialogue-turn.speaker-jim { --bubble-bg: #f2ebff; --avatar-bg: #bda3ed; }
.dialogue-turn:is(.speaker-senpai, .speaker-jim) { grid-template-columns: minmax(0, 1fr) var(--avatar-size); }
.mini-avatar {
  display: block;
  width: var(--avatar-size);
  height: var(--avatar-size);
  grid-column: 1;
  grid-row: 1;
  margin-top: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--avatar-bg);
  object-fit: contain;
}
:is(.speaker-senpai, .speaker-jim) .mini-avatar { grid-column: 2; }
.dialogue-bubble {
  position: relative;
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
  margin-inline-end: clamp(0px, 3vw, 34px);
  padding: 10px 15px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--bubble-bg);
  box-shadow: 2px 2px 0 #18171d23;
}
:is(.speaker-senpai, .speaker-jim) .dialogue-bubble { grid-column: 1; margin-inline: clamp(0px, 3vw, 34px) 0; }
.dialogue-bubble::before {
  position: absolute;
  inset: 16px auto auto -5px;
  width: 8px;
  height: 8px;
  border: solid var(--ink);
  border-width: 0 0 1.5px 1.5px;
  background: var(--bubble-bg);
  transform: rotate(45deg);
  content: "";
}
:is(.speaker-senpai, .speaker-jim) .dialogue-bubble::before { inset: 16px -5px auto auto; border-width: 1.5px 1.5px 0 0; }
.dialogue-bubble > strong { display: block; color: #134367; font-size: 12px; font-weight: 850; letter-spacing: .04em; }
.speaker-senpai .dialogue-bubble > strong { color: #754414; }
.speaker-ken .dialogue-bubble > strong { color: #245e37; }
.speaker-jim .dialogue-bubble > strong { color: #563384; }
.dialogue-bubble p { margin: 3px 0 0; color: var(--ink); font-size: clamp(15px, 1.7vw, 17px); line-height: 1.86; overflow-wrap: anywhere; white-space: pre-line; }
.lesson-term, .lesson-key {
  color: var(--ink);
  font-size: 1.13em;
  font-weight: 800;
}
.lesson-key {
  text-decoration: underline #b1392d;
  text-decoration-thickness: .11em;
  text-underline-offset: .2em;
}
.chapter-example, .chapter-checkpoint {
  margin: 18px 0 0;
  padding: 13px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: #fff8e4;
}
.chapter-example { border-inline-start: 5px solid #e57b29; }
.chapter-example :is(h3, strong), .chapter-checkpoint summary { color: var(--ink); }
.chapter-example p, .chapter-checkpoint p { margin-top: 4px; font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; white-space: pre-line; }
.chapter-checkpoint { background: #effaff; }
.chapter-checkpoint summary { min-height: 38px; }
.chapter-checkpoint[open] summary { margin-bottom: 5px; border-bottom: 1px solid #8eb7c4; }
.lesson-figure, .takeaway, .quiz, .notice { background: #fff7e2; border-color: #d4b67d; }
.figure-table th, .comparison-table thead th, .comparison-table tbody th[scope=row] { background: #ffebae; color: var(--ink); }

@media (max-width: 1050px) {
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
  .chapter-layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .chapter-rail { position: static; max-height: none; overflow: visible; }
  .chapter-body { max-width: none; }
  .chapter-nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 11px; }
}
@media (max-width: 760px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-link { box-shadow: 2px 3px 0 var(--ink); }
  .chapter-intro h1 { font-size: clamp(31px, 7vw, 43px); }
  .chapter-visual { box-shadow: 4px 5px 0 var(--ink); }
}
@media (max-width: 530px) {
  .cover-hero { padding-block: 19px 29px; }
  .cover-frame { border-radius: 13px; box-shadow: 4px 5px 0 var(--ink); }
  .cover-copy { box-shadow: 3px 4px 0 var(--ink); }
  .cover-copy h1 { font-size: clamp(23px, 7.25vw, 34px); }
  .cover-copy .actions { gap: 8px; }
  .cover-copy .button { min-height: 44px; padding-inline: 10px; font-size: 13px; white-space: normal; }
  .chapter-nav { padding: 10px 11px; }
  .chapter-nav-list a { min-height: 37px; padding-block: 6px; font-size: 12px; }
  .chapter-heading { gap: 8px; margin-bottom: 16px; padding: 8px 9px; }
  .chapter-heading .section-index { min-width: 34px; min-height: 33px; font-size: 13px; }
  .dialogue { gap: 13px; }
  .dialogue-turn { --avatar-size: 34px; gap: 8px; }
  .dialogue-bubble { padding: 8px 10px 9px; }
  .chapter-example, .chapter-checkpoint { margin-top: 15px; padding: 10px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .button:hover, .topic-link:hover, .lesson-card:hover { transform: none; }
}

.cover-characters {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 750;
}
.chapter-nav-list a > span {
  flex: none;
  min-width: 2em;
  color: var(--deep-red);
  font-variant-numeric: tabular-nums;
}
.chapter-nav > .text-link { margin-top: 8px; font-size: 13px; }

.data-figure { padding: clamp(12px, 3vw, 20px); border: 1.5px solid var(--ink); background: #fff9e8; }
.data-figure figcaption { color: var(--ink); font-size: clamp(15px, 2.5vw, 19px); line-height: 1.5; }
.data-figure .figure-note { font-size: 13px; line-height: 1.65; }
.data-figure .figure-table { table-layout: fixed; }
.data-figure .figure-table :is(th, td) { padding: 6px; line-height: 1.55; }
.data-figure .figure-table th[scope=row] { width: auto; }
.data-bars { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.data-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; }
.bar-label { font-size: 14px; font-weight: 750; }
.bar-value { font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; position: relative; min-height: 18px; overflow: hidden; border-radius: 3px; background: #e9e4dd; }
.bar-fill, .bar-zero { position: absolute; inset-block: 0; }
.bar-fill { background: #127e9e; }
.bar-fill.loss { background: #d7433c; }
.bar-zero { z-index: 1; width: 2px; transform: translateX(-1px); background: var(--ink); }
.bar-scale { display: flex; justify-content: space-between; margin-top: 3px; color: var(--muted); font-size: 11px; }
.data-line-plot { display: block; width: 100%; max-width: 520px; height: auto; margin-inline: auto; border-radius: 8px; background: white; }
.plot-grid path { stroke: #928a86; stroke-dasharray: 4 4; }
.plot-grid text, .plot-markers { fill: var(--ink); font-size: 13px; font-weight: 700; }
.plot-trace { fill: none; stroke: #127e9e; stroke-width: 3; stroke-linejoin: round; }
.plot-dots { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.6; }
.data-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); gap: 7px; margin: 9px 0 0; }
.data-metrics > div { padding: 7px 8px; border: 1px solid #bfae93; border-radius: 7px; background: white; }
.data-metrics dt { color: var(--muted); font-size: 12px; line-height: 1.5; }
.data-metrics dd { margin: 2px 0 0; color: var(--ink); font-size: clamp(14px, 3vw, 19px); font-weight: 850; overflow-wrap: anywhere; line-height: 1.35; }
.data-steps li { border-color: #bfae93; }

.wide-table { overflow-x: auto; }
.wide-table .figure-table { min-width: 420px; }

.character-poses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-block: 9px 12px; }
.character-poses a { display: block; border: 1px solid #bfae93; border-radius: 8px; overflow: hidden; background: #fff7e8; cursor: zoom-in; }
.character-poses a:hover { border-color: var(--ink); }
.character-poses img { display: block; width: 100%; height: auto; }
.character-copy .character-quote { padding: 8px 10px; border-inline-start: 4px solid var(--red); background: #fff4d6; color: var(--ink); font-weight: 750; }
.character-meta { display: grid; grid-template-columns: 3.5em minmax(0, 1fr); gap: 5px 8px; margin-block: 10px 13px; }
.character-meta dt { color: var(--deep-red); font-size: 13px; font-weight: 850; }
.character-meta dd { margin: 0; color: var(--ink); font-size: 13px; }
