/* The Wall of Yes/No: paper, ink, phosphor and signal red. Hard edges, an 8px grid, stepped motion. */
:root {
  --paper: #f3f2ec;
  --paper-hi: #fbfaf6;
  --paper-lo: #e8e6dc;
  --ink: #111;
  --ink-2: #3a3935;
  --muted: #6d6b63;
  --rule: rgba(17, 17, 17, 0.18);
  --yes: #13a05a;
  --yes-lo: #0b7a42;
  --no: #e2412a;
  --no-lo: #b02c18;
  --amber: #e8a530;
  --led-bg: #121311;
  --led-yes: #4ef08e;
  --led-no: #ff5b3d;
  --led-abs: #f2b544;
  --pixel: "Silkscreen", "IBM Plex Mono", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hard: 3px 3px 0 var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.12) 1px, transparent 1.3px);
  background-size: 16px 16px;
  color: var(--ink);
  font: 400 14px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.stage { max-width: 792px; margin: 0 auto; padding: 48px 16px 24px; display: flex; flex-direction: column; align-items: center; }

/* Header */
.head { text-align: center; }
h1 { margin: 0; font: 400 40px/1 var(--pixel); text-transform: uppercase; letter-spacing: 0; }
h1 .y { color: var(--yes); }
h1 .n { color: var(--no); }
h1 .slash { color: var(--muted); }
.sub { margin: 16px 0 0; font: 500 12px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.sub i { font-style: normal; color: var(--rule); margin: 0 4px; }

/* Terminal input */
.ask {
  width: 100%; max-width: 584px; margin-top: 40px; height: 56px; padding: 0 8px 0 16px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: var(--paper-hi); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
}
.prompt { font: 600 20px/1 var(--mono); color: var(--yes-lo); }
.field { position: relative; min-width: 0; height: 100%; display: flex; align-items: center; }
.field input {
  width: 100%; height: 100%; padding: 0; border: 0; outline: none; background: transparent;
  font: 400 18px/1 var(--mono); color: var(--ink); caret-color: transparent;
}
.field input::placeholder { color: #9b998f; }
/* Empty: the block cursor sits at x=0, so start the placeholder one cell over instead of under it */
.field input:placeholder-shown { text-indent: calc(1ch + 4px); }
.cursor {
  position: absolute; top: 50%; left: 0; width: 0.6em; height: 1.2em; margin-top: -0.62em; font-size: 18px;
  background: var(--ink); transform: translateX(var(--cx, 0px)); pointer-events: none; opacity: 0.85;
  animation: blink 1.06s steps(1, end) infinite;
}
.ask:not(:focus-within) .cursor { animation: none; opacity: 0.25; }
@keyframes blink { 50% { opacity: 0; } }
.key {
  height: 32px; padding: 0 10px; border: 2px solid var(--ink); background: var(--paper);
  font: 600 11px/1 var(--mono); letter-spacing: 0.1em; cursor: pointer; box-shadow: 2px 2px 0 var(--ink);
  transition: none;
}
.key b { font-weight: 600; margin-right: 6px; }
.ask.armed .key { background: var(--ink); color: var(--paper); }
.key:active, .ask.fire .key { transform: translate(2px, 2px); box-shadow: none; }

/* Example chips */
.examples { width: 100%; max-width: 584px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.examples[hidden] { display: none; }
.examples button {
  padding: 6px 10px; border: 1px solid var(--ink); background: var(--paper-hi); cursor: pointer;
  font: 400 12px/1.2 var(--mono); box-shadow: 2px 2px 0 var(--ink);
}
.examples button::before { content: "[ "; color: var(--muted); }
.examples button::after { content: " ]"; color: var(--muted); }
.examples button:hover { background: var(--ink); color: var(--paper); }
.examples button:hover::before, .examples button:hover::after { color: #8f8d84; }
.examples button:active { transform: translate(2px, 2px); box-shadow: none; }

/* Tally: the question, an LED readout and a 50-cell bar */
.tally { width: 100%; max-width: 584px; margin-top: 32px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.tally[hidden] { display: none; }
.asked { margin: 0; text-align: center; font: 500 18px/1.4 var(--mono); text-wrap: balance; }
.asked .lbl { display: inline-block; margin-right: 8px; padding: 2px 6px; font: 600 11px/1.3 var(--mono); letter-spacing: 0.1em; vertical-align: 3px; background: var(--ink); color: var(--paper); }
.readout {
  display: flex; gap: 24px; padding: 8px 16px; border: 2px solid var(--ink); box-shadow: var(--hard);
  background-color: var(--led-bg);
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
}
.lane { display: flex; align-items: center; gap: 8px; }
.lane b { font: 600 11px/1 var(--mono); letter-spacing: 0.14em; color: #8a887f; }
.digits { display: flex; }
.dg { position: relative; width: 20px; text-align: center; font: 400 24px/1 var(--pixel); }
.dg::before { content: "8"; position: absolute; inset: 0; opacity: 0.09; }
.lane.y .dg { color: var(--led-yes); text-shadow: 0 0 6px rgba(78, 240, 142, 0.45); }
.lane.n .dg { color: var(--led-no); text-shadow: 0 0 6px rgba(255, 91, 61, 0.45); }
.lane.a .dg { color: var(--led-abs); text-shadow: 0 0 6px rgba(242, 181, 68, 0.35); }
.lane .dg.zero { opacity: 0.35; text-shadow: none; }
.bar { width: 100%; display: grid; grid-template-columns: repeat(50, 1fr); gap: 2px; height: 12px; }
.bar i { display: block; background: var(--paper-lo); box-shadow: inset 0 0 0 1px var(--rule); }
.bar i.y { background: var(--yes); box-shadow: none; }
.bar i.n { background: var(--no); box-shadow: none; }
.bar i.a { background: repeating-linear-gradient(45deg, var(--ink-2) 0 1px, var(--paper-lo) 1px 3px); box-shadow: none; }
.bar i.new { animation: cellin 0.24s steps(3, end); }
@keyframes cellin { from { background: var(--ink); } }

/* The wall */
.wall { width: 100%; margin-top: 40px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
@media (max-width: 600px) {
  .wall { grid-template-columns: repeat(5, 1fr); max-width: 392px; }
  h1 { font-size: 24px; }
  .sub { font-size: 11px; }
  .readout { gap: 16px; padding: 8px 12px; }
  .dg { width: 16px; font-size: 16px; }
  .ask { gap: 8px; padding-left: 12px; }
  .key b { display: none; }
}
.sq { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: default; outline: none; }
.sq:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cell {
  position: absolute; inset: 0; border: 1px solid rgba(17, 17, 17, 0.4);
  background-color: var(--paper-lo);
  background-image: repeating-conic-gradient(rgba(17, 17, 17, 0.085) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
}
.fill { position: absolute; inset: 0; display: none; place-items: center; border: 2px solid var(--ink); box-shadow: var(--hard); }
.glyph { font: 700 24px/1 var(--pixel); color: var(--paper-hi); }
.sq.voted .fill { display: grid; }
.sq.yes .fill { background: var(--yes); box-shadow: var(--hard), inset 0 0 0 2px rgba(255, 255, 255, 0.16); }
.sq.no .fill { background: var(--no); box-shadow: var(--hard), inset 0 0 0 2px rgba(255, 255, 255, 0.16); }
.sq.abstain .fill {
  background: var(--paper-hi) repeating-linear-gradient(45deg, var(--ink-2) 0 1.5px, transparent 1.5px 6px);
  border-color: var(--ink-2); box-shadow: 2px 2px 0 var(--ink-2);
}
.sq:hover .fill, .sq:hover .cell { filter: brightness(1.06); }

/* The flip: a stepped pixel wipe from a random side, then the glyph */
.sq.voted.anim .fill { animation: var(--wipe) 0.24s steps(4, end); }
.sq.voted.anim .glyph { animation: glyph 0.3s steps(3, end); }
@keyframes wipe-d { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes wipe-u { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes wipe-r { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes wipe-l { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes glyph { 0% { opacity: 0; transform: scale(0.4); } 66% { opacity: 1; transform: scale(1.35); } 100% { transform: scale(1); } }

/* Waiting: a stepped blink. Thinking: the dither scrambles. */
.sq.queued .cell { animation: wait 1.2s steps(1, end) infinite; animation-delay: var(--d, 0s); }
@keyframes wait { 50% { opacity: 0.45; } }
.sq.thinking .cell { border-color: var(--ink); animation: scramble 0.24s steps(1, end) infinite; }
@keyframes scramble { 50% { background-position: 2px 0; background-color: #dedbd0; } }

/* The ripple: a ring stepping out from the flipped square, and a jolt through its neighbours */
.sq::after { content: ""; position: absolute; inset: -2px; pointer-events: none; opacity: 0; border: 2px solid var(--ring, var(--ink)); }
.sq.ring::after { animation: ring 0.36s steps(3, end); }
.sq.yes { --ring: var(--yes); }
.sq.no { --ring: var(--no); }
@keyframes ring { 0% { inset: -4px; opacity: 1; } 100% { inset: -16px; opacity: 0.2; } }
.sq.nudge { animation: jolt 0.2s steps(2, end); animation-delay: var(--nd, 0s); }
@keyframes jolt { 0% { transform: translate(-2px, -2px); } 100% { transform: none; } }
.sq.nudge:not(.voted) .cell { animation: glint 0.2s steps(1, end); animation-delay: var(--nd, 0s); }
@keyframes glint { 0% { background-color: #d9d6ca; border-color: var(--ink); } }

/* Tooltip: a small window */
.tip {
  position: fixed; z-index: 10; width: 288px; background: var(--paper-hi); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); pointer-events: none; display: none;
  font: 400 12px/1.5 var(--mono);
}
.tip.show { display: block; }
.tip .tb {
  display: flex; align-items: center; gap: 8px; height: 24px; padding: 0 8px; background: var(--ink); color: var(--paper);
  font: 600 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.tip .tb .fam { width: 8px; height: 8px; background: var(--fam); flex: none; }
.tip .tb .num { margin-left: auto; color: #a7a59c; }
.tip .bd { padding: 8px 12px 12px; }
.tip .verdict { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tip .chip { padding: 2px 6px; font: 600 11px/1.3 var(--mono); letter-spacing: 0.1em; border: 1px solid var(--ink); }
.tip .chip.yes { background: var(--yes); color: #fff; border-color: var(--yes-lo); }
.tip .chip.no { background: var(--no); color: #fff; border-color: var(--no-lo); }
.tip .chip.abstain { background: repeating-linear-gradient(45deg, var(--ink-2) 0 1px, var(--paper-hi) 1px 4px); color: var(--ink); }
.tip .chip.wait { background: var(--paper-lo); color: var(--muted); border-color: var(--rule); }
.tip .ms { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip .reason { margin: 0; font: 500 13px/1.45 var(--mono); }
.tip .reason.plain { font-weight: 400; color: var(--ink-2); }
.tip hr { margin: 8px 0; border: 0; border-top: 1px dashed rgba(17, 17, 17, 0.35); }
.tip .soul { margin: 0; color: var(--ink-2); }
.tip .soul b { font-weight: 600; color: var(--ink); }

/* Footer status line */
.foot {
  width: 100%; margin-top: 48px; padding-top: 12px; border-top: 1px solid var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font: 500 11px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.pip { width: 8px; height: 8px; background: var(--yes); box-shadow: 0 0 0 1px var(--ink); }
.foot.busy .pip { background: var(--amber); animation: wait 0.5s steps(1, end) infinite; }
.foot .meta { margin-left: auto; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .sq.voted.anim .fill, .sq.voted.anim .glyph, .sq.queued .cell, .sq.thinking .cell, .sq.nudge, .sq.ring::after, .cursor, .foot.busy .pip { animation: none; }
}

/* ---- illiana.me additions: verification, notices, resting, the fine print ---- */
.ask.locked { box-shadow: 2px 2px 0 var(--ink); }
.ask.locked .prompt { color: var(--muted); }
.field input:disabled { color: var(--muted); -webkit-text-fill-color: var(--muted); }
.key:disabled { cursor: not-allowed; color: var(--muted); border-color: #9b998f; box-shadow: 2px 2px 0 #9b998f; background: var(--paper); }
.ask.armed .key:disabled { background: var(--paper); color: var(--muted); }
.challenge { display: flex; justify-content: center; margin-top: 16px; }
.challenge:empty { display: none; }
.notice {
  width: 100%; max-width: 584px; margin: 16px 0 0; padding: 8px 12px; border: 1px solid var(--ink); background: var(--paper-hi);
  font: 500 12px/1.5 var(--mono); box-shadow: 2px 2px 0 var(--ink);
}
.notice[hidden] { display: none; }
.reconnect { align-self: flex-start; padding: 6px 10px; border: 1px solid var(--ink); background: var(--paper); cursor: pointer; }
.reconnect[hidden] { display: none; }
.reconnect:hover { background: var(--ink); color: var(--paper); }
.notice::before { content: "! "; font-weight: 600; color: var(--no); }
.notice.calm::before { content: "· "; color: var(--muted); }
.fine {
  width: 100%; margin: 12px 0 0; display: flex; gap: 8px 16px; flex-wrap: wrap; justify-content: space-between;
  font: 400 11px/1.5 var(--mono); color: var(--muted);
}
.fine a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.fine a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
