:root {
  --night: #0b0810;
  --stone: #2c2638;
  --stone-hi: #463f56;
  --parchment: #efe3c8;
  --ink: #2a1d14;
  --gold: #e6c873;
  --ember: #d98b4a;
  --muted: #b9adc9;
  --f-pixel: "Pixelify Sans", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); }
body { font-family: var(--f-pixel); color: var(--parchment); -webkit-text-size-adjust: 100%; }
#hall { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; image-rendering: pixelated; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The name plate over a game: a parchment card with a dark wooden edge. */
.plate {
  position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none;
  display: grid; gap: 2px; justify-items: center; text-align: center;
  width: max-content; max-width: min(260px, 80vw);
  padding: 7px 12px 8px;
  background: var(--parchment); color: var(--ink);
  border: 3px solid #5a3a22; outline: 2px solid var(--night);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}
.plate strong { font-weight: 600; font-size: 20px; line-height: 1.05; }
.plate span { font-size: 14px; line-height: 1.2; color: #5a4636; }
.plate em { font-style: normal; font-size: 13px; color: #8a3a1c; margin-top: 2px; }
.plate.sealed { background: #cfc6d6; border-color: #463f56; }
.plate.sealed em { color: #463f56; }

.plate.extra strong { font-size: 17px; }
.plate.extra { background: #e6dcc6; }

/* Thumbs beside each game: small, stacked, quiet until hovered. */
.votes {
  position: fixed; left: 0; top: 0; z-index: 2;
  display: grid; gap: 3px;
}
.vote {
  display: flex; align-items: center; gap: 3px; min-width: 26px; height: 24px; padding: 0 5px;
  font: 13px var(--f-pixel); color: var(--muted); background: rgba(11, 8, 16, 0.6);
  border: 1px solid var(--stone-hi); border-radius: 2px; cursor: pointer; opacity: 0.7;
  touch-action: manipulation;
}
.vote:hover, .vote:focus-visible { opacity: 1; }
.vote[aria-pressed="true"] { opacity: 1; color: var(--night); background: var(--gold); border-color: var(--gold); }
.vote.down[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); }
.vote .n:empty { display: none; }
@media (max-width: 700px) {
  .votes { gap: 2px; }
  .vote { height: 14px; min-width: 14px; padding: 0 2px; gap: 1px; font-size: 9px; border-radius: 1px; }
  .vote svg { width: 8px; height: 8px; }
  .plate { padding: 4px 8px 5px; max-width: 200px; border-width: 2px; }
  .plate strong { font-size: 15px; }
  .plate span { font-size: 11px; }
  .plate em { font-size: 11px; }
}

.about {
  max-width: min(460px, calc(100vw - 32px)); padding: 18px 22px 16px;
  font-family: var(--f-pixel); font-size: 16px; line-height: 1.35;
  background: var(--parchment); color: var(--ink);
  border: 3px solid #5a3a22; outline: 2px solid var(--night); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5);
}
.about::backdrop { background: rgba(11, 8, 16, 0.7); }
.about h2 { margin: 0 0 8px; font-weight: 600; font-size: 24px; }
.about p { margin: 0 0 10px; }
.about form { margin: 14px 0 0; text-align: right; }
.about button { font: 15px var(--f-pixel); padding: 6px 12px; color: var(--parchment); background: #5a3a22; border: 2px solid var(--night); cursor: pointer; }

.bubble {
  position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none;
  max-width: 220px; padding: 6px 10px;
  background: #f6f0dc; color: var(--ink); font-size: 15px; line-height: 1.2; text-align: center;
  border: 2px solid var(--night); border-radius: 2px;
}

.hint {
  position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; padding: 4px 10px; z-index: 1;
  font-size: 15px; color: var(--muted); background: rgba(11, 8, 16, 0.72); white-space: nowrap;
}

/* The games as a plain list, for keyboard and screen-reader users; it shows itself on focus. */
.games-nav ul { list-style: none; margin: 0; padding: 0; }
.games-nav { position: fixed; left: 10px; top: 10px; z-index: 4; }
.games-nav:not(:focus-within) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.games-nav:focus-within { background: var(--stone); padding: 8px; border: 2px solid var(--stone-hi); }
.games-nav button {
  display: block; width: 100%; text-align: left; margin: 2px 0; padding: 6px 10px;
  font: 15px var(--f-pixel); color: var(--parchment); background: var(--night); border: 1px solid var(--stone-hi); cursor: pointer;
}

.fade { position: fixed; inset: 0; z-index: 10; background: var(--night); opacity: 1; pointer-events: none; transition: opacity 500ms ease-out; }
body.ready .fade { opacity: 0; }
body.leaving .fade { opacity: 1; transition-duration: 420ms; transition-timing-function: ease-in; }
@media (prefers-reduced-motion: reduce) { .fade { transition: none; } }
@media (max-width: 520px) { .hint { font-size: 13px; } }
