@font-face { font-family: Pricedown; src: url('/assets/fonts/pricedown.otf') format('opentype'); font-display: swap; }

:root {
  --ink: #fff7f2;
  --dim: rgba(255, 240, 235, .64);
  --glass: rgba(16, 8, 20, .52);
  --line: rgba(255, 220, 230, .14);
  --pink: #ff2d87;
  --orange: #ff8a3d;
  --gold: #ffc23c;
  --teal: #17cfc0;
  --cash: #78c86b;
  --vi: linear-gradient(172deg, #ffe08a 0%, #ffa24a 30%, #ff3e8a 62%, #8a5cff 100%);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a0b1e; color: var(--ink); overflow: hidden; }
body { font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: pan-y; }
.grade { position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(18, 4, 20, .55) 100%),
    linear-gradient(180deg, rgba(40, 6, 40, .18), transparent 30%, transparent 70%, rgba(20, 4, 18, .45)); }
.grade::after { content: ''; position: absolute; inset: -50%; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-3%, 2%); } 66% { transform: translate(2%, -3%); } 100% { transform: translate(0, 0); } }

/* loading curtain */
.curtain { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #12060f;
  transition: opacity 1.1s var(--ease), visibility 0s linear 1.1s; }
.curtain.off { opacity: 0; visibility: hidden; }
.curtain-logo { width: min(420px, 62vw); height: auto; display: block; filter: drop-shadow(0 20px 60px rgba(255, 45, 135, .35));
  animation: breathe 2.4s var(--ease) infinite alternate; }
@keyframes breathe { from { opacity: .55; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }

.w { color: #fff; }
.vi { background: var(--vi); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: .06em;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .25)); }

/* top bar */
.top { position: fixed; z-index: 10; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 36px) 0; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: block; line-height: 0; transition: transform .3s var(--ease); }
.brand img { height: clamp(72px, 9vw, 104px); width: auto; display: block; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .45)); }
.brand:hover { transform: scale(1.03) rotate(-1deg); }
.nav { display: flex; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-radius: 999px; padding: 9px 15px; font-size: 13px; font-weight: 600; letter-spacing: .01em;
  transition: transform .25s var(--ease), background .25s var(--ease), border-color .25s; }
.chip:hover { transform: translateY(-1px); background: rgba(40, 16, 40, .66); border-color: rgba(255, 220, 230, .28); }
.chip:active { transform: translateY(0) scale(.98); }
.chip.hot { background: linear-gradient(135deg, #ff3e8a, #ff8a3d); border-color: transparent; color: #1b0610; font-weight: 800; }
.chip.ca { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.chip.ca .k { color: var(--gold); margin-right: 8px; font-family: Archivo, sans-serif; font-weight: 800; }

/* the GTA cash HUD */
.hud { position: fixed; z-index: 10; right: clamp(16px, 3vw, 36px); top: 92px; text-align: right; pointer-events: none; }
.cash { font-family: Pricedown, Archivo, sans-serif; font-size: clamp(46px, 5.4vw, 74px); line-height: .9; color: var(--cash);
  -webkit-text-stroke: 2px #0b0b0b; paint-order: stroke fill; text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 24px rgba(0, 0, 0, .25);
  font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.cash.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.06); color: #a6f08f; } }
.goal { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--dim); text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.goal b { color: #fff; font-weight: 800; }
.wanted { display: flex; justify-content: flex-end; gap: 4px; margin-top: 10px; }
.wanted i { width: 26px; height: 26px; position: relative; display: block;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: rgba(0, 0, 0, .55); }
.wanted i::after { content: ''; position: absolute; inset: 2.5px; clip-path: inherit; background: rgba(255, 255, 255, .16); }
.wanted i.on::after { background: #fff; }
.wanted i.half::after { background: linear-gradient(90deg, #fff 50%, rgba(255, 255, 255, .16) 50%); }
.wanted.flash i.on::after { animation: wflash .5s steps(2) infinite; }
@keyframes wflash { 50% { background: var(--pink); } }

.card3d { margin: 18px 0 0 auto; width: 214px; aspect-ratio: 1.586; perspective: 700px; pointer-events: auto; }
.card-face { position: relative; width: 100%; height: 100%; border-radius: 13px; overflow: hidden; padding: 14px 16px; text-align: left;
  background: radial-gradient(120% 140% at 0% 0%, #2a7bff 0%, #0b47b8 42%, #062c78 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .18);
  transform: rotateY(-14deg) rotateX(6deg); transition: transform .6s var(--ease); }
.card3d:hover .card-face { transform: rotateY(-4deg) rotateX(2deg); }
.card-face::before { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .28) 48%, transparent 60%);
  transform: translateX(-60%); animation: sheen 5s var(--ease) infinite; }
@keyframes sheen { 0%, 55% { transform: translateX(-70%); } 100% { transform: translateX(70%); } }
.ps { width: 34px; height: 34px; display: block; }
.card-store { margin-top: 6px; font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.card-val { position: absolute; right: 14px; bottom: 26px; font-size: 30px; font-weight: 900; font-stretch: 75%; letter-spacing: -.01em; }
.card-for { position: absolute; right: 14px; bottom: 11px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .78); }

/* panels */
.panel { position: fixed; z-index: 10; bottom: max(22px, env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 32px));
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px;
  backdrop-filter: blur(18px) saturate(1.35); -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.entry { left: clamp(16px, 3vw, 36px); }
.board { right: clamp(16px, 3vw, 36px); max-height: 32vh; display: flex; flex-direction: column; }
.lbl { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
#enterForm { display: flex; gap: 8px; }
#wallet { flex: 1; min-width: 0; border: 1px solid var(--line); background: rgba(0, 0, 0, .32); border-radius: 12px; padding: 12px 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; outline: none; transition: border-color .2s, background .2s; }
#wallet:focus { border-color: rgba(255, 62, 138, .7); background: rgba(0, 0, 0, .42); }
#wallet::placeholder { color: rgba(255, 240, 235, .42); font-family: Archivo, sans-serif; }
#enterBtn { border: 0; border-radius: 12px; padding: 0 16px; font-weight: 800; font-size: 14px; white-space: nowrap; color: #1b0610;
  background: linear-gradient(135deg, #ffd36e, #ff8a3d 45%, #ff3e8a); transition: transform .2s var(--ease), filter .2s; }
#enterBtn:hover { filter: brightness(1.08); transform: translateY(-1px); }
#enterBtn:active { transform: scale(.97); }
#enterBtn:disabled { filter: grayscale(.6) brightness(.8); cursor: progress; }
.msg { margin: 10px 2px 0; font-size: 13px; line-height: 1.45; color: var(--dim); min-height: 1.45em; }
.msg.ok { color: #9ff0b0; }
.msg.bad { color: #ffb3c4; }
.msg b { color: #fff; }

.hist { list-style: none; margin: 0; padding: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 62, 138, .5) transparent; }
.hist::-webkit-scrollbar { width: 6px; }
.hist::-webkit-scrollbar-thumb { background: rgba(255, 62, 138, .5); border-radius: 6px; }
.hist li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.hist li:first-child { border-top: 0; }
.hist li.none { display: block; color: var(--dim); line-height: 1.45; }
.hist .no { font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
.hist .who { font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
.hist .st { font-size: 12px; color: var(--dim); }
.hist button { border: 0; background: none; padding: 0; color: var(--teal); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* GTA mission subtitles */
.subtitle { position: fixed; z-index: 9; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(560px, calc(100vw - 840px)); text-align: center; font-weight: 700; font-size: 18px; line-height: 1.35;
  text-shadow: 0 0 2px #000, 0 0 2px #000, 0 2px 3px #000, 0 0 14px rgba(0, 0, 0, .6); transition: opacity .4s var(--ease); }
.subtitle .y { color: #f3c94c; } .subtitle .p { color: #ff5fa5; } .subtitle .b { color: #6fc7ff; } .subtitle .g { color: var(--cash); }
.subtitle.swap { opacity: 0; }

/* winner: the mission passed card */
.passed { position: fixed; inset: 0; z-index: 20; display: grid; align-items: start; padding-top: 15vh; pointer-events: none; visibility: hidden; }
.passed .band { position: absolute; left: 0; right: 0; top: calc(15vh + 110px); height: 250px; transform: translateY(-50%) scaleY(0);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62) 22%, rgba(0, 0, 0, .62) 78%, transparent); transition: transform .5s var(--ease); }
.pass-in { position: relative; text-align: center; }
.pass-big { font-family: Pricedown, Archivo, sans-serif; font-size: clamp(64px, 10vw, 128px); line-height: .9; padding-bottom: .34em; color: #f6b73c;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 0 4px 0 #000; opacity: 0; transform: scale(1.4); }
.pass-who { margin-top: 0; font-family: ui-monospace, Menlo, monospace; font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; letter-spacing: .04em; opacity: 0; }
.pass-sub { margin-top: 8px; font-size: 16px; font-weight: 600; color: rgba(255, 255, 255, .85); opacity: 0; }
.passed.on { visibility: visible; }
.passed.on .band { transform: translateY(-50%) scaleY(1); }
.passed.on .pass-big { opacity: 1; transform: scale(1); transition: opacity .3s .15s, transform .55s .15s var(--ease); }
.passed.on .pass-who { opacity: 1; transition: opacity .5s .6s; }
.passed.on .pass-sub { opacity: 1; transition: opacity .5s .9s; }
.passed.mine .pass-big { color: var(--cash); }

/* sheets */
.sheet { width: min(560px, calc(100vw - 32px)); max-height: min(84vh, 760px); border: 1px solid var(--line); border-radius: 20px; padding: 26px 26px 22px;
  color: var(--ink); background: rgba(22, 10, 26, .88); backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .55); overflow: auto; }
.sheet::backdrop { background: rgba(10, 2, 12, .5); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.sheet h2 { margin: 0 0 14px; font-weight: 900; font-stretch: 75%; font-size: 34px; letter-spacing: -.01em; line-height: 1; }
.sheet h3 { margin: 22px 0 6px; font-size: 15px; font-weight: 800; }
.sheet p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; color: rgba(255, 240, 235, .82); }
.sheet .fine { font-size: 13px; color: var(--dim); }
.x { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); font-size: 20px; line-height: 1; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 10px 0 10px 44px; font-size: 14.5px; line-height: 1.5; color: rgba(255, 240, 235, .82); border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 9px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #1b0610; background: var(--vi); }
.steps b { color: #fff; }
.proofline { margin-top: 14px; font-size: 12px; color: var(--dim); word-break: break-all; font-family: ui-monospace, Menlo, monospace; }
.proofline a { color: var(--teal); }

.wallets { display: grid; gap: 8px; margin-top: 14px; }
.wbtn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04); font-weight: 700; text-align: left; text-decoration: none; color: inherit; transition: background .2s, transform .2s var(--ease); }
.wbtn:hover { background: rgba(255, 255, 255, .08); transform: translateY(-1px); }
.wbtn img { width: 28px; height: 28px; border-radius: 8px; }
.wbtn .s { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--dim); }
.code { margin: 14px 0 8px; padding: 16px; border-radius: 14px; background: rgba(0, 0, 0, .4); border: 1px dashed rgba(255, 194, 60, .5); text-align: center; }
.code .v { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 800; letter-spacing: .06em; word-break: break-all; }
.code .l { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; font-size: 14px; color: #1b0610; background: linear-gradient(135deg, #ffd36e, #ff8a3d 45%, #ff3e8a); text-decoration: none; }
.btn.ghost { background: rgba(255, 255, 255, .07); color: #fff; border: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin: 10px 0; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.entrants { max-height: 180px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.6; color: var(--dim);
  background: rgba(0, 0, 0, .3); border-radius: 10px; padding: 10px 12px; }
.entrants .win { color: var(--gold); font-weight: 800; }

/* phones: the drum gets the top, the panels stack under it */
@media (max-width: 900px) {
  .subtitle { width: calc(100vw - 32px); bottom: auto; top: 54vh; font-size: 15px; }
  .chip { padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  .nav { gap: 6px; }
  .hud { top: 70px; }
  .cash { font-size: 44px; }
  .card3d { display: none; }
  .wanted i { width: 20px; height: 20px; }
  .brand img { height: 58px; }
  #howBtn { display: none; }
  .panel { position: absolute; left: 16px; right: 16px; width: auto; }
  body { overflow-y: auto; }
  .entry { top: calc(62vh + 20px); bottom: auto; }
  .board { top: calc(62vh + 190px); bottom: auto; max-height: none; margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .grade::after, .card-face::before, .curtain-logo { animation: none; }
}
