/* 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: #17692f;
  --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: #6fdc8c;
    --danger: #ff8a80;
  }
}

body { margin: 0; background: var(--background); color: var(--foreground); font: var(--text-base) / 1.5 system-ui, sans-serif; }
h1, h2, p, ol, ul, fieldset { margin: 0; }
input, select, button { font: inherit; border-radius: var(--radius); }
input, select { border: 1px solid var(--border); background: var(--background); color: var(--foreground); padding: var(--space-2); }
button { border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
header, main { padding: var(--space-4); }
header { border-bottom: 1px solid var(--border); }
main { max-width: 60rem; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-lg); }
.muted { color: var(--muted-foreground); font-size: var(--text-sm); }
.stack { display: grid; gap: var(--space-2); max-width: 40rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.panel { display: grid; gap: var(--space-4); }
.grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 800px) { .grid { grid-template-columns: 1fr 1fr; } }

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

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-4); display: grid; gap: var(--space-2); }
label { display: block; }
.row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.field { display: grid; gap: 0.25rem; }
.run { background: var(--primary); color: var(--primary-foreground); padding: var(--space-2) var(--space-6); font-weight: 600; }

.trace { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.trace li { border-inline-start: 4px solid var(--border); padding-inline-start: var(--space-2); overflow-wrap: anywhere; }
.trace li[data-fw] { border-inline-start-color: var(--success); }
.trace b { display: block; font-size: var(--text-sm); color: var(--muted-foreground); }
.trace code { display: block; font-size: var(--text-sm); }
.verdict { font-weight: 700; font-size: var(--text-lg); border-radius: var(--radius); border: 2px solid; padding: var(--space-2) var(--space-4); }
.verdict[data-kind="bad"] { color: var(--danger); }
.verdict[data-kind="good"] { color: var(--success); }
.verdict[data-kind="idle"] { color: var(--muted-foreground); font-weight: 400; font-size: var(--text-base); border-color: var(--border); }

.diagram { width: 100%; height: auto; color: var(--foreground); }
.diagram rect { fill: var(--card); stroke: currentColor; stroke-width: 1.5; }
.diagram .wall { fill: none; stroke: var(--success); stroke-width: 2; stroke-dasharray: 6 4; }
.diagram text { fill: currentColor; font-size: 12px; }
.diagram .sub { fill: var(--muted-foreground); font-size: 10px; }
.diagram path { fill: none; stroke: var(--muted-foreground); stroke-width: 2; stroke-dasharray: 5 4; }
.diagram #p-home { stroke: var(--primary); stroke-dasharray: none; }
.diagram[data-reach="third"] #p-third, .diagram[data-reach="internal"] #p-internal { stroke: var(--danger); stroke-width: 4; stroke-dasharray: none; }
@media (prefers-reduced-motion: no-preference) { .diagram path { transition: stroke 0.3s; } }

table { border-collapse: collapse; width: 100%; border: 1px solid var(--border); }
caption { text-align: start; padding-bottom: var(--space-2); font-size: var(--text-lg); font-weight: 600; }
th, td { text-align: start; padding: var(--space-2); border-bottom: 1px solid var(--border); }
tfoot { font-weight: 600; }
.doc h2 { margin-top: var(--space-4); }
.doc ul, .doc ol { padding-inline-start: var(--space-6); }

.sprite { position: absolute; width: 0; height: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
footer { padding: var(--space-4); border-top: 1px solid var(--border); }
.wide { max-width: none; }
.ghost { background: none; border: 1px solid var(--border); color: var(--foreground); padding: var(--space-2) var(--space-4); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.rules { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.rules li { display: grid; gap: 0.25rem; }
.rules input[type="text"], .rules input:not([type]) { width: 100%; box-sizing: border-box; }

.diagram { max-width: 40rem; margin-inline: auto; }
.diagram .node use { color: var(--foreground); }
.diagram .stop { fill: var(--success); font-weight: 700; opacity: 0; }
.diagram[data-blocked="true"] .stop { opacity: 1; }
.diagram[data-blocked="true"] .wall { stroke-width: 5; stroke-dasharray: none; }
.diagram[data-fw="off"] .wall { stroke: var(--muted-foreground); }
.diagram path.ok { stroke: var(--primary); stroke-dasharray: none; }
.diagram #dot { fill: var(--primary); stroke: var(--foreground); stroke-width: 2; opacity: 0; transition: transform 0.45s linear; }
.diagram[data-reach="third"] #n-third rect, .diagram[data-reach="internal"] #n-internal rect { stroke: var(--danger); stroke-width: 4; }

.chat { display: grid; gap: var(--space-2); max-height: 26rem; overflow-y: auto; padding: var(--space-2); background: var(--background); border: 1px solid var(--border); border-radius: var(--radius); }
.msg { display: flex; gap: var(--space-2); align-items: flex-end; max-width: 90%; }
.msg[data-side="right"] { flex-direction: row-reverse; margin-inline-start: auto; }
.avatar { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--border); border-radius: 50%; background: var(--card); font-size: var(--text-sm); font-weight: 700; }
.avatar svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.bubble { display: grid; gap: 0.15rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2); overflow-wrap: anywhere; }
.msg[data-side="right"] .bubble { border-color: var(--primary); }
.bubble b, .bubble small { font-size: var(--text-sm); }
.typing { grid-auto-flow: column; justify-content: start; gap: 0.3rem; }
.typing i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted-foreground); }
@media (prefers-reduced-motion: no-preference) {
  .typing i { animation: blink 1s infinite; }
  .typing i:nth-child(2) { animation-delay: 0.2s; }
  .typing i:nth-child(3) { animation-delay: 0.4s; }
}
@keyframes blink { 50% { opacity: 0.2; } }
.notice { text-align: center; font-size: var(--text-sm); font-weight: 600; border: 2px solid; border-radius: var(--radius); padding: var(--space-2); overflow-wrap: anywhere; }
.notice[data-kind="block"] { color: var(--success); }
.notice[data-kind="block"]::before { content: "[Firewall] "; }
.notice[data-kind="leak"] { color: var(--danger); }
.notice[data-kind="leak"]::before { content: "[Alert] "; }

.sees { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem var(--space-4); margin: 0; font-size: var(--text-sm); }
.sees dt { color: var(--muted-foreground); }
.sees dd { margin: 0; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.sees dd[data-kind="stop"] { color: var(--success); font-weight: 700; }
