:root {
  color-scheme: light;
  --paper: #f4edd8;
  --paper-deep: #e9dfc3;
  --cream: #fbf6e8;
  --ink: #23301c;
  --muted: #56614d;
  --gold: #b6973f;
  --hair: rgba(35, 48, 28, 0.25);
  --soft-hair: rgba(35, 48, 28, 0.12);
  --reply: #e9dfc3;
  --sage: #cfe1c5;
  --rose: #f2d0cb;
  --shadow: rgba(30, 38, 23, 0.14);
  --display: Georgia, "Times New Roman", serif;
  --body: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b100a;
  --paper-deep: #171e15;
  --cream: #111810;
  --ink: #f8f1df;
  --muted: #bdc7b3;
  --gold: #ead797;
  --hair: rgba(248, 241, 223, 0.24);
  --soft-hair: rgba(248, 241, 223, 0.11);
  --reply: #263823;
  --sage: #294522;
  --rose: #562d2a;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(12px, 2vw, 28px);
  background:
    radial-gradient(circle at 12% 8%, rgba(182, 151, 63, 0.08), transparent 30rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - clamp(24px, 4vw, 56px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: var(--cream);
  box-shadow: 0 18px 50px var(--shadow);
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(22px, 4vw, 42px);
  border-bottom: 1px solid rgba(182, 151, 63, 0.55);
}

.eyebrow, .label, .pill, .tab, .metric-label, .section-kicker,
.prompt-label, .composer-hint, th, .source-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.eyebrow { font-size: 12px; color: var(--muted); }

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

h1 {
  margin: 7px 0 9px;
  font-size: clamp(42px, 7vw, 72px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.subtitle {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  font-style: italic;
  line-height: 1.5;
}

.controls {
  display: flex;
  min-width: 185px;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.small-button, .tab, .example, .primary-button {
  border: 1px solid var(--hair);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
  transition: 150ms ease;
}

.small-button {
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.small-button:hover, .example:hover { border-color: var(--gold); background: var(--paper-deep); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--paper-deep);
  font: 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #c09b46; box-shadow: 0 0 0 3px rgba(192,155,70,.18); }
.status-pill.ready .status-dot { background: #6b9859; box-shadow: 0 0 0 3px rgba(107,152,89,.18); }
.status-pill.error .status-dot { background: #b9655d; }

.tabs {
  display: flex;
  padding: 0 clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--soft-hair);
}

.tab {
  margin-bottom: -1px;
  padding: 13px 18px 12px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.tab[aria-selected="true"] { border-color: var(--ink); color: var(--ink); }

.panel[hidden] { display: none; }
.panel { flex: 1; min-height: 0; }

#chat-panel { display: flex; min-height: 560px; flex-direction: column; }

.chat-log {
  flex: 1;
  min-height: 360px;
  max-height: 58vh;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 42px);
}

.intro-note { max-width: 67ch; margin-bottom: 22px; color: var(--muted); line-height: 1.55; }
.warning { display: inline-block; padding: 6px 9px; border: 1px solid rgba(185,101,93,.48); border-radius: 4px; background: var(--rose); font: 12px/1.3 var(--mono); }
.rule { height: 1px; margin: 24px 0; background: rgba(182,151,63,.42); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-label { flex-basis: 100%; margin-bottom: 2px; color: var(--muted); font-size: 10px; }
.example { padding: 7px 11px; font-size: 14px; }
.example:disabled { opacity: .45; cursor: progress; }

.turn { margin: 0 0 20px; }
.label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.user-copy { color: var(--muted); font-style: italic; line-height: 1.55; white-space: pre-wrap; }
.assistant-copy { display: block; padding: 13px 15px; border: 1px solid rgba(157,137,79,.48); border-radius: 5px; background: var(--reply); line-height: 1.6; white-space: pre-wrap; }
.streaming::after { content: "▋"; margin-left: 2px; animation: blink .85s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.response-meta { display: flex; gap: 7px; margin-top: 7px; color: var(--muted); font: 11px/1.2 var(--mono); }
.metric-chip { padding: 4px 7px; border: 1px solid var(--hair); border-radius: 4px; background: rgba(182,151,63,.08); }

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 17px clamp(18px, 4vw, 42px);
  border-top: 1px solid rgba(182,151,63,.5);
  background: var(--paper-deep);
}

.caret { color: var(--muted); font-size: 24px; }
.composer input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 17px; }
.composer input::placeholder { color: var(--muted); opacity: .65; font-style: italic; }
.composer input:disabled { opacity: .5; }
.composer-hint { color: var(--muted); font-size: 9px; }

.benchmarks { padding: clamp(28px, 5vw, 58px) clamp(18px, 5vw, 58px) 56px; }
.benchmarks h2 { max-width: 18ch; margin-bottom: 13px; font-size: clamp(34px, 5vw, 58px); font-weight: 400; line-height: 1.02; }
.lede { max-width: 72ch; margin-bottom: 32px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.section-kicker { margin-bottom: 8px; color: var(--muted); font-size: 10px; }

.headline-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 40px; }
.headline-card { padding: 19px; border: 1px solid var(--hair); border-radius: 5px; background: var(--paper); }
.metric-value { display: block; margin-bottom: 5px; font-size: clamp(31px, 4vw, 48px); line-height: 1; }
.metric-label { display: block; color: var(--muted); font-size: 9px; line-height: 1.45; }

.chart-block { margin: 0 0 42px; }
.chart-block h3, .method h3 { margin-bottom: 16px; font-size: 24px; font-weight: 400; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 62px; align-items: center; gap: 12px; margin-bottom: 11px; }
.bar-label { color: var(--muted); font-size: 14px; }
.bar-track { height: 15px; overflow: hidden; border-radius: 2px; background: var(--soft-hair); }
.bar-fill { height: 100%; width: var(--value); background: var(--gold); }
.bar-row.shaun .bar-fill { background: var(--ink); }
.bar-row.bonsai .bar-fill { background: #739064; }
.bar-value { text-align: right; font: 12px/1 var(--mono); }
.chart-note { margin: 10px 0 0 162px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.table-wrap { overflow-x: auto; margin-bottom: 34px; border: 1px solid var(--hair); border-radius: 5px; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--soft-hair); text-align: right; }
th { color: var(--muted); font-size: 9px; font-weight: 500; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
tr.highlight td { background: rgba(182,151,63,.09); font-weight: 600; }

.method { display: grid; grid-template-columns: 1.1fr .9fr; gap: 30px; padding-top: 8px; }
.method p, .method li { color: var(--muted); line-height: 1.6; }
.method ul { margin: 0; padding-left: 20px; }
.source-card { padding: 18px; border-left: 2px solid var(--gold); background: var(--paper); }
.source-label { color: var(--muted); font-size: 9px; }
.source-card a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; }

.footer { display: flex; justify-content: space-between; gap: 18px; padding: 11px 2px 0; color: var(--muted); font: 10px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.footer a { color: var(--ink); text-decoration-color: var(--gold); }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(16,24,13,.75); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(540px, 100%); padding: clamp(28px, 5vw, 43px); border: 1px solid rgba(182,151,63,.65); border-radius: 7px; background: var(--cream); box-shadow: 0 22px 70px rgba(12,18,10,.4); text-align: center; }
.modal h2 { margin: 8px 0 14px; font-size: clamp(35px, 7vw, 49px); font-weight: 400; line-height: 1; }
.modal p { color: var(--muted); font-size: 16px; line-height: 1.55; }
.primary-button { margin-top: 13px; padding: 10px 22px; border-color: var(--ink); background: var(--ink); color: var(--cream); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px var(--shadow); }
.primary-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 760px) {
  .masthead { flex-direction: column; }
  .controls { min-width: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .headline-grid { grid-template-columns: 1fr; }
  .method { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 105px 1fr 55px; gap: 8px; }
  .chart-note { margin-left: 113px; }
  .composer-hint { display: none; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

