:root {
  --square: #9a9a9a;   /* the town square */
  --crowd-dark: #7e7e7e;
  --crowd-light: #c8c8c8;
  --ink: #1e1e1e;
  --sheet: #e4e4e4;    /* notice sheet and windows */
  --shadow: #b3b3b3;
  --rule: #1e1e1e;
  --mute: #555;
  --display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--square); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--square); color: var(--ink); font: 500 17px/1.45 var(--display); font-synthesis: none; min-height: 100vh; }
main { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; padding: 0; }

/* ---------- the notice sheet ---------- */
.board { position: relative; z-index: 2; max-width: 1120px; margin: 8px auto 0; background: var(--sheet); padding: 20px 32px 18px; box-shadow: 10px 10px 0 var(--crowd-dark); }
.board .rules { height: 7px; border-top: 3px solid var(--rule); border-bottom: 1.5px solid var(--rule); margin-bottom: 16px; }
.board-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px 44px; align-items: end; }
h1 { margin: 0 0 14px; font: 900 clamp(44px, 14.2vw, 124px)/0.84 var(--display); white-space: nowrap; letter-spacing: -0.045em; text-shadow: 0.06em 0.06em 0 var(--shadow); }
.ticker { margin: 0; font: 700 15px/1 var(--display); letter-spacing: 0.28em; }
.line { margin: 14px 0 0; max-width: 34em; font-size: 17px; }
.readings { margin: 0; }
.row { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 17px; }
.row dt { font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.row::after { content: none; }
.row dt::after { content: ""; }
.row { background: radial-gradient(circle, var(--ink) 1px, transparent 1.4px) 0 calc(100% - 12px) / 7px 3px repeat-x; }
.row dt, .row dd { background: var(--sheet); position: relative; }
.row dt { padding-right: 8px; }
.row dd { margin: 0 0 0 auto; padding-left: 8px; font: 500 20px/1 var(--mono); white-space: nowrap; }
.bar { height: 12px; margin-top: 8px; border: 1.5px solid var(--ink); background: var(--sheet); }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.6s ease; }
.state { margin: 10px 0 0; font-size: 15px; color: var(--mute); min-height: 1.45em; }

.random { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px; margin: 16px 0 0; padding: 0 22px; border: 0; background: var(--ink); color: var(--sheet); font: 700 18px/1 var(--display); letter-spacing: 0.22em; text-transform: uppercase; cursor: pointer; transition: transform 0.08s; }
.random:active { transform: translateY(2px); }
.random[disabled] { background: #6f6f6f; cursor: not-allowed; }
.random kbd { font: 500 14px/1 var(--mono); border: 1.5px solid currentColor; padding: 5px 8px; letter-spacing: 0; }

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 18px; padding-top: 16px; border-top: 1.5px solid var(--rule); }
.ca { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: 1 1 520px; min-width: 0; }
.lbl { font: 700 13px/1 var(--display); letter-spacing: 0.24em; text-transform: uppercase; }
.addr { font: 500 16px/1.35 var(--mono); overflow-wrap: anywhere; word-break: break-all; user-select: all; min-width: 0; }
.addr.off { font-family: var(--display); color: var(--mute); user-select: text; }
.copy, .still { min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ink); background: transparent; font-weight: 700; cursor: pointer; }
.copy[disabled] { opacity: 0.45; cursor: not-allowed; }
.copied { font-size: 15px; min-width: 5em; }
.links { display: flex; align-items: center; gap: 10px; }
.links a { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; transition: transform 0.08s; }
.links a:active { transform: translateY(2px); }
.buy { padding: 0 16px 0 10px; white-space: nowrap; }
.buy img { display: block; border-radius: 4px; }
.x { width: 48px; }
.links a.is-off { background: transparent; opacity: 0.45; cursor: not-allowed; }
.still[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }

/* ---------- the square ---------- */
.square { position: relative; margin: -4px -16px 0; }
#crowd { display: block; width: 100%; touch-action: manipulation; cursor: pointer; }
.square .sr button:focus { outline: none; }

/* ---------- NPC window ---------- */
dialog { border: 0; padding: 0; background: transparent; max-width: min(860px, calc(100vw - 24px)); width: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(30, 30, 30, 0.45); }
.win { background: var(--sheet); box-shadow: 10px 10px 0 var(--crowd-dark); }
.win-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 12px 22px; border-bottom: 1.5px solid var(--rule); border-top: 3px solid var(--rule); }
.win-bar h2 { margin: 0; font: 900 30px/1 var(--display); letter-spacing: -0.02em; }
.close { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); background: transparent; font-weight: 700; cursor: pointer; }
.win-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; padding: 20px 22px 22px; }
.portrait { background: var(--square); aspect-ratio: 2 / 3; overflow: hidden; }
.face { width: 100%; height: 100%; background-size: 300% 100%; background-repeat: no-repeat; background-position: 0 0; }
.who { margin: 0; font-weight: 700; font-size: 17px; }
.who #npc-name { font-weight: 900; }
.subs { margin-top: 12px; min-height: 7.6em; padding: 14px 16px; background: #fff; border: 1.5px solid var(--ink); font-size: 19px; line-height: 1.45; }
.subs p { margin: 0; }
.subs .w-on { background: var(--crowd-light); }
.controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.play { min-width: 112px; min-height: 52px; border: 0; background: var(--ink); color: var(--sheet); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.play[disabled] { background: #6f6f6f; cursor: not-allowed; }
.time { flex: 1; height: 10px; border: 1.5px solid var(--ink); }
.time i { display: block; height: 100%; width: 0; background: var(--ink); }
.deed { margin: 14px 0 0; font-size: 15px; color: #333; overflow-wrap: anywhere; }
.deed a { color: var(--ink); font-weight: 700; }
.naming { margin-top: 14px; padding-top: 12px; border-top: 1.5px dashed var(--ink); }
.naming label { display: block; font-size: 15px; font-weight: 700; }
.name-row { display: flex; gap: 8px; margin-top: 8px; }
.name-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border: 1.5px solid var(--ink); background: #fff; font-size: 17px; }
.name-row button { min-height: 48px; padding: 0 14px; border: 0; background: var(--ink); color: var(--sheet); font-weight: 700; cursor: pointer; }
.name-msg { margin: 8px 0 0; font-size: 15px; min-height: 1.4em; }

@media (max-width: 860px) {
  .board { padding: 20px 18px 18px; box-shadow: 6px 6px 0 var(--crowd-dark); }
  .board-top { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: stretch; }
  .ca { flex: none; }
  .random { letter-spacing: 0.12em; font-size: 16px; padding: 0 16px; }
  .random kbd { display: none; }
  h1 { margin-bottom: 10px; }
  .links { flex-wrap: wrap; }
  .buy { flex: 1; }
  .links .still { flex: 1 0 100%; }
  .win-body { grid-template-columns: 1fr; }
  .portrait { width: 150px; margin: 0 auto; }
  .subs { min-height: 6.2em; font-size: 18px; }
}
@media (max-width: 380px) {
  .random { letter-spacing: 0.12em; font-size: 16px; padding: 0 14px; }
  .row dd { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar i, .random, .links a { transition: none; }
}
