/*
  BigDogg's Arcade — retro pixel chrome around full-colour artwork.
  Headings use a blocky monospace look now; a real pixel font (self-hosted,
  open licence) arrives with the logo PR so nothing loads from outside sites.
*/
/* Pixel font for headings, stored on our own server (SIL Open Font License, see static/fonts/OFL-PressStart2P.txt) */
@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* Palette pulled from the BigDogg's logo: neon cyan + hot magenta + rottweiler orange on deep purple-black */
  --bg: #0d0221;
  --bg-2: #1a0636;
  --panel: rgba(22, 8, 48, .82);
  --line: #3d1f72;
  --text: #f4ecff;
  --muted: #b9a8da;
  --cyan: #22f0f5;
  --pink: #ff2aa6;
  --orange: #ff8a1f;
  --purple: #7b2ff7;
  --violet: #b48cff;
  --yellow: #ffd23f;
  --green: #39ff14;
  --neon: var(--cyan);      /* main accent */
  --ok: #39ff14;            /* status light: working */
  --amber: #ffb300;
  --red: #ff3b5c;
  --pixel: "Press Start 2P", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font: 16px/1.45 var(--body); }
html { background: var(--bg); }
body { min-height: 100vh; position: relative; isolation: isolate; }

/* ---- 80s backdrop: sky glow + stars (layer 1), neon perspective grid floor (layer 2) ---- */
body::before, body::after { content: ""; position: fixed; left: 0; right: 0; z-index: -1; pointer-events: none; }
body::before {
  top: 0; bottom: 0;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 31%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 26%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 25% 6%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 14%, #fff5 50%, transparent 51%),
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(255, 42, 166, .28), transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(34, 240, 245, .18), transparent 70%),
    radial-gradient(ellipse 120% 50% at 50% 100%, rgba(255, 42, 166, .35), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, #2a0a4a 100%);
}
body::after {
  bottom: 0; height: 42vh;
  background:
    linear-gradient(to top, rgba(255, 42, 166, .55) 2px, transparent 2px) 0 0 / 100% 48px,
    linear-gradient(to right, rgba(34, 240, 245, .45) 2px, transparent 2px) 50% 0 / 64px 100%;
  transform: perspective(260px) rotateX(58deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 95%);
          mask-image: linear-gradient(to top, #000 10%, transparent 95%);
}
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: grid-run 6s linear infinite; }
}
@keyframes grid-run { to { background-position: 0 48px, 50% 0; } }
a { color: var(--cyan); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.pixel, .logo { font-family: var(--pixel); text-transform: uppercase; letter-spacing: 1px; }
h1.pixel { font-size: 18px; line-height: 1.6; color: var(--cyan); text-shadow: 0 0 10px rgba(34,240,245,.6), 2px 2px 0 var(--pink); }
h2.pixel { font-size: 13px; margin: 28px 0 12px; color: var(--pink); }
h2.pixel small { color: var(--muted); }

/* Top bar */
.topbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 2px solid var(--pink); box-shadow: 0 2px 18px rgba(255,42,166,.35);
  background: rgba(13, 2, 33, .78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--cyan); text-decoration: none; font-size: 12px; text-shadow: 2px 2px 0 var(--pink); }
.logo img { width: 46px; height: 46px; filter: drop-shadow(0 0 6px rgba(34,240,245,.6)); }
.logo .pixel-wordmark { display: block; line-height: 1.5; }
.logo .pixel-wordmark span { display: block; color: var(--pink); font-size: 10px; text-shadow: none; }
@media (max-width: 480px) { .logo .pixel-wordmark { display: none; } }
.nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.nav a.on { color: var(--text); border-bottom: 2px solid var(--neon); }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; padding: 8px 0; cursor: pointer; }

/* Stats row */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.stat { background: var(--panel); border: 2px solid var(--line); padding: 12px; text-decoration: none; color: var(--text); }
.stat b { display: block; font-family: var(--pixel); font-size: 20px; color: var(--neon); }
.stat b small { font-size: 11px; color: var(--muted); }
.stat span { font-size: 13px; color: var(--muted); }
.stat.cap-over_comfortable b, .stat.warn b { color: var(--amber); }
.stat.cap-over_max b { color: var(--red); }

/* Space switcher */
.switcher { display: flex; gap: 8px; overflow-x: auto; margin-top: 16px; padding-bottom: 4px; }
.switcher a { flex: none; padding: 10px 14px; border: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.switcher a.on { border-color: var(--neon); color: var(--text); }

/* Machine cards */
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card { position: relative; display: block; background: var(--panel); border: 2px solid var(--line); color: var(--text); text-decoration: none; }
.card:active, .card:hover { border-color: var(--cyan); }
.card-body { padding: 8px 10px 10px; display: grid; gap: 2px; }
.card-body strong { font-size: 15px; line-height: 1.25; }
.card-body em { font-style: normal; font-size: 13px; color: var(--pink); }
.card-body small { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); }

/* Placeholder art tile (replaced by real artwork later) */
.tile { aspect-ratio: 5 / 6; display: grid; place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, hsl(var(--hue) 80% 35%), hsl(calc(var(--hue) + 60) 80% 18%)); }
.tile span { font-family: var(--pixel); font-size: 28px; color: #fff; text-shadow: 3px 3px 0 rgba(0,0,0,.6); }

/* Status light */
.light { display: inline-block; width: 10px; height: 10px; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.light-attention { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.light-down { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* Coming Soon strip */
.strip { list-style: none; padding: 0; margin: 0; display: flex; gap: 12px; overflow-x: auto; }
.strip li { flex: 0 0 160px; }
.ribbon { position: absolute; top: 10px; left: -4px; background: var(--amber); color: #000; font-family: var(--pixel); font-size: 9px; padding: 4px 6px; }

/* Detail page */
.hero { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: start; margin-top: 8px; }
.hero h1 { margin: 0 0 4px; font-size: 24px; }
.edition { color: var(--pink); margin: 0 0 8px; }
.panel { background: var(--panel); border: 2px solid var(--line); padding: 14px 16px; margin-top: 16px; }
.panel.narrow { max-width: 420px; margin: 40px auto; }
.panel h2.pixel { margin-top: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.warn { color: var(--amber); }
.error { color: var(--red); }

/* Forms */
label { display: grid; gap: 6px; margin-bottom: 14px; color: var(--muted); }
input[type=text], input[type=password] { font: inherit; padding: 12px; background: var(--bg); color: var(--text); border: 2px solid var(--line); }
input:focus { outline: none; border-color: var(--cyan); }
.btn { font-family: var(--pixel); font-size: 12px; padding: 14px 18px; background: var(--neon); color: #000; border: 0; box-shadow: 4px 4px 0 var(--pink); cursor: pointer; }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--pink); }

/* Real artwork fills the tile, full colour, no pixel effects */
.tile.has-art { background: #000; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile { overflow: hidden; }

/* Messages */
.flash { padding: 10px 12px; border: 2px solid var(--line); background: var(--panel); }
.flash-success { border-color: var(--neon); }
.flash-error { border-color: var(--red); }
.muted { color: var(--muted); }

/* Buttons */
.btn-alt { background: var(--cyan); }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.btn-sm { font-size: 10px; padding: 10px 12px; box-shadow: 3px 3px 0 var(--pink); }
.btn-ghost.btn-sm { box-shadow: none; }
.btn-file { display: inline-block; cursor: pointer; color: #000; margin: 0; }
.photo-form { display: inline-block; margin-right: 12px; }

/* Artwork page */
.steps form { margin: 0 0 14px; }
.art-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.art-row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; background: var(--panel); border: 2px solid var(--line); padding: 8px; scroll-margin-top: 80px; }
.art-thumb .tile span { font-size: 16px; }
.art-info { display: grid; gap: 4px; }
.art-info small { color: var(--muted); }
.art-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.art-actions form { margin: 0; }
.manual { display: flex; gap: 6px; }
.manual input { font: inherit; font-size: 14px; padding: 8px; width: 170px; background: var(--bg); color: var(--text); border: 2px solid var(--line); }
.chip { justify-self: start; font-size: 11px; padding: 2px 8px; border: 1px solid var(--line); color: var(--muted); }
.chip-suggested { border-color: var(--amber); color: var(--amber); }
.chip-confirmed { border-color: var(--neon); color: var(--neon); }
.chip-not_found, .chip-skipped { border-color: var(--red); color: var(--red); }
.pick { font: inherit; font-size: 15px; padding: 10px; width: 100%; background: var(--bg); color: var(--text); border: 2px solid var(--line); }
.pick.unmatched { border-color: var(--amber); }
.steps hr { border: 0; border-top: 2px dashed var(--line); margin: 16px 0; }

/* Optimization To-Do */
.kp-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.kp { background: var(--bg); border: 2px solid var(--line); border-left-width: 6px; padding: 10px 12px; scroll-margin-top: 80px; }
.kp p { margin: 6px 0; }
.kp small { color: var(--muted); }
.kp-include, .kp-todo { border-left-color: var(--neon); }
.kp-review { border-left-color: var(--amber); }
.kp-exclude { border-left-color: var(--line); opacity: .8; }
.kp-done, .kp-na, .kp-skip { opacity: .6; }
.kp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.chip-include { border-color: var(--neon); color: var(--neon); }
.chip-review { border-color: var(--amber); color: var(--amber); }
.chip-exclude { border-color: var(--line); color: var(--muted); }
.chip-new { border-color: var(--pink); color: var(--pink); }
.field { display: block; width: 100%; font: inherit; font-size: 16px; padding: 10px; margin: 6px 0 12px; background: var(--bg); color: var(--text); border: 2px solid var(--line); box-sizing: border-box; }
.field-sm { display: inline-block; width: auto; flex: 1 1 160px; margin: 0; font-size: 15px; padding: 8px; }
.pastebox { min-height: 160px; max-height: 50vh; overflow: auto; padding: 10px; margin-bottom: 12px; background: var(--bg); color: var(--text); border: 2px dashed var(--cyan); font-size: 14px; }
.pastebox:empty::before { content: "Tap here, then Paste"; color: var(--muted); }
.pastebox img { max-width: 60px; }
.howto { padding-left: 20px; }
.howto li { margin: 4px 0; }
details summary { cursor: pointer; padding: 8px 0; color: var(--muted); }


/* ---- Neon glass for panels and cards so the backdrop glows through ---- */
.panel, .stat, .card, .art-row, .flash {
  background: var(--panel);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.stat { border-color: rgba(34,240,245,.35); box-shadow: inset 0 0 12px rgba(34,240,245,.08); }
.stat b { text-shadow: 0 0 8px rgba(34,240,245,.55); }
.card { border-color: rgba(123,47,247,.6); transition: transform .12s ease, border-color .12s, box-shadow .12s; }
.card:hover, .card:active, .card:focus-visible {
  border-color: var(--cyan); box-shadow: 0 0 14px rgba(34,240,245,.55), 0 0 2px var(--pink); transform: translateY(-2px);
}
.panel { border-color: rgba(123,47,247,.6); }
.ribbon { background: var(--orange); }

/* ---- Big logo at the top of the dashboard, with a striped 80s sun behind it ---- */
.marquee { position: relative; display: grid; place-items: center; padding: 8px 0 4px; }
.marquee::before {
  /* soft dark halo so the neon logo pops (the logo itself is see-through) */
  content: ""; position: absolute; width: clamp(140px, 48vw, 400px); aspect-ratio: 1; border-radius: 50%; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(8, 0, 20, .85) 0 45%, rgba(8, 0, 20, .4) 62%, transparent 72%);
}
.marquee img { position: relative; width: clamp(96px, 33vw, 280px); height: auto; filter: drop-shadow(0 0 10px rgba(34,240,245,.45)) drop-shadow(0 0 3px rgba(255,42,166,.6)); }
@media (min-width: 900px) { .marquee img { width: 280px; } }

/* Sign-in page logo */
.signin-logo { display: block; width: 180px; margin: 0 auto 8px; filter: drop-shadow(0 0 16px rgba(34,240,245,.5)); }


/* ---- Retro colour cycling: stat boxes and row titles each get their own neon ---- */
.stats > :nth-child(4n+1) { --c: var(--cyan); }
.stats > :nth-child(4n+2) { --c: var(--pink); }
.stats > :nth-child(4n+3) { --c: var(--orange); }
.stats > :nth-child(4n+4) { --c: var(--yellow); }
.stats > .stat { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.stats > .stat b { color: var(--c); text-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
.stats > .stat.warn b { color: var(--amber); }
.stat b { font-size: 16px; }
.btn-alt { background: var(--orange); }
.section-title { color: var(--yellow) !important; text-shadow: 0 0 8px rgba(255,210,63,.5); }

/* ---- One swipeable row per manufacturer ---- */
.maker { margin-top: 18px; }
.maker-title { font-size: 11px; margin: 0 0 8px; color: var(--c, var(--pink)); text-shadow: 0 0 8px currentColor; letter-spacing: 1px; }
.maker-title small { color: var(--muted); text-shadow: none; font-size: 9px; }
.maker:nth-of-type(6n+1) { --c: var(--pink); }
.maker:nth-of-type(6n+2) { --c: var(--cyan); }
.maker:nth-of-type(6n+3) { --c: var(--orange); }
.maker:nth-of-type(6n+4) { --c: var(--yellow); }
.maker:nth-of-type(6n+5) { --c: var(--green); }
.maker:nth-of-type(6n+6) { --c: var(--violet); }
.row {
  list-style: none; margin: 0 -16px; padding: 4px 16px 12px;
  display: grid; grid-auto-flow: column; gap: 10px;
  grid-auto-columns: calc((100% - 20px) / 3.2);   /* 3 cards + a peek of the 4th says "swipe me" */
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > li { scroll-snap-align: start; min-width: 0; }
.row .card { height: 100%; }
.maker .card { border-color: color-mix(in srgb, var(--c) 45%, transparent); }
@media (min-width: 700px) { .row { grid-auto-columns: 170px; margin: 0; padding: 4px 0 12px; } }
@media (max-width: 600px) {
  .card-body { padding: 6px 7px 8px; }
  .card-body strong { font-size: 12.5px; }
  .card-body em { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-body small { font-size: 10.5px; }
  .tile span { font-size: 16px; }
  .card-body .light { width: 7px; height: 7px; }
}

/* ---- 8-bit characters crossing the backdrop (original pixel art, see tools/make_sprites.py) ---- */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sp { position: absolute; left: 0; top: var(--top); animation: var(--path) var(--dur) linear var(--delay) infinite; will-change: transform; }
.sp i { display: block; width: var(--w); height: var(--h); background: var(--img) center / contain no-repeat;
  image-rendering: pixelated; filter: drop-shadow(0 0 5px var(--glow, rgba(34,240,245,.7))); }
@keyframes cross-right { 0% { transform: translateX(-160px); } 45%, 100% { transform: translateX(calc(100vw + 160px)); } }
@keyframes cross-left  { 0% { transform: translateX(calc(100vw + 160px)); } 45%, 100% { transform: translateX(-160px); } }
@keyframes hover  { 50% { transform: translateY(-6px); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes trot   { 0% { background-image: url("../img/sprites/rottie-1.svg"); transform: translateY(0); }
                    50% { background-image: url("../img/sprites/rottie-2.svg"); transform: translateY(-3px); } }
@keyframes flip   { 50% { transform: scaleX(.15); } }
.sp-rocket { --top: 12%; --path: cross-right; --dur: 24s; --delay: -3s; }
.sp-rocket i { --w: 60px; --h: 28px; --img: url("../img/sprites/rocket.svg"); --glow: rgba(255,42,166,.8); animation: hover .5s steps(2) infinite; }
.sp-ufo { --top: 30%; --path: cross-left; --dur: 36s; --delay: -19s; }
.sp-ufo i { --w: 56px; --h: 24px; --img: url("../img/sprites/ufo.svg"); --glow: rgba(180,140,255,.9); animation: hover 1.4s ease-in-out infinite; }
.sp-token { --top: 48%; --path: cross-right; --dur: 42s; --delay: -30s; }
.sp-token i { --w: 56px; --h: 56px; --img: url("../img/icons/paw-coin.png"); --glow: rgba(255,210,63,.9); image-rendering: auto; animation: flip 2s steps(6) infinite; }
.sp-dog { --top: calc(100% - 100px); --path: cross-right; --dur: 18s; --delay: -11s; }
.sp-dog i { --w: 78px; --h: 66px; --img: url("../img/sprites/rottie-1.svg"); --glow: rgba(255,138,31,.8); animation: trot .32s steps(1) infinite; }
/* The bone floats just ahead of the dog on the same path, so he's always chasing it */
.sp-bone { --top: calc(100% - 62px); --path: cross-right; --dur: 18s; --delay: -12.3s; }
.sp-bone i { --w: 54px; --h: 27px; --img: url("../img/sprites/bone.svg"); --glow: rgba(255,243,214,.8); animation: bone-hop .9s infinite; }
/* hops along like it was tossed: up and down in an arc while spinning end over end */
@keyframes bone-hop {
  0%   { transform: translateY(0) rotate(0deg); animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  50%  { transform: translateY(-46px) rotate(180deg); animation-timing-function: cubic-bezier(.6,0,.8,.3); }
  100% { transform: translateY(0) rotate(360deg); }
}
.sp-ball { --top: calc(100% - 56px); --path: cross-left; --dur: 14s; --delay: -5s; }
.sp-ball i { --w: 26px; --h: 26px; --img: url("../img/icons/ball.png"); --glow: rgba(255,255,255,.8); animation: bounce .7s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .sky { display: none; } }

/* ---- Row title tile (first card in each row) ---- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.maker-tile .mt {
  height: 100%; min-height: 100%; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 10px 6px;
  text-align: center; border: 2px solid var(--c); background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 3px, transparent 3px 6px),
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%),
    var(--panel);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 30%, transparent);
}
.maker-tile .mt span { color: var(--c); font-size: 13px; line-height: 1.6; text-transform: uppercase; word-break: break-word;
  text-shadow: 0 0 8px var(--c), 2px 2px 0 rgba(0,0,0,.7); }
.maker-tile .mt small { color: var(--muted); font-size: 11px; }
.maker-tile .mt-arrow { font-style: normal; color: var(--c); font-size: 12px; animation: nudge 1.2s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }
@media (max-width: 600px) { .maker-tile .mt span { font-size: 10px; } }

/* ---- Your pixel icons (static/img/icons) ---- */
.stat { position: relative; }
.stat-ic { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(255,255,255,.25)); }
.h-ic { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin-right: 8px; image-rendering: pixelated; }
.mt-ic { width: 46%; max-width: 64px; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 70%, transparent)); }
.chip-ic { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; }
/* Flippers under the logo give it a little flick now and then */
.marquee { width: fit-content; margin: 0 auto; }
.marquee .flip { position: absolute; bottom: 3%; width: 38%; height: auto; z-index: 1; image-rendering: pixelated; filter: drop-shadow(0 0 6px rgba(255,42,166,.5)); }
/* Like a real machine: pivots on the outside, tips angled down toward the middle at rest,
   tucked in so they peek just over the bottom edge of the logo. Every few seconds they flick up. */
.marquee .flip-l { left: -9%; transform-origin: 14% 58%; transform: rotate(34deg); }
.marquee .flip-r { right: -9%; transform-origin: 86% 58%; transform: rotate(-34deg); }
@media (prefers-reduced-motion: no-preference) {
  .marquee .flip-l { animation: flick-l 5s steps(1) infinite; }
  .marquee .flip-r { animation: flick-r 5s steps(1) 2.5s infinite; }
}
@keyframes flick-l { 0%, 6% { transform: rotate(-14deg); } 7%, 100% { transform: rotate(34deg); } }
@keyframes flick-r { 0%, 6% { transform: rotate(14deg); } 7%, 100% { transform: rotate(-34deg); } }

.mt-logo { display: block; width: 92%; height: auto; max-height: 130px; object-fit: contain; image-rendering: pixelated;
  /* thin light outline + glow keeps dark logos (Atari, Data East...) readable on the dark tile */
  filter: drop-shadow(0 0 1px rgba(255,255,255,.9)) drop-shadow(0 0 6px rgba(255,255,255,.35)); }
.mt.has-logo { gap: 8px; }
.mt-logo:not(:only-of-type) { max-height: 70px; }

/* ---- Guest side ---- */
.btn-report { background: var(--orange); color: #000; box-shadow: 4px 4px 0 var(--pink); text-decoration: none; display: inline-block; font-size: 11px; padding: 12px 14px; }
.btn-big { font-size: 13px; padding: 16px 20px; }
.btn-block { display: block; width: 100%; text-align: center; margin: 16px 0; }
.welcome { text-align: center; }
.welcome-title { color: var(--yellow); font-size: 12px; text-shadow: 0 0 8px rgba(255,210,63,.6); }
.report textarea.field { min-height: 110px; resize: vertical; }
.report h1 .h-ic { width: 26px; height: 26px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.thanks { text-align: center; }
.thanks-ic { width: 96px; image-rendering: pixelated; filter: drop-shadow(0 0 12px rgba(255,210,63,.7)); }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; background: var(--pink); color: #fff; font-size: 12px; border-radius: 10px; text-align: center; }
.foot { text-align: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }
.poster { text-align: center; }
.poster img { width: min(100%, 600px); height: auto; }
@media print { .topbar, .foot, .noprint, .sky { display: none !important; } body::before, body::after { display: none; } html, body { background: #000; } }

/* Fix queue */
.tickets { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.ticket { display: grid; grid-template-columns: 64px 1fr; gap: 12px; background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--orange); padding: 10px; }
.ticket.closed { border-left-color: var(--green); opacity: .7; }
.ticket p { margin: 4px 0; }
.ticket .when { color: var(--muted); font-size: 13px; }
.ticket form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Info groups under the to-do list */
.info-group { border-top: 1px dashed var(--line); padding: 4px 0; }
.info-group summary { padding: 10px 0; font-size: 15px; }
.info-group[open] summary { color: var(--cyan); }

/* Pinside checklist */
.checklist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.check-row { display: grid; grid-template-columns: 1fr; gap: 6px; background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--amber); padding: 10px 12px; scroll-margin-top: 80px; }
.check-row.all-done { border-left-color: var(--green); }
.check-name { color: var(--text); text-decoration: none; }
.check-name small { color: var(--pink); }
.check-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.check-box small { color: var(--muted); }
.check-box a { margin-left: auto; font-size: 13px; }
.box { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--cyan); color: var(--green); font-weight: 700; }
@media (min-width: 900px) { .check-row { grid-template-columns: 1.2fr 1fr 1fr 1.2fr; align-items: center; } }

.pick-art { display: grid; gap: 10px; margin: 12px 0; }
.pick-art img { max-width: min(100%, 320px); max-height: 380px; object-fit: contain; border: 2px solid var(--line); background: #000; }
.check { display: flex; gap: 10px; align-items: center; font-size: 16px; }
.check input { width: 22px; height: 22px; }

/* Waiting list on the Send button page */
.waiting { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.waiting li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.waiting small { grid-column: 1; }
.waiting form { grid-column: 2; grid-row: 1 / span 2; margin: 0; }

/* Picture picker (Pinside page pictures) */
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.pic { position: relative; display: block; cursor: pointer; border: 3px solid var(--line); background: #000; aspect-ratio: 5 / 6; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic input { position: absolute; opacity: 0; }
.pic:has(input:checked) { border-color: var(--cyan); box-shadow: 0 0 12px rgba(34,240,245,.7); }
.pic-none { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 6px; }
.check-box a + a { margin-left: 10px; }

.check-thumb { width: 34px; height: 40px; object-fit: cover; border: 1px solid var(--line); }
.check-upload { margin: 0 0 0 auto; }
.check-upload .btn { margin: 0; }

/* ---- Pixel-shatter cards (inspired by things breaking into glowing cubes) ----
   Each card has small stair-step "bites" taken out of two corners and both sides
   (even cards are mirrored), and tiny glowing cubes drift off those edges.
   The cubes are added by the small script in base.html; they're decoration only. */
.card, .maker .card {
  border: 2px solid var(--c, var(--cyan));
  border-radius: 0;
  outline: none;
  box-shadow: none;
  clip-path: polygon(
    0 0,
    calc(100% - 32px) 0, calc(100% - 32px) 8px, calc(100% - 24px) 8px, calc(100% - 24px) 16px,
    calc(100% - 16px) 16px, calc(100% - 16px) 24px, calc(100% - 8px) 24px, calc(100% - 8px) 32px, 100% 32px,
    100% 38%, calc(100% - 8px) 38%, calc(100% - 8px) calc(38% + 8px), calc(100% - 16px) calc(38% + 8px),
    calc(100% - 16px) calc(38% + 24px), calc(100% - 8px) calc(38% + 24px), calc(100% - 8px) calc(38% + 32px), 100% calc(38% + 32px),
    100% 100%,
    calc(70% + 24px) 100%, calc(70% + 24px) calc(100% - 8px), calc(70% + 16px) calc(100% - 8px), calc(70% + 16px) calc(100% - 16px),
    calc(70% + 8px) calc(100% - 16px), calc(70% + 8px) calc(100% - 8px), 70% calc(100% - 8px), 70% 100%,
    32px 100%, 32px calc(100% - 8px), 24px calc(100% - 8px), 24px calc(100% - 16px),
    16px calc(100% - 16px), 16px calc(100% - 24px), 8px calc(100% - 24px), 8px calc(100% - 32px), 0 calc(100% - 32px),
    0 calc(22% + 24px), 8px calc(22% + 24px), 8px calc(22% + 16px), 16px calc(22% + 16px),
    16px calc(22% + 8px), 8px calc(22% + 8px), 8px 22%, 0 22%);
  transition: transform .15s ease, filter .15s ease;
}
.row > li:nth-child(even) .card { transform: scaleX(-1); }
.row > li:nth-child(even) .card > * { transform: scaleX(-1); }
.card:hover, .card:active, .card:focus-visible { border-color: var(--c, var(--cyan)); filter: brightness(1.12); }
.row > li:nth-child(odd) .card:hover { transform: translateY(-2px); }
.card-body strong { color: var(--c, var(--cyan)); text-shadow: none; }
.row { gap: 14px; padding-top: 8px; padding-bottom: 14px; }
.row > li { position: relative; padding: 4px; }
.maker-tile .mt { border-radius: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, calc(100% - 12px) 6px, calc(100% - 6px) 6px, calc(100% - 6px) 12px, 100% 12px, 100% 100%, 12px 100%, 12px calc(100% - 6px), 6px calc(100% - 6px), 6px calc(100% - 12px), 0 calc(100% - 12px)); }

.shard {
  position: absolute; z-index: 1; pointer-events: none;
  width: var(--s); height: var(--s); background: var(--sc);
  box-shadow: inset -1px -1px 0 rgba(0, 0, 0, .35), inset 1px 1px 0 rgba(255, 255, 255, .55), 0 0 4px var(--sc);
  opacity: 0;
  animation: shard-drift var(--t) linear var(--d) infinite;
}
@keyframes shard-drift {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .shard, .frag { animation: none; opacity: .85; } }
/* Edit form */
.edit-form h2 { margin-top: 20px; }
.form-field { display: block; margin-bottom: 4px; color: var(--muted); font-size: 14px; }
.form-field .field { color: var(--text); }
.edit-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.edit-form select.field { appearance: auto; }
.error { color: var(--red); }

/* Mod list */
.mod-list { list-style: none; padding: 0; margin: 8px 0 14px; }
.mod-list li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px dashed var(--line); }
.mod-list strong a { color: var(--text); }
.mod-list small { display: block; }
.mod-list p { margin: 4px 0 0; }
.mod-form details { margin: 4px 0 10px; }
.mod-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.inline-edit { display: flex; align-items: center; gap: 6px; margin: 0; }
.inline-edit .field-sm { width: 110px; flex: 0 0 auto; }
.inline-edit .dollar { color: var(--muted); }

/* ---- Background fleet (original sprites from tools/make_sprites.py) ----
   Different heights, directions, speeds and paths; long gaps so only a few are on screen at once. */
@keyframes swoop-left { 0% { transform: translate(calc(100vw + 160px), 0); } 22% { transform: translate(60vw, 90px); }
                        44%, 100% { transform: translate(-160px, -30px); } }
@keyframes dive-right { 0% { transform: translate(-160px, 0); } 10% { transform: translate(18vw, 70px); } 20% { transform: translate(36vw, -10px); }
                        30% { transform: translate(54vw, 70px); } 40% { transform: translate(72vw, -10px); } 50%, 100% { transform: translate(calc(100vw + 160px), 40px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
.sp-drone { --top: 18%; --path: cross-left; --dur: 34s; --delay: -8s; }
.sp-drone i { --w: 39px; --h: 30px; --img: url("../img/sprites/drone.svg"); --glow: rgba(34,240,245,.8); animation: bob 1.2s ease-in-out infinite; }
.sp-fighter { --top: 7%; --path: cross-right; --dur: 16s; --delay: -11s; }
.sp-fighter i { --w: 45px; --h: 33px; --img: url("../img/sprites/fighter.svg"); --glow: rgba(255,42,166,.8); }
.sp-fighter2 { --top: 40%; --path: dive-right; --dur: 26s; --delay: -2s; }
.sp-fighter2 i { --w: 36px; --h: 26px; --img: url("../img/sprites/fighter.svg"); --glow: rgba(123,47,247,.9); }
.sp-manta { --top: 28%; --path: swoop-left; --dur: 30s; --delay: -16s; }
.sp-manta i { --w: 48px; --h: 24px; --img: url("../img/sprites/manta.svg"); --glow: rgba(180,140,255,.9); animation: bob 1.6s ease-in-out infinite; }
.sp-boneship { --top: 52%; --path: cross-right; --dur: 38s; --delay: -27s; }
.sp-boneship i { --w: 52px; --h: 26px; --img: url("../img/sprites/boneship.svg"); --glow: rgba(255,243,214,.8); animation: bob 1.4s ease-in-out infinite; }
/* ships flying left face left */
.sp-drone i, .sp-manta i { transform-origin: center; }


/* ---- Guest intro crawl (public home page only) ----
   Scrolling, fading text in the site's own neon colours, with pixel touches:
   scanlines, a typed-out pixel-font opening line, stepped (8-bit) motion, and cubes around the logo. */
.intro { display: none; position: fixed; inset: 0; z-index: 9999; overflow: hidden; cursor: pointer;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9 50%, transparent 51%), radial-gradient(1px 1px at 72% 9%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 31%, #fff7 50%, transparent 51%), radial-gradient(1px 1px at 88% 26%, #fff9 50%, transparent 51%),
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(255, 42, 166, .30), transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(34, 240, 245, .22), transparent 70%),
    radial-gradient(ellipse 120% 50% at 50% 100%, rgba(255, 42, 166, .40), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, #2a0a4a 100%); }
.intro::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38vh; z-index: 0;
  background: linear-gradient(to top, rgba(255, 42, 166, .55) 2px, transparent 2px) 0 0 / 100% 44px,
              linear-gradient(to right, rgba(34, 240, 245, .45) 2px, transparent 2px) 50% 0 / 60px 100%;
  transform: perspective(260px) rotateX(58deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 95%); mask-image: linear-gradient(to top, #000 10%, transparent 95%);
  animation: grid-run 4s linear infinite; }
.intro::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 2px, transparent 2px 4px); }  /* CRT scanlines */
.intro.show { display: block; }
.intro.bye { opacity: 0; transition: opacity .35s steps(4); }
.intro-skip { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 5; background: rgba(13,2,33,.7);
  color: var(--cyan); border: 2px solid var(--cyan); padding: 8px 12px; font: 11px var(--pixel); cursor: pointer; }
.intro-lead { position: absolute; top: 40%; left: 0; right: 0; z-index: 2; margin: 0 auto; width: fit-content; max-width: 92vw; padding: 0 12px;
  font: clamp(10px, 2.8vw, 16px)/1.8 var(--pixel); color: var(--cyan); text-align: center;
  text-shadow: 2px 2px 0 var(--pink), 0 0 10px rgba(34, 240, 245, .7);
  opacity: 0; animation: intro-lead 2.2s steps(1) forwards; }
@keyframes intro-lead { 0% { opacity: 0; } 5% { opacity: 1; } 12% { opacity: .4; } 18%, 72% { opacity: 1; } 82% { opacity: .5; } 90% { opacity: .2; } 100% { opacity: 0; } }
.intro-stage { position: absolute; inset: 0; z-index: 1; perspective: 700px; perspective-origin: 50% 20%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%); mask-image: linear-gradient(to bottom, transparent 0%, #000 16%); }
.intro-crawl { position: absolute; left: 50%; top: 92%; width: min(78vw, 520px); transform-origin: 50% 0;
  transform: translateX(-50%) rotateX(12deg); color: var(--text); font-weight: 700;
  font-size: clamp(16px, 4.4vw, 26px); line-height: 1.5; text-align: center;
  text-shadow: 0 0 8px rgba(34, 240, 245, .55), 2px 2px 0 rgba(123, 47, 247, .9);
  animation: intro-crawl 38s linear 1.8s forwards; }
.intro-crawl h2 { font-family: var(--pixel); font-size: clamp(14px, 3.6vw, 22px); line-height: 1.7; text-align: center; margin: 0 0 1.2em;
  color: var(--pink); text-shadow: 3px 3px 0 var(--cyan), 0 0 14px rgba(255, 42, 166, .8); }
.intro-crawl p { margin: 0 0 1.1em; }
.intro-crawl p:nth-of-type(even) { color: #d9fbff; }
@keyframes intro-crawl { from { top: 92%; } to { top: -175%; } }
.intro-end { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 24px; z-index: 3; background: rgba(13, 2, 33, .55); }
.intro.ending .intro-end { display: grid; animation: intro-end-in .9s steps(6) both; }
.intro-end img { width: min(60vw, 260px); height: auto; filter: drop-shadow(0 0 16px rgba(34, 240, 245, .6)); }
.intro-end .logo-wrap { position: relative; }
.intro-start { animation: blink 1s steps(1) infinite; }
@keyframes intro-end-in { from { opacity: 0; transform: scale(.6); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes blink { 50% { opacity: .35; } }

@media (min-width: 900px) { .check-row.soon-row { grid-template-columns: 1.2fr 3.2fr; } }


/* ---- Breaking off (calmer): shallower 6px steps, and card-coloured fragments that sit on
   each break, then crack loose and drift away now and then. Replaces the pulsing lights. ---- */
.card, .maker .card {
  clip-path: polygon(
    0 0,
    calc(100% - 18px) 0, calc(100% - 18px) 6px, calc(100% - 12px) 6px, calc(100% - 12px) 12px,
    calc(100% - 6px) 12px, calc(100% - 6px) 18px, 100% 18px,
    100% 38%, calc(100% - 6px) 38%, calc(100% - 6px) calc(38% + 12px), 100% calc(38% + 12px),
    100% 100%,
    calc(70% + 12px) 100%, calc(70% + 12px) calc(100% - 6px), 70% calc(100% - 6px), 70% 100%,
    18px 100%, 18px calc(100% - 6px), 12px calc(100% - 6px), 12px calc(100% - 12px),
    6px calc(100% - 12px), 6px calc(100% - 18px), 0 calc(100% - 18px),
    0 calc(22% + 12px), 6px calc(22% + 12px), 6px 22%, 0 22%);
}
/* Break colour: each row's chips flash a contrasting colour as they crack loose, then
   fade into the row's trim colour as they drift away. */
.maker:nth-of-type(6n+1) { --c2: var(--yellow); }  /* pink row   → yellow */
.maker:nth-of-type(6n+2) { --c2: var(--pink); }    /* cyan row   → pink */
.maker:nth-of-type(6n+3) { --c2: var(--cyan); }    /* orange row → cyan */
.maker:nth-of-type(6n+4) { --c2: var(--violet); }  /* yellow row → violet */
.maker:nth-of-type(6n+5) { --c2: var(--pink); }    /* green row  → pink */
.maker:nth-of-type(6n+6) { --c2: var(--yellow); }  /* violet row → yellow */
.frag {
  position: absolute; z-index: 2; pointer-events: none; width: 6px; height: 6px;
  background: #1a0636; border: 1px solid var(--c1); box-shadow: 0 0 3px var(--c1);
  animation: frag-off var(--t) ease-in var(--d) infinite;
}
@keyframes frag-off {  /* invisible while the card is whole; appears exactly as the hole opens */
  0%, 54.9% { transform: translate(0, 0) rotate(0); opacity: 0;
              background: var(--c2, #fff); border-color: var(--c2, #fff); box-shadow: none; }
  55%       { opacity: 1; background: var(--c2, #fff); border-color: var(--c2, #fff); box-shadow: 0 0 6px var(--c2, #fff); }
  100%      { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0;
              background: var(--c1); border-color: var(--c1); box-shadow: 0 0 3px var(--c1); }
}
/* Cards are whole now; holes are torn out by the script (see base.html), not cut in advance. */
.card, .maker .card { clip-path: none; }
.frag { opacity: 0; }
.row > li.off .frag, .row > li.off .card, .row > li.off .shard { animation-play-state: paused; }
.shard { animation-name: shard-break; animation-timing-function: linear; box-shadow: 0 0 3px var(--sc); }
@keyframes shard-break {  /* tiny cubes: start in the break colour, fade into the trim colour */
  0%   { transform: translate(0, 0) scale(1); opacity: 0; background: var(--c2, #fff); }
  10%  { opacity: 1; background: var(--c2, #fff); }
  60%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: 0; background: var(--sc); }
}

/* Move games page */
.btn-small { padding: 6px 10px; font-size: 12px; min-height: 0; }
.move-spaces { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.move-spaces li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.move-group { border: 1px solid var(--line); margin: 0 0 12px; padding: 8px 10px; }
.move-group legend { padding: 0 6px; font-weight: 700; }
.move-game { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.move-game input { width: 22px; height: 22px; }
/* "Play the intro" link on the guest home: the intro only runs on its own once a day. */
.intro-replay { margin: 10px 0 0; font-size: 13px; }
.intro-replay a { color: var(--cyan); }
