/* One-Pixel-Over · canvas.css
   Concept: a lit switchboard. Flat, saturated holder pixels sit on a quiet board of
   graph paper (light) or a dark phosphor screen (dark); state is carried by light,
   bitmap caps label the hardware, a humanist sans does the talking.

   Tokens live on :root. Light is the bare default; dark is applied by the device
   preference unless the page is pinned light, and again when the page is pinned dark. */

:root {
  color-scheme: light;
  /* colour */
  --ground: #eef1f5;        /* page */
  --panel: #ffffff;         /* cards, inputs */
  --ink: #0f1722;           /* text */
  --ink-2: #4b5669;         /* secondary text, AA on panel and ground */
  --line: #cdd4df;          /* hairlines */
  --accent: #b4530a;        /* amber, dark enough for text on white */
  --accent-ink: #ffffff;    /* text on accent */
  --lit: #ffcf4a;           /* the light that carries state */
  /* the board */
  --board: #ffffff;
  --board-grid: #dfe4ec;
  --empty: #e7ebf1;
  --px-edge: inset 0 0 0 1px rgb(15 23 34 / .14);
  --px-glow: 0 0 0 0 transparent;
  --lit-glow: 0 0 0 1px rgb(15 23 34 / .35);
  --shadow: 0 1px 0 rgb(15 23 34 / .04), 0 8px 24px -16px rgb(15 23 34 / .25);
  /* type */
  --font-body: "Atkinson Hyperlegible", "Source Sans 3", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Silkscreen", "Px437 IBM VGA", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-0: .72rem;  /* bitmap caps */
  --fs-1: .875rem;
  --fs-2: 1rem;
  --fs-3: 1.25rem;
  --fs-4: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
  /* space */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2.5rem;
  --r: 4px;
  --t: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #090c14;
    --panel: #111726;
    --ink: #edf0f6;
    --ink-2: #a2abc0;
    --line: #273047;
    --accent: #f3b63e;
    --accent-ink: #0a0d15;
    --lit: #ffe08a;
    --board: #04060b;
    --board-grid: #070a12;
    --empty: #151c2e;
    --px-edge: 0 0 0 0 transparent;
    --px-glow: 0 0 .7rem .05rem var(--c, transparent);
    --lit-glow: 0 0 .4rem var(--lit);
    --shadow: 0 0 0 1px rgb(255 255 255 / .03), 0 12px 32px -20px rgb(0 0 0 / .9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #090c14;
  --panel: #111726;
  --ink: #edf0f6;
  --ink-2: #a2abc0;
  --line: #273047;
  --accent: #f3b63e;
  --accent-ink: #0a0d15;
  --lit: #ffe08a;
  --board: #04060b;
  --board-grid: #070a12;
  --empty: #151c2e;
  --px-edge: 0 0 0 0 transparent;
  --px-glow: 0 0 .7rem .05rem var(--c, transparent);
  --lit-glow: 0 0 .4rem var(--lit);
  --shadow: 0 0 0 1px rgb(255 255 255 / .03), 0 12px 32px -20px rgb(0 0 0 / .9);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--ground); color: var(--ink);
  font: 400 var(--fs-2)/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
}
main { max-width: 74rem; margin: 0 auto; padding: 0 var(--s-4) var(--s-6); }
@media (min-width: 52rem) { main { padding: 0 var(--s-5) var(--s-6); } }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: var(--fs-4); font-weight: 700; }
h2 { font-size: var(--fs-3); font-weight: 700; }
p { margin: var(--s-2) 0; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--ink); }
code { font: .9em var(--font-display); }
b, strong { font-weight: 700; }
.small { font-size: var(--fs-1); color: var(--ink-2); }
.small b { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--lit); color: #0f1722; }

/* bitmap caps: the labels on the hardware */
.cap, .kicker, th, .chip, .coord, .legend, #mode, .ticker-time, .rank, .topic {
  font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .04em; text-transform: uppercase;
  font-weight: 400; color: var(--ink-2);
}

/* ---------- header ---------- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--line); margin-bottom: var(--s-5);
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); text-decoration: none; font-family: var(--font-display); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.brand:hover { color: var(--accent); }
.mark { /* 3×3 pixels, one pixel over */
  width: 18px; height: 18px; flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
}
.mark i { background: var(--ink); }
.mark i:nth-child(3) { background: var(--accent); box-shadow: var(--lit-glow); }
.mark i:nth-child(5) { background: transparent; }
.nav { display: flex; gap: var(--s-1); margin-left: auto; }
.nav a { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; padding: .35rem .55rem; border-radius: var(--r); }
.nav a:hover { color: var(--ink); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.chip, #mode { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink-2); white-space: nowrap; }
#mode::before { content: ""; width: 7px; height: 7px; background: var(--lit); box-shadow: var(--lit-glow); flex: none; }
#mode:empty { display: none; }
.theme { font: inherit; font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: var(--r); padding: .3rem .55rem; cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--ink-2); }
@media (max-width: 36rem) {
  .top { gap: var(--s-2) var(--s-3); }
  .theme { order: 2; margin-left: auto; }
  .top .nav { order: 3; margin-left: -.55rem; }
  #mode { order: 4; margin-left: auto; display: block; max-width: 58%; overflow: hidden; text-overflow: ellipsis; }
  #mode::before { display: inline-block; margin-right: .4rem; }
}

.hero { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); max-width: 60rem; }
.hero .lede { margin: 0; color: var(--ink-2); font-size: var(--fs-1); }
.notice { border-left: 3px solid var(--accent); padding: .1rem 0 .1rem var(--s-3); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@media (min-width: 52rem) { .layout { grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); gap: var(--s-5); } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: var(--s-4); margin-bottom: var(--s-4); box-shadow: var(--shadow); }
@media (min-width: 52rem) { .card { padding: var(--s-5); } }
.card > h2 { margin-bottom: var(--s-2); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-3); }
.card-head h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.row > input { flex: 1 1 10rem; min-width: 0; }

/* ---------- the board ---------- */
.board { padding: var(--s-2); background: var(--board); border: 1px solid var(--line); border-radius: 6px; max-width: 40rem; margin: var(--s-3) auto; }
#grid {
  display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 2px; aspect-ratio: 1;
  background: var(--board-grid); padding: 2px; border-radius: 2px;
}
#grid button {
  aspect-ratio: 1; min-width: 0; border: 0; padding: 0; position: relative; cursor: pointer; border-radius: 1px;
  background: var(--empty); color: var(--c, var(--ink));
  box-shadow: var(--px-edge);
  transition: transform var(--t) ease-out, opacity var(--t) ease-out;
}
#grid button:not([data-state="empty"]) { box-shadow: var(--px-edge), var(--px-glow); z-index: 1; }
#grid button:hover { transform: scale(1.15); z-index: 3; }
/* light carries state */
#grid button::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; display: none; }
#grid button[data-state="proposed"]::after { display: block; background: var(--board); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .4); }               /* unlit socket */
#grid button[data-state="queued"]::after { display: block; background: var(--lit); box-shadow: var(--lit-glow); }                                   /* lit */
#grid button[data-state="built"]::after { display: block; inset: 20%; border-radius: 0; background: transparent; border: 2px solid var(--lit); box-shadow: var(--lit-glow), inset 0 0 0 2px rgb(0 0 0 / .35); } /* open door */
#grid button[data-state="removed"] { background-image: linear-gradient(135deg, transparent 46%, var(--board) 46%, var(--board) 54%, transparent 54%); opacity: .7; }
/* entrance: an accent ring */
#grid button[data-entrance="yes"] { box-shadow: var(--px-edge), 0 0 0 1px var(--board), 0 0 0 3px var(--accent), var(--px-glow); z-index: 2; }
/* search dim */
#grid button[data-dim="yes"] { opacity: .15; }
/* selection */
#grid button[aria-pressed="true"] { transform: scale(1.3); z-index: 4; outline: 2px solid var(--ink); outline-offset: 1px; box-shadow: var(--px-edge), 0 0 0 5px var(--board), 0 0 0 7px var(--accent), var(--px-glow); }
#grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 5; }
/* event pulse: an actual change happened on this pixel */
#grid button.changed { animation: px-pulse 280ms ease-out; }
@keyframes px-pulse { from { box-shadow: 0 0 0 0 var(--lit); } to { box-shadow: 0 0 0 .6rem rgb(255 207 74 / 0); } }

.board-foot { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); justify-content: space-between; align-items: center; margin-top: var(--s-3); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin: 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 14px; height: 14px; flex: none; position: relative; background: var(--empty); border-radius: 1px; box-shadow: var(--px-edge); display: inline-block; }
.legend i[data-c] { background: var(--c); }
.legend i::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; display: none; }
.legend i[data-state="proposed"]::after { display: block; background: var(--board); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .4); }
.legend i[data-state="queued"]::after { display: block; background: var(--lit); box-shadow: var(--lit-glow); }
.legend i[data-state="built"]::after { display: block; inset: 20%; border-radius: 0; border: 2px solid var(--lit); }
.legend i[data-entrance="yes"] { box-shadow: var(--px-edge), 0 0 0 1px var(--board), 0 0 0 2px var(--accent); }

/* search */
.search { display: grid; gap: var(--s-1); margin: 0 0 var(--s-2); }
.search input { width: 100%; }
#results { list-style: none; padding: 0; margin: 0 0 var(--s-2); display: grid; gap: var(--s-1); }
#results li { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-1); color: var(--ink); }
#results:empty { display: none; }

/* ---------- forms ---------- */
label { display: grid; gap: .3rem; margin: var(--s-3) 0; font-size: var(--fs-1); font-weight: 700; color: var(--ink); }
label.row { grid-template-columns: none; display: flex; font-weight: 400; }
input, textarea, select {
  font: inherit; font-size: var(--fs-2); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); padding: .55rem .7rem; max-width: 100%; width: 100%;
  transition: border-color var(--t);
}
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: .8; }
input:hover, textarea:hover, select:hover { border-color: var(--ink-2); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; margin: 0; padding: 0; accent-color: var(--accent); flex: none; }
input[type="number"] { max-width: 8rem; }
textarea { min-height: 4.5rem; resize: vertical; }
select { appearance: auto; }
details { margin: var(--s-3) 0; }
summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-1); }
summary:hover { color: var(--ink); }
summary::marker { color: var(--accent); }
details > form { padding: var(--s-2) 0 0 var(--s-3); border-left: 2px solid var(--line); margin-top: var(--s-2); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: var(--fs-1); font-weight: 700; line-height: 1.2;
  color: var(--ink); background: var(--panel); border: 1px solid var(--ink-2); border-radius: var(--r);
  padding: .55rem .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn:hover { border-color: var(--ink); background: var(--ground); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn:disabled:hover { background: var(--panel); border-color: var(--ink-2); }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
form > .btn, #pixel-body > .btn { margin-top: var(--s-2); }
#pixel-body .row .btn { flex: 1 1 auto; justify-content: center; }
#results .btn, #queue .btn { padding: .3rem .55rem; font-family: var(--font-display); font-size: var(--fs-0); font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- pixel card ---------- */
#pixel-card { border-top: 3px solid var(--accent); }
#pixel-title { font-family: var(--font-display); font-weight: 400; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
#pixel-body > p:first-child { margin-top: var(--s-3); }
#pixel-body p b { color: var(--ink); }
#pixel-body form { margin-top: var(--s-3); }
#pixel-body ul:not(.options) { margin: var(--s-2) 0; padding-left: 1.1rem; }

/* options list: a choice with live counts */
ul.options { list-style: none; padding: 0; margin: var(--s-3) 0; display: grid; gap: var(--s-1); }
ul.options li {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; justify-content: space-between;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--ground);
}
ul.options li > span:first-child { font-weight: 700; flex: 1 1 8rem; }
ul.options li .small { font-variant-numeric: tabular-nums; }
ul.options li .btn { padding: .35rem .7rem; }
ul.options li label.row { margin: 0; width: 100%; gap: .6rem; cursor: pointer; }

/* entrance */
.entrance { border: 1px solid var(--accent); border-radius: var(--r); padding: var(--s-3) var(--s-3); margin: var(--s-3) 0; background: var(--ground); position: relative; }
.entrance::before { content: "entrance"; position: absolute; top: -.55rem; left: .6rem; padding: 0 .35rem; background: var(--panel); color: var(--accent); font: var(--fs-0) var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.entrance > p:first-child { margin-top: 0; }
.entrance img, .entrance audio { max-width: 100%; display: block; margin-top: .3rem; }

/* ---------- tables: queue, tally ---------- */
.table-wrap { overflow-x: auto; margin: var(--s-3) 0 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-1); }
th { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--ground); }
#queue td:first-child, .rank { font-family: var(--font-display); font-size: var(--fs-0); color: var(--ink-2); padding-top: .75rem; }
#queue td:nth-child(4) { font-variant-numeric: tabular-nums; font-weight: 700; }
#queue td:nth-child(5) { font-family: var(--font-display); font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding-top: .75rem; }
#queue td:last-child { text-align: right; }
@media (max-width: 36rem) {
  .table-wrap.queue thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #queue tr { display: grid; grid-template-columns: 1.5rem auto auto 1fr; gap: .15rem .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
  #queue tr:last-child { border-bottom: 0; }
  #queue td { display: block; border: 0; padding: 0; }
  #queue td:first-child { grid-row: 1 / 3; padding-top: .25rem; }
  #queue td:nth-child(2) { grid-column: 2 / -1; font-weight: 700; }
  #queue td:nth-child(3), #queue td:nth-child(5) { padding-top: 0; }
  #queue td:nth-child(3)::before { content: "by "; font-weight: 400; }
  #queue td:nth-child(4)::after { content: " votes"; font-weight: 400; color: var(--ink-2); font-size: var(--fs-1); }
  #queue td:last-child { grid-column: 4; text-align: right; grid-row: 2; }
  #queue td[colspan] { grid-column: 1 / -1; }
}
#people td:first-child { font-weight: 700; }
#people td:first-child .small { font-weight: 400; font-family: var(--font-display); font-size: .65rem; display: block; }

/* ---------- log ---------- */
.ticker {
  display: flex; align-items: baseline; gap: var(--s-2); margin: calc(var(--s-5) * -1 + var(--s-2)) 0 var(--s-5);
  padding: .4rem .7rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  font-size: var(--fs-1); color: var(--ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ticker:empty { display: none; }
.ticker b { color: var(--ink); }
.ticker > span { animation: tick-in 240ms ease-out; display: inline; overflow: hidden; text-overflow: ellipsis; }
@keyframes tick-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
#log { font-size: var(--fs-1); max-height: 18rem; overflow: auto; margin: var(--s-2) 0; padding: 0; list-style: none;
  -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); }
#log li { padding: .35rem 0; border-bottom: 1px solid var(--line); color: var(--ink-2); display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: baseline; }
#log li:last-child { border-bottom: 0; }
#log li b { color: var(--ink); }
#log li .ticker-time { padding-top: .1rem; }
#log:empty::before { content: "Nothing has happened yet."; color: var(--ink-2); }

[hidden] { display: none !important; }

/* ---------- decide: rounds of short prompts (Board Hub contract) ---------- */
.round { margin-bottom: var(--s-6); }
.round > header { display: grid; grid-template-columns: 1fr auto; gap: var(--s-1) var(--s-4); align-items: baseline; margin-bottom: var(--s-3); }
.round > header h2 { margin: 0; }
.round > header .intro { grid-column: 1; margin: 0; color: var(--ink-2); font-size: var(--fs-1); }
.round > header .progress { grid-column: 2; grid-row: 1 / span 2; font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0; font-variant-numeric: tabular-nums; }
details.prompt { margin: 0 0 var(--s-2); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
details.prompt[open] { border-color: var(--accent); }
details.prompt.answered { border-left: 3px solid var(--lit); }
details.prompt > summary { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3); align-items: center; padding: .8rem var(--s-4); min-height: 44px; color: var(--ink); font-size: var(--fs-2); list-style: none; }
details.prompt > summary::-webkit-details-marker { display: none; }
details.prompt > summary::marker { content: ""; }
details.prompt > summary .verb { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); min-width: 4.5em; }
details.prompt > summary .question { font-weight: 600; min-width: 0; }
details.prompt > summary .pending, details.prompt > summary .stance { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
details.prompt > summary .stance-comfortable { color: var(--accent); }
details.prompt > summary .stance-change, details.prompt > summary .stance-question { color: var(--ink); }
details.prompt > .body { padding: 0 var(--s-4) var(--s-4); display: grid; gap: var(--s-3); border-top: 1px solid var(--line); padding-top: var(--s-3); }
details.prompt .context { margin: 0; color: var(--ink-2); }
details.prompt .request { margin: 0; font-weight: 600; }
.recommendation, .mine { display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-3); align-items: baseline; padding: .6rem .8rem; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.mine { border-left-color: var(--lit); background: color-mix(in srgb, var(--lit) 10%, var(--panel)); }
.recommendation .label, .mine .label { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.mine .when { grid-column: 2; font-size: var(--fs-1); color: var(--ink-2); }
form.answer-form { display: grid; gap: var(--s-3); }
form.answer-form fieldset { border: 0; padding: 0; margin: 0; }
form.answer-form legend { font-size: var(--fs-1); color: var(--ink-2); margin-bottom: var(--s-2); }
.stances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.stances label { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 600; text-align: center; }
.stances label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.stances input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.stances label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 30rem) { .stances { grid-template-columns: 1fr; } }
details.prompt .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
details.prompt details.more { margin: 0; }
details.prompt details.more > .body { padding-top: var(--s-2); }
details.prompt .sources a { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: .04em; color: var(--accent); }

footer.foot { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--fs-1); }
footer.foot p { margin: var(--s-1) 0; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* word address beside the pixel title */
#pixel-title .words { font-family: var(--font-body); font-weight: 400; font-size: var(--fs-1); color: var(--accent); letter-spacing: 0; text-transform: none; margin-left: var(--s-2); }

/* ---------- presence strip: everyone active in the last twenty minutes, as their colored pixel ---------- */
.presence { display: flex; gap: var(--s-2); overflow-x: auto; margin: 0 0 var(--s-4); padding: 2px 0 var(--s-1); align-items: center; scrollbar-width: thin; }
.presence:empty { display: none; }
.presence .who {
  flex: none; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-3) 0 var(--s-2);
  font: inherit; font-size: var(--fs-1); font-weight: 700; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
}
.presence .who:hover { border-color: var(--ink-2); }
.presence .who:disabled { color: var(--ink-2); border-style: dashed; cursor: default; }
.presence .who i { width: 24px; height: 24px; background: var(--c); border-radius: 2px; box-shadow: var(--px-edge), var(--px-glow); flex: none; }

/* ---------- the door: ranked entrances above the map. Compact one-row scroller on phones, large cards wide ---------- */
.door { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-3); margin: 0 0 var(--s-4); transition: opacity 200ms ease; }
.door:empty { display: none; }
.door[data-fade="out"] { opacity: 0; }
.door .gate {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); min-height: 44px; padding: var(--s-4); text-align: left;
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer;
}
.door .gate:hover { border-color: var(--accent); }
.door .gate b { font-size: var(--fs-3, 1.25rem); overflow-wrap: anywhere; }
.door .gate .in { color: var(--accent); font-weight: 700; }

/* ---------- pixel card: a card in the aside on wide screens, a bottom sheet at phone width (TE-028) ---------- */
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.sheet-head h2 { margin-bottom: var(--s-2); }
.grip, #sheet-close { display: none; }
@media (max-width: 51.99rem) {
  #pixel-card {
    position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 20; width: min(100%, 40rem); margin: 0 auto;
    max-height: var(--sheet-max, 50dvh); display: flex; flex-direction: column;
    border-radius: 14px 14px 0 0; border-bottom: 0; padding: var(--s-2) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 32px -12px rgb(0 0 0 / .45);
    transform: translateY(105%); visibility: hidden; transition: transform 200ms ease-out, visibility 0s linear 200ms;
  }
  #pixel-card[data-open="true"] { transform: none; visibility: visible; transition-delay: 0s; }
  #pixel-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .sheet-head { position: relative; padding-top: var(--s-4); touch-action: none; cursor: grab; min-height: 52px; }
  .sheet-head h2 { margin: 0; }
  .grip { display: block; position: absolute; top: var(--s-2); left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--ink-2); }
  #sheet-close { display: inline-flex; min-height: 44px; flex: none; }
}

/* ---------- phone first screen (TE-028): presence, then the whole map, then the thumb dock ---------- */
.phone-only, .dock { display: none; }
@media (max-width: 51.99rem) {
  body { padding-bottom: 5.5rem; }
  .top { padding: var(--s-2) 0; margin-bottom: var(--s-2); gap: var(--s-1) var(--s-3); }
  .hero { display: none; }
  .ticker { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; } /* still a live region for screen readers */
  .presence { margin-bottom: var(--s-2); }
  .door { display: flex; overflow-x: auto; gap: var(--s-2); margin-bottom: var(--s-2); scrollbar-width: thin; }
  .door .gate { flex: none; flex-direction: row; align-items: center; gap: var(--s-2); padding: 0 var(--s-3); min-height: 44px; box-shadow: none; }
  .door .gate b { font-size: var(--fs-1); }
  .door .gate .small:not(.in) { display: none; }
  .phone-only { display: block; margin: var(--s-4) 0 0; }
  .map-card { display: flex; flex-direction: column; background: none; border: 0; box-shadow: none; padding: 0; margin: 0 0 var(--s-4); }
  .map-card .card-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); margin: 0; }
  .map-card .board { order: 1; max-width: none; margin: 0; padding: 0; }
  #grid { gap: 1px; padding: 1px; }
  .map-card .board-foot { order: 2; }
  .map-card .search { order: 3; margin-top: var(--s-3); }
  .map-card #results { order: 4; }
  .map-card .phone-only { order: 5; }
  .dock {
    display: grid; grid-template-columns: 1fr 2fr; gap: var(--s-2); position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line);
  }
  .dock .btn { min-height: 52px; justify-content: center; font-size: var(--fs-2); }
  body[data-sheet="open"] .dock { visibility: hidden; }
}
