/* Design tokens. Change the look here: the page uses only these. */
:root {
  --background: #ffffff;
  --foreground: #1a1c23;
  --card: #f6f7f9;
  --primary: #3451c7;
  --primary-foreground: #ffffff;
  --muted-foreground: #5b6070;
  --border: #d7dae2;
  --success: #1c6f38;
  --warning: #8a5300;
  --danger: #b3261e;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-2xl: 1.75rem;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --radius: 0.5rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #14161c;
    --foreground: #eceef3;
    --card: #1e212a;
    --primary: #8ea2ff;
    --primary-foreground: #14161c;
    --muted-foreground: #a3a8b8;
    --border: #353a47;
    --success: #6fd08c;
    --warning: #f0b44c;
    --danger: #ff8a80;
  }
}

body { margin: 0; font: var(--text-base) / 1.5 system-ui, sans-serif; }
h1, h2, p { margin: 0; }
input, button, select { font: inherit; border-radius: var(--radius); }
button { border: 0; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }

.bg-background { background: var(--background); }
.bg-card { background: var(--card); }
.bg-primary { background: var(--primary); }
.text-foreground { color: var(--foreground); }
.text-primary { color: var(--primary); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.border { border: 1px solid; }
.border-b { border-bottom: 1px solid; }
.border-border { border-color: var(--border); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); font-weight: 600; }
.text-2xl { font-size: var(--text-2xl); font-weight: 700; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.stack { display: grid; gap: var(--space-2); max-width: 40rem; }
.card { border-radius: var(--radius); }
.outline { background: none; }

.tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.tabs [role="tab"] { background: none; color: var(--muted-foreground); padding: var(--space-2); }
.tabs [aria-selected="true"] { color: var(--primary); box-shadow: inset 0 -2px var(--primary); }
table { border-collapse: collapse; width: 100%; }
caption { text-align: start; padding-bottom: var(--space-2); }
th, td { text-align: start; padding: var(--space-2); border-bottom: 1px solid var(--border); }
tfoot { font-weight: 600; }

.wide { display: grid; gap: var(--space-4); max-width: 60rem; }
.wide .stack { max-width: none; }
.note { border-left: 4px solid var(--primary); padding-left: var(--space-2); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.panels { display: grid; gap: var(--space-4); grid-template-columns: 1fr 1fr; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.diagram { width: 100%; max-width: 32rem; height: auto; color: var(--foreground); }

.step { display: block; border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: var(--space-2); background: var(--background); }
.step.match { border-left-color: var(--success); }
.step.extra { border-left-color: var(--warning); }
.step.danger { border-left-color: var(--danger); }
.step label { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.step input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; flex: none; }
.badge { font-size: var(--text-sm); font-weight: 700; display: block; }
.match .badge { color: var(--success); }
.extra .badge { color: var(--warning); }
.danger .badge { color: var(--danger); }
.tag, .why { font-size: var(--text-sm); color: var(--muted-foreground); display: block; }

.state { display: flex; justify-content: space-between; gap: var(--space-2); border-bottom: 1px solid var(--border); padding-bottom: var(--space-2); }
.state.changed { font-weight: 700; }
.state.changed span:last-child { color: var(--primary); }

@media (max-width: 40rem) {
  .panels { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Round 2: chat, live panel, animated diagram. */
.layout { display: grid; gap: var(--space-4); grid-template-columns: 3fr 2fr; align-items: start; }
.col { display: grid; gap: var(--space-4); min-width: 0; }
.controls { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.field { display: grid; gap: 0.25rem; }
.chat { display: grid; gap: var(--space-2); max-height: 38rem; overflow: auto; }
.msg { display: flex; gap: var(--space-2); align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.avatar { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--background); border: 1px solid var(--border); color: var(--foreground); }
.avatar svg { width: 1.2rem; height: 1.2rem; }
.me .avatar { background: var(--primary); color: var(--primary-foreground); font-size: var(--text-sm); font-weight: 700; }
.bubble { min-width: 0; flex: 0 1 100%; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); padding: var(--space-2); display: grid; gap: var(--space-2); }
.me .bubble { background: var(--primary); color: var(--primary-foreground); flex: 0 1 auto; }
.meta { font-size: var(--text-sm); color: var(--muted-foreground); }
.me .meta { color: var(--primary-foreground); }
.notice { border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); color: var(--foreground); }
.notice::before { content: "System notice: "; font-weight: 700; }
.notice.warn { border-color: var(--warning); }
.notice.ok { border-color: var(--success); }
.dots { display: inline-flex; gap: 0.25rem; align-items: center; }
.dots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted-foreground); animation: blink 1s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.enter { animation: slide-in 0.35s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
.pulse { animation: pulse 0.7s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--primary); } 100% { box-shadow: 0 0 0 0.6rem transparent; } }
.step.picked { background: var(--card); outline: 2px solid var(--primary); outline-offset: -2px; }
.sign { font-family: ui-monospace, monospace; font-weight: 700; }
.stats { display: grid; gap: 0.25rem; }
.mono { font-family: ui-monospace, monospace; font-size: var(--text-sm); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.live-note { font-weight: 700; }
.logo { width: 1.1rem; height: 1.1rem; vertical-align: -0.2rem; }
.sr-hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.line { display: block; margin-bottom: var(--space-2); }
.node rect { fill: var(--background); stroke: currentColor; stroke-width: 1.5; transition: stroke 0.3s, stroke-width 0.3s; }
.node.on rect { stroke: var(--primary); stroke-width: 4; }
.node.done rect { stroke: var(--success); stroke-width: 3; }
.node text { fill: currentColor; font-size: 12px; text-anchor: middle; }
.link { stroke: currentColor; stroke-width: 1.5; fill: none; opacity: 0.35; transition: opacity 0.3s; }
.link.on { opacity: 1; stroke: var(--primary); stroke-width: 3; }
.diagram.wide-d { max-width: 100%; }
.stage { min-height: 2.5rem; }
.footer { border-top: 1px solid var(--border); }

@media (max-width: 52rem) {
  .layout { grid-template-columns: 1fr; }
}

/* Is It Really Them? */
.surfaces, .row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.surfaces button, .actions button, .run { background: var(--card); color: var(--foreground); border: 1px solid var(--border); padding: var(--space-2) var(--space-4); }
.surfaces [aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.actions .main { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.logo { width: 1.5rem; height: 1.5rem; flex: none; }
.logo.sm { width: 1.1rem; height: 1.1rem; }
.logos { display: inline-flex; gap: 0.25rem; color: var(--muted-foreground); }
.layout { display: grid; gap: var(--space-4); grid-template-columns: 3fr 2fr; align-items: start; }
.mock { border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); overflow: hidden; }
.mock-bar { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); background: var(--card); font-weight: 600; }
.mock-body { padding: var(--space-4); display: grid; gap: var(--space-2); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); display: inline-grid; place-items: center; font-weight: 700; flex: none; }
.inbox-row { display: flex; gap: var(--space-2); align-items: baseline; border-bottom: 1px solid var(--border); padding-bottom: var(--space-2); font-size: var(--text-sm); }
.inbox-row strong { flex: none; }
.inbox-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
.bubble { max-width: 85%; padding: var(--space-2) var(--space-4); border-radius: 1.1rem; background: var(--card); border: 1px solid var(--border); }
.bubble.me { align-self: end; background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.stamp { font-size: var(--text-sm); color: var(--muted-foreground); }
.typing { display: inline-flex; gap: 0.25rem; padding: var(--space-2) var(--space-4); border-radius: 1.1rem; background: var(--card); border: 1px solid var(--border); width: fit-content; }
.typing i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted-foreground); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.notice { border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.notice.good { border-left-color: var(--success); color: var(--success); }
.notice.bad { border-left-color: var(--danger); color: var(--danger); }
.notice.wait { border-left-color: var(--warning); color: var(--warning); }
.call { text-align: center; padding: var(--space-6) var(--space-4); display: grid; gap: var(--space-2); justify-items: center; }
.call .avatar { width: 4rem; height: 4rem; font-size: var(--text-lg); }
.call .timer { font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.verify-btn { background: var(--success); color: var(--primary-foreground); padding: var(--space-2) var(--space-6); }
.checks { display: grid; gap: var(--space-2); }
.check { border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: var(--space-2); background: var(--background); display: grid; gap: 0.25rem; }
.check.pass { border-left-color: var(--success); }
.check.fail { border-left-color: var(--danger); }
.check h3 { margin: 0; font-size: var(--text-base); display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; }
.result { font-weight: 700; font-size: var(--text-sm); }
.pass .result { color: var(--success); }
.fail .result { color: var(--danger); }
.meter { height: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--primary); transition: width 0.4s; }
.meter.ok div { background: var(--success); }
.tally { font-size: var(--text-2xl); font-weight: 700; }
.log { margin: 0; padding: var(--space-2); background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); font: var(--text-sm) / 1.4 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 5rem; }
.st { opacity: 0.3; transition: opacity 0.4s; }
.st.on { opacity: 1; }
.st.now rect, .st.now circle { stroke: var(--primary); stroke-width: 3; }
.diagram { max-width: 40rem; }
footer { padding: var(--space-4); }
@media (max-width: 48rem) {
  .layout { grid-template-columns: 1fr; }
}
