/* VICE GETAWAY — page chrome. Dark neon Vice City vibe. */

:root {
  --bg: #0d0a1a;
  --bg-2: #120c22;
  --ink: #f3ecff;
  --ink-muted: #9a8fc4;
  --pink: #ff2ec4;
  --teal: #2ee6d6;
  --orange: #ffb03a;
  --purple: #6a4bd6;
  --glass: rgba(28, 20, 52, 0.55);
  --glass-border: rgba(255, 255, 255, 0.12);
  --font-ui: "Archivo", system-ui, sans-serif;
  --font-pixel: "Archivo", system-ui, sans-serif;
  --card-radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(106, 75, 214, 0.22), transparent 60%),
    radial-gradient(900px 600px at 85% 110%, rgba(255, 46, 196, 0.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 20px 0;
}

/* ---------- Masthead ---------- */
.masthead {
  width: 100%;
  max-width: 1080px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--orange);
  filter: drop-shadow(0 0 6px rgba(46, 230, 214, 0.5));
}

.brand-name {
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink);
  text-shadow:
    0 0 8px rgba(255, 46, 196, 0.55),
    0 0 2px rgba(46, 230, 214, 0.6);
}

.brand-tag {
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Stage / canvas ---------- */
.stage {
  width: 100%;
  max-width: 1080px;
  display: flex;
  justify-content: center;
  /* keep the canvas at a true 2:1 so buffer pixels stay square */
  align-items: center;
  flex: 1;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 1080px;
  aspect-ratio: 2 / 1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 2px rgba(46, 230, 214, 0.35),
    0 0 34px rgba(255, 46, 196, 0.28),
    0 24px 80px rgba(0, 0, 0, 0.6);
  background: #05030d;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  /* buffer is high-res now; smooth upscale avoids uneven pixel doubling at 1.5x */
  image-rendering: auto;
  touch-action: none;
}

/* ---------- Touch zones (mobile only) ---------- */
.touch-zones {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 3;
}
.touch-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
}
.touch-left {
  left: 0;
}
.touch-right {
  right: 0;
}

/* ---------- Waitlist glass card ---------- */
.waitlist-card {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(360px, 62%);
  padding: 18px 18px 16px;
  border-radius: var(--card-radius);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 4;
}

.wl-kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.wl-title {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: #fff;
}

.wl-countdown {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--teal);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.wl-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.wl-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 7, 20, 0.6);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.wl-input::placeholder {
  color: rgba(154, 143, 196, 0.8);
}
.wl-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 230, 214, 0.22);
}

.wl-button {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, #ffc766, var(--orange));
  color: #2a1500;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(255, 176, 58, 0.35);
  transition: transform 120ms ease, box-shadow 160ms ease, filter 120ms ease;
}
.wl-button:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 22px rgba(255, 176, 58, 0.5);
}
.wl-button:active {
  transform: translateY(1px);
}
.wl-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.wl-status {
  margin: 10px 2px 0;
  min-height: 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.wl-status.ok {
  color: #57e39a;
}
.wl-status.dup {
  color: var(--teal);
}
.wl-status.err {
  color: #ff6a8a;
}

/* BUSTED pulse to draw the eye to the card */
@keyframes cardPulse {
  0%,
  100% {
    box-shadow:
      0 10px 40px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 0 0 rgba(255, 46, 196, 0);
  }
  50% {
    box-shadow:
      0 10px 40px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 0 6px rgba(255, 46, 196, 0.35);
  }
}
.waitlist-card.pulse {
  animation: cardPulse 1.1s ease-in-out 4;
}

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  max-width: 1080px;
  text-align: center;
  padding: 22px 0 26px;
  color: var(--ink-muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* ---------- Mobile: card becomes a bar under the canvas ---------- */
@media (max-width: 768px) {
  .page {
    padding: 16px 12px 0;
  }
  .masthead {
    margin-bottom: 14px;
  }
  .brand-tag {
    display: none;
  }
  .canvas-wrap {
    /* Taller aspect for portrait play */
    aspect-ratio: 3 / 4;
    max-width: 520px;
  }
  .touch-zones {
    display: block;
  }
  .waitlist-card {
    position: static;
    width: 100%;
    max-width: 520px;
    margin: 14px auto 0;
    right: auto;
    bottom: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg-2);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .stage {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------- Busted record card overlay ---------- */
.busted-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 6;
  padding: 16px;
}
.busted-overlay.show {
  display: flex;
}

.record-card {
  width: min(340px, 92%);
  background: linear-gradient(180deg, rgba(24, 16, 46, 0.96), rgba(14, 9, 28, 0.97));
  border: 1px solid rgba(46, 230, 214, 0.45);
  border-radius: 12px;
  padding: 16px 16px 14px;
  box-shadow:
    0 0 0 1px rgba(255, 46, 196, 0.25),
    0 20px 60px rgba(0, 0, 0, 0.7);
  color: var(--ink);
  font-family: var(--font-ui);
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.record-badge {
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 8px;
  color: var(--teal);
  letter-spacing: 0.5px;
}
.record-case {
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 7px;
  color: var(--ink-muted);
}

.record-line {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.record-sub {
  margin: 0 0 8px;
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 8px;
  color: var(--ink-muted);
  letter-spacing: 0.5px;
}
.record-hint {
  margin: 8px 0 10px;
  font-size: 10px;
  color: var(--ink-muted);
}

.initials-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0;
}
.initial-cell {
  width: 40px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 20px;
  color: var(--teal);
  background: rgba(10, 7, 20, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.initial-cell.active {
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 46, 196, 0.25);
}

.record-btn,
.record-retry {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.record-btn {
  background: linear-gradient(180deg, #43e0ff, var(--teal));
  color: #04231f;
}
.record-retry {
  background: linear-gradient(180deg, #ffc766, var(--orange));
  color: #2a1500;
}
.record-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.board-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}
.board-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.board-row + .board-row {
  margin-top: 2px;
}
.board-rank {
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 8px;
  color: var(--ink-muted);
}
.board-ini {
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--ink);
  letter-spacing: 1px;
}
.board-score {
  font-weight: 700;
  color: var(--teal);
}
.board-row.you {
  background: rgba(255, 46, 196, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 46, 196, 0.5);
}
.board-row.you .board-ini {
  color: var(--pink);
}
.board-row.you .board-score {
  color: #fff;
}
.board-loading {
  list-style: none;
  text-align: center;
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 8px;
  color: var(--ink-muted);
  padding: 10px 0;
}

@media (max-width: 768px) {
  .record-card {
    width: min(340px, 96%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .waitlist-card.pulse {
    animation: none;
  }
  .wl-button,
  .wl-input {
    transition: none;
  }
}
