:root {
  --ink: #0B0B0F;
  --panel: #15141B;
  --panel-raised: #1D1B24;
  --amber: #FF9E2C;
  --amber-dim: #8A551A;
  --blue: #3EC6FF;
  --green: #4ADE80;
  --red: #FF6B6B;
  --paper: #F2EDE4;
  --paper-dim: #B9B3A7;

  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-led: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
}

button, input, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- Layout shells ---------- */
#app, #admin-app {
  position: relative;
  min-height: 100dvh;
  width: 100%;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 100dvh;
}
.view-active { display: flex; }

.btn {
  border: none;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--amber); color: #1a1206; width: 100%; }
.btn-large { padding: 16px 20px; font-size: 16px; }
.btn-ghost {
  background: transparent;
  color: var(--paper-dim);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(255,107,107,0.35); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.field-label { display: block; font-size: 12px; color: var(--paper-dim); margin-bottom: 6px; }
.field-input, .field-textarea {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--paper);
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 16px;
}
.field-textarea { resize: vertical; min-height: 70px; }
.field-input:focus, .field-textarea:focus { outline: 2px solid var(--amber); }
/* ---------- Landing ---------- */
#view-landing {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  background: radial-gradient(ellipse at 50% 20%, #1a1720 0%, #0B0B0F 65%);
}
.landing-brand {
  font-family: var(--font-led);
  letter-spacing: 3px;
  font-size: 13px;
  color: var(--amber-dim);
  margin-bottom: 18px;
}
.landing-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.2;
}
.landing-instructions {
  color: var(--paper-dim);
  font-size: 15px;
  line-height: 1.5;
  max-width: 320px;
  margin: 0 0 22px;
}
.bounty-banner {
  background: linear-gradient(135deg, rgba(255,158,44,0.16), rgba(255,158,44,0.05));
  border: 1px solid rgba(255,158,44,0.4);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 26px;
  max-width: 320px;
}
.bounty-amount {
  font-family: var(--font-led);
  font-size: 26px;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255,158,44,0.5);
}
.bounty-machine { font-size: 13px; color: var(--blue); font-weight: 600; margin-top: 4px; }
.bounty-window { font-size: 12px; color: var(--paper-dim); font-family: var(--font-mono); margin-top: 4px; }
.bounty-countdown { font-family: var(--font-mono); font-size: 12px; color: var(--blue); margin-top: 8px; letter-spacing: 0.5px; }
.bounty-entrants { font-size: 12px; color: var(--paper-dim); margin-top: 6px; }
.bounty-winner { font-size: 13px; color: var(--green); font-weight: 600; margin-top: 6px; }
.bounty-note { font-size: 12px; color: var(--paper-dim); margin: 10px 0 0; padding-top: 10px; border-top: 1px solid rgba(255,158,44,0.25); line-height: 1.4; }
.landing-actions { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.landing-link { color: var(--paper-dim); font-size: 12px; text-decoration: underline; margin-top: 18px; }

/* ---------- Home ---------- */
#view-home {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  background: radial-gradient(ellipse at 50% 20%, #1a1720 0%, #0B0B0F 65%);
}
.home-title { font-size: 26px; font-weight: 700; margin: 0 0 28px; line-height: 1.25; }
.home-actions { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 22px; }
/* Each button gets its own short caption directly underneath it, instead of
   one shared sentence above both -- a shared line made it easy to read
   "High Scores" as just another way to chase the bounty, when it's actually
   a separate, personal, bounty-independent record. */
.home-action { display: flex; flex-direction: column; gap: 8px; }
.home-action-caption { color: var(--paper-dim); font-size: 12px; line-height: 1.5; margin: 0; padding: 0 6px; }
.btn-secondary { background: var(--panel-raised); color: var(--paper); border: 1px solid rgba(255,255,255,0.15); width: 100%; }

.view-back-link {
  align-self: flex-start;
  margin: calc(env(safe-area-inset-top, 0px) + 4px) 0 14px;
  padding: 0;
  background: none;
  border: none;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.view-back-link:active { color: var(--paper); }
#view-landing .view-back-link { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); left: 20px; margin: 0; }

/* ---------- Camera scan ---------- */
.camera-stage { position: relative; flex: 1; background: #000; overflow: hidden; min-height: 45vh; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.camera-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #1a1720 0%, #0B0B0F 70%);
}
.placeholder-glyph { font-size: 40px; color: var(--amber); opacity: 0.85; }
.placeholder-title { font-size: 20px; font-weight: 600; margin: 0; }
.placeholder-sub { font-size: 14px; color: var(--paper-dim); margin: 0 0 14px; max-width: 260px; }
.camera-error { color: var(--red); font-size: 13px; max-width: 280px; }

.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: flex-end;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}
.hud-brand { font-family: var(--font-led); letter-spacing: 3px; font-size: 15px; color: var(--amber); text-shadow: 0 0 8px rgba(255,158,44,0.6); }
.hud-count { font-size: 12px; font-family: var(--font-mono); color: var(--paper-dim); }

/* ---------- Manual photo fallback (full-screen, over the camera-stage) ---------- */
.manual-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 24px; gap: 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.25) 42%, transparent 75%);
}
.manual-message {
  font-size: 15px; color: var(--paper); text-align: center; margin: 0;
  background: rgba(0,0,0,0.55); padding: 10px 16px; border-radius: 10px;
}
/* A framing aid, not a hard mask — leaves room at the bottom for the
   message + shutter button so it never covers them. Purely visual; the
   server checks the actual photo for full-backglass framing separately. */
.framing-guide {
  position: absolute;
  top: 7%; left: 5%; right: 5%; bottom: 26%;
  border: 2px dashed rgba(255, 158, 44, 0.7);
  border-radius: 14px;
  pointer-events: none;
}
.manual-shutter {
  width: 74px; height: 74px; border-radius: 50%; cursor: pointer;
  background: var(--paper); border: 5px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.35);
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
}
.manual-shutter:active { transform: scale(0.93); }
.manual-preview-overlay {
  background: #000; justify-content: space-between; padding: 0; gap: 0;
}
.manual-preview-img { width: 100%; flex: 1; min-height: 0; object-fit: contain; background: #000; }
.manual-preview-bottom {
  width: 100%; background: var(--panel);
  padding: 16px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
}
.manual-score-input {
  max-width: none; text-align: center; font-family: var(--font-led);
  font-size: 24px; letter-spacing: 2px; color: var(--amber); margin-bottom: 12px;
}
.manual-preview-actions {
  width: 100%; display: flex; gap: 10px;
}
.manual-preview-actions .btn { flex: 1; }
.hint-text { font-size: 12px; color: var(--paper-dim); text-align: center; margin: 0 0 10px; line-height: 1.5; }

/* ---------- Verify ---------- */
#view-verify { align-items: center; justify-content: center; padding: 32px 24px; background: radial-gradient(ellipse at 50% 20%, #191622 0%, #0B0B0F 60%); }
.verify-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.verify-progress { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; color: var(--paper-dim); margin-bottom: 6px; }
.verify-eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--green); margin-bottom: 8px; }
.verify-score { font-family: var(--font-led); font-size: 48px; letter-spacing: 3px; color: var(--amber); text-shadow: 0 0 16px rgba(255,158,44,0.55); margin-bottom: 18px; }
.verify-thumb { width: 100%; max-width: 300px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); margin-bottom: 22px; }

/* ---------- Names step ---------- */
#view-names { padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px); overflow-y: auto; }
.names-title { font-size: 20px; margin: 0 0 4px; }
.names-sub { color: var(--paper-dim); font-size: 13px; margin: 0 0 20px; }
.name-card { background: var(--panel); border-radius: 14px; padding: 14px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; transition: opacity 0.15s ease; }
.name-card img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #000; }
.name-card-score { font-family: var(--font-led); color: var(--amber); font-size: 18px; margin-bottom: 8px; }
.name-card-fields { flex: 1; display: flex; gap: 8px; }
.name-card-fields input { margin-bottom: 0; }
.name-card-remove {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--panel-raised);
  color: var(--paper-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.name-card-remove:hover, .name-card-remove:active { background: var(--red); color: var(--paper); }
.input-first { flex: 2; }
.input-last { flex: 1; }

/* Set-aside (excluded) state — the card stays exactly where it was in the
   list, just visually dimmed, so tapping × never reshuffles or removes
   anything from the screen and it's obvious at a glance which ones are set
   aside. The × becomes a ✓ in this state; tapping it brings the score back. */
.name-card-excluded { opacity: 0.4; }
.name-card-excluded .name-card-fields input { pointer-events: none; }
.name-card-remove.is-excluded { background: var(--green); color: #0B2213; }
.name-card-remove.is-excluded:hover, .name-card-remove.is-excluded:active { background: var(--green); color: #0B2213; }

/* ---------- Results ---------- */
#view-results { padding: calc(env(safe-area-inset-top, 0px) + 32px) 22px calc(env(safe-area-inset-bottom, 0px) + 32px); overflow-y: auto; text-align: center; }
.results-title { font-size: 22px; margin: 0 0 4px; }
.results-sub { color: var(--paper-dim); font-size: 13px; margin: 0 0 22px; }
.your-score-card {
  background: linear-gradient(135deg, rgba(255,158,44,0.14), rgba(255,158,44,0.03));
  border: 1px solid rgba(255,158,44,0.35); border-radius: 14px; padding: 16px; margin-bottom: 10px; text-align: left;
}
.your-score-card-row { display: flex; align-items: center; gap: 14px; }
.your-score-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #000; border: 1px solid rgba(255,158,44,0.35); }
.your-score-rank { font-family: var(--font-mono); font-size: 11px; color: var(--amber); text-transform: uppercase; letter-spacing: 1px; }
/* A score that isn't on the bounty board (wrong machine, or no bounty
   running) still gets saved to My High Scores — muted styling instead of
   the amber "you're competing" treatment, since it's not part of the prize. */
.your-score-card-saved { background: var(--panel); border-color: rgba(255,255,255,0.1); }
.your-score-rank-saved { color: var(--blue); }
.your-score-card-saved .your-score-value { color: var(--paper); }
.your-score-card-saved .your-score-thumb { border-color: rgba(255,255,255,0.15); }
.your-score-name { font-size: 15px; margin: 4px 0 2px; }
.your-score-machine { font-size: 12px; color: var(--paper-dim); margin-bottom: 4px; }
.your-score-value { font-family: var(--font-led); font-size: 22px; color: var(--amber); }
.your-score-gap { font-size: 12px; color: var(--paper-dim); margin-top: 10px; font-family: var(--font-mono); }
.your-score-gap-lead { color: var(--green); }
.your-score-pb { font-size: 12px; color: var(--paper-dim); margin-top: 4px; font-family: var(--font-mono); }
.your-score-pb-new { color: var(--green); font-weight: 600; }
.your-score-thisgame { font-size: 12px; color: var(--paper-dim); margin-top: 4px; font-family: var(--font-mono); }

.menu-return-link {
  display: block;
  width: 100%;
  margin: 0 0 22px;
  padding: 0;
  background: none;
  border: none;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 12px;
  text-decoration: underline;
  text-align: center;
  cursor: pointer;
}
.menu-return-link:active { color: var(--paper); }

/* ---------- My High Scores ---------- */
#view-myscores { padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px); overflow-y: auto; }
.myscores-upload-btn { margin-bottom: 18px; }
.myscores-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.myscores-search { margin-bottom: 0; }
.myscores-sort { display: flex; gap: 8px; }
.myscores-sort-btn {
  flex: 1;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 9px 10px;
  cursor: pointer;
}
.myscores-sort-btn.is-active { background: rgba(255,158,44,0.16); border-color: rgba(255,158,44,0.5); color: var(--amber); font-weight: 600; }
.myscores-card {
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  border-left: 4px solid var(--machine-color, rgba(255,255,255,0.15));
}
.myscores-card:hover, .myscores-card:focus-visible { background: var(--panel-raised); outline: none; }
.myscores-card:active { transform: scale(0.99); }
.myscores-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.myscores-card-machine { font-size: 14px; font-weight: 600; }
.myscores-card-score { font-family: var(--font-led); color: var(--amber); font-size: 17px; flex-shrink: 0; }
.myscores-card-date { font-size: 11px; color: var(--paper-dim); font-family: var(--font-mono); margin-top: 3px; }

/* ---------- Machine detail (one machine's full history) ---------- */
#view-machine-detail { padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px); overflow-y: auto; }
#view-machine-detail .myscores-card { cursor: default; }
#view-machine-detail .myscores-card:hover { background: var(--panel); }
.machine-detail-avg {
  background: var(--panel);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  text-align: center;
  border-left: 4px solid var(--machine-color, rgba(255,255,255,0.15));
}
.machine-detail-avg-label {
  font-size: 11px;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.machine-detail-avg-value {
  font-family: var(--font-led);
  font-size: 24px;
  color: var(--amber);
}
.myscores-loading, .myscores-empty-inline { color: var(--paper-dim); font-size: 13px; text-align: center; padding: 20px 0; }
.myscores-empty { color: var(--paper-dim); font-size: 14px; line-height: 1.5; text-align: center; padding: 40px 12px; }

/* Deliberately quiet — recovery email + "recover my scores" sit at the
   very bottom of My High Scores, not styled to draw the eye. */
.myscores-account-section {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.myscores-account-hint { color: var(--paper-dim); font-size: 12px; line-height: 1.5; margin: 0; }
.myscores-recovery-form { margin: 6px 0 4px; }
.myscores-recovery-form .field-input { margin-bottom: 10px; }

.leaderboard { margin-top: 22px; text-align: left; }
.leaderboard-title { font-size: 13px; color: var(--paper-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; background: var(--panel); }
.lb-row.is-you {
  background: rgba(62,198,255,0.16);
  border: 1px solid rgba(62,198,255,0.55);
  box-shadow: 0 0 0 1px rgba(62,198,255,0.15) inset;
}
.lb-rank { font-family: var(--font-mono); color: var(--paper-dim); width: 22px; }
.lb-row.is-you .lb-rank { color: var(--blue); font-weight: 700; }
.lb-name-block { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; }
.lb-machine { font-size: 11px; color: var(--paper-dim); margin-top: 1px; }
.lb-row.is-you .lb-name { color: var(--blue); font-weight: 700; }
.lb-you-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0b0b0f;
  background: var(--blue);
  border-radius: 5px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.lb-score { font-family: var(--font-led); color: var(--amber); font-size: 15px; }
.lb-row.is-you .lb-score { color: var(--blue); font-weight: 700; }
.lb-score-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.lb-games { font-size: 10px; color: var(--paper-dim); font-family: var(--font-mono); }

/* ---------- Rank popup (shown before the leaderboard, for a top-10 finish) ---------- */
.rank-popup {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: rank-popup-fade-in 0.2s ease;
}
.rank-popup-card {
  width: 100%; max-width: 360px;
  background: var(--panel-raised);
  border: 1px solid rgba(255,158,44,0.4);
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255,158,44,0.18);
  animation: rank-popup-pop-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.rank-popup-emoji { font-size: 40px; margin-bottom: 10px; }
.rank-popup-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--paper);
  margin-bottom: 22px;
}
.rank-popup-text .rank-popup-highlight { color: var(--amber); }
@keyframes rank-popup-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rank-popup-pop-in { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Confetti ---------- */
.confetti-container {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60;
}
.confetti-piece {
  position: absolute; top: -20px; width: 9px; height: 14px; opacity: 0.9;
  animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(var(--start-rot, 0deg)); opacity: 0.95; }
  100% { transform: translateY(110vh) rotate(calc(var(--start-rot, 0deg) + 540deg)); opacity: 0; }
}

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #0B2312; font-weight: 600; font-size: 13px;
  padding: 10px 18px; border-radius: 20px; z-index: 40; animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Sits above the toast (not on top of it) so both can be visible at once
   without overlapping — the toast is transient, this sticks around for the
   whole undo window. */
.undo-bar {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: var(--panel-raised); color: var(--paper);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 8px 8px 14px; border-radius: 22px; z-index: 45;
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  max-width: calc(100vw - 32px);
  animation: toast-in 0.25s ease;
}
.undo-bar-text { color: var(--paper-dim); white-space: nowrap; }
.undo-bar-btn {
  background: var(--amber); color: #1a1206; border: none;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 16px; cursor: pointer; white-space: nowrap;
}
.undo-bar-btn.is-armed { background: var(--red); color: var(--paper); }
.undo-bar-dismiss {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: none;
  background: transparent; color: var(--paper-dim); font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.undo-bar-dismiss:hover, .undo-bar-dismiss:active { background: rgba(255,255,255,0.1); }

/* ---------- Accept/skip flash (between scores in a multi-score batch) ---------- */
.accept-flash {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: rank-popup-fade-in 0.15s ease;
}
.accept-flash-card {
  width: 100%; max-width: 320px;
  background: var(--panel-raised);
  border: 1px solid rgba(74,222,128,0.5);
  border-radius: 18px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 0 40px rgba(74,222,128,0.2);
  animation: rank-popup-pop-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.accept-flash-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #0B2312; background: var(--green);
}
.accept-flash-text { font-size: 19px; font-weight: 700; line-height: 1.4; color: var(--paper); }
.accept-flash.accept-flash-skip .accept-flash-card { border-color: rgba(255,255,255,0.18); box-shadow: none; }
.accept-flash.accept-flash-skip .accept-flash-icon { color: var(--paper); background: rgba(255,255,255,0.14); }

/* ---------- Admin ---------- */
#view-admin-login { align-items: center; justify-content: center; padding: 24px; }
.admin-login-card { width: 100%; max-width: 320px; text-align: center; }
.admin-dashboard { padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px 60px; max-width: 640px; margin: 0 auto; overflow-y: auto; }
.admin-section { background: var(--panel); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.admin-section h2 { font-size: 15px; margin: 0 0 14px; color: var(--amber); }
.admin-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toggle-label { font-size: 14px; }
.admin-top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-top-bar h1 { font-size: 18px; margin: 0; font-family: var(--font-led); color: var(--amber); letter-spacing: 2px; }

/* Three-way tab nav splitting the admin into separate pages (Create a
   Bounty / Leaderboard / User Information) instead of one long scrolling
   form — the active tab is the only page rendered at a time. */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 12px 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.admin-tab:hover { color: var(--paper); }
.admin-tab.is-active { color: var(--amber); border-bottom-color: var(--amber); }

/* Always-visible summary of whatever bounty is (or isn't) currently live,
   right under the top bar — so "is anything running right now" never
   requires scrolling down and reading through the form to answer. */
.admin-bounty-status {
  font-size: 13px;
  color: var(--paper-dim);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.admin-bounty-status.is-active {
  color: var(--paper);
  border-color: rgba(255,158,44,0.35);
  background: linear-gradient(135deg, rgba(255,158,44,0.12), rgba(255,158,44,0.02));
}

/* A single consistent style for the small explanatory line under a field —
   replaces a handful of one-off inline styles that all did roughly the same
   thing with slightly different numbers. */
.field-hint { color: var(--paper-dim); font-size: 12px; line-height: 1.5; margin: -8px 0 14px; }
.admin-table-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.admin-table-thumbs { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.admin-table-row img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #000; cursor: zoom-in; }
.admin-table-info { flex: 1; min-width: 0; }
.admin-table-name { font-size: 13px; }
.admin-table-score { font-family: var(--font-led); color: var(--amber); font-size: 16px; }
.admin-table-meta { font-size: 10px; color: var(--paper-dim); font-family: var(--font-mono); }
.admin-table-machine { font-size: 11px; color: var(--blue); margin: 2px 0; }
.admin-empty { color: var(--paper-dim); font-size: 13px; text-align: center; padding: 20px 0; }
.admin-table-games { font-size: 10px; color: var(--paper-dim); font-family: var(--font-mono); }
.admin-table-rank { font-family: var(--font-led); color: var(--amber); font-size: 15px; width: 26px; flex-shrink: 0; text-align: center; }

/* One player's card on the User Information page -- summary row, a wrapping
   row of small action buttons, and two optional panels (email editor, full
   game history) that stay collapsed until tapped open. */
.admin-user-card { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.admin-user-card .admin-table-row-flush { padding: 0 0 10px; border-bottom: none; }
.admin-user-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-user-email-edit { margin-top: 10px; max-width: 320px; }
.admin-user-email-edit .field-input { margin-bottom: 8px; }
.admin-user-games { margin-top: 10px; padding-top: 4px; border-top: 1px dashed rgba(255,255,255,0.08); }
.admin-user-games .admin-table-row:last-child { border-bottom: none; }
.draw-result {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
  background: linear-gradient(135deg, rgba(74,222,128,0.14), rgba(74,222,128,0.03));
  border: 1px solid rgba(74,222,128,0.35); border-radius: 14px; padding: 14px;
}
.draw-result img { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #000; cursor: zoom-in; }

/* ---------- Image lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 0 40px rgba(0,0,0,0.6); }
.draw-result-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--green); text-transform: uppercase; letter-spacing: 1px; }
.draw-result-name { font-size: 16px; margin: 4px 0 2px; font-weight: 600; }
.draw-result-score { font-family: var(--font-led); color: var(--amber); font-size: 18px; }
.admin-error { color: var(--red); font-size: 13px; margin-top: 6px; }
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0; background: rgba(255,255,255,0.15); border-radius: 20px; cursor: pointer; transition: background 0.2s ease;
}
.switch-track::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--paper);
  border-radius: 50%; transition: transform 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--amber); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .accept-flash, .accept-flash-card { animation: none; }
}
