/* 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: #17703a;
  --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;
  --muted-bg: #eceef3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #14161c;
    --foreground: #eceef3;
    --card: #1e212a;
    --primary: #8ea2ff;
    --primary-foreground: #14161c;
    --muted-foreground: #a3a8b8;
    --border: #353a47;
    --success: #6fd89a;
    --danger: #ff8a80;
    --muted-bg: #272b36;
  }
}

body { margin: 0; font: var(--text-base) / 1.5 system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
h3 { font-weight: 600; }
input, button { 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; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: 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); }
.wide { display: grid; gap: var(--space-4); max-width: 60rem; }
.wide .stack { max-width: none; }
ol, ul { margin: 0; padding-inline-start: var(--space-6); }

.btn { background: var(--background); color: var(--foreground); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-4); }
.grid2 > h2 { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--space-4); margin: 0; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, monospace; }
.tag { font-weight: 600; min-height: 1.5em; }
.tag.ok { color: var(--success); }
.tag.bad { color: var(--danger); }

.scroll { overflow-x: auto; }
.diagram { min-width: 36rem; width: 100%; height: auto; color: var(--foreground); }
.diagram .svg-text { font-size: 14px; fill: currentColor; }
.diagram .box { fill: var(--background); stroke: currentColor; stroke-width: 1.5; }
.diagram .box.swap { stroke: var(--danger); stroke-width: 3; stroke-dasharray: 6 4; }
.diagram .box.catch { stroke: var(--success); stroke-width: 3; }
.diagram .arrow { stroke: currentColor; stroke-width: 1.5; }
.diagram .step { opacity: 0.2; transition: opacity 0.4s; }
.diagram .step.on { opacity: 1; }
.diagram .step.on .arrow { stroke-width: 3; }
.diagram .mark-swap { fill: var(--danger); font-weight: 700; }
.diagram .mark-catch { fill: var(--success); font-weight: 700; }

.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; }

.chain { list-style: none; padding: 0; display: flex; align-items: stretch; min-width: max-content; font: var(--text-sm) / 1.4 ui-monospace, monospace; }
.chain .block { border: 2px solid var(--success); border-radius: var(--radius); padding: var(--space-2); background: var(--background); min-width: 9rem; }
.chain .block.broken { border-color: var(--danger); border-style: dashed; color: var(--danger); font-weight: 700; }
.chain .block.doubt { border-color: var(--muted-foreground); border-style: dotted; color: var(--muted-foreground); }
.chain .block-title { font-weight: 700; }
.chain .link { align-self: center; padding: 0 var(--space-2); font-weight: 700; border-top: 3px solid; }
.chain .link.ok { color: var(--success); }
.chain .link.bad { color: var(--danger); border-top-style: dashed; }
.chain .enter { animation: slide-in 0.6s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(2rem); } to { opacity: 1; transform: none; } }

.actors { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.actors li { display: flex; align-items: center; gap: var(--space-2); }
.logo { width: 1.5rem; height: 1.5rem; fill: currentColor; }

.checks { list-style: none; padding: 0; display: grid; gap: var(--space-2); font-size: var(--text-sm); }
.check { padding: var(--space-2); border-inline-start: 4px solid; background: var(--background); border-radius: var(--radius); overflow-wrap: anywhere; }
.check.pass { color: var(--success); }
.check.fail { color: var(--danger); font-weight: 700; }
.check.skip { color: var(--muted-foreground); }

.feed { display: grid; gap: var(--space-2); align-content: start; max-height: 22rem; overflow-y: auto; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2); font-size: var(--text-sm); }
.msg { display: flex; gap: var(--space-2); align-items: flex-start; }
.avatar { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--muted-bg); font-size: 0.7rem; font-weight: 700; }
.avatar svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.bubble { background: var(--muted-bg); border-radius: var(--radius); padding: var(--space-2); overflow-wrap: anywhere; }
.bubble.bad { border: 2px solid var(--danger); }
.from-client .bubble { background: var(--card); border: 1px solid var(--border); }
.time { color: var(--muted-foreground); }
.notice { text-align: center; color: var(--muted-foreground); font-style: italic; }
.notice.bad { color: var(--danger); font-weight: 700; }
