:root {
  color-scheme: light;
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --surface-strong: #e8efed;
  --ink: #121817;
  --muted: #65736f;
  --muted-2: #81908b;
  --line: #d8e1de;
  --line-strong: #b5c5c0;
  --dark: #101918;
  --primary: #0f6f61;
  --primary-strong: #0a4a41;
  --primary-soft: #e7f5f1;
  --blue: #275f93;
  --blue-soft: #e7f0fa;
  --amber: #a76414;
  --amber-soft: #fff0d8;
  --rose: #a94355;
  --rose-soft: #fae8ec;
  --violet: #604b8f;
  --violet-soft: #eee9f8;
  --shadow: 0 16px 36px rgba(18, 24, 23, 0.08);
  --shadow-soft: 0 8px 20px rgba(18, 24, 23, 0.06);
  --radius: 8px;
  --content: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(18, 24, 23, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 24, 23, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  color: var(--ink);
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.62;
  word-break: keep-all;
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.22;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.28;
  letter-spacing: 0;
}

p {
  margin-bottom: 0;
}

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 4px;
  background: transparent;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px max(18px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid rgba(216, 225, 222, 0.95);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--dark);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

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

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.toc {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.toc a {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  color: #40504c;
  font-size: 13px;
  font-weight: 800;
}

.toc a:hover,
.toc a.active {
  background: var(--dark);
  color: #fff;
}

main {
  width: min(var(--content), calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.panel {
  margin-bottom: 24px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.section-label {
  margin: 0 0 10px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.section-heading {
  max-width: 900px;
  margin-bottom: 26px;
}

.section-heading p:not(.section-label) {
  color: var(--muted);
  font-size: 17px;
}

.lead {
  max-width: 780px;
  color: #3f504b;
  font-size: 19px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, 0.9fr);
  gap: 32px;
  align-items: stretch;
  min-height: 520px;
  padding-top: 42px;
  padding-bottom: 42px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn,
.tab-button,
.step-btn,
.query-btn,
.chunk-btn,
.api-choice,
.copy-button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.btn:hover,
.tab-button:hover,
.step-btn:hover,
.query-btn:hover,
.chunk-btn:hover,
.api-choice:hover,
.copy-button:hover {
  transform: translateY(-1px);
  border-color: #8fa39d;
  box-shadow: var(--shadow-soft);
}

.btn:focus-visible,
.tab-button:focus-visible,
.step-btn:focus-visible,
.query-btn:focus-visible,
.chunk-btn:focus-visible,
.api-choice:focus-visible,
.copy-button:focus-visible {
  outline: 3px solid rgba(15, 111, 97, 0.24);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
}

.btn.primary,
.copy-button {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

.btn.primary::after {
  content: "→";
  font-weight: 900;
}

.hero-demo {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 18px;
  border: 1px solid #cbd8d4;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #f9fcfb, #edf4f2);
}

.demo-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.demo-node {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 0 rgba(18, 24, 23, 0.04);
}

.demo-node span {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
}

.demo-node strong,
.demo-node small {
  display: block;
}

.demo-node strong {
  font-size: 21px;
  line-height: 1.25;
}

.demo-node small {
  margin-top: 6px;
  color: var(--muted);
}

.demo-arrow {
  position: relative;
  width: 2px;
  height: 26px;
  margin: -2px auto;
  background: var(--line-strong);
}

.demo-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  transform: translateX(-50%) rotate(45deg);
}

.concept-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.concept-strip article {
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.concept-strip article:nth-child(3n + 1) b {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.concept-strip article:nth-child(3n + 2) b {
  background: var(--blue-soft);
  color: var(--blue);
}

.concept-strip article:nth-child(3n) b {
  background: var(--amber-soft);
  color: var(--amber);
}

.concept-strip b {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.concept-strip strong,
.concept-strip p {
  display: block;
}

.concept-strip strong {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.28;
}

.concept-strip p {
  color: var(--muted);
  font-size: 15px;
}

.lesson-panel {
  scroll-margin-top: 92px;
}

.interactive-grid {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.interactive-grid.wide-left {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.interactive-grid > *,
.rag-workbench > *,
.rag-pipeline > *,
.api-simulator > *,
.db-demo > * {
  min-width: 0;
}

.control-card,
.context-lab,
.embedding-stage,
.doc-card,
.retrieval-card,
.phone-card,
.api-log,
.api-menu,
.sheet-card,
.normalize-card,
.schema-card,
.case-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.control-card {
  padding: 20px;
  background: var(--surface-soft);
}

.control-card p {
  color: var(--muted);
}

.step-buttons,
.query-buttons,
.api-menu {
  display: grid;
  gap: 10px;
}

.step-btn,
.query-btn,
.chunk-btn,
.api-choice,
.tab-button {
  position: relative;
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}

.step-btn::after,
.query-btn::after,
.chunk-btn::after,
.api-choice::after,
.tab-button::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.38;
  transform: rotate(-45deg);
}

.step-btn.active,
.query-btn.active,
.chunk-btn.active,
.api-choice.active,
.tab-button.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
  box-shadow: 0 10px 22px rgba(16, 25, 24, 0.16);
}

.teacher-script {
  margin-top: 16px;
  min-height: 110px;
  padding: 16px;
  border: 1px solid #bfddd5;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: #214a42;
  font-weight: 800;
}

.context-lab {
  padding: 20px;
}

.lab-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.lab-title strong {
  font-size: 16px;
}

.lab-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.context-rail {
  display: grid;
  gap: 10px;
}

.context-block {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  opacity: 0.34;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.context-block.active {
  opacity: 1;
  border-color: #b7d8d0;
  border-left-color: var(--primary);
  background: #fbfffd;
}

.context-block b,
.context-block p {
  display: block;
}

.context-block b {
  font-size: 14px;
}

.context-block p {
  color: var(--muted);
}

.meter {
  height: 12px;
  margin: 18px 0;
  border-radius: 999px;
  background: #dce7e3;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

.prediction-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.prediction-box > span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

#tokenChoices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token-chip {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #33433e;
  font-weight: 800;
}

.token-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(15, 111, 97, 0.12);
}

.embedding-stage {
  padding: 18px;
  background: #f9fbfb;
  overflow: hidden;
}

.embedding-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 470px;
}

.graph-bg {
  fill: #ffffff;
  stroke: #dbe5e2;
}

.axis-line {
  stroke: #31413a;
  stroke-width: 2.8;
}

.axis-label {
  fill: #2e3e39;
  font-size: 16px;
  font-weight: 900;
}

.grid-lines line {
  stroke: #dbe5e2;
  stroke-width: 1.2;
}

.near-line {
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.76;
}

.query-line {
  stroke: #c87920;
  stroke-width: 3;
  stroke-dasharray: 8 7;
  stroke-linecap: round;
}

.query-marker circle {
  fill: #c87920;
  stroke: #fff;
  stroke-width: 4;
}

.query-badge rect {
  fill: #fff8ec;
  stroke: #e8c994;
}

.query-badge text {
  fill: #5d3b10;
  font-size: 15px;
  font-weight: 900;
}

.label-guide {
  stroke: #83948e;
  stroke-width: 1.6;
  stroke-dasharray: 4 6;
}

.embedding-item {
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.embedding-item.dim {
  opacity: 0.28;
}

.embedding-item.focus {
  opacity: 1;
}

.embedding-point circle {
  fill: var(--primary);
  stroke: #fff;
  stroke-width: 5;
}

.embedding-point.focus circle {
  stroke: #101918;
  stroke-width: 4;
}

.point-cat circle {
  fill: var(--blue);
}

.point-icecream circle {
  fill: var(--rose);
}

.point-meeting circle {
  fill: var(--violet);
}

.point-label rect {
  fill: #fff;
  stroke: #d0ddd9;
  filter: url(#labelShadow);
}

.point-label text {
  fill: #24332e;
  font-size: 15px;
  font-weight: 900;
}

.point-label.focus rect {
  stroke: var(--dark);
  stroke-width: 1.8;
}

.ranking-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ranking-card > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.ranking-card ol {
  margin: 12px 0 0;
  padding-left: 22px;
}

.ranking-card li {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.ranking-card li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.ranking-card b,
.ranking-card small {
  display: block;
}

.ranking-card b {
  line-height: 1.35;
}

.ranking-card small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.rag-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
}

.doc-card,
.retrieval-card,
.sheet-card {
  padding: 20px;
}

.doc-card pre {
  margin: 0;
  padding: 20px;
  border-radius: var(--radius);
  background: #121b1a;
  color: #e8f3ee;
  white-space: pre-wrap;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
}

.rag-pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
  gap: 20px;
  margin-top: 20px;
}

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

.chunk-card {
  min-height: 150px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.chunk-card.selected {
  border-color: #8fc8ba;
  background: var(--primary-soft);
}

.chunk-card span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
}

.chunk-card p {
  color: #41514b;
  font-weight: 700;
}

.chunk-card mark {
  display: inline;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff0c7;
  color: #5c3d0a;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.retrieval-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.retrieval-flow div {
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 8px;
  border: 1px solid #cfe0ed;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #214c72;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.context-result {
  padding: 15px;
  border: 1px solid #bfddd5;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: #244940;
  font-weight: 700;
}

.api-simulator {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: stretch;
}

.phone-card {
  display: grid;
  gap: 16px;
  align-content: center;
  justify-items: start;
  min-height: 270px;
  padding: 24px;
  background: var(--dark);
  color: #fff;
}

.phone-card span {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 900;
}

.phone-card strong {
  font-size: 24px;
  line-height: 1.32;
}

.phone-card .btn.primary {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--primary);
}

.api-log {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px;
  background: var(--surface-soft);
}

.log-line {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #33413b;
  font-weight: 750;
}

.log-line.muted {
  color: var(--muted);
}

.api-menu {
  padding: 14px;
  background: #fff;
}

.db-demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
}

.wide-sheet {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.wide-sheet table {
  min-width: 820px;
  table-layout: auto;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  overflow-wrap: anywhere;
}

th {
  background: var(--surface-strong);
  color: #2d3b35;
  font-weight: 900;
}

td {
  color: #45534e;
}

.problem-note {
  margin: 14px 0 0;
  color: var(--rose);
  font-weight: 900;
}

.normalize-card {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 20px;
  background: var(--amber-soft);
}

.normalize-card p {
  color: #66420e;
}

.schema-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 18px;
  opacity: 0.32;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.schema-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

.schema-card article {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.schema-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--primary-strong);
  font-weight: 900;
}

.schema-table-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.schema-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.schema-table-wrap table {
  min-width: 620px;
  table-layout: auto;
}

.schema-relationship {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px solid #bfddd5;
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.schema-relationship b {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-strong);
}

.schema-relationship p {
  color: #244940;
  font-weight: 750;
}

.schema-relationship code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #fff;
  color: var(--primary-strong);
}

.case-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.tab-button {
  min-height: 44px;
  padding: 10px 14px;
  text-align: center;
}

.case-menu .tab-button {
  display: grid;
  min-height: 138px;
  align-content: start;
  justify-content: stretch;
  gap: 6px;
  padding: 16px;
  text-align: left;
}

.case-menu .tab-button::after {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.case-menu .tab-button span,
.case-menu .tab-button strong,
.case-menu .tab-button small {
  display: block;
}

.case-menu .tab-button span {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
}

.case-menu .tab-button strong {
  font-size: 20px;
  line-height: 1.2;
}

.case-menu .tab-button small {
  max-width: 210px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.case-menu .tab-button.active span,
.case-menu .tab-button.active small {
  color: rgba(255, 255, 255, 0.72);
}

.case-panel {
  overflow: hidden;
}

.case-summary {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.case-summary span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 900;
}

.case-summary p {
  color: var(--muted);
}

.case-detail h4 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.28;
}

.case-pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.case-pipeline div {
  min-height: 150px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.case-pipeline span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.case-pipeline b {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.case-pipeline p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.case-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.case-detail-grid article {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.case-detail-grid p {
  color: var(--muted);
}

.context-stack {
  margin: 0 18px 18px;
  padding: 18px;
  border: 1px solid #bfddd5;
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.context-stack ol {
  margin: 0;
  padding-left: 22px;
}

.context-stack li {
  margin-bottom: 8px;
  color: #244940;
  font-weight: 750;
}

.context-stack li:last-child {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--dark);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .toc {
    width: 100%;
  }

  .hero,
  .interactive-grid,
  .interactive-grid.wide-left,
  .rag-workbench,
  .rag-pipeline,
  .api-simulator,
  .db-demo {
    grid-template-columns: 1fr;
  }

  .api-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  main {
    width: min(100% - 24px, var(--content));
    padding-top: 16px;
  }

  .topbar {
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .panel {
    padding: 22px;
  }

  .hero {
    min-height: auto;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .lead {
    font-size: 17px;
  }

  .demo-row,
  .chunk-output,
  .retrieval-flow,
  .schema-card,
  .case-menu,
  .case-pipeline,
  .case-detail-grid,
  .api-menu {
    grid-template-columns: 1fr;
  }

  .context-block {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .embedding-stage {
    padding: 10px;
  }

  .embedding-svg {
    min-height: 360px;
  }

  .lab-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  body {
    background-size: 28px 28px;
  }

  .brand small {
    display: none;
  }

  .toc a {
    padding: 7px 10px;
    font-size: 12px;
  }

  .panel {
    padding: 18px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  .copy-button {
    width: 100%;
  }

  .demo-node {
    min-height: 118px;
  }

  .concept-strip {
    grid-template-columns: 1fr;
  }

  .step-btn,
  .query-btn,
  .chunk-btn,
  .api-choice,
  .tab-button {
    min-height: 48px;
  }

  .embedding-svg text {
    font-size: 14px;
  }

  .query-marker text,
  .point-label text {
    font-size: 15px;
  }
}
