/* The hub's front page: a late-night den with a shelf of game cartridges. */

@font-face { font-family: 'Press Start 2P'; src: url('fonts/press-start-2p-latin-400-normal.woff2?v=5ec7be8c9f') format('woff2'); font-display: swap; }
@font-face { font-family: 'VT323'; src: url('fonts/vt323-latin-400-normal.woff2?v=5ec7be8c9f') format('woff2'); font-display: swap; }
@font-face { font-family: 'Space Mono'; src: url('fonts/space-mono-latin-400-normal.woff2?v=5ec7be8c9f') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Mono'; src: url('fonts/space-mono-latin-700-normal.woff2?v=5ec7be8c9f') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Chakra Petch'; src: url('fonts/chakra-petch-latin-700-normal.woff2?v=5ec7be8c9f') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Chakra Petch'; src: url('fonts/chakra-petch-latin-700-italic.woff2?v=5ec7be8c9f') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  --den: #12101a;
  --panel: #191524;
  --panel-2: #251f36;
  --panel-3: #312947;
  --ink: #0e0b16;
  --line: rgba(253, 230, 190, 0.15);
  --line-strong: rgba(253, 230, 190, 0.3);
  --amber: #ffbe3b;
  --amber-soft: #fde68a;
  --mint: #58f29c;
  --cream: #f7efe6;
  --muted: rgba(231, 222, 210, 0.72);
  --error: #ff8a7a;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --vt: 'VT323', ui-monospace, monospace;
  --mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --label: 'Chakra Petch', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--den); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font: 15px/1.5 var(--mono);
  background-color: var(--den);
  background-image:
    radial-gradient(ellipse 75% 45% at 50% 8%, rgba(255, 178, 72, 0.14) 0%, transparent 65%),
    radial-gradient(ellipse 65% 50% at 85% 85%, rgba(56, 189, 248, 0.09) 0%, transparent 60%),
    linear-gradient(180deg, #171322 0%, #100e17 55%, #0c0a12 100%);
  background-attachment: fixed;
  padding-bottom: 120px;
  overflow-x: hidden;
}
::selection { background: var(--amber); color: #16111c; }
.pixel { font-family: var(--pixel); }
.vt { font-family: var(--vt); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
a { color: var(--amber); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* CRT scanlines and vignette over everything (decorative, ignores the mouse). */
.crt-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.18) 50%),
    radial-gradient(circle at center, transparent 62%, rgba(6, 5, 10, 0.6) 100%);
  background-size: 100% 4px, 100% 100%;
}

.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- header ---- */
.top { position: relative; z-index: 20; max-width: 1120px; margin: 0 auto; padding: 20px 16px 8px; }
.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(25, 21, 36, 0.9); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.power {
  width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #fcd34d, #f97316); color: #1c1410;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.25);
}
.power svg { width: 24px; height: 24px; }
.brand-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-size: clamp(12px, 2.4vw, 17px); line-height: 1.4; color: var(--amber-soft); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.badge {
  font-size: 15px; line-height: 1; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px;
  color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3);
}
.tagline { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.find { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 0; }
.search { position: relative; display: block; flex: 1 1 auto; min-width: 0; }
.find .select { flex: none; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: rgba(253, 230, 190, 0.5); pointer-events: none; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 12px; font-size: 13px;
  background: var(--ink); border: 1px solid var(--line); color: var(--cream);
}
.search input::placeholder { color: rgba(214, 205, 194, 0.6); }
.search input:focus { outline: none; border-color: rgba(255, 190, 59, 0.7); }
.select select {
  appearance: none; padding: 9px 30px 9px 12px; border-radius: 12px; font-size: 13px; cursor: pointer;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23fde68a'%3E%3Cpath d='M5.3 7.3a1 1 0 011.4 0L10 10.6l3.3-3.3a1 1 0 111.4 1.4l-4 4a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4z'/%3E%3C/svg%3E") no-repeat right 9px center / 15px;
  border: 1px solid var(--line); color: var(--amber-soft);
}
.select select:hover { background-color: var(--panel-3); }
.select.small select { padding-top: 6px; padding-bottom: 6px; }
.board-pick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player { font-family: var(--vt); font-size: 19px; color: var(--amber-soft); letter-spacing: 0.04em; }
.player b { color: var(--mint); font-weight: 400; }
button.player { background: none; border: 0; padding: 0; cursor: pointer; border-bottom: 1px dashed transparent; }
button.player:hover, button.player:focus-visible { border-bottom-color: var(--mint); outline: none; }
#nick + #pw { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  border-radius: 12px; border: 1px solid transparent; padding: 9px 14px; font-size: 11px; line-height: 1.2;
  transition: transform 0.12s, background 0.15s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.amber { background: var(--amber); color: #16111c; box-shadow: 0 8px 18px rgba(245, 158, 11, 0.2); }
.btn.amber:hover { background: #fcd34d; }
.btn.mint { background: var(--mint); color: #0c1a12; box-shadow: 0 8px 18px rgba(16, 185, 129, 0.25); }
.btn.mint:hover { background: #86efac; }
.btn.ghost { background: var(--panel-2); border-color: var(--line); color: var(--amber-soft); font-size: 17px; padding: 6px 12px; }
.btn.ghost:hover { background: var(--panel-3); }
.link { background: none; border: 0; padding: 0; color: var(--amber); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; justify-self: start; }

/* ---- shelves ---- */
main { position: relative; z-index: 10; max-width: 1120px; margin: 0 auto; padding: 18px 16px 24px; }
.shelves { display: grid; gap: 38px; perspective: 1200px; }
.loading { font-size: 22px; color: var(--amber-soft); text-align: center; padding: 60px 0; }
.shelf { position: relative; padding: 18px 10px 20px; }
.shelf-row { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 28px; align-items: end; }
.shelf::after {
  /* the wooden ledge the cartridges stand on */
  content: ''; position: absolute; left: -6px; right: -6px; bottom: 0; height: 18px; border-radius: 6px; z-index: 0;
  background: linear-gradient(180deg, #4b332b 0%, #2d1d19 45%, #19100e 100%);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 214, 178, 0.2);
  border: 1px solid rgba(255, 200, 160, 0.12);
}
.shelf::before {
  /* a soft back wall glow behind each row */
  content: ''; position: absolute; inset: 0 2% 10px; border-radius: 18px; z-index: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 100%, rgba(255, 170, 90, 0.07), transparent 70%);
}
.slot { position: relative; min-width: 0; }

.cartridge {
  position: relative; display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  aspect-ratio: var(--ar, 1.49); container-type: inline-size;
  transform-style: preserve-3d; transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.cartridge:hover, .cartridge.is-selected { transform: translateY(-9px) scale(1.035); z-index: 5; }
.cartridge:active { transform: translateY(1px) scale(0.985); }
.cartridge:focus-visible { outline: none; }
.cartridge:focus-visible .art { filter: drop-shadow(0 0 0 var(--amber)) drop-shadow(0 0 3px var(--amber)) drop-shadow(0 18px 20px rgba(0, 0, 0, 0.85)); }
.art {
  position: absolute; inset: 0; display: block;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.78)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.65));
  transition: filter 0.26s;
}
.cartridge:hover .art, .cartridge.is-selected .art {
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.88)) drop-shadow(0 0 14px rgba(255, 210, 130, 0.22));
}
.shell { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; }

/* The LED wakes up on hover. */
.led-glow {
  position: absolute; left: var(--led-x); top: var(--led-y); width: 9cqw; height: 9cqw; margin: -4.5cqw 0 0 -4.5cqw;
  border-radius: 50%; pointer-events: none; mix-blend-mode: screen; opacity: 0.25;
  background: radial-gradient(circle, var(--led) 0%, color-mix(in srgb, var(--led) 45%, transparent) 35%, transparent 70%);
  transition: opacity 0.25s, transform 0.25s;
}
.cartridge:hover .led-glow, .cartridge.is-selected .led-glow { opacity: 1; animation: led-pulse 1.35s ease-in-out infinite alternate; }
@keyframes led-pulse { from { transform: scale(1.2); opacity: 0.8; } to { transform: scale(1.8); opacity: 1; } }

.slot-chip {
  position: absolute; top: -10px; right: 8%; z-index: 6; font-family: var(--vt); font-size: 15px; line-height: 1;
  padding: 3px 7px; border-radius: 6px; background: rgba(18, 15, 26, 0.92); border: 1px solid rgba(255, 232, 198, 0.22);
  color: var(--cream); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); opacity: 0.85; transition: all 0.2s;
}
.cartridge:hover .slot-chip, .cartridge.is-selected .slot-chip { background: var(--amber); color: #16111c; border-color: #fff; opacity: 1; }

/* ---- the label sticker (NES-era style) ---- */
.sticker {
  position: absolute; z-index: 3; border-radius: 0.9cqw; padding: 1.2cqw 1.5cqw; overflow: hidden;
  display: flex; flex-direction: column; gap: 0.8cqw; text-align: left;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), inset 0 -1px 2px rgba(0, 0, 0, 0.65), 0 1px 3px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(15, 15, 20, 0.75);
}
.sticker::before {
  /* paper grain */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 0); background-size: 3px 3px;
}
.sticker::after {
  /* laminated sheen */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4;
  background: linear-gradient(122deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.05) 38%, transparent 39%);
}
.sticker > * { position: relative; z-index: 3; }
.theme-blackbox { background: linear-gradient(160deg, #16171d, #0b0c10); color: #f8fafc; border-color: #3f4252; }
.theme-silver { background: linear-gradient(155deg, #e5e7eb, #cbd5e1 55%, #94a3b8); color: #0f172a; border-color: #475569; }
.theme-gold { background: linear-gradient(155deg, #3b2608, #1c1204); color: #fde68a; border-color: #d97706; }
.theme-grid { background: linear-gradient(165deg, #17122b, #0d0a1a); color: #f0abfc; border-color: #7e22ce; }
.theme-paper { background: linear-gradient(160deg, #efe6d0, #d9cba8); color: #2b2117; border-color: #8a7550; }
.sticker.weathered { filter: contrast(0.95) sepia(0.16); }
.sticker .scuff {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(32deg, transparent 46%, rgba(210, 200, 185, 0.28) 47%, transparent 48.5%),
    radial-gradient(circle at 18% 82%, rgba(35, 30, 28, 0.45) 0%, transparent 24%);
}
.sticker-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1cqw;
  border-bottom: 0.45cqw solid currentColor; padding-bottom: 0.6cqw;
}
.pill {
  font: 700 2.6cqw/1.15 var(--label); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  padding: 0.15cqw 1.3cqw; border: 1px solid currentColor; border-radius: 999px; overflow: hidden; text-overflow: ellipsis;
}
.code { font: 400 2.2cqw/1 var(--mono); opacity: 0.8; white-space: nowrap; }
.sticker-art {
  position: relative; flex: 1; min-height: 0; border-radius: 0.6cqw; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #1c1a2a, #090a0f 75%); border: 1px solid rgba(255, 255, 255, 0.22);
}
/* Fill the window, not the picture's own size (which a percentage height would grow to), so the whole logo shows. */
.sticker-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3%; display: block; }
.sticker-art .initials { font: 6cqw/1 var(--pixel); color: var(--amber-soft); text-shadow: 0.6cqw 0.6cqw 0 #7c2d12; letter-spacing: 0.04em; }
.sticker-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1cqw; }
.sticker-title {
  font: italic 700 3.6cqw/1.05 var(--label); letter-spacing: 0.02em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.65);
}
.theme-silver .sticker-title, .theme-paper .sticker-title { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }
.seal {
  flex: none; width: 5.6cqw; height: 3.5cqw; border-radius: 999px; border: 1px solid #fbbf24;
  background: radial-gradient(circle, #fef08a, #b45309); box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Small cartridges (two to a shelf on a phone): the label keeps what reads at that size,
   the name (on up to two lines) and the art, and drops the genre and code. */
@container (max-width: 260px) {
  .sticker { padding: 2cqw 2.4cqw; gap: 1.4cqw; border-radius: 1.6cqw; }
  .sticker-top { display: none; }
  .sticker-art .initials { font-size: 11cqw; text-shadow: 0.9cqw 0.9cqw 0 #7c2d12; }
  .sticker-title {
    font-size: 5.8cqw; line-height: 1.08; white-space: normal; overflow-wrap: normal; word-break: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .seal { display: none; }
  .slot-chip { font-size: 12px; padding: 2px 5px; top: -8px; }
}

/* ---- totes: a game that holds other games ---- */
.tote .art, .disk .art { position: absolute; inset: 0; display: block; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.7)); transition: filter 0.26s; }
.tote:hover .art, .tote.is-selected .art, .disk:hover .art, .disk.is-selected .art { filter: drop-shadow(0 0 3px var(--amber)) drop-shadow(0 22px 22px rgba(0, 0, 0, 0.8)); }
.tote:focus-visible .art, .disk:focus-visible .art { filter: drop-shadow(0 0 0 var(--amber)) drop-shadow(0 0 3px var(--amber)) drop-shadow(0 18px 20px rgba(0, 0, 0, 0.85)); }

/* A few of its games stand up out of the tub. */
.tote-peek { position: absolute; left: 14%; right: 14%; top: 1%; height: 56%; }
.tote-peek img {
  position: absolute; bottom: 0; width: 34%; aspect-ratio: 1; object-fit: cover; image-rendering: pixelated;
  left: calc(var(--i) * 32%); border-radius: 4px; border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6); transform-origin: 50% 100%;
  transform: rotate(calc(-9deg + var(--i) * 9deg)) translateY(calc(var(--i) * -3% + 6%));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.tote:hover .tote-peek img, .tote.is-selected .tote-peek img { transform: rotate(calc(-13deg + var(--i) * 13deg)) translateY(calc(var(--i) * -3% - 8%)); }

/* The tub: tinted plastic with ribs, a thick rim, and handle holes at the ends. */
.tote-box {
  position: absolute; left: 3%; right: 3%; bottom: 2%; height: 64%; border-radius: 7% / 11%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 3%, transparent 3% 9%),
    linear-gradient(180deg, color-mix(in srgb, var(--plastic) 70%, white 30%), var(--plastic) 45%, color-mix(in srgb, var(--plastic) 65%, black 35%));
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.35);
}
.tote-box::before, .tote-box::after {
  content: ''; position: absolute; top: 20%; width: 7%; height: 15%; border-radius: 999px;
  background: rgba(10, 8, 16, 0.75); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.8);
}
.tote-box::before { left: 3.5%; }
.tote-box::after { right: 3.5%; }
.tote-rim {
  position: absolute; left: -2%; right: -2%; top: -7%; height: 15%; border-radius: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--plastic) 55%, white 45%), color-mix(in srgb, var(--plastic) 80%, black 20%));
  border: 1px solid rgba(0, 0, 0, 0.35); box-shadow: 0 3px 5px rgba(0, 0, 0, 0.35);
}
/* Its label: a paper card stuck on the front. */
.tote-card {
  position: absolute; left: 16%; right: 16%; top: 30%; bottom: 12%; display: flex; align-items: center; gap: 6%;
  padding: 0 5%; border-radius: 3px; background: #f4ecdc; color: #1c1622; transform: rotate(-1deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}
.tote-logo { flex: none; width: 30%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px; overflow: hidden; background: #1c1622; color: var(--amber); }
.tote-logo img { width: 100%; height: 100%; object-fit: cover; }
.tote-logo .initials { font: 6cqw var(--pixel); }
.tote-text { min-width: 0; display: flex; flex-direction: column; gap: 3cqw; }
.tote-name { font: 6cqw/1.15 var(--pixel); text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tote-count { font: 7cqw/1 var(--vt); color: #6b5f73; letter-spacing: 0.05em; }

/* ---- a game from a tote: a floppy disk ---- */
.floppy {
  position: absolute; top: 2%; bottom: 2%; left: 50%; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 4% 4% 4% 4%; clip-path: polygon(0 0, 92% 0, 100% 8%, 100% 100%, 0 100%);
  background: linear-gradient(160deg, color-mix(in srgb, var(--plastic) 55%, #1a1a22), color-mix(in srgb, var(--plastic) 30%, #0c0c12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.floppy-shutter {
  position: absolute; top: 0; left: 24%; width: 46%; height: 26%; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #9aa1ab, #e3e7ec 40%, #b3b9c2 70%, #8c929c);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}
.floppy-shutter::after { content: ''; position: absolute; top: 18%; right: 14%; width: 22%; height: 58%; border-radius: 2px; background: #2a2c33; }
.floppy-label {
  position: absolute; left: 10%; right: 10%; top: 30%; bottom: 21%; border-radius: 3px; overflow: hidden;
  background: #f4ecdc; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.floppy-label img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.floppy-label .initials { font: 9cqw var(--pixel); color: #1c1622; }
.floppy-name {
  position: absolute; left: 6%; right: 6%; bottom: 2%; height: 18%; display: flex; align-items: center; justify-content: center;
  text-align: center; font: 3.8cqw/1.3 var(--pixel); color: #f4ecdc; text-transform: uppercase;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; padding-top: 1.5cqw;
}
@container (max-width: 260px) { .floppy-name { font-size: 4.4cqw; } }

/* ---- an open tote's bar ---- */
.tote-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 4px 0 26px; }
.tote-heading { margin: 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tote-heading .pixel { font-size: 18px; color: var(--amber); }
.tote-heading .vt { font-size: 20px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tote-peek img { transition: none; } }

.players-week { margin: 6px 0 0; text-align: center; font: 15px var(--vt); letter-spacing: 0.08em; color: var(--mint); }
.made-for { margin: 10px 0 0; text-align: center; font: 16px/1.2 var(--vt); color: var(--muted); letter-spacing: 0.04em; }

/* ---- other systems, empty search ---- */
.others { margin-top: 40px; }
.others summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 10px;
  font-size: 20px; color: var(--amber-soft); padding: 6px 12px; border-radius: 10px; border: 1px dashed var(--line-strong);
}
.others summary::-webkit-details-marker { display: none; }
.others summary::before { content: '▸'; transition: transform 0.15s; }
.others[open] summary::before { transform: rotate(90deg); }
.others .note { color: var(--muted); font-size: 13px; margin: 12px 0 18px; }
.empty {
  margin: 30px auto; max-width: 460px; text-align: center; padding: 40px 24px; border-radius: 22px;
  background: rgba(25, 21, 36, 0.9); border: 1px solid var(--line);
}
.empty .q {
  width: 48px; height: 48px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 14px;
  color: var(--amber); background: rgba(255, 190, 59, 0.12); border: 1px solid rgba(255, 190, 59, 0.3);
}
.empty h2 { font-size: 12px; color: var(--amber-soft); line-height: 1.6; margin: 0; }
.empty p { color: var(--muted); font-size: 13px; }

/* ---- CRT panels: high scores ---- */
.crt-panel {
  margin-top: 48px; border-radius: 20px; padding: 18px 20px 20px;
  background: linear-gradient(180deg, #191524, #13101d); border: 2px solid var(--line);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.45);
}
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-bar h2 { margin: 0; font-size: 13px; color: var(--amber-soft); }
.boards h3 { font: 20px/1.2 var(--vt); color: var(--mint); letter-spacing: 0.06em; margin: 14px 0 6px; text-transform: uppercase; }
.boards table { width: 100%; border-collapse: collapse; font: 20px/1.25 var(--vt); font-variant-numeric: tabular-nums; }
.boards th, .boards td { text-align: left; padding: 4px 6px; border-bottom: 1px dashed rgba(253, 230, 190, 0.12); }
.boards th { color: var(--muted); font-weight: 400; font-size: 17px; }
.boards td.n, .boards th.n { text-align: right; }
.boards tr.top1 td { color: var(--amber); }
.muted { color: var(--muted); }
.error { color: var(--error); margin: 0; }
.ok { color: var(--mint); margin: 0; }

/* ---- status bar ---- */
.status { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px; pointer-events: none; }
.status-box {
  pointer-events: auto; max-width: 1000px; margin: 0 auto;
  background: rgba(19, 16, 29, 0.95); backdrop-filter: blur(8px); border: 2px solid rgba(253, 230, 190, 0.2);
  border-radius: 18px; padding: 10px 14px; box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.75);
}
.status-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-led { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--led, var(--amber)); box-shadow: 0 0 10px var(--led, var(--amber)); }
.status-text { min-width: 0; }
.status-meta { display: flex; align-items: center; gap: 8px; font-size: 16px; color: rgba(214, 205, 194, 0.7); letter-spacing: 0.06em; }
.status-badge { padding: 0 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--amber-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-title-row { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.status-title { flex: none; max-width: 100%; font-size: 12px; color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 3px; }
.status-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-actions { display: flex; align-items: center; gap: 8px; flex: none; }
#status-scores .caret { display: inline-block; transition: transform 0.15s; }
#status-scores.open .caret { transform: rotate(180deg); }

/* The selected game's high scores, under its name */
.status-board { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(253, 230, 190, 0.12); max-height: 40vh; overflow-y: auto; }
.board-bar { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.board-tabs { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.board-tabs button, .period button {
  font: 17px/1 var(--vt); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: none;
  border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; cursor: pointer;
}
.board-tabs button:hover, .period button:hover:not(:disabled) { color: var(--text, #f7efe6); }
.board-tabs button[aria-selected='true'], .board-label { color: var(--mint); border-color: rgba(88, 242, 156, 0.35); }
.board-label { font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; border: 1px solid; border-radius: 6px; }
.period { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.period button[aria-pressed='true'] { color: #16111c; background: var(--amber-soft); }
.period button:disabled { opacity: 0.35; cursor: default; }
.status-board table { margin-top: 4px; font-size: 18px; }
/* Room for five rows whatever the game, so the bar doesn't jump as the selection moves. */
#tables { min-height: 168px; }
.status-board th:first-child { width: 3.5ch; }
.status-board td:nth-child(2) { overflow-wrap: anywhere; }
.status-board th { font-size: 15px; }
.status-board th, .status-board td { padding: 2px 6px; }
.boards tr.me td { color: var(--mint); }
.board-note { margin: 8px 0 2px; }

/* ---- modal (account) and boot screen ---- */
.modal, .boot {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(3px);
}
.modal-box {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto;
  background: #161221; border: 2px solid rgba(253, 211, 120, 0.35); border-radius: 22px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9);
}
.modal-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #201a30; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.modal-bar .vt { flex: 1; font-size: 18px; color: var(--amber-soft); letter-spacing: 0.08em; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #f87171; }
.dots i:nth-child(2) { background: #fbbf24; }
.dots i:nth-child(3) { background: var(--mint); }
.x { background: rgba(255, 255, 255, 0.08); border: 0; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; color: var(--cream); }
.x:hover { background: rgba(255, 255, 255, 0.16); }
.panel { padding: 18px 20px 22px; }
.panel h2 { font: 12px/1.6 var(--pixel); color: var(--amber-soft); margin: 0 0 12px; }
.panel p { font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 8px 10px; cursor: pointer; font: 11px var(--pixel); }
.tabs button[aria-selected='true'] { color: var(--amber-soft); border-bottom-color: var(--amber); }
form { display: grid; gap: 12px; }
form label { display: grid; gap: 5px; font: 17px/1.1 var(--vt); color: var(--muted); letter-spacing: 0.04em; }
form input {
  font: 14px var(--mono); color: var(--cream); background: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
form input:focus { outline: none; border-color: rgba(255, 190, 59, 0.7); }
.msg { margin: 0; font-size: 13px; }
.msg:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 12px; }

.boot-box {
  width: 100%; max-width: 520px; text-align: center; padding: 34px 26px; border-radius: 26px;
  background: radial-gradient(ellipse at 50% 40%, #1d2a22, #0b0f0d 75%); border: 2px solid rgba(88, 242, 156, 0.35);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8), 0 25px 70px rgba(0, 0, 0, 0.9);
}
.boot-line { font-size: 22px; color: var(--mint); margin: 0; letter-spacing: 0.08em; text-shadow: 0 0 8px rgba(88, 242, 156, 0.5); }
.boot-line.dim { opacity: 0.7; margin-top: 14px; }
.boot-title { font-size: clamp(13px, 3.4vw, 20px); color: var(--amber); margin: 18px 0; line-height: 1.5; text-shadow: 0 0 12px rgba(255, 190, 59, 0.45); }
.boot-progress { height: 14px; border: 2px solid rgba(88, 242, 156, 0.6); border-radius: 4px; padding: 2px; }
.boot-progress i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--mint) 0 10px, transparent 10px 13px); }
.boot.go .boot-progress i { animation: load 0.75s steps(12) forwards; }
@keyframes load { to { width: 100%; } }

.crt-on { animation: crt-on 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes crt-on {
  0% { transform: scale(0.92, 0.02); opacity: 0; filter: brightness(2.6); }
  55% { transform: scale(1.01, 1.01); opacity: 1; filter: brightness(1.2); }
  100% { transform: none; opacity: 1; filter: none; }
}

/* ---- pokes ---- */
.pokes { position: fixed; top: 14px; right: 14px; z-index: 60; display: grid; gap: 10px; width: min(320px, calc(100vw - 28px)); }
.poke {
  background: #161221; border: 2px solid rgba(88, 242, 156, 0.45); border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7); animation: poke-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.poke-from { font-size: 18px; color: var(--mint); letter-spacing: 0.08em; }
.poke-text { margin: 4px 0 8px; font-size: 14px; overflow-wrap: anywhere; }
.poke-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.poke-actions .btn { font-size: 16px; padding: 5px 10px; text-decoration: none; }
@keyframes poke-in { from { transform: translateY(-10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .poke { animation: none; } }

/* ---- admin page ---- */
body.admin { padding-bottom: 40px; }
.admin-panel { margin-top: 22px; }
.admin-panel:first-of-type { margin-top: 10px; }
.tools, .selected-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.selected-tools { margin: 4px 0 10px; font-size: 18px; color: var(--amber-soft); }
.table-wrap { overflow-x: auto; }
.games-table { width: 100%; border-collapse: collapse; }
.games-table th { text-align: left; font: 17px var(--vt); color: var(--muted); font-weight: 400; padding: 4px 8px; }
.games-table td { padding: 8px; border-top: 1px dashed rgba(253, 230, 190, 0.12); vertical-align: top; }
.games-table tr.detail td { border-top: 0; padding-top: 0; }
.games-table a { color: var(--cream); }
.games-table code, .warnings code { color: var(--amber-soft); }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.row-actions .btn { font-size: 15px; padding: 3px 8px; }
.btn.danger { color: var(--error); }
.repo { word-break: break-all; }
.small { font-size: 12px; }
.warn { color: var(--error); }
.warnings { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.warnings li { border: 1px solid rgba(255, 138, 122, 0.35); background: rgba(255, 138, 122, 0.08); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.sub { font-size: 19px; color: var(--mint); letter-spacing: 0.06em; margin: 16px 0 6px; font-weight: 400; }
.console {
  margin: 6px 0 0; padding: 10px 12px; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: #0b0f0d; border: 1px solid rgba(88, 242, 156, 0.25); border-radius: 10px; color: #c8f7da; font: 12px/1.5 var(--mono);
}
.console.small { max-height: 240px; }
.run-state { font-size: 18px; color: var(--amber-soft); }
.run-state.ok { color: var(--mint); }
.run-state.warn { color: var(--error); }
.conf {
  width: 100%; min-height: 240px; resize: vertical; margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: var(--cream); border: 1px solid var(--line); font: 12px/1.6 var(--mono); white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
.conf:focus { outline: none; border-color: rgba(255, 190, 59, 0.7); }
.add-game summary { cursor: pointer; font-size: 18px; color: var(--amber); }
.add-form, .mute-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.add-form .wide, .mute-form .wide { grid-column: 1 / -1; }
.add-form select, .mute-form select, .mute-form input, .add-form input {
  font: 14px var(--mono); color: var(--cream); background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 100%;
}
.mute-form .check { display: flex; gap: 8px; align-items: center; font: 13px var(--mono); }
.mute-form .check input { width: auto; }
.reports { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reports li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); }
.reports blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--amber); }
.reports .actions { margin-top: 6px; }
.mutes { border-collapse: collapse; width: 100%; }
.mutes td { padding: 6px 8px; border-top: 1px dashed rgba(253, 230, 190, 0.12); }
.who .btn { text-decoration: none; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; z-index: 5; background: var(--den); padding-top: 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 19px; letter-spacing: 0.05em;
  color: var(--muted); background: none; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; padding: 6px 14px 5px; margin-bottom: -1px;
}
.tab:hover { color: var(--amber-soft); }
.tab[aria-selected='true'] { color: var(--amber); background: var(--panel-2); border-color: var(--line-strong); border-bottom: 1px solid var(--panel-2); }
.tab:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.tab-badge { font: 13px/1 var(--mono); min-width: 18px; padding: 2px 5px; border-radius: 9px; background: var(--amber); color: #000; text-align: center; }
.tab-badge.bad { background: #ff6b5e; }
.tab-panel > .admin-panel:first-child { margin-top: 0; }

.state { display: inline-block; font: 16px var(--vt); letter-spacing: 0.05em; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--amber-soft); white-space: nowrap; }
.state.ok { color: var(--mint); border-color: currentColor; }
.state.bad { color: #ff6b5e; border-color: currentColor; }
.warn-text { color: #ffb347; }
.usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; margin: 10px 0 4px; }
.use { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: 12px; }
.use-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.use-num { color: var(--cream); }
.use-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.use-bar i { display: block; height: 100%; background: var(--mint); }
.use.warn .use-bar i { background: #ffb347; }
.use.bad .use-bar i { background: #ff6b5e; }
.use.bad .use-num { color: #ff6b5e; }
.server-apps td:nth-child(3) { min-width: 150px; }
/* Phones: each app's cells stack, so nothing scrolls off to the side. */
@media (max-width: 640px) {
  .server-apps thead { display: none; }
  .server-apps tr, .server-apps td { display: block; }
  .server-apps td { border-top: 0; padding: 3px 4px; min-width: 0 !important; }
  .server-apps tr:not(.detail) { border-top: 1px dashed rgba(253, 230, 190, 0.12); padding: 8px 0; }
  .server-apps .row-actions { display: flex; justify-content: flex-start; }
  .server-apps pre { max-width: calc(100vw - 80px); overflow-x: auto; }
}

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); }
.stat-label { font-size: 16px; color: var(--muted); letter-spacing: 0.04em; }
.stat-big { font-size: 20px; color: var(--amber); margin: 6px 0 4px; }
.stat-sub { font-size: 12px; color: var(--muted); }
.day-chart { display: flex; align-items: stretch; gap: 3px; height: 150px; padding: 6px 0 0; border-bottom: 1px solid var(--line-strong); }
.day-chart .day { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.day-chart .bar-stack { flex: 1; display: flex; flex-direction: column-reverse; }
.day-chart .bar-stack i { display: block; }
.day-chart .members { background: var(--amber); }
.day-chart .guests { background: rgba(255, 190, 59, 0.38); }
.day-chart .bar-stack i:last-child { border-radius: 2px 2px 0 0; }
.day-chart .signups { display: block; background: var(--mint); margin-top: 3px; }
.day-chart .day:hover .bar-stack i { filter: brightness(1.25); }
.day-chart.hours { gap: 2px; }
.day-chart .day.now .members { background: var(--amber-soft); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.chart-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); }
.chart-key .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -4px; }
.key.members { background: var(--amber); }
.key.guests { background: rgba(255, 190, 59, 0.38); }
.key.signups { background: var(--mint); }
.stats-games td:not(:first-child), .stats-games th:not(:first-child) { text-align: right; }

.settings-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.settings-table th, .settings-table td { padding: 6px 8px; border-top: 1px dashed rgba(253, 230, 190, 0.12); text-align: left; vertical-align: middle; }
.settings-table th { width: 30%; font-weight: 400; }
.settings-table code { color: var(--amber-soft); word-break: break-all; }
.settings-table td:last-child { width: 1%; white-space: nowrap; }
.settings-table input, .add-setting input {
  width: 100%; font: 13px var(--mono); color: var(--cream); background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
}
.settings-table tr.gone code, .settings-table tr.gone input { text-decoration: line-through; opacity: 0.5; }
.settings-table tr.new code { color: var(--mint); }
.add-setting { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin: 10px 0; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .bar { padding: 12px 14px; }
  .controls { width: 100%; }
  .tagline { display: none; }
  .status-desc { display: none; }
  .status-main { flex-direction: column; align-items: stretch; gap: 8px; }
  .status-actions { justify-content: flex-end; }
  .status-board { max-height: 34vh; }
  body { padding-bottom: 150px; }
  /* Two cartridges to a shelf */
  .shelf { padding: 14px 4px 16px; }
  .shelf-row { gap: 14px; }
  .shelves { gap: 26px; }
  .players-week { font-size: 13px; letter-spacing: 0.04em; }
  .made-for { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .cartridge, .art, .led-glow, .slot-chip { transition: none; }
  .cartridge:hover, .cartridge.is-selected { transform: none; }
  .cartridge:hover .led-glow, .cartridge.is-selected .led-glow { animation: none; opacity: 1; }
  .crt-on, .cursor { animation: none; }
  .boot.go .boot-progress i { animation: none; width: 100%; }
}

/* Friends (the FRIENDS dialog) */
#friends-btn .count:not(:empty) {
  margin-left: 6px; background: var(--amber); color: #16111c; border-radius: 999px; padding: 0 6px; font-size: 14px;
}
.people { list-style: none; margin: 0 0 14px; padding: 0; }
.people li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed rgba(253, 230, 190, 0.12);
}
.people .row-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.people .row-actions .btn { font-size: 16px; padding: 4px 10px; }
.panel form + h2, .people + h2, .panel > p.muted + h2 { margin-top: 20px; }
.nowrap { white-space: nowrap; }
