/* Backstreet: full-window arcade scene. The alley is drawn on a canvas (backstreet.js); this
   file styles the HUD, the title screen and the dialog box on top of it. */
@font-face { font-family: 'Silkscreen'; src: url('/static/fonts/silkscreen-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url('/static/fonts/silkscreen-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'VT323'; src: url('/static/fonts/vt323-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --ink: #f4ecff;
  --dim: #a99cc6;
  --pink: #ff3fa4;
  --cyan: #3ff0ff;
  --amber: #ffd166;
  --red: #ff5a5a;
  --green: #6dff9c;
  --bg: #07060b;
  --panel: rgba(13, 10, 22, 0.95);
  --edge: #3a2f5c;
  /* Room the dialog box keeps at the bottom; the alley's ground sits just above it. */
  --reserve: clamp(190px, 34vh, 290px);
  /* One height for the code input and every button next to it. */
  --control: clamp(46px, 6.5vw, 56px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body {
  font-family: 'VT323', ui-monospace, monospace;
  font-size: 22px;
  line-height: 1.15;
  -webkit-font-smoothing: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  left: 0;
  top: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Scanlines and a vignette, like an old cabinet screen. */
.crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.6) 100%);
}

button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* ------------------------------------------------------------------ HUD */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  font-family: 'Silkscreen', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
}
.hud__title { color: var(--pink); }
.hud__right { display: flex; align-items: center; gap: 16px; }
.hud__btn {
  pointer-events: auto;
  cursor: pointer;
  background: rgba(11, 7, 18, 0.7);
  border: 2px solid var(--cyan);
  padding: 4px 8px;
  color: #dffcff;
  font-family: 'Silkscreen', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  box-shadow: 0 0 6px rgba(63, 240, 255, 0.4);
  text-shadow: 0 0 4px var(--cyan);
}
.hud__btn:hover { background: var(--cyan); color: #0b0712; text-shadow: none; }
.hud__btn[aria-pressed='false'] { border-color: #3a4a56; color: #7d8a96; box-shadow: none; text-shadow: none; }

/* ------------------------------------------------------------------ title screen */
.title {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(7, 6, 11, 0.35), rgba(7, 6, 11, 0.85) 70%);
}
.title[hidden] { display: none; }
.title__logo {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(40px, 11vw, 112px);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: #ffe3f3;
  text-shadow: 0 0 2px #fff, 0 0 10px var(--pink), 0 0 24px var(--pink), 0 0 48px rgba(255, 63, 164, 0.6), 6px 6px 0 #2a0b20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  animation: neon 6s steps(1) infinite;
}
.title__logo span:last-child { color: #e3fdff; text-shadow: 0 0 2px #fff, 0 0 10px var(--cyan), 0 0 24px var(--cyan), 0 0 48px rgba(63, 240, 255, 0.5), 6px 6px 0 #062a2e; }
.title__sub {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(11px, 2.4vw, 16px);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--dim);
}
.title__start {
  margin-top: 28px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(18px, 4vw, 28px);
  letter-spacing: 0.2em;
  color: var(--amber);
  text-shadow: 3px 3px 0 #3a2400;
  animation: blink 1.1s steps(1) infinite;
  padding: 10px 18px;
}
.title__start:hover, .title__start:focus-visible { animation: none; color: #fff; }
.title__hint {
  margin: 0;
  font-family: 'Silkscreen', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #6f6590;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ dialog box */
.dialog {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(880px, calc(100% - 32px));
  min-height: calc(var(--reserve) - 32px);
  max-height: calc(100% - 72px);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 18px 22px 22px;
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--edge), 8px 12px 0 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  overflow: auto;
}
.dialog[hidden] { display: none; }
.dialog.is-busy { cursor: default; }
.dialog__portrait {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid var(--edge);
  background: #120d1f;
  box-shadow: inset 0 0 0 2px #000;
}
.dialog__body { min-width: 0; }
.dialog__name {
  margin: 0 0 6px;
  font-family: 'Silkscreen', monospace;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--pink);
}
.dialog.is-you .dialog__name { color: var(--cyan); }
.dialog__text {
  margin: 0;
  font-size: clamp(24px, 3.3vw, 32px);
  line-height: 1.1;
  min-height: 2.2em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dialog.is-you .dialog__text { color: #dffcff; }
.dialog__extra:empty { display: none; }
.dialog__extra { margin-top: 14px; }
.dialog__next {
  position: absolute;
  right: 18px;
  bottom: 10px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--amber);
  opacity: 0;
}
.dialog__next.is-on { opacity: 1; animation: bob 0.6s steps(2) infinite; }

/* Choices: an arcade menu with a cursor. */
.choices { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.choice {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: clamp(22px, 3vw, 28px);
  color: var(--ink);
}
.choice::before { content: ''; width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 10px solid transparent; flex: none; }
.choice:focus::before { border-left-color: var(--amber); animation: nudge 0.5s steps(2) infinite; }
.choice:focus { color: var(--amber); outline: none; }
.choice img { width: 22px; height: 22px; image-rendering: auto; }
.choice__glyph { width: 18px; height: 18px; flex: none; fill: currentColor; }
.choice small { color: var(--dim); font-size: 0.75em; }
.choice--quiet { color: var(--dim); }

/* The code entry: twelve slots, typed or pasted. */
.entry { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.entry__input {
  flex: 1 1 260px;
  min-width: 0;
  height: var(--control);
  background: #07050d;
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 0 2px #000;
  color: var(--green);
  caret-color: var(--green);
  font-family: 'Silkscreen', monospace;
  font-size: clamp(18px, 3.2vw, 26px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 12px;
  text-shadow: 0 0 6px rgba(109, 255, 156, 0.6);
  user-select: text;
  -webkit-user-select: text;
}
.entry__input::placeholder { color: #2c4d36; text-shadow: none; }
.entry__input.is-wrong { border-color: var(--red); animation: shake 0.3s steps(3) 2; }
.entry__input:focus { border-color: var(--green); box-shadow: inset 0 0 0 2px #000, 0 0 10px rgba(109, 255, 156, 0.35); outline: none; }

/* Neon tubes: dark glass, a glowing outline and lettering, lit up on hover. Pink is the
   main action (the sign's BACK), cyan the way out (STREET), red for burning things. */
.btn {
  --neon: var(--pink);
  --neon-glow: rgba(255, 63, 164, 0.55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control);
  padding: 0 20px;
  flex: none;
  font-family: 'Silkscreen', monospace;
  font-size: 14px;
  letter-spacing: 0.16em;
  white-space: nowrap;
  color: #ffe3f3;
  background: #0b0712;
  border: 3px solid var(--neon);
  box-shadow: 0 0 8px var(--neon-glow), inset 0 0 8px var(--neon-glow), 4px 4px 0 #000;
  text-shadow: 0 0 4px var(--neon), 0 0 10px var(--neon-glow);
  transition: background-color 0.08s steps(1), color 0.08s steps(1);
}
.btn:hover, .btn:focus-visible {
  background: var(--neon);
  color: #0b0712;
  text-shadow: none;
  box-shadow: 0 0 14px var(--neon-glow), 0 0 28px var(--neon-glow), 4px 4px 0 #000;
  outline: none;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 14px var(--neon-glow), 2px 2px 0 #000; }
.btn--ghost { --neon: var(--cyan); --neon-glow: rgba(63, 240, 255, 0.4); color: #dffcff; }
.btn--danger { --neon: var(--red); --neon-glow: rgba(255, 90, 90, 0.5); color: #ffe0e0; }
.btn[disabled] { opacity: 0.45; cursor: wait; animation: none; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.note { margin: 8px 0 0; color: var(--dim); font-size: 20px; }

/* A code, or a pass, held up to the light. */
.card {
  position: relative;
  border: 3px dashed var(--pink);
  padding: 14px 16px;
  background: repeating-linear-gradient(135deg, rgba(255, 63, 164, 0.06) 0 8px, transparent 8px 16px), #0d0816;
}
.card__kicker { margin: 0; font-family: 'Silkscreen', monospace; font-size: 11px; letter-spacing: 0.3em; color: var(--pink); }
.card__code {
  margin: 6px 0;
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(22px, 5.5vw, 44px);
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 8px var(--pink), 3px 3px 0 #2a0b20;
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}
.card__meta { margin: 0; color: var(--dim); font-size: 20px; }
.card--pass { border-color: var(--green); }
.card--pass .card__kicker { color: var(--green); }
.card--pass .card__code { text-shadow: 0 0 8px var(--green), 3px 3px 0 #06220f; font-size: clamp(20px, 4.2vw, 34px); }
.timer { color: var(--amber); font-family: 'Silkscreen', monospace; letter-spacing: 0.1em; }

/* The sponsor's codes. */
.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 38vh; overflow: auto; }
.ledger__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--edge);
  background: #0c0915;
}
.ledger__code { font-family: 'Silkscreen', monospace; font-size: 16px; letter-spacing: 0.08em; user-select: all; -webkit-user-select: all; }
.ledger__meta { grid-column: 1; color: var(--dim); font-size: 19px; }
.ledger__item .btn { grid-row: 1 / span 2; grid-column: 2; height: 40px; padding: 0 12px; font-size: 11px; }
.tag { font-family: 'Silkscreen', monospace; font-size: 11px; letter-spacing: 0.12em; padding: 1px 6px; margin-right: 6px; }
.tag--wait { background: var(--amber); color: #1a1000; }
.tag--in { background: var(--green); color: #032010; }

.sign {
  margin: 10px 0 0;
  max-height: 5.8em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.15;
  color: #cfc6e6;
  background: #0a0812;
  border-left: 3px solid var(--edge);
  padding: 6px 10px;
  user-select: text;
  -webkit-user-select: text;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(4px); } }
@keyframes nudge { 50% { transform: translateX(3px); } }
@keyframes shake { 33% { transform: translateX(-6px); } 66% { transform: translateX(6px); } }
@keyframes neon { 0%, 61%, 63%, 100% { opacity: 1; } 62% { opacity: 0.55; } }

@media (max-width: 600px) {
  body { font-size: 20px; }
  .dialog { grid-template-columns: 1fr; gap: 8px; padding: 14px 14px 20px; width: calc(100% - 20px); bottom: max(10px, env(safe-area-inset-bottom)); }
  .dialog__portrait { position: absolute; top: -48px; left: 8px; width: 60px; height: 60px; }
  .dialog { overflow: visible; }
  .dialog__body { max-height: calc(100vh - 140px); overflow: auto; }
  .hud__title { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
