:root {
  color-scheme: light dark;
  --bg: #f3f0e8;
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: #fbfaf6;
  --text: #17211d;
  --muted: #6f766f;
  --line: rgba(23, 33, 29, 0.14);
  --accent: #315f4c;
  --accent-soft: #dfe8e1;
  --decision: #0f1412;
  --warning: #9a5a34;
  --shadow: 0 28px 70px rgba(31, 41, 36, 0.08);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 13px;
  --max: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: rgba(25, 34, 30, 0.72);
    --surface-strong: #161e1a;
    --text: #f0f1eb;
    --muted: #a3ada6;
    --line: rgba(239, 242, 236, 0.14);
    --accent: #91b9a4;
    --accent-soft: #213229;
    --decision: #eff1ec;
    --warning: #dfa780;
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% 0%, rgba(111, 151, 130, 0.13), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page-shell { width: min(100%, 1600px); margin: 0 auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 20px 0 14px;
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 760; letter-spacing: .18em; }
.brand-mark { width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 50% 50% 50% 12%; transform: rotate(-32deg); }
.nav-actions { display: flex; gap: 10px; }
.text-button, .inline-button, .icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.text-button { color: var(--muted); font-size: 13px; padding: 8px 0; }
.text-button:hover, .inline-button:hover { color: var(--text); }

.hero {
  min-height: calc(100svh - 76px);
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: clamp(36px, 7vw, 96px);
  align-items: center;
  padding: 60px 0 90px;
}
.eyebrow, .panel-kicker, .mini-label {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .17em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 24px;
  max-width: 900px;
  font-size: clamp(48px, 7.4vw, 102px);
  line-height: .96;
  font-weight: 530;
  letter-spacing: -.055em;
}
.hero-lede {
  max-width: 700px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 19px;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.primary-button { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.secondary-button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.microcopy { margin: 20px 0 0; color: var(--muted); font-size: 12px; }

.principle-card {
  align-self: center;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.principle-label { color: var(--muted); font-size: 12px; }
.principle-card blockquote { margin: 12px 0 18px; font-size: clamp(25px, 3vw, 38px); line-height: 1.15; letter-spacing: -.035em; }
.principle-card > p:last-of-type { color: var(--muted); }
.principle-route { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.simulator-section {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 70px 0 100px;
  scroll-margin-top: 72px;
}
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 28px; }
.section-heading h2, .closing h2, .drawer-header h2 { margin-bottom: 0; font-size: clamp(34px, 5vw, 62px); line-height: 1.02; letter-spacing: -.045em; font-weight: 540; }
.status-badge { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; letter-spacing: .12em; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #bc8a5f; box-shadow: 0 0 0 4px rgba(188, 138, 95, .14); }

.scenario-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 18px;
  scrollbar-width: none;
}
.scenario-tabs::-webkit-scrollbar { display: none; }
.scenario-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}
.scenario-tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.simulator-grid { display: grid; grid-template-columns: 1fr 1.08fr .92fr; gap: 14px; }
.context-panel, .decision-panel, .learning-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: clamp(22px, 3vw, 30px);
}
.decision-panel { background: var(--surface-strong); box-shadow: var(--shadow); }
.panel-heading h3 { font-size: 21px; font-weight: 580; letter-spacing: -.02em; }
.context-list, .judgment-list { display: grid; gap: 9px; }
.context-item, .judgment-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.context-item span:first-child, .judgment-item span:first-child { color: var(--muted); font-size: 13px; }
.context-item strong, .judgment-item strong { text-align: right; font-size: 13px; font-weight: 620; }
.panel-note { margin: auto 0 0; padding-top: 24px; color: var(--muted); font-size: 12px; }

.decision-result {
  margin-top: auto;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--text);
  color: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}
.decision-label { margin-bottom: 7px; font-size: 10px; letter-spacing: .16em; opacity: .62; }
.decision-action { margin: 0; font-size: clamp(25px, 3vw, 38px); line-height: 1; letter-spacing: -.04em; }
.decision-chip { padding: 7px 9px; border: 1px solid currentColor; border-radius: 999px; font-size: 10px; letter-spacing: .12em; opacity: .8; }
.decision-reason { margin: 16px 0 0; color: var(--muted); font-size: 13px; }

.learning-body { display: flex; flex: 1; flex-direction: column; }
.learning-body > p { color: var(--muted); font-size: 15px; }
.boundary-box {
  margin-top: auto;
  display: flex;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
}
.boundary-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border: 1px solid var(--line); border-radius: 50%; }
.boundary-box strong { display: block; margin-bottom: 4px; font-size: 13px; }
.boundary-box p { margin: 0; color: var(--muted); font-size: 12px; }

.simulator-footer { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-top: 18px; padding: 18px 2px; color: var(--muted); font-size: 12px; }
.simulator-footer p { margin: 0; max-width: 820px; }
.inline-button { color: var(--accent); padding: 8px 0; text-align: left; }

.closing {
  min-height: 64svh;
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 80px 0;
}
.closing h2 { margin-bottom: 20px; max-width: 800px; font-size: clamp(48px, 7vw, 88px); }
.closing > p:not(.eyebrow) { max-width: 560px; color: var(--muted); font-size: 18px; }
.footer {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.drawer {
  width: min(760px, calc(100% - 24px));
  height: min(88svh, 900px);
  max-width: none;
  max-height: none;
  margin: auto 12px 12px auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 28px 100px rgba(0,0,0,.28);
}
.drawer::backdrop { background: rgba(3, 7, 5, .44); backdrop-filter: blur(4px); }
.drawer-shell { height: 100%; overflow: auto; }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 28px; background: color-mix(in srgb, var(--surface-strong) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.drawer-header h2 { font-size: 34px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; font-size: 26px; line-height: 1; }
.drawer-content { padding: 4px 28px 34px; }
.drawer-section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { margin-bottom: 14px; font-size: 18px; }
.drawer-section p { color: var(--muted); }
.state-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.state-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.state-grid dt { color: var(--muted); font-size: 11px; }
.state-grid dd { margin: 5px 0 0; font-size: 13px; font-weight: 620; }
.warning-text { color: var(--warning); }
.split-section { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.mini-label { margin-bottom: 8px; font-size: 9px; }
.claim-ladder { display: grid; gap: 8px; }
.claim-ladder h3 { margin-bottom: 6px; }
.ladder-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 13px 0; }
.ladder-index { color: var(--muted); font-size: 10px; }
.ladder-row strong { font-size: 13px; }
.ladder-row p { margin: 2px 0 0; font-size: 11px; }
.ladder-state { padding: 5px 7px; border-radius: 999px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.allowed { background: var(--accent-soft); }
.limited { border: 1px solid var(--line); }
.blocked { color: var(--warning); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); }
.source-note p { margin: 0; font-size: 11px; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 80px 0 70px; }
  .principle-card { max-width: 620px; }
  .simulator-grid { grid-template-columns: 1fr 1fr; }
  .learning-panel { grid-column: 1 / -1; min-height: 300px; }
}

@media (max-width: 680px) {
  .topbar, .hero, .simulator-section, .closing, .footer { width: min(calc(100% - 28px), var(--max)); }
  .topbar { padding-top: 14px; }
  .text-button { font-size: 11px; }
  .hero { gap: 28px; padding: 54px 0 62px; }
  h1 { font-size: clamp(46px, 14vw, 70px); }
  .hero-lede { font-size: 17px; }
  .desktop-only { display: none; }
  .principle-card { padding: 22px; border-radius: 24px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .simulator-section { padding-top: 54px; }
  .simulator-grid { grid-template-columns: 1fr; }
  .context-panel, .decision-panel, .learning-panel { min-height: auto; border-radius: 24px; }
  .decision-result, .boundary-box { margin-top: 26px; }
  .simulator-footer { grid-template-columns: 1fr; gap: 4px; }
  .closing { min-height: 56svh; }
  .footer { flex-direction: column; }
  .drawer { width: calc(100% - 12px); height: calc(100svh - 12px); margin: 6px; border-radius: 24px; }
  .drawer-header, .drawer-content { padding-left: 20px; padding-right: 20px; }
  .split-section, .state-grid { grid-template-columns: 1fr; }
  .ladder-row { grid-template-columns: 26px 1fr; }
  .ladder-state { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
