:root {
  --ink: #1e2b2f;
  --soft-ink: #40545a;
  --paper: #fffdf6;
  --line: #1f1f1f;
  --panel: #ffffff;
  --cream: #f8f0df;
  --mint: #dff8eb;
  --mint-strong: #46b581;
  --coral: #f06f59;
  --blue: #2467d8;
  --sky: #dceeff;
  --yellow: #ffe875;
  --pink: #ffdbe2;
  --graph: rgba(36, 103, 216, 0.12);
  --shadow: 0 18px 40px rgba(37, 48, 54, 0.14);
  color-scheme: light;
  font-family:
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 232, 117, 0.42), transparent 24rem),
    linear-gradient(135deg, rgba(220, 238, 255, 0.82), transparent 28rem),
    var(--paper);
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  border-bottom: 2px solid var(--line);
  background: rgba(255, 253, 246, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 1.65rem;
  line-height: 1;
  box-shadow: 3px 3px 0 var(--line);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font-size: clamp(0.92rem, 2vw, 1.05rem);
  overflow-wrap: anywhere;
}

.brand small {
  color: var(--soft-ink);
  font-size: 0.75rem;
}

.current-episode-title {
  min-width: 0;
  max-width: min(46rem, 52vw);
  color: var(--soft-ink);
  font-size: clamp(0.86rem, 1.7vw, 1rem);
  font-weight: 850;
  line-height: 1.35;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-credit {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 0.25rem clamp(1rem, 3vw, 2rem) 2rem;
  color: rgba(64, 84, 90, 0.82);
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: center;
}

.site-credit a {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.site-credit a:hover,
.site-credit a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.course-map {
  position: sticky;
  top: 5.25rem;
  align-self: start;
  max-height: calc(100vh - 6.5rem);
  overflow: auto;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 5px 5px 0 var(--line);
}

.course-map h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.course-map p {
  margin: 0 0 0.9rem;
  color: var(--soft-ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

.part-label {
  margin: 1rem 0 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(31, 31, 31, 0.18);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
}

.episode-list {
  display: grid;
  gap: 0.42rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.episode-link {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.58rem 0.68rem;
  border: 2px solid rgba(31, 31, 31, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.episode-link[aria-current="page"] {
  border-color: var(--line);
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--line);
}

.episode-link strong {
  font-size: 0.88rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.episode-link span {
  color: var(--soft-ink);
  font-size: 0.76rem;
}

.reader {
  min-width: 0;
}

.image-manuscript {
  display: grid;
  gap: 0;
  width: min(900px, 100%);
  margin: 0 auto;
  border: 3px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow), 7px 7px 0 var(--line);
}

.generated-panel {
  margin: 0;
  background: #111;
}

.generated-panel + .generated-panel {
  border-top: 8px solid #111;
}

.generated-panel img {
  display: block;
  width: 100%;
  height: auto;
}

.episode {
  display: grid;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
  counter-reset: panel;
}

.episode > section {
  position: relative;
}

.episode > section:not(.episode-cover)::before {
  counter-increment: panel;
  content: "CUT " counter(panel);
  position: absolute;
  top: -0.72rem;
  right: 1rem;
  z-index: 2;
  padding: 0.18rem 0.52rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  box-shadow: 2px 2px 0 var(--line);
}

.episode-cover {
  position: relative;
  overflow: hidden;
  min-height: min(78vh, 720px);
  padding: clamp(1.1rem, 4vw, 2rem);
  border: 3px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 232, 117, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(36, 103, 216, 0.12) 1px, transparent 1px),
    #fff;
  background-size: 30px 30px;
  box-shadow: var(--shadow), 7px 7px 0 var(--line);
}

.episode-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.8rem;
  padding: 0.34rem 0.6rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  font-size: 0.78rem;
  font-weight: 900;
}

.episode-title {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(2.05rem, 7.4vw, 4.65rem);
  line-height: 1.04;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.episode-subtitle {
  max-width: 44rem;
  margin: 1rem 0 1.4rem;
  color: var(--soft-ink);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 700;
  line-height: 1.65;
}

.cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(16rem, 0.9fr);
  gap: 1rem;
  align-items: end;
}

.cover-art {
  margin: 0;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 5px 5px 0 var(--line);
}

.cover-art img {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
}

.cover-callout {
  margin: 0;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--pink);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.65;
}

.cover-callout code,
.formula code,
.note-step code {
  font-family: "SFMono-Regular", Consolas, ui-monospace, monospace;
}

.learning-card {
  display: grid;
  gap: 0.9rem;
  padding: 1.1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 5px 5px 0 var(--line);
}

.learning-card h2,
.block-heading {
  margin: 0;
  font-size: clamp(1.24rem, 3vw, 1.7rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.learning-card ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.65;
}

.webtoon-panel,
.scene-panel,
.note-sheet,
.concept-block,
.history-block,
.compare-block,
.quiz-block,
.next-block {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--line);
}

.webtoon-panel {
  overflow: hidden;
}

.scene-panel {
  overflow: hidden;
  background: #fff;
}

.scene-frame {
  display: grid;
  grid-template-columns: minmax(17rem, 0.82fr) minmax(0, 1.18fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 360px;
  padding: clamp(1rem, 3vw, 1.45rem);
  background:
    linear-gradient(90deg, rgba(31, 31, 31, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(31, 31, 31, 0.07) 1px, transparent 1px),
    #fffdf6;
  background-size: 28px 28px;
}

.scene-copy {
  display: grid;
  align-content: center;
  gap: 0.75rem;
  min-width: 0;
}

.scene-eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 0.25rem 0.6rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 0.8rem;
  font-weight: 950;
  box-shadow: 3px 3px 0 var(--line);
}

.scene-copy h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: 0;
  word-break: keep-all;
}

.scene-copy p {
  margin: 0;
  color: var(--soft-ink);
  font-size: clamp(1rem, 2vw, 1.08rem);
  font-weight: 750;
  line-height: 1.75;
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.scene-tags span {
  padding: 0.28rem 0.55rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  font-size: 0.82rem;
  font-weight: 900;
}

.scene-tags span:nth-child(2) {
  background: var(--pink);
}

.scene-tags span:nth-child(3) {
  background: var(--sky);
}

.scene-art {
  display: grid;
  align-items: center;
  margin: 0;
  padding: 0.6rem;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 5px 5px 0 var(--line);
}

.scene-art img {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
}

.panel-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.75fr);
  gap: 1rem;
  min-height: 270px;
  padding: clamp(1rem, 3vw, 1.45rem);
  background:
    linear-gradient(135deg, rgba(70, 181, 129, 0.16), transparent 45%),
    linear-gradient(90deg, rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    #fbfbff;
  background-size: auto, 28px 28px, 28px 28px, auto;
}

.panel-stage[data-tone="night"] {
  background:
    linear-gradient(135deg, rgba(36, 103, 216, 0.2), transparent 45%),
    linear-gradient(90deg, rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    #f1f7ff;
}

.panel-stage[data-tone="alert"] {
  background:
    linear-gradient(135deg, rgba(240, 111, 89, 0.23), transparent 48%),
    linear-gradient(90deg, rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(31, 31, 31, 0.08) 1px, transparent 1px),
    #fff8f0;
}

.scene-characters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: 0.75rem;
  min-width: 0;
}

.character {
  width: min(38vw, 190px);
  margin: 0;
  text-align: center;
}

.character img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(4px 5px 0 rgba(31, 31, 31, 0.75));
}

.character figcaption {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.18rem 0.5rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.dialogue-stack {
  display: grid;
  align-content: center;
  gap: 0.7rem;
}

.speech {
  position: relative;
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.65;
  box-shadow: 3px 3px 0 rgba(31, 31, 31, 0.9);
}

.speech::before {
  content: attr(data-speaker);
  display: block;
  margin-bottom: 0.25rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 950;
}

.panel-caption {
  margin: 0;
  padding: 0.85rem 1rem;
  border-top: 3px solid var(--line);
  background: var(--ink);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.6;
}

.note-sheet {
  padding: clamp(1rem, 3vw, 1.4rem);
  background:
    linear-gradient(90deg, rgba(240, 111, 89, 0.28) 0 2px, transparent 2px),
    repeating-linear-gradient(
      to bottom,
      #fffef8 0,
      #fffef8 31px,
      rgba(36, 103, 216, 0.18) 32px
    );
  background-position: 3rem 0, 0 0;
}

.note-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.note-head h2 {
  margin: 0;
  font-family: "Comic Sans MS", "Apple SD Gothic Neo", cursive, sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.2;
}

.note-tag {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: var(--yellow);
  font-size: 0.78rem;
  font-weight: 950;
  transform: rotate(1deg);
}

.note-steps {
  display: grid;
  gap: 0.72rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-step {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.5rem 0;
}

.note-step b {
  display: inline-flex;
  justify-content: center;
  padding: 0.2rem 0.4rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  font-size: 0.78rem;
}

.formula {
  margin: 0 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(30, 43, 47, 0.14);
  border-radius: 8px;
  background: #fff;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 900;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.math {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.16em;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.math sub,
.math sup {
  font-size: 0.72em;
  line-height: 0;
}

.frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  margin: 0 0.12em;
  vertical-align: middle;
}

.frac > span:first-child {
  width: 100%;
  padding: 0 0.18em 0.08em;
  border-bottom: 2px solid currentColor;
  text-align: center;
}

.frac > span:last-child {
  padding: 0.08em 0.18em 0;
  text-align: center;
}

.note-step p {
  margin: 0;
  color: var(--soft-ink);
  line-height: 1.7;
}

.concept-block,
.history-block,
.compare-block,
.quiz-block,
.next-block {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.concept-block {
  background: #ffffff;
}

.concept-block p,
.history-block p,
.next-block p {
  margin: 0.7rem 0 0;
  color: var(--soft-ink);
  line-height: 1.75;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.95rem;
}

.idea-chip {
  padding: 0.8rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--sky);
}

.idea-chip:nth-child(2) {
  background: var(--mint);
}

.idea-chip:nth-child(3) {
  background: var(--pink);
}

.idea-chip b {
  display: block;
  margin-bottom: 0.35rem;
}

.idea-chip span {
  color: var(--soft-ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

.timeline {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.78rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.timeline-year {
  display: grid;
  place-items: center;
  min-height: 2.5rem;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--yellow);
  font-weight: 950;
}

.timeline-item h3 {
  margin: 0 0 0.24rem;
  font-size: 1rem;
}

.timeline-item p {
  margin: 0;
}

.compare-block {
  background:
    linear-gradient(90deg, rgba(36, 103, 216, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(36, 103, 216, 0.1) 1px, transparent 1px),
    #fff;
  background-size: 24px 24px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.compare-card {
  display: grid;
  align-content: start;
  min-height: 12rem;
  padding: 0.9rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--line);
}

.compare-card:nth-child(1) {
  background: var(--sky);
}

.compare-card:nth-child(2) {
  background: var(--pink);
}

.compare-card:nth-child(3) {
  background: var(--mint);
}

.compare-card b {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.45rem;
  padding: 0.18rem 0.48rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 0.82rem;
}

.compare-card p {
  margin: 0;
  color: var(--soft-ink);
  line-height: 1.68;
}

.quiz-block {
  background: var(--mint);
}

.quiz-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: quiz;
}

.quiz-list li {
  counter-increment: quiz;
  padding: 0.9rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.65;
}

.quiz-list li::before {
  content: counter(quiz);
  display: inline-grid;
  width: 1.55rem;
  height: 1.55rem;
  margin-right: 0.45rem;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-weight: 950;
  line-height: 1;
}

.answer-hint {
  display: block;
  margin-top: 0.45rem;
  color: var(--soft-ink);
  font-size: 0.9rem;
}

.next-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  background: var(--ink);
  color: #fff;
}

.next-block p {
  color: rgba(255, 255, 255, 0.78);
}

.next-badge {
  display: inline-grid;
  min-width: 5rem;
  min-height: 5rem;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 950;
}

/* Clean study-note mode */
body {
  background:
    linear-gradient(180deg, #f7faf8 0%, #fffdf7 42%, #f7f9fb 100%);
}

.topbar {
  border-bottom: 1px solid rgba(30, 43, 47, 0.16);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(30, 43, 47, 0.06);
}

.brand-mark {
  border: 1px solid rgba(30, 43, 47, 0.25);
  background: #eef7f0;
  box-shadow: none;
}

.app-shell {
  grid-template-columns: minmax(11.5rem, 13.5rem) minmax(0, 1fr);
  gap: clamp(0.85rem, 2vw, 1.35rem);
  width: min(1260px, 100%);
  padding: clamp(0.85rem, 2.4vw, 1.35rem);
}

.course-map {
  top: 4.75rem;
  max-height: calc(100vh - 5.5rem);
  padding: 0.72rem;
  border: 1px solid rgba(30, 43, 47, 0.14);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 34px rgba(30, 43, 47, 0.08);
}

.course-map h2 {
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
}

.course-map p {
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
}

.part-label {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  font-size: 0.68rem;
}

.episode-list {
  gap: 0.28rem;
}

.episode-link {
  gap: 0.12rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(30, 43, 47, 0.14);
  border-radius: 6px;
}

.episode-link[aria-current="page"] {
  border-color: rgba(36, 103, 216, 0.38);
  background: #eef5ff;
  box-shadow: none;
}

.episode-link strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.episode-link span {
  display: none;
}

.episode-link[aria-current="page"] span {
  display: block;
  font-size: 0.68rem;
}

.episode-link.is-disabled {
  opacity: 0.56;
  cursor: default;
}

.study-note {
  display: grid;
  gap: 1rem;
  width: min(1040px, 100%);
  margin: 0 auto;
  scroll-margin-top: 5.75rem;
}

.study-hero,
.study-card,
.study-section {
  border: 1px solid rgba(30, 43, 47, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(30, 43, 47, 0.07);
}

.study-hero {
  padding: clamp(1.25rem, 3vw, 2rem);
  background:
    linear-gradient(90deg, rgba(36, 103, 216, 0.08), transparent 36%),
    #fff;
}

.study-kicker,
.section-kicker {
  margin: 0 0 0.55rem;
  color: #1d5a6b;
  font-size: 0.82rem;
  font-weight: 850;
}

.study-hero h1 {
  max-width: 17ch;
  margin: 0;
  color: #182327;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.14;
  letter-spacing: 0;
  word-break: keep-all;
}

.study-hero p {
  max-width: 52rem;
  margin: 1rem 0 0;
  color: var(--soft-ink);
  font-size: 1.03rem;
  line-height: 1.8;
}

.study-card,
.study-section {
  padding: clamp(1.15rem, 3vw, 1.55rem);
  scroll-margin-top: 5.75rem;
}

.study-card h2,
.study-section h2 {
  margin: 0;
  color: #182327;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.28;
  letter-spacing: 0;
  word-break: keep-all;
}

.study-section > p:not(.section-kicker),
.formula-explain,
.formula-takeaway {
  color: var(--soft-ink);
  font-size: 1rem;
  line-height: 1.78;
}

.study-section > p:not(.section-kicker) {
  margin: 0.75rem 0 1rem;
}

.note-text {
  margin: 0.75rem 0 0;
  color: var(--soft-ink);
  line-height: 1.72;
}

.goal-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
  padding-left: 1.25rem;
  color: var(--soft-ink);
  line-height: 1.7;
}

.formula-grid,
.derivation-box {
  display: grid;
  gap: 0.85rem;
}

.derivation-box {
  margin-top: 1rem;
}

.derivation-box h3 {
  margin: 0 0 0.2rem;
  color: #1d5a6b;
  font-size: 1.06rem;
}

.study-formula {
  padding: 1rem;
  border: 1px solid rgba(30, 43, 47, 0.13);
  border-radius: 8px;
  background: #fff;
}

.formula-label {
  margin: 0 0 0.45rem;
  color: #1d5a6b;
  font-size: 0.9rem;
  font-weight: 850;
}

.formula-history {
  margin: -0.1rem 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: #f2f6f4;
  color: #4b5b60;
  font-size: 0.84rem;
  line-height: 1.5;
}

.formula-display {
  margin: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(30, 43, 47, 0.12);
  border-radius: 6px;
  background: #f7f9fb;
  color: #182327;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 780;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.formula-display .math {
  font-size: 1em;
}

.math sup,
.math sub {
  font-size: 0.68em;
  line-height: 0;
}

.math sup {
  vertical-align: super;
}

.math sub {
  vertical-align: sub;
}

.symbol-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
  margin: 0.75rem 0;
}

.symbol-table div {
  display: grid;
  grid-template-columns: minmax(4.2rem, auto) 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(30, 43, 47, 0.1);
  border-radius: 6px;
  background: #fffdf7;
}

.symbol-table dt {
  color: #1f4f99;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 850;
}

.symbol-table dt .math,
.symbol-table dd .math,
.formula-explain .math,
.formula-takeaway .math {
  display: inline-flex;
}

.symbol-table dd {
  margin: 0;
  color: var(--soft-ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.formula-explain {
  margin: 0.55rem 0 0;
}

.formula-takeaway {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: #eef7f0;
  color: #1e4f43;
  font-weight: 760;
}

.logic-flow {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0;
}

.logic-flow div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid rgba(30, 43, 47, 0.13);
  border-radius: 8px;
  background: #fbfcfa;
}

.logic-flow b {
  color: #8a5b13;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.summary-grid article {
  padding: 1rem;
  border: 1px solid rgba(30, 43, 47, 0.13);
  border-radius: 8px;
  background: #fbfcfa;
}

.summary-grid h3 {
  margin: 0 0 0.65rem;
  color: #1d5a6b;
}

.summary-grid ol {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--soft-ink);
  line-height: 1.65;
}

.episode-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(30, 43, 47, 0.1);
}

.episode-pager a {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(30, 43, 47, 0.14);
  border-radius: 8px;
  background: #fff;
  color: #1d5a6b;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(30, 43, 47, 0.06);
}

.episode-pager .pager-prev {
  grid-column: 1;
}

.episode-pager .pager-next {
  grid-column: 2;
  justify-content: end;
}

.episode-pager a:hover,
.episode-pager a:focus-visible {
  border-color: rgba(36, 103, 216, 0.42);
  background: #eef5ff;
  outline: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .course-map {
    position: static;
    max-height: none;
    order: 2;
  }

  .reader {
    order: 1;
  }

  .cover-grid,
  .panel-stage,
  .scene-frame,
  .concept-grid,
  .compare-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
  }

  .current-episode-title {
    max-width: 100%;
    text-align: left;
    white-space: normal;
  }

  .app-shell {
    padding: 0.75rem;
  }

  .episode-pager {
    grid-template-columns: 1fr;
  }

  .episode-pager .pager-prev,
  .episode-pager .pager-next {
    grid-column: 1;
    justify-content: center;
  }

  .episode-cover {
    min-height: auto;
  }

  .episode-title {
    max-width: 11ch;
  }

  .character {
    width: min(43vw, 150px);
  }

  .note-step,
  .timeline-item,
  .symbol-table,
  .logic-flow div {
    grid-template-columns: 1fr;
  }

  .next-block {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .character img {
    animation: floaty 4.8s ease-in-out infinite;
  }

  .character:nth-child(2) img {
    animation-delay: -1.6s;
  }

  .character:nth-child(3) img {
    animation-delay: -2.4s;
  }

  @keyframes floaty {
    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-8px);
    }
  }
}
