/* The Round Table. Dark ground, gold for lines, markers and buttons; text
   that people wrote sits on a solid block in plain colours. */

:root {
  --ground: #0c0b09;
  --ground-2: #15120e;
  --panel: #12100c;
  --paper: #17140f;
  --paper-ink: #f1eadc;
  --paper-label: #cbc1ad;
  --ink: #ece5d6;
  --ink-2: #bdb3a0;
  --ink-3: #8f8571;
  --gold: #c9a45c;
  --gold-hi: #ead08e;
  --gold-dim: #5e5036;
  --gold-veil: rgba(201, 164, 92, 0.08);
  --gold-veil-2: rgba(201, 164, 92, 0.16);
  --rust: #b85a4a;
  --rust-ink: #ecb6a8;
  --hair: 1px solid var(--gold-dim);
  --gutter: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-title: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  --bar-h: 56px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--ground);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 32%, rgba(201, 164, 92, 0.07), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, #17140f 0%, var(--ground) 70%);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.6 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Buttons ── */
.btn {
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  background: var(--gold-veil);
  color: var(--gold-hi);
  letter-spacing: 0.12em;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--gold-veil-2); }
.btn:disabled { opacity: 0.45; }
.btn-strong { border-color: var(--gold-hi); background: rgba(234, 208, 142, 0.12); }
.btn-danger { border-color: var(--rust); color: var(--rust-ink); background: rgba(184, 90, 74, 0.1); }
.btn-danger:hover:not(:disabled) { background: rgba(184, 90, 74, 0.18); }
.btn-quiet { border-color: var(--gold-dim); color: var(--ink-2); background: transparent; }

/* ── Diamond markers ── */
.dia {
  position: relative;
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
}
.dia::before {
  content: "";
  position: absolute;
  inset: 3px;
  transform: rotate(45deg);
  border: 1px solid var(--gold-dim);
}
.dia-lit::before { background: var(--gold-hi); border-color: var(--gold-hi); box-shadow: 0 0 8px rgba(234, 208, 142, 0.55); }
.dia-lit::after {
  content: "!";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 10px/1 var(--font);
  color: #1a150c;
}
.dia-out::before { background: transparent; }
.dia-recused::before { border-color: var(--rust); background: rgba(184, 90, 74, 0.35); }

/* ── Header bar ── */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  background: rgba(12, 11, 9, 0.94);
  border-bottom: var(--hair);
}
.bar-home {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--gold-hi);
  font: 600 18px/1 var(--font-title);
  letter-spacing: 0.2em;
}
.bar-mark { width: 26px; height: 26px; }
.bar-seat { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; color: var(--ink-2); font-size: 14px; }
.bar-seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.bar-face {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-hi);
  font: 15px/1 var(--font-title);
}
.bar-tools { display: flex; gap: 8px; }
.bar-btn {
  min-height: 36px;
  padding: 0 10px;
  border: var(--hair);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  white-space: nowrap;
}
.bar-btn:hover { color: var(--gold-hi); border-color: var(--gold); }

.screen { display: block; }
.loading { padding: 48px var(--gutter); text-align: center; color: var(--ink-2); }

/* ── Gate ── */
.gate {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  min-height: 100dvh;
  padding: 24px var(--gutter);
  text-align: center;
}
.gate-mark { width: 120px; height: 120px; opacity: 0.55; }
.gate-line { margin: 0; font-size: 18px; color: var(--ink); letter-spacing: 0.06em; }

/* ── Naming ── */
.naming {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(56px + env(safe-area-inset-top, 0px)) var(--gutter) 40px;
  text-align: center;
}
.reveal { position: relative; width: 128px; height: 128px; margin-bottom: 28px; }
.reveal-ring {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 6px var(--ground), 0 0 0 7px var(--gold-dim);
}
.reveal-char { font: 48px/1 var(--font-title); color: var(--gold-hi); opacity: 0; }
.reveal-mask { position: absolute; inset: 0; width: 128px; height: 128px; }
.naming-title { margin: 0 0 8px; font: 600 26px/1.3 var(--font-title); color: var(--gold-hi); letter-spacing: 0.12em; }
.naming-hint { margin: 0 0 28px; color: var(--ink-2); font-size: 15px; }
.name-input {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font: 22px/1.3 var(--font-title);
  text-align: center;
  letter-spacing: 0.1em;
}
.name-input:focus { border-color: var(--gold); outline: none; }
.name-msg { min-height: 1.6em; margin: 10px 0 14px; color: var(--rust-ink); font-size: 15px; }
.name-go { width: 100%; min-height: 52px; font-size: 17px; }
.naming-done .reveal-mask { opacity: 0; }
.naming-done .reveal-char { opacity: 1; }
.naming-lift .reveal-mask { animation: mask-lift 1.1s cubic-bezier(0.5, 0, 0.2, 1) both; opacity: 1; }
.naming-lift .reveal-char { animation: char-rise 0.9s 0.45s ease-out both; }
.naming-lift .reveal-ring { animation: ring-glow 1.4s ease-out both; }
.naming-lift > :not(.reveal) { animation: fade-away 0.6s 0.2s ease both; }
@keyframes mask-lift {
  0% { transform: none; opacity: 1; }
  30% { transform: translateY(4px) rotate(1deg); opacity: 1; }
  100% { transform: translateY(-90px) rotate(-10deg) scale(0.92); opacity: 0; }
}
@keyframes char-rise { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes ring-glow {
  0% { box-shadow: 0 0 0 6px var(--ground), 0 0 0 7px var(--gold-dim); }
  60% { box-shadow: 0 0 0 6px var(--ground), 0 0 0 7px var(--gold-hi), 0 0 36px rgba(234, 208, 142, 0.45); }
  100% { box-shadow: 0 0 0 6px var(--ground), 0 0 0 7px var(--gold), 0 0 18px rgba(234, 208, 142, 0.2); }
}
@keyframes fade-away { to { opacity: 0; } }

/* ── Layers ── */
.layers { position: relative; z-index: 50; }
.layer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 4, 3, 0.74);
  animation: layer-in 0.16s ease both;
}
.layer-out { animation: layer-in 0.16s ease reverse both; }
.layer-card {
  width: 100%;
  max-width: 420px;
  padding: 22px 20px 20px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  background: var(--ground-2);
  box-shadow: 0 0 0 4px var(--ground), 0 0 0 5px var(--gold-dim), 0 24px 60px rgba(0, 0, 0, 0.6);
}
.layer-title { margin: 0 0 10px; font: 600 20px/1.4 var(--font-title); color: var(--gold-hi); }
.layer-body { color: var(--ink); font-size: 16px; }
.layer-big {
  margin: 14px 0;
  padding: 18px 12px;
  border-top: var(--hair);
  border-bottom: var(--hair);
  font: 40px/1.3 var(--font-title);
  color: var(--paper-ink);
  text-align: center;
  letter-spacing: 0.12em;
  overflow-wrap: anywhere;
}
.layer-form { display: grid; gap: 16px; }
.layer-msg { min-height: 1.4em; margin: 10px 0 0; color: var(--rust-ink); font-size: 15px; }
.layer-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
@keyframes layer-in { from { opacity: 0; } to { opacity: 1; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 1px solid var(--gold-dim);
  background: var(--ground-2);
  color: var(--ink);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast-show { opacity: 1; transform: translate(-50%, 0); }

/* ── The table ── */
.table-screen { padding: 20px var(--gutter) 48px; }
.table-layout { display: grid; gap: 28px; max-width: 1360px; margin: 0 auto; }
.web { display: none; }

.phone-table { display: grid; justify-items: center; gap: 22px; }
.seat-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 12px; max-width: 100%; }
.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 64px;
  padding: 0;
  border: 0;
  background: none;
}
.seat-ring {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--ground), 0 0 0 4px var(--gold-dim);
}
.seat-char { font: 22px/1 var(--font-title); color: var(--gold-hi); }
.seat-img { width: 56px; height: 56px; }
.seat-name { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-2); }
.seat-mask .seat-name { color: var(--ink-3); }
.seat-me .seat-ring { border-color: var(--gold-hi); box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--gold-hi), 0 0 16px rgba(234, 208, 142, 0.35); }
.seat-me .seat-name { color: var(--gold-hi); }
.seat-owner .seat-ring { box-shadow: 0 0 0 3px var(--ground), 0 0 0 4px var(--gold-dim), 0 0 0 7px var(--ground), 0 0 0 8px var(--gold-dim); }
.seat-me.seat-owner .seat-ring { box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--gold-hi), 0 0 0 7px var(--ground), 0 0 0 8px var(--gold), 0 0 16px rgba(234, 208, 142, 0.35); }
.seat-you {
  position: absolute;
  top: -6px;
  right: 0;
  padding: 0 5px;
  border: 1px solid var(--gold-hi);
  background: var(--ground);
  color: var(--gold-hi);
  font-size: 11px;
  line-height: 16px;
}
.seat-named:hover .seat-ring { border-color: var(--gold-hi); }

.emblem { position: relative; display: grid; place-items: center; width: 168px; height: 168px; }
.emblem-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.emblem-total { position: relative; margin-top: -10px; font: 600 44px/1 var(--font-title); color: var(--gold-hi); text-shadow: 0 0 18px rgba(234, 208, 142, 0.35); }
.emblem-label { position: absolute; bottom: 44px; font-size: 13px; color: var(--ink-2); letter-spacing: 0.3em; }

.branch-list { width: 100%; max-width: 560px; margin: 0; padding: 0; list-style: none; border-bottom: var(--hair); }
.branch {
  display: grid;
  grid-template-columns: 16px 1fr auto 10px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 13px 6px;
  border: 0;
  border-top: var(--hair);
  background: none;
  text-align: left;
}
.branch:hover { background: var(--gold-veil); }
.branch-name { font: 17px/1.3 var(--font-title); color: var(--ink); letter-spacing: 0.06em; }
.branch-count { font: 600 18px/1 var(--font-title); color: var(--gold-hi); }
.branch-dim .branch-name { color: var(--ink-2); }
.branch-dim .branch-count { color: var(--ink-3); font-weight: 400; }
.branch-caret { width: 8px; height: 8px; border-top: 1.5px solid var(--gold-dim); border-right: 1.5px solid var(--gold-dim); transform: rotate(45deg); }

/* The web, from 900px up. */
@media (min-width: 900px) {
  .web {
    position: relative;
    display: block;
    width: 100%;
    max-width: 1080px;
    aspect-ratio: 1000 / 640;
    margin: 0 auto;
  }
  .phone-table { display: none; }
  .web-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .web-layer { position: absolute; inset: 0; }
  .web-layer > * { position: absolute; transform: translate(-50%, -50%); }
  .web .emblem { width: 17%; height: auto; aspect-ratio: 1; }
  .web .seat { width: 72px; }
  .web .seat-name { position: absolute; top: 100%; margin-top: 3px; padding: 0 4px; background: var(--ground); line-height: 1.4; }
  .web .node-name, .web .leaf-name { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
  .web .leaf-name { top: calc(100% + 2px); }
}
@media (min-width: 1240px) {
  .table-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .record { position: sticky; top: calc(var(--bar-h) + 20px); max-height: calc(100dvh - var(--bar-h) - 40px); overflow: auto; }
}

.web-lines line, .web-lines circle { fill: none; vector-effect: non-scaling-stroke; }
.ln-ring { stroke: var(--gold); stroke-width: 1; stroke-opacity: 0.8; }
.ln-ring-faint { stroke: var(--gold-dim); stroke-width: 1; }
.ln-tick { stroke: var(--gold); stroke-width: 1; }
.ln-branch { stroke: var(--gold-dim); stroke-width: 1; }
.ln-branch.ln-hot { stroke: var(--gold); stroke-width: 1.4; }
.web-lines .ln-knot { fill: var(--gold-dim); stroke: none; }
.web-lines .ln-knot.ln-hot { fill: var(--gold-hi); }
.ln-leaf { stroke: var(--gold-dim); stroke-width: 1; stroke-dasharray: 3 4; }
html:not(.motion-off) .web-lines .ln-branch { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 0.9s 0.1s ease-out forwards; }
html:not(.motion-off) .web-layer > * { animation: rise 0.5s ease-out both; }
html:not(.motion-off) .web-layer > .node { animation-delay: 0.45s; }
html:not(.motion-off) .web-layer > .leaf { animation-delay: 0.7s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }

.node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
}
.node-disc {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 4px var(--ground), 0 0 0 5px var(--gold-dim);
  transition: box-shadow 0.2s;
}
.node-count { font: 600 22px/1 var(--font-title); color: var(--gold-hi); }
.node-name { font: 16px/1.2 var(--font-title); color: var(--ink); letter-spacing: 0.08em; white-space: nowrap; }
.node .dia { position: absolute; top: -6px; left: calc(50% + 18px); width: 20px; height: 20px; }
.node-dim .node-disc { border-color: var(--gold-dim); }
.node-dim .node-count { color: var(--ink-3); font-weight: 400; }
.node-dim .node-name { color: var(--ink-2); }
.node:hover .node-disc, .node:focus-visible .node-disc { box-shadow: 0 0 0 4px var(--ground), 0 0 0 5px var(--gold-hi), 0 0 22px rgba(234, 208, 142, 0.3); }
.node-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  padding: 6px 10px;
  border: 1px solid var(--gold);
  background: var(--ground-2);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s, transform 0.15s;
}
.node:hover .node-tip, .node:focus-visible .node-tip { opacity: 1; transform: translate(-50%, 0); }
html:not(.motion-off) .node-hot .dia-lit::before { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 14px rgba(234, 208, 142, 0.9); } }

.leaf { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border: 0; background: none; }
.leaf-mark { width: 9px; height: 9px; border: 1px solid var(--gold); background: var(--ground); transform: rotate(45deg); }
.leaf-name { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.leaf:hover .leaf-name { color: var(--gold-hi); }
.leaf:hover .leaf-mark { background: var(--gold); }

/* ── The record ── */
.record { width: 100%; max-width: 640px; margin: 0 auto; }
.record-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; padding-bottom: 10px; border-bottom: var(--hair); }
.record-title { margin: 0; font: 600 20px/1.3 var(--font-title); color: var(--gold-hi); letter-spacing: 0.2em; }
.record-filter { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; }
.chip-clear { margin-left: 8px; padding: 2px 8px; border: var(--hair); background: none; color: var(--ink-2); font-size: 13px; }
.record-list { margin: 0; padding: 0; list-style: none; }
.record-row { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-bottom: var(--hair); }
.record-face {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-hi);
  font: 15px/1 var(--font-title);
}
.record-mask { border: 0; }
.record-main { display: grid; gap: 2px; min-width: 0; }
.record-line { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.record-seat { color: var(--gold-hi); }
.record-act { color: var(--ink); }
.record-what { color: var(--ink-2); }
.record-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.record-target { font-family: var(--font-mono); overflow-wrap: anywhere; }
.record-empty { color: var(--ink-2); font-size: 15px; }
.record-more { margin-top: 14px; width: 100%; }

/* ── A desk ── */
.desk { padding: 18px var(--gutter) 48px; max-width: 1360px; margin: 0 auto; }
.desk-head { display: grid; gap: 12px; margin-bottom: 14px; }
.desk-title { margin: 0; font: 600 26px/1.3 var(--font-title); color: var(--gold-hi); letter-spacing: 0.2em; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px 2px; border-bottom: var(--hair); }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-2);
  font-size: 15px;
}
.tab-on { color: var(--gold-hi); border-bottom-color: var(--gold-hi); }
.tab-count { font: 600 15px/1 var(--font-title); color: var(--gold-hi); }
.tab .dia { width: 12px; height: 12px; }
.tab .dia::after { content: none; }

.desk-body { display: block; }
.docket { margin: 0; padding: 0; list-style: none; border-bottom: var(--hair); }
.docket-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 64px;
  padding: 14px 8px;
  border: 0;
  border-top: var(--hair);
  background: none;
  text-align: left;
}
.docket-row .dia { margin-top: 4px; }
.docket-row:hover { background: var(--gold-veil); }
.docket-row[aria-current="true"] { background: var(--gold-veil-2); }
.docket-row[aria-current="true"] .row-title { color: var(--gold-hi); }
.row-main { display: grid; gap: 4px; min-width: 0; }
.row-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.row-meta { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.row-recused { margin-right: 8px; padding: 0 6px; border: 1px solid var(--rust); color: var(--rust-ink); }
.is-done .row-title { color: var(--ink-3); }
.docket-empty { padding: 28px 8px; color: var(--ink-2); font-size: 15px; }

.case-pane { position: relative; display: none; }
.has-case .docket-wrap { display: none; }
.has-case .case-pane { display: block; }
.case-idle { padding: 40px 12px; text-align: center; color: var(--ink-2); }
.case-clear p { margin: 0 0 18px; font: 20px/1.4 var(--font-title); color: var(--ink); }
.case-clear .gavels { justify-content: center; }

@media (min-width: 1000px) {
  .desk-body { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 28px; align-items: start; }
  .docket-wrap, .has-case .docket-wrap { display: block; position: sticky; top: calc(var(--bar-h) + 12px); max-height: calc(100dvh - var(--bar-h) - 24px); overflow: auto; }
  .case-pane { display: block; }
  .case-back, .case-back-btn { display: none; }
}

.case { display: grid; gap: 18px; }
.case-back {
  justify-self: start;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--gold-hi);
  font-size: 15px;
}
.case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  padding: 14px 16px;
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--ground), inset 0 0 0 4px var(--gold-dim);
}
.case-kicker { font: 600 19px/1.3 var(--font-title); color: var(--gold-hi); letter-spacing: 0.1em; }
.case-id { font: 13px/1.3 var(--font-mono); color: var(--ink-2); overflow-wrap: anywhere; }
.case-count { margin-left: auto; font-size: 15px; color: var(--ink); }

/* The evidence: measured, not eyeballed (scripts/desk-harness.mjs). Solid
   ground, 16px and up, contrast 7:1 and up. No gold for paragraphs. */
.evidence {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--gold-dim);
  background: var(--paper);
  color: var(--paper-ink);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.evidence * { font-size: max(16px, 1em); }
.ev-group { display: grid; gap: 12px; }
.ev-group + .ev-group, .ev-row + .ev-group, .ev-group + .ev-row { padding-top: 14px; border-top: 1px solid #3a3224; }
.ev-group-title { font: 600 17px/1.4 var(--font-title); color: var(--paper-ink); }
.ev-row { display: grid; gap: 2px; }
.ev-label { font-size: 16px; color: var(--paper-label); }
.ev-value { font-size: 17px; color: var(--paper-ink); }
.ev-prose { font-size: 17px; color: var(--paper-ink); white-space: pre-wrap; }
.ev-pics { display: flex; flex-wrap: wrap; gap: 10px; }
.ev-pic { max-width: 100%; max-height: 360px; border: 1px solid #3a3224; background: #0f0d0a; }
.ev-pic-missing { font-size: 16px; color: var(--paper-label); font-family: var(--font-mono); }
.ev-face-btn { justify-self: start; min-height: 44px; font-size: 16px; color: var(--gold-hi); background: #221d14; border-color: var(--gold); }
.ev-details summary { cursor: pointer; font-size: 16px; color: var(--paper-label); }
.ev-pre { margin: 8px 0 0; max-height: 320px; overflow: auto; font: 16px/1.5 var(--font-mono); color: var(--paper-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.thread { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.line { display: grid; gap: 2px; }
.line-who { font-size: 16px; color: var(--paper-label); }
.line-body { font-size: 17px; color: var(--paper-ink); white-space: pre-wrap; }
.line-time { font-size: 16px; color: var(--paper-label); }
.line-ops .line-who { color: #e4d6b4; }
.line-system { font-size: 16px; color: var(--paper-label); }

.verdict { display: grid; gap: 18px; padding-top: 4px; }
.fields { display: grid; gap: 18px; max-width: 720px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 15px; color: var(--ink); }
.field-hint { font-size: 13px; color: var(--ink-2); }
.field-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
}
.field-input:focus { border-color: var(--gold); outline: none; }
textarea.field-input { resize: vertical; line-height: 1.6; }
select.field-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.pairing { display: flex; flex-wrap: wrap; gap: 10px; }
.pairing-opt, .check-line { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--gold-dim); color: var(--ink); }
.pairing-opt input, .check-line input { accent-color: var(--gold); width: 18px; height: 18px; }
.gavels { display: flex; flex-wrap: wrap; gap: 12px; }
.verdict-btn { min-width: 96px; font-size: 17px; }
.verdict-done { margin: 0; color: var(--ink-2); }
.verdict-recused { padding: 14px 16px; border: 1px solid var(--rust); background: rgba(184, 90, 74, 0.1); }
.recused-line { margin: 0; color: var(--rust-ink); font-size: 16px; }
.case-msg { min-height: 1.4em; margin: 0; color: var(--rust-ink); font-size: 15px; }
.case-msg:empty { display: none; }

/* The gavel: a ring strikes, the word stays a beat. */
/* Fixed at the middle of the screen, over the case pane's centre line (queue.js sets left). */
.gavel { position: fixed; top: 50%; left: 50%; z-index: 30; width: 0; height: 0; pointer-events: none; }
.gavel-ring, .gavel-word { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); }
.gavel-ring { width: 168px; height: 168px; border: 2px solid var(--gold-hi); border-radius: 50%; background: rgba(12, 11, 9, 0.88); box-shadow: 0 0 0 6px rgba(12, 11, 9, 0.88), 0 0 0 7px var(--gold); }
.gavel-word { font: 600 32px/1 var(--font-title); white-space: nowrap; color: var(--gold-hi); letter-spacing: 0.3em; padding-left: 0.3em; }
.gavel-strike { animation: strike 0.62s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes strike {
  0% { opacity: 0; transform: scale(1.45); }
  28% { opacity: 1; transform: scale(0.94); }
  40% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}
.case-out { animation: case-out 0.22s ease-in both; }
.case-in { animation: case-in 0.26s ease-out both; }
@keyframes case-out { to { opacity: 0; transform: translateX(-22px); } }
@keyframes case-in { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }

/* Motion off: the switch, or the system's reduced-motion default. */
.motion-off *, .motion-off *::before, .motion-off *::after { animation: none !important; transition: none !important; }

@media (max-width: 420px) {
  .bar { gap: 8px; }
  .bar-seat-name { display: none; }
  .bar-home span { letter-spacing: 0.1em; }
}
