:root {
  color-scheme: light;
  --paper: #f3f6f8;
  --paper-strong: #e9eef3;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef3f6;
  --ink: #141a1f;
  --ink-soft: #28323d;
  --muted: #65717e;
  --muted-strong: #4c5967;
  --line: #d7dee6;
  --line-strong: #bdc7d2;
  --teal: #0f766e;
  --teal-soft: #dff5f1;
  --coral: #bd4b35;
  --coral-soft: #fde8e0;
  --gold: #9f6b16;
  --gold-soft: #fff2cc;
  --blue: #2b6f9f;
  --blue-soft: #e3f0f8;
  --shadow: 0 18px 50px rgba(20, 26, 31, 0.1);
  --shadow-soft: 0 10px 30px rgba(20, 26, 31, 0.08);
  --radius: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(189, 75, 53, 0.08), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(20, 26, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 26, 31, 0.026) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 70%);
}

button,
summary {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
summary:focus-visible,
.deck:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 3px;
}

.app-shell {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 78px minmax(0, 1fr) 76px;
  background: rgba(255, 255, 255, 0.2);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(189, 199, 210, 0.82);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid rgba(15, 118, 110, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(223, 245, 241, 0.72)),
    var(--teal-soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 12px 28px rgba(15, 118, 110, 0.16);
  flex: 0 0 auto;
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
}

.brand-mark::before {
  border: 2px solid var(--teal);
}

.brand-mark::after {
  inset: 17px;
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(189, 75, 53, 0.12);
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.18;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span:not(.brand-mark) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand > div {
  min-width: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.subject-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.subject-tab {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.42s var(--ease), color 0.42s var(--ease), transform 0.42s var(--ease), box-shadow 0.42s var(--ease);
}

.subject-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.subject-tab.active {
  color: #ffffff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(20, 26, 31, 0.18);
}

.icon-button,
.nav-button {
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.42s var(--ease), background 0.42s var(--ease), border-color 0.42s var(--ease), color 0.42s var(--ease);
}

.icon-button {
  width: 44px;
  height: 44px;
}

.nav-button {
  width: 50px;
  height: 50px;
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.icon-button:hover,
.nav-button:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
}

.icon-button:active,
.nav-button:active,
.subject-tab:active,
.rail-button:active {
  transform: scale(0.98);
}

.icon-button[aria-pressed="true"] {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.38);
}

.icon-button svg,
.nav-button svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.slide-rail {
  grid-row: 2 / 4;
  grid-column: 1;
  padding: 16px 14px 18px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.92)),
    var(--surface-soft);
}

.slide-rail::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.slide-rail::-webkit-scrollbar-track {
  background: transparent;
}

.slide-rail::-webkit-scrollbar-thumb {
  background: #bdc7d2;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.rail-button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 9px;
  margin-bottom: 8px;
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background 0.42s var(--ease), border-color 0.42s var(--ease), color 0.42s var(--ease), transform 0.42s var(--ease), box-shadow 0.42s var(--ease);
}

.rail-button .rail-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 850;
  color: var(--teal);
  background: var(--teal-soft);
}

.rail-button span:last-child {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.rail-button:hover,
.rail-button.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 10px 26px rgba(20, 26, 31, 0.08);
}

.rail-button.active .rail-num {
  color: white;
  background: var(--teal);
}

.deck {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.slide {
  height: 100%;
  overflow-y: auto;
  padding: 34px clamp(20px, 4.2vw, 58px) 36px;
  animation: fadeInUp 0.58s var(--ease) both;
}

.slide::-webkit-scrollbar {
  width: 10px;
}

.slide::-webkit-scrollbar-track {
  background: transparent;
}

.slide::-webkit-scrollbar-thumb {
  background: #bdc7d2;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.slide[data-theme="lens"],
.slide[data-theme="orbit"],
.slide[data-theme="tear"],
.slide[data-theme="muscle"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(243, 246, 248, 0.92)),
    var(--paper);
}

.slide-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(15, 118, 110, 0.18);
  font-size: 12px;
  font-weight: 850;
}

.slide h1 {
  max-width: 980px;
  margin: 13px 0 10px;
  font-size: clamp(34px, 4.1vw, 58px);
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 900;
  text-wrap: balance;
}

.slide h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 850;
}

.lead {
  max-width: 860px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 18px;
  line-height: 1.78;
  font-weight: 520;
}

.source-chip {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

.slide-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.52fr);
  gap: 22px;
  align-items: start;
}

.study-panel,
.visual-panel,
.section-panel,
.question-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.study-panel,
.visual-panel,
.section-panel {
  padding: 20px;
}

.visual-panel {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.96)),
    var(--surface);
}

.eye-asset {
  display: block;
  width: 100%;
  max-height: 310px;
  object-fit: contain;
  filter: saturate(0.94) contrast(1.03);
}

.pdf-figure {
  margin: 0;
  display: grid;
  gap: 10px;
}

.pdf-figure img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(20, 26, 31, 0.08);
}

.pdf-figure figcaption {
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 750;
}

.image-notes {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 9px;
}

.image-notes li {
  padding: 10px 11px;
  border-radius: var(--radius);
  background: #eef7f5;
  border: 1px solid rgba(15, 118, 110, 0.16);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 680;
}

.summary-list,
.section-list,
.hot-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 11px;
}

.summary-list li,
.section-list li,
.hot-list li {
  position: relative;
  padding-left: 21px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.68;
  font-weight: 560;
}

.summary-list li::before,
.section-list li::before,
.hot-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(189, 75, 53, 0.1);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.section-panel {
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.58s var(--ease) both;
}

.section-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--coral), var(--gold));
}

.section-panel strong {
  display: block;
  margin-bottom: 12px;
  color: var(--teal);
  font-size: 15px;
  font-weight: 900;
}

.visual-stack {
  display: grid;
  gap: 14px;
}

.mini-diagram {
  min-height: 190px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(238, 243, 246, 0.92)),
    var(--surface-soft);
  overflow: hidden;
}

.diagram-lens {
  width: 220px;
  height: 138px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.92) 0 20%, transparent 21%),
    linear-gradient(90deg, #e6b84a, #fff6ce 50%, #e6b84a);
  border: 5px solid #7a5613;
  position: relative;
}

.diagram-lens::before,
.diagram-lens::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 58px;
  height: 4px;
  background: var(--teal);
}

.diagram-lens::before {
  left: -70px;
}

.diagram-lens::after {
  right: -70px;
}

.diagram-flow {
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 14px;
}

.flow-step {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #154764;
  border: 1px solid rgba(43, 111, 159, 0.16);
  font-weight: 850;
  text-align: center;
}

.flow-arrow {
  text-align: center;
  color: var(--coral);
  font-weight: 900;
}

.diagram-orbit,
.diagram-muscle,
.diagram-tear {
  width: min(255px, 100%);
  aspect-ratio: 1 / 1;
  position: relative;
}

.diagram-frame,
.diagram-prism,
.diagram-fitting,
.diagram-lensmeter {
  width: min(280px, 100%);
  min-height: 180px;
  position: relative;
}

.diagram-frame {
  display: grid;
  place-items: center;
}

.frame-code {
  display: grid;
  grid-template-columns: 82px 44px 82px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 35px;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.frame-code span {
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 3px solid var(--teal);
  border-radius: var(--radius);
  background: var(--teal-soft);
}

.frame-code small {
  display: grid;
  place-items: center;
  min-height: 44px;
  color: var(--coral);
}

.frame-labels {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diagram-prism {
  display: grid;
  place-items: center;
}

.prism-lens {
  width: 176px;
  height: 116px;
  clip-path: polygon(8% 50%, 92% 10%, 92% 90%);
  background: linear-gradient(90deg, var(--coral-soft), #ffffff);
  border: 4px solid var(--coral);
}

.prism-formula {
  margin-top: 14px;
  text-align: center;
  color: var(--teal);
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.diagram-fitting {
  display: grid;
  gap: 10px;
  align-content: center;
}

.fit-step {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--coral-soft);
  color: #73321e;
  border: 1px solid rgba(189, 75, 53, 0.16);
  font-weight: 900;
  text-align: center;
}

.diagram-lensmeter {
  display: grid;
  place-items: center;
}

.meter-body {
  width: 194px;
  height: 132px;
  border-radius: 8px 8px 26px 26px;
  border: 5px solid var(--blue);
  background: var(--blue-soft);
  position: relative;
}

.meter-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 22px;
  width: 78px;
  height: 78px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 5px solid var(--teal);
  background: #ffffff;
}

.meter-body::after {
  content: "D";
  position: absolute;
  left: 50%;
  top: 44px;
  transform: translateX(-50%);
  color: var(--coral);
  font-size: 29px;
  font-weight: 900;
}

.diagram-wave,
.diagram-mirror {
  width: min(280px, 100%);
  min-height: 180px;
  display: grid;
  place-items: center;
  position: relative;
}

.wave-line {
  width: 235px;
  height: 92px;
  background:
    radial-gradient(ellipse at center, transparent 0 55%, var(--teal) 56% 60%, transparent 61%) 0 0 / 78px 92px repeat-x;
  position: relative;
}

.wave-line::after {
  content: "λ";
  position: absolute;
  right: 12px;
  top: 24px;
  color: var(--coral);
  font-size: 34px;
  font-weight: 900;
}

.mirror-plane {
  width: 214px;
  height: 8px;
  background: var(--blue);
  transform: rotate(-24deg);
  border-radius: 999px;
  position: relative;
}

.mirror-plane::before,
.mirror-plane::after {
  content: "";
  position: absolute;
  width: 112px;
  height: 4px;
  background: var(--coral);
  transform-origin: right center;
  right: 54%;
  top: -46px;
}

.mirror-plane::before {
  transform: rotate(42deg);
}

.mirror-plane::after {
  transform: rotate(-42deg);
  top: 50px;
  background: var(--teal);
}

.diagram-orbit {
  border: 7px solid var(--blue);
  clip-path: polygon(50% 5%, 92% 30%, 82% 82%, 50% 97%, 18% 82%, 8% 30%);
  background: #ecf6f8;
}

.diagram-orbit span,
.diagram-muscle span,
.diagram-tear span {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 28px;
  padding: 4px 7px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.diagram-orbit .top {
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
}

.diagram-orbit .side {
  right: 14px;
  top: 45%;
}

.diagram-orbit .hole {
  left: 50%;
  bottom: 35px;
  transform: translateX(-50%);
  background: var(--coral);
}

.diagram-muscle {
  border: 3px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(var(--line), var(--line)) 50% 0 / 2px 100% no-repeat,
    linear-gradient(90deg, var(--line), var(--line)) 0 50% / 100% 2px no-repeat,
    #ffffff;
}

.diagram-muscle .up {
  left: 50%;
  top: 13px;
  transform: translateX(-50%);
  background: var(--teal);
}

.diagram-muscle .out {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--coral);
}

.diagram-muscle .in {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--blue);
}

.diagram-muscle .long {
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  background: var(--gold);
}

.diagram-tear {
  display: grid;
  gap: 9px;
  align-content: center;
}

.tear-layer {
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 900;
}

.tear-layer.lipid {
  background: var(--gold-soft);
}

.tear-layer.aqueous {
  background: var(--blue-soft);
}

.tear-layer.mucin {
  background: var(--teal-soft);
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.question-card {
  padding: 18px;
  display: grid;
  gap: 13px;
  min-height: 286px;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.58s var(--ease) both;
}

.question-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--line-strong);
}

.question-card.hot {
  border-color: rgba(159, 107, 22, 0.38);
  background: linear-gradient(180deg, #fffdf8, #fff8e9);
}

.question-card.hot::before {
  background: linear-gradient(90deg, var(--gold), var(--coral));
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.pill.hot-pill {
  background: var(--gold-soft);
  color: #73500a;
}

.question-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.52;
  font-weight: 850;
}

.answer-block {
  display: grid;
  gap: 9px;
}

.exam-mode .answer-block {
  display: none;
}

.answer {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(20, 26, 31, 0.18);
}

.answer small {
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 850;
}

.note {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.68;
  font-size: 14px;
  font-weight: 540;
}

.intent-note,
.term-note,
.concept-note {
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.intent-note {
  background: #eef7f5;
}

.term-note {
  background: #fff7e4;
}

.concept-note {
  background: #f6f8ff;
}

.note b {
  display: inline-flex;
  align-items: center;
  min-width: 82px;
  margin-right: 6px;
  color: var(--coral);
  font-weight: 900;
}

.choices {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.choices summary {
  width: fit-content;
  color: var(--blue);
  font-weight: 850;
  cursor: pointer;
  font-size: 13px;
}

.choice-list {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
}

.choice-list li.correct {
  color: var(--teal);
  font-weight: 900;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cheat-table th,
.cheat-table td {
  padding: 15px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.62;
}

.cheat-table th {
  width: 28%;
  color: var(--teal);
  background: var(--teal-soft);
  font-weight: 900;
}

.cheat-table td {
  color: var(--ink-soft);
  font-weight: 570;
}

.cheat-table tr:last-child th,
.cheat-table tr:last-child td {
  border-bottom: 0;
}

.controlbar {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(20px, 4.2vw, 58px);
  border-top: 1px solid rgba(189, 199, 210, 0.82);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.85) inset;
  z-index: 4;
}

.progress-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.progress-meter {
  height: 10px;
  border-radius: 999px;
  background: #dfe6ee;
  overflow: hidden;
}

.progress-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  border-radius: inherit;
  transition: width 0.42s var(--ease);
}

#progressLabel {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 981px) {
  body::before {
    opacity: 0.18;
  }

  .app-shell {
    grid-template-columns: 228px minmax(0, 1fr);
    grid-template-rows: 68px minmax(0, 1fr) 58px;
  }

  .topbar {
    gap: 14px;
    padding: 10px 18px;
  }

  .brand {
    flex: 0 0 218px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .subject-tabs {
    flex: 1 1 auto;
    justify-content: flex-start;
    max-width: min(780px, 54vw);
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .subject-tab {
    min-height: 35px;
    padding: 7px 11px;
    font-size: 12.5px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .slide-rail {
    padding: 14px 13px 16px;
  }

  .rail-button {
    grid-template-columns: 32px 1fr;
    gap: 9px;
    padding: 9px;
  }

  .rail-button .rail-num {
    width: 32px;
    height: 32px;
  }

  .rail-button span:last-child {
    font-size: 12.5px;
    line-height: 1.32;
  }

  .slide {
    padding: 24px clamp(24px, 3vw, 52px) 30px;
  }

  .slide-head,
  .slide-layout {
    width: min(100%, 1500px);
    margin-inline: auto;
  }

  .slide-head {
    gap: 18px;
    margin-bottom: 18px;
  }

  .slide h1 {
    max-width: 1120px;
    margin: 9px 0 7px;
    font-size: clamp(34px, 2.8vw, 48px);
    line-height: 1.1;
  }

  .lead {
    max-width: 1040px;
    font-size: 17px;
    line-height: 1.62;
  }

  .source-chip {
    min-height: 34px;
    padding: 7px 11px;
    box-shadow: var(--shadow-soft);
  }

  .slide-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .visual-stack {
    min-width: 0;
    grid-template-columns: minmax(560px, 1.35fr) minmax(260px, 0.65fr);
    align-items: start;
    gap: 18px;
  }

  .slide-layout > div {
    min-width: 0;
    display: grid;
    gap: 18px;
  }

  .study-panel,
  .visual-panel,
  .section-panel,
  .question-card,
  .cheat-table {
    box-shadow: var(--shadow-soft);
  }

  .study-panel,
  .visual-panel,
  .section-panel {
    padding: 22px;
  }

  .pdf-figure {
    gap: 12px;
  }

  .pdf-figure img {
    max-height: min(56vh, 540px);
  }

  .pdf-figure figcaption {
    font-size: 14.5px;
    line-height: 1.6;
  }

  .image-notes {
    gap: 10px;
    margin-top: 16px;
  }

  .image-notes li {
    padding: 12px 13px;
    font-size: 15px;
    line-height: 1.62;
  }

  .slide h2 {
    margin-bottom: 14px;
    font-size: 19px;
    line-height: 1.35;
  }

  .summary-list,
  .section-list,
  .hot-list {
    gap: 12px;
  }

  .summary-list li,
  .section-list li,
  .hot-list li {
    font-size: 16px;
    line-height: 1.66;
  }

  .section-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 0;
  }

  .section-panel strong {
    font-size: 16px;
    line-height: 1.45;
  }

  .question-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .question-card {
    min-height: 0;
    padding: 22px 24px;
    gap: 14px;
  }

  .question-card h3 {
    font-size: 19px;
    line-height: 1.48;
  }

  .answer-block {
    gap: 10px;
  }

  .answer {
    padding: 13px 14px;
    font-size: 18px;
  }

  .note {
    font-size: 15.5px;
    line-height: 1.68;
  }

  .intent-note,
  .term-note,
  .concept-note {
    padding: 13px 14px;
  }

  .note b {
    display: block;
    min-width: 0;
    margin: 0 0 4px;
  }

  .choices {
    padding-top: 12px;
  }

  .choices summary,
  .choice-list {
    font-size: 14px;
  }

  .cheat-table th,
  .cheat-table td {
    padding: 17px 18px;
    line-height: 1.66;
  }

  .controlbar {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 12px;
    padding: 8px clamp(24px, 3vw, 52px);
  }

  .nav-button {
    width: 42px;
    height: 42px;
  }
}

@media (min-width: 1440px) {
  .slide-layout {
    grid-template-columns: minmax(500px, 0.9fr) minmax(560px, 1.1fr);
    gap: 30px;
  }

  .visual-stack {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pdf-figure img {
    max-height: min(61vh, 640px);
  }

  .section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) 76px;
  }

  .slide-rail {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 11px 12px;
  }

  .rail-button {
    width: 142px;
    flex: 0 0 142px;
    margin-bottom: 0;
    grid-template-columns: 28px 1fr;
  }

  .rail-button .rail-num {
    width: 28px;
    height: 28px;
  }

  .rail-button span:last-child {
    font-size: 12px;
  }

  .deck {
    grid-column: 1;
    grid-row: 3;
  }

  .controlbar {
    grid-column: 1;
    grid-row: 4;
  }

  .slide-layout {
    grid-template-columns: 1fr;
  }

  .source-chip {
    justify-self: start;
  }

  .subject-tabs {
    order: 3;
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .topbar {
    height: auto;
    min-height: 92px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
    row-gap: 8px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span:not(.brand-mark) {
    max-width: 210px;
  }

  .subject-tabs {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .subject-tab {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .slide {
    padding: 24px 14px 30px;
  }

  .slide-head {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-bottom: 18px;
  }

  .slide h1 {
    font-size: clamp(29px, 9vw, 36px);
    line-height: 1.16;
  }

  .lead {
    font-size: 15px;
    line-height: 1.72;
  }

  .study-panel,
  .visual-panel,
  .section-panel {
    padding: 16px;
  }

  .mini-diagram {
    min-height: 164px;
  }

  .question-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .question-card {
    min-height: auto;
    padding: 16px;
  }

  .question-card h3 {
    font-size: 16px;
  }

  .answer {
    font-size: 16px;
  }

  .controlbar {
    padding: 12px 14px;
  }

  .cheat-table,
  .cheat-table tbody,
  .cheat-table tr,
  .cheat-table th,
  .cheat-table td {
    display: block;
    width: 100%;
  }

  .cheat-table th {
    border-bottom: 0;
  }
}
