:root,
html.light {
  color-scheme: light;
  --bg: #f6f3eb;
  --bg-2: #eeeee5;
  --surface: #fffdf7;
  --text: #192b2b;
  --muted: #536663;
  --accent: #087f75;
  --accent-2: #b5d3c6;
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", sans-serif;
  --line: #d4dcd2;
  --soft-teal: #e6efE8;
  --amber: #f8edcf;
  --amber-ink: #6b4e18;
  --focus: #087f75;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 280px;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

button,
select,
summary {
  cursor: pointer;
}

button {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

::selection {
  color: var(--text);
  background: #c4e4d8;
}

.app {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding: 0;
}

#app {
  width: calc(100% - 40px);
  max-width: 1100px;
  margin-inline: auto;
  padding: 0;
}

main,
section,
article,
aside,
header,
footer,
form,
fieldset,
.grid,
.split,
.row,
.stack,
.exhibit,
.card {
  min-width: 0;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
blockquote,
pre {
  margin-top: 0;
}

h1,
h2,
h3,
h4,
.title {
  color: var(--text);
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 {
  margin-bottom: 24px;
  font-size: clamp(38px, 5.1vw, 56px);
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(27px, 3.2vw, 36px);
}

h3 {
  margin-bottom: 12px;
  font-size: 22px;
  letter-spacing: -0.025em;
}

h4 {
  margin-bottom: 10px;
  font-size: 18px;
}

p {
  margin-bottom: 18px;
}

p,
li,
dd,
a,
.message,
.trace,
.token,
#lab-context,
#lab-output {
  overflow-wrap: anywhere;
}

p:last-child,
ul:last-child,
ol:last-child,
dl:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

a:hover {
  text-decoration-thickness: 2px;
}

small,
.small {
  font-size: 13px;
  line-height: 1.5;
}

.muted,
small,
figcaption {
  color: var(--muted);
}

strong,
b {
  font-weight: 650;
}

hr {
  height: 1px;
  margin-block: 32px;
  border: 0;
  background: var(--line);
}

.masthead,
#app > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  padding-block: 25px 22px;
  border-bottom: 1px solid var(--line);
}

.masthead h1,
.masthead h2,
#app > header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.masthead p,
#app > header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.brand,
.wordmark {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.masthead a,
.brand,
.wordmark {
  color: var(--text);
  text-decoration: none;
}

nav,
.tabs,
[role="tablist"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#app > nav,
main > nav,
#app > [role="tablist"] {
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover,
.btn:hover {
  border-color: #91ada2;
  background: #edf2e9;
}

button:active,
.btn:active {
  background: #dfece3;
}

.btn.primary,
button.primary,
#try-eliza,
#send-message,
#step-token {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover,
button.primary:hover,
#try-eliza:hover,
#send-message:hover,
#step-token:hover {
  border-color: #06675f;
  background: #06675f;
}

.btn.ghost,
button.ghost,
#reset-chat,
#reset-lab {
  background: transparent;
}

.btn.ghost:hover,
button.ghost:hover,
#reset-chat:hover,
#reset-lab:hover {
  background: var(--soft-teal);
}

.btn.big {
  min-height: 50px;
  padding-inline: 24px;
  font-size: 16px;
}

button:disabled,
.btn:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

nav button,
.tabs button,
[role="tab"] {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 550;
}

nav button:hover,
.tabs button:hover,
[role="tab"]:hover {
  border-color: transparent;
  background: #e9ede3;
  color: var(--text);
}

[role="tab"][aria-selected="true"],
nav button[aria-selected="true"],
.tabs .active,
.tabs .is-active {
  border-color: #c6dacf;
  background: #e1eee5;
  color: #075f58;
}

[role="tabpanel"] {
  padding-block: 38px 12px;
}

.hero {
  position: relative;
  padding-block: 17px 40px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  max-width: 800px;
}

.hero > p,
.hero-copy > p {
  max-width: 720px;
}

.hero .lead,
.hero .lede,
.hero .intro,
.hero h1 + p {
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.6;
}

.hero .btn,
.hero #try-eliza {
  margin-top: 10px;
}

.eyebrow,
.kicker,
.section-label,
.section-number,
.overline {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-heading,
.exhibit-heading {
  margin-bottom: 24px;
}

.section-heading p,
.exhibit-heading p {
  max-width: 720px;
  color: var(--muted);
}

#intro-panel > section + section,
#loop-panel > section + section,
.science,
.history {
  margin-top: 44px;
}

.card,
.paper,
.exhibit-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 3px 0 rgb(25 43 43 / 2%);
}

.grid,
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.exhibit {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  margin-block: 26px 36px;
}

.exhibit > header,
.exhibit > h2,
.exhibit > .section-heading,
.exhibit > .exhibit-heading,
.exhibit > .exhibit-footer,
.exhibit > .caveat,
.exhibit > :only-child {
  grid-column: 1 / -1;
}

.exhibit > *,
.grid > *,
.split > * {
  min-width: 0;
}

.diagram,
.flow,
.process,
.prediction-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-block: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef0e6;
}

.diagram > *,
.flow > *,
.process > *,
.prediction-diagram > * {
  min-width: 0;
}

.diagram .arrow,
.flow .arrow,
.process .arrow {
  color: var(--accent);
  font-size: 22px;
}

.diagram .step,
.flow .step,
.process .step {
  flex: 1 1 150px;
  padding: 15px 18px;
  border: 1px solid #cbd8cd;
  border-radius: 12px;
  background: var(--surface);
}

.timeline {
  position: relative;
  margin-block: 25px 36px;
  padding: 0;
  list-style: none;
}

.timeline > li,
.timeline > .timeline-item,
.timeline > article {
  position: relative;
  margin: 0 0 0 8px;
  padding: 0 0 30px 29px;
  border-left: 1px solid #b8cbc0;
  list-style: none;
}

.timeline > li::before,
.timeline > .timeline-item::before,
.timeline > article::before {
  position: absolute;
  top: 7px;
  left: -5px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
}

.timeline > :last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline time,
.timeline .year,
.timeline .date {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--accent);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timeline h3 {
  margin-bottom: 8px;
  font-size: 21px;
}

.timeline p {
  max-width: 760px;
  margin-bottom: 10px;
}

.badge,
.chip,
.demo-label,
.rule-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 11px;
  border: 1px solid #c5d8ca;
  border-radius: 7px;
  background: #eaf1e6;
  color: #31574d;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#eliza-panel .badge,
.demo-label,
.rule-label {
  margin-bottom: 14px;
}

#chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 360px;
  min-height: 220px;
  margin-block: 20px;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f5ed;
  scroll-padding-block: 16px;
  scrollbar-width: thin;
  scrollbar-color: #9bb6a9 transparent;
  -webkit-overflow-scrolling: touch;
}

.message {
  flex: 0 0 auto;
  align-self: flex-start;
  width: fit-content;
  max-width: 92%;
  margin: 0;
  padding: 12px 15px;
  border: 1px solid #dce2d7;
  border-radius: 13px 13px 13px 3px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message p {
  margin: 0;
}

.message .role,
.message .speaker,
.message > small,
.message > header {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message.user,
.message--user,
.message[data-role="user"],
.message[data-speaker="user"] {
  align-self: flex-end;
  margin-left: auto;
  border-color: #c8dacd;
  border-radius: 13px 13px 3px 13px;
  background: #e2eee3;
}

.message.eliza,
.message--eliza,
.message[data-role="eliza"] {
  margin-right: auto;
}

.examples,
.example-list,
.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 14px;
}

.example {
  min-height: 44px;
  padding: 8px 12px;
  border-color: #d2dcd0;
  border-radius: 999px;
  background: transparent;
  color: #35574e;
  font-size: 13px;
  font-weight: 500;
  white-space: normal;
}

.example:hover {
  border-color: #8eafa0;
  background: #e9f0e5;
}

#chat-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
}

#chat-form > input,
#chat-form > textarea,
#chat-form > .field,
#chat-form > label:not(.sr-only):not(.visually-hidden) {
  flex: 1 1 180px;
  min-width: 0;
}

#chat-form > button {
  flex: 0 0 auto;
}

label,
.field > span,
.field > label {
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

input,
textarea,
select {
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #adC2b7;
  border-radius: 9px;
  background: #fffef9;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  box-shadow: none;
}

input,
textarea {
  width: 100%;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #6b7971;
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

#chat-input {
  scroll-margin-block: 24px;
}

#scenario {
  width: 100%;
  margin-block: 6px 18px;
}

.trace,
#trace-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid #c8d7cc;
  border-radius: var(--radius);
  background: #edf1e8;
}

.trace.card,
#trace-panel.card {
  box-shadow: none;
}

.trace h3,
#trace-panel h3 {
  font-size: 21px;
}

.trace dl,
#trace-panel dl {
  margin-bottom: 0;
}

.trace dt,
#trace-panel dt {
  margin-top: 17px;
  margin-bottom: 5px;
  color: #466357;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trace dt:first-child,
#trace-panel dt:first-child {
  margin-top: 0;
}

.trace dd,
#trace-panel dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.trace code,
#trace-panel code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #e1e8dd;
  color: #234c41;
}

#show-trace {
  white-space: normal;
}

#show-trace[aria-expanded="true"] {
  border-color: #8aafa0;
  background: #e2eee4;
  color: #075f58;
}

code,
pre,
.token,
#lab-context,
#lab-output {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eff1e8;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#lab-context {
  margin-block: 10px 20px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f2f3eb;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

#lab-output {
  min-height: 84px;
  margin-block: 12px 22px;
  padding: 14px;
  border: 1px solid #bdd6c9;
  border-radius: 11px;
  background: #ebf3e9;
  font-size: 15px;
  line-height: 2.5;
  white-space: pre-wrap;
}

.token {
  display: inline-block;
  max-width: 100%;
  margin: 3px 3px 3px 0;
  padding: 3px 9px;
  border: 1px solid #b9d3c5;
  border-radius: 6px;
  background: var(--surface);
  color: #1d5145;
  font-size: 14px;
  line-height: 1.7;
  vertical-align: baseline;
  white-space: pre-wrap;
}

#lab-output .token:last-child {
  border-color: var(--accent);
  background: #d9ebdf;
  color: #075f58;
}

#candidates {
  display: grid;
  gap: 12px;
  margin-block: 18px;
}

.candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
}

.candidate:first-child {
  border-color: #98bfae;
  background: #f0f5ec;
}

.candidate .token {
  justify-self: start;
  margin: 0;
}

.candidate .probability,
.candidate .percentage,
.candidate .percent,
.candidate strong {
  font-variant-numeric: tabular-nums;
}

.candidate .bar,
.candidate .candidate-bar,
.candidate .probability-bar,
.candidate .track,
.candidate .progress,
.candidate > meter,
.candidate > progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #dfe7db;
}

.candidate .bar > *,
.candidate .candidate-bar > *,
.candidate .probability-bar > *,
.candidate .track > *,
.candidate .progress > i {
  display: block;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #8aafa0;
  transition: width 150ms ease;
}

.candidate:first-child .bar > *,
.candidate:first-child .candidate-bar > *,
.candidate:first-child .probability-bar > *,
.candidate:first-child .track > *,
.candidate:first-child .progress > i {
  background: var(--accent);
}

progress,
meter {
  accent-color: var(--accent);
}

progress::-webkit-progress-bar,
meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: #dfe7db;
}

progress::-webkit-progress-value,
meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.lab-actions,
.chat-actions,
.actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.caveat,
.notice,
.callout,
.disclaimer {
  margin-block: 24px;
  padding: 18px 20px;
  border: 1px solid #e5d7b4;
  border-left: 3px solid #bf9451;
  border-radius: 0 11px 11px 0;
  background: var(--amber);
  color: var(--amber-ink);
  font-size: 14px;
  line-height: 1.7;
}

.caveat h3,
.notice h3,
.callout h3,
.disclaimer h3 {
  color: inherit;
  font-size: 19px;
}

blockquote {
  margin-inline: 0;
  padding-left: 20px;
  border-left: 3px solid #a0bfb0;
  color: #3f5c52;
}

details {
  padding-block: 14px;
  border-block: 1px solid var(--line);
}

summary {
  min-height: 44px;
  padding-block: 10px;
  color: #176b5f;
  font-weight: 600;
}

details[open] > summary {
  margin-bottom: 10px;
}

#sources {
  margin-top: 52px;
  padding-block: 30px 40px;
  border-top: 1px solid var(--line);
}

#sources h2 {
  font-size: 26px;
}

#sources > p {
  max-width: 740px;
  color: var(--muted);
  font-size: 14px;
}

.source-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 32px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.65;
}

.source-list > li,
.source-list > article,
.source-list > .source {
  min-width: 0;
  padding-block: 16px;
  border-top: 1px solid var(--line);
}

.source-list p {
  margin-block: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.source-list a {
  display: inline-block;
  padding-block: 5px;
}

.source-list cite {
  font-style: normal;
}

.gradient-text {
  background: none;
  color: var(--accent);
  -webkit-text-fill-color: currentColor;
}

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 760px) {
  [role="tabpanel"] {
    padding-top: 48px;
  }

  .hero {
    padding-top: 22px;
    padding-bottom: 48px;
  }

  .grid,
  .split,
  .exhibit {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  }

  .source-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline > li,
  .timeline > .timeline-item,
  .timeline > article {
    padding-left: 35px;
  }
}

@media (min-width: 1040px) {
  #app {
    width: calc(100% - 80px);
  }

  .exhibit {
    gap: 30px;
  }

  .card,
  .paper,
  .exhibit-card {
    padding: 30px;
  }

  .hero:has(> .hero-copy):has(> .diagram) {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    align-items: center;
    gap: 36px;
  }

  .hero > .diagram {
    margin-block: 0;
  }
}

@media (max-width: 759px) {
  #chat-log {
    max-height: 260px;
    min-height: 180px;
    padding: 13px;
  }

  .card,
  .paper,
  .exhibit-card,
  .trace,
  #trace-panel {
    padding: 20px;
  }

  .message {
    max-width: 95%;
  }

  .exhibit {
    gap: 20px;
  }
}

@media (max-width: 599px) {
  .masthead,
  #app > header {
    gap: 16px;
    padding-block: 20px 16px;
  }

  .masthead > nav,
  .masthead > [role="tablist"],
  #app > header > nav,
  #app > nav,
  .tabs,
  [role="tablist"] {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }

  nav button,
  .tabs button,
  [role="tab"] {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 9px 6px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
  }

  [role="tabpanel"] {
    padding-top: 28px;
  }

  .hero {
    padding-top: 8px;
    padding-bottom: 32px;
  }

  .hero h1 {
    margin-bottom: 20px;
  }

  .hero > p,
  .hero-copy > p {
    margin-bottom: 17px;
  }

  .hero #try-eliza {
    min-height: 48px;
    padding-inline: 22px;
  }

  .diagram,
  .flow,
  .process,
  .prediction-diagram {
    gap: 10px;
    padding: 16px;
  }

  .diagram .step,
  .flow .step,
  .process .step {
    flex-basis: 100%;
  }

  .diagram .arrow,
  .flow .arrow,
  .process .arrow {
    flex-basis: 100%;
    text-align: center;
  }

  .timeline > li,
  .timeline > .timeline-item,
  .timeline > article {
    padding-left: 23px;
  }

  #intro-panel > section + section,
  #loop-panel > section + section,
  .science,
  .history {
    margin-top: 34px;
  }

  .example {
    font-size: 12px;
    padding-inline: 11px;
  }

  #send-message {
    padding-inline: 15px;
  }

  #sources {
    margin-top: 38px;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 359px) {
  .card,
  .paper,
  .exhibit-card,
  .trace,
  #trace-panel {
    padding: 16px;
  }

  #chat-form > input,
  #chat-form > textarea,
  #chat-form > .field,
  #chat-form > label:not(.sr-only):not(.visually-hidden) {
    flex-basis: 100%;
  }

  #send-message {
    width: 100%;
  }
}

.is-paused,
.is-paused *,
.is-paused::before,
.is-paused::after,
.is-paused *::before,
.is-paused *::after {
  animation-play-state: paused !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

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

@media (forced-colors: active) {
  button,
  .btn,
  .token,
  .message,
  .candidate,
  .trace,
  .card {
    border: 1px solid CanvasText;
  }

  [role="tab"][aria-selected="true"] {
    outline: 2px solid Highlight;
    outline-offset: -3px;
  }

  .candidate .bar > *,
  .candidate .candidate-bar > *,
  .candidate .probability-bar > *,
  .candidate .progress > i {
    background: Highlight;
    forced-color-adjust: none;
  }
}


/* ELIZA's conversation is a single terminal; only its transcript scrolls. */
@font-face {
  font-family: 'ELIZA Mini';
  src: url('assets/Kenney Mini.ttf') format('truetype');
  font-display: swap;
}

#eliza-terminal {
  --terminal-bg: #f7faf8;
  --terminal-bar: #e8efeb;
  --terminal-ink: #203c30;
  --terminal-accent: #176340;
  --terminal-line: #b7ccc0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  height: clamp(26rem, 67vh, 44rem);
  height: clamp(26rem, 67dvh, 44rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--terminal-line);
  border-radius: 12px;
  background: var(--terminal-bg);
  color: var(--terminal-ink);
  box-shadow: 0 12px 34px rgb(0 0 0 / 16%);
  font-family: var(--mono);
}

:root[data-theme='dark'] #eliza-terminal {
  --terminal-bg: #0b1411;
  --terminal-bar: #121f19;
  --terminal-ink: #d0e9d8;
  --terminal-accent: #94efb0;
  --terminal-line: #304c3c;
}

#eliza-terminal .terminal-titlebar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--terminal-line);
  background: var(--terminal-bar);
}

#eliza-terminal .terminal-titlebar h2 {
  margin: 0;
  color: var(--terminal-accent);
  font-family: 'ELIZA Mini', var(--mono);
  font-size: 25px;
  font-weight: normal;
  line-height: 1;
  letter-spacing: .04em;
}

#eliza-terminal .chat-tools {
  gap: 6px;
  margin: 0;
}

#eliza-terminal .chat-tools button {
  min-height: 36px;
  padding: 5px 9px;
  font-size: 12px;
}

#eliza-terminal #chat-log {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: 20px;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--terminal-ink);
  scrollbar-color: var(--terminal-line) var(--terminal-bg);
}

#eliza-terminal .terminal-entry {
  display: block;
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.7;
}

#eliza-terminal .terminal-speaker {
  display: block;
  margin-bottom: 3px;
  color: var(--terminal-accent);
  font-size: 12px;
  letter-spacing: .13em;
}

#eliza-terminal .message-user .terminal-speaker {
  color: var(--muted);
}

#eliza-terminal .message-text {
  margin: 0;
  color: inherit;
  font: inherit;
}

#eliza-terminal .terminal-input-area {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--terminal-line);
  background: var(--terminal-bar);
}

#eliza-terminal .privacy-note {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.5;
}

#eliza-terminal .examples {
  gap: 6px;
  margin: 0 0 12px;
}

#eliza-terminal .example {
  min-height: 36px;
  padding: 5px 8px;
  font-size: 12px;
}

#eliza-terminal #chat-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

#eliza-terminal .terminal-prompt {
  flex: 0 0 auto;
  color: var(--terminal-accent);
  font-size: 22px;
}

#eliza-terminal #chat-input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--terminal-line);
  border-radius: 4px;
  background: var(--terminal-bg);
  color: var(--terminal-ink);
  font-family: var(--mono);
  font-size: 16px;
}

#eliza-terminal #chat-input::placeholder {
  color: var(--muted);
}

#eliza-terminal #send-message {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  padding: 9px 14px;
  border-color: var(--terminal-accent);
  background: var(--terminal-accent);
  color: var(--terminal-bg);
}

@media (min-width: 801px) {
  .chat-layout.trace-open {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

@media (max-width: 800px) {
  .chat-layout.trace-open {
    grid-template-columns: minmax(0, 1fr);
  }

  #eliza-terminal #chat-log {
    padding: 20px 16px;
  }
}

/* Dark mode covers the editorial shell as well as the terminal. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151c;
  --bg-2: #171f2a;
  --surface: #171f2a;
  --surface-2: #202b39;
  --text: #f2f5f8;
  --muted: #b7c3d4;
  --accent: #8fdad0;
  --accent-2: #8fdad0;
  --border: #71849a;
  --line: #71849a;
  --soft-teal: #202b39;
  --amber: #202b39;
  --amber-ink: #f2f5f8;
  --focus: #8fdad0;
  --good: #8fdad0;
  --bad: #ffb4b4;
  --warn: #f2d294;
  background: var(--bg);
  color: var(--text);
}

html[data-theme="dark"] :is(body, #app, .masthead, #app > header, .tabs,
  #main-content, [role="tabpanel"], #sources) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] :is(.hero, .card, .exhibit, .timeline,
  .timeline-item, .timeline article, .timeline li, .education-card,
  .educational-card, .concept-card, .history-card, .science-card,
  .diagram, .flow, .process, .prediction-diagram,
  .chat-panel, .chat-shell, .chat-window, .chat-log, #chat-log,
  .trace, .trace-panel, .trace-inspector, #trace-panel, #trace-inspector,
  .lab-panel, .prediction-loop, .candidate, .source-list) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] :is(.timeline::before, .timeline-item::before,
  .timeline li::before, .timeline article::before) {
  background: var(--accent);
  border-color: var(--line);
}

html[data-theme="dark"] :is(.message, .message-user, .message.user,
  .message[data-role="user"], .user-message, .token,
  .trace pre, .trace code, .trace dd, .trace-step,
  .lab-controls, .prediction-controls, .lab-context, .lab-output,
  #lab-context, #lab-output, .context-box, .output-box,
  .caveat, .notice, .callout, .disclaimer) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] :is(.message-eliza, .message.eliza,
  .message[data-role="eliza"], .eliza-message) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] :is(h1, h2, h3, h4, .title,
  .hero p, .card p, .exhibit p, .timeline p, .timeline h3,
  .message-text, .trace dd, .trace pre, .trace code,
  .candidate-label, .candidate-word, .candidate-token,
  .candidate .word, .candidate .label, .candidate strong,
  #lab-context, #lab-output, label, .field > label, .field > span) {
  color: var(--text);
}

html[data-theme="dark"] :is(.muted, small, figcaption, .subtitle,
  .eyebrow, .kicker, .lede, .lead, .intro-copy, .section-intro,
  .privacy-note, .chat-note, .message-role, .message-meta,
  .trace dt, .trace-note, .trace-empty, .empty-state,
  .timeline time, .timeline .date, .timeline .year, .timeline-date,
  .candidate .probability, .candidate .percent, .candidate-probability,
  .candidate-percent, .source-list li, .source-list p,
  #sources p, #sources li, .stat span) {
  color: var(--muted);
}

html[data-theme="dark"] :is(input, textarea, select,
  .composer, .chat-composer, #chat-form) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: var(--muted);
  opacity: 1;
}

html[data-theme="dark"] :is(button, .btn, .example,
  .candidate, .chip, .badge) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] :is(button, .btn, .example):hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

html[data-theme="dark"] :is(.btn.primary, button.primary,
  button[type="submit"], #send-message,
  .tabs button[aria-selected="true"], [role="tab"][aria-selected="true"],
  .tabs button.active, .tabs .is-active,
  .candidate.selected, .candidate.is-selected,
  .candidate[aria-pressed="true"], .token.active, .token.is-active) {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: none;
}

html[data-theme="dark"] :is(.btn.primary, button.primary,
  button[type="submit"], #send-message):hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

html[data-theme="dark"] :is(.candidate.selected, .candidate.is-selected,
  .candidate[aria-pressed="true"]) :is(span, strong, small) {
  color: var(--bg);
}

html[data-theme="dark"] :is(.candidate .bar, .candidate .candidate-bar,
  .candidate .probability-bar, .candidate .progress) {
  background: var(--bg);
}

html[data-theme="dark"] :is(.candidate .bar > *,
  .candidate .candidate-bar > *, .candidate .probability-bar > *,
  .candidate .progress > i) {
  background: var(--accent);
  color: var(--bg);
}

html[data-theme="dark"] :is(a, #sources a, .source-list a) {
  color: var(--accent);
}

html[data-theme="dark"] :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

html[data-theme="dark"] ::selection {
  background: var(--accent);
  color: var(--bg);
}

/* These variables are local to the terminal, so override them here too. */
html[data-theme="dark"] #eliza-terminal {
  --terminal-bg: #171f2a;
  --terminal-bar: #202b39;
  --terminal-ink: #f2f5f8;
  --terminal-accent: #8fdad0;
  --terminal-line: #71849a;
  background: var(--terminal-bg);
  color: var(--terminal-ink);
  border-color: var(--terminal-line);
}

html[data-theme="dark"] #eliza-terminal :is(.terminal-header,
  .terminal-titlebar, .terminal-input-area) {
  background: var(--terminal-bar);
  color: var(--terminal-ink);
  border-color: var(--terminal-line);
}

html[data-theme="dark"] #eliza-terminal #chat-log {
  background: var(--terminal-bg);
  color: var(--terminal-ink);
}

html[data-theme="dark"] #eliza-terminal .terminal-entry {
  background: transparent;
  color: var(--terminal-ink);
}

html[data-theme="dark"] #eliza-terminal #chat-input {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] #eliza-terminal #send-message {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
