:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1d1f1c; --muted: #646a61; --line: #d9d8d0;
  --accent: #0a6b4f; --accent-ink: #ffffff; --danger: #a8281d; --ok-bg: #e2f2ea; --err-bg: #fbe7e4;
  --tag: #ecebe4; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101311; --panel: #181c19; --ink: #e6e8e3; --muted: #9aa096; --line: #2c322d;
    --accent: #4ed29d; --accent-ink: #06231a; --danger: #ff8a7d; --ok-bg: #143026; --err-bg: #3a1a16; --tag: #262b27;
  }
}
:root[data-theme="dark"] {
  --bg: #101311; --panel: #181c19; --ink: #e6e8e3; --muted: #9aa096; --line: #2c322d;
  --accent: #4ed29d; --accent-ink: #06231a; --danger: #ff8a7d; --ok-bg: #143026; --err-bg: #3a1a16; --tag: #262b27;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font: 700 18px var(--mono); color: var(--ink); text-decoration: none; letter-spacing: -.5px; }
.brand b { color: var(--accent); }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
nav { display: flex; flex-wrap: wrap; gap: 2px 16px; }
nav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--ink); }
nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.signout { margin-left: auto; color: var(--muted); }
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 16px; font-size: 24px; letter-spacing: -.3px; }
h2 { margin: 28px 0 10px; font-size: 16px; }
.lead { color: var(--muted); max-width: 72ch; margin: 0 0 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 14px; }
.nowrap { white-space: nowrap; }
.note { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; overflow-wrap: anywhere; }
.note.ok { background: var(--ok-bg); }
.note.err { background: var(--err-bg); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card > summary { cursor: pointer; font-weight: 600; }
.narrow { max-width: 420px; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 12px; }
.inline.tight { margin: 0; gap: 8px; }
.search { margin: 0 0 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 4px; }
input:not([type=checkbox]):not([type=radio]), select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; width: 100%; }
.inline input:not([type=checkbox]):not([type=radio]), .inline select { width: auto; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { font: inherit; font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none; border-radius: 6px; padding: 7px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 400; }
button.link.danger { color: var(--danger); }
.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); white-space: nowrap; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:target td { background: var(--ok-bg); }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--tag); white-space: nowrap; }
.tag.bad { background: var(--err-bg); color: var(--danger); }
.state.connected { color: var(--accent); font-weight: 600; }
.actions { text-align: right; }
.actions > * { display: inline-block; vertical-align: top; margin: 0 0 4px 8px; }
.actions summary { cursor: pointer; color: var(--accent); }
.actions details[open] { display: block; min-width: 260px; margin-left: 0; }
.actions details[open] > :not(summary) { margin-top: 10px; text-align: left; }
.toggles { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.group { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.group a { padding: 6px 12px; text-decoration: none; color: var(--muted); }
.group a[aria-current] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.boards h2 { margin-top: 0; }
.board { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; }
.rank { color: var(--muted); width: 2.5em; }
.bbs { color: var(--muted); }
.boards + .muted { margin-top: 16px; }
.prose { max-width: 72ch; }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; }
.panels h2 { margin: 0 0 8px; }
.term { background: #000; padding: 6px; border-radius: 6px; overflow-x: auto; }
.hex { background: #000; color: #bfe8d4; padding: 10px; border-radius: 6px; height: 420px; overflow: auto; font: 12px/1.45 var(--mono); margin: 0; white-space: pre; }
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  main { padding: 16px; }
  .signout { margin-left: 0; }
  .actions { text-align: left; }
}
.term-controls { margin: 0 0 12px; }
.term-options { margin: 0 0 16px; }
.term-options label.check { padding-bottom: 7px; }
.term-controls select { min-width: 200px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.combo { position: relative; }
#term-line { width: 300px; max-width: 100%; }
.term-controls input, .term-controls select { height: 36px; }
.combo ul { position: absolute; top: 100%; left: 0; z-index: 10; width: 340px; max-width: calc(100vw - 32px); max-height: 280px; overflow-y: auto; margin: 4px 0 0; padding: 4px 0; list-style: none; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.combo li { padding: 6px 10px; cursor: pointer; overflow-wrap: anywhere; }
.combo li[aria-selected="true"], .combo li:hover { background: var(--tag); }
.combo li.none { color: var(--muted); cursor: default; background: none; }
.combo li .num { font-family: var(--mono); }
.combo li .name { color: var(--muted); margin-left: 8px; }
.settings { margin-bottom: 16px; max-width: 560px; }
.settings h2 { margin: 0 0 6px; }
.settings .muted { margin: 0 0 12px; }
.term-screen { max-width: 100%; overflow-x: auto; }
.term-screen .term { display: inline-block; }
.term-screen [hidden] { display: none !important; }
.mode7 { background: #000; display: block; border-radius: 6px; max-width: 100%; outline-offset: 2px; }
@font-face { font-family: Bedstead; src: url(/static/bedstead.otf) format("opentype"); }
