:root{
  --bg:#07061a;
  --panel:rgba(20,17,44,.72);
  --stroke:rgba(255,255,255,.10);
  --txt:#eae7ff;
  --dim:#9a94c4;
  --violet:#8b5cf6;
  --violet-2:#c4a6ff;
  --teal:#22d3ee;
  --coral:#ff6b5b;
  --gold:#ffb52e;
  --gold-2:#ffe9a8;
  --green:#22c55e;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden;background:var(--bg)}
body{
  font-family:"Poppins",-apple-system,"Segoe UI",Inter,system-ui,sans-serif;
  color:var(--txt);
  -webkit-font-smoothing:antialiased;
  user-select:none;
}
canvas#stage{position:fixed;inset:0;width:100%;height:100%;display:block}
canvas#clipcanvas{display:none}

#ui{position:fixed;inset:0;pointer-events:none;z-index:10;display:flex;flex-direction:column}
#ui button,#ui a{pointer-events:auto;font-family:inherit}

/* ---------- generic controls ---------- */
.btn{
  pointer-events:auto;
  display:inline-block;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.045);
  color:var(--txt);
  padding:12px 22px;
  border-radius:999px;
  font-size:14px;font-weight:600;letter-spacing:.01em;
  text-decoration:none;
  cursor:pointer;
  backdrop-filter:blur(14px);
  transition:transform .16s cubic-bezier(.2,.9,.3,1),background .16s,border-color .16s,box-shadow .16s;
}
.btn:hover{background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.22);transform:translateY(-1px)}
.btn:active{transform:translateY(0) scale(.985)}
.btn.small{padding:9px 17px;font-size:12.5px}
.btn.big{padding:16px 40px;font-size:16.5px}
.btn.gold{
  background:linear-gradient(135deg,#ffb52e,#ffd980 60%,#f79a1e);
  color:#2a1a02;border-color:transparent;font-weight:700;
  box-shadow:0 8px 34px -10px rgba(255,181,46,.95);
}
.btn.gold:hover{box-shadow:0 12px 44px -10px rgba(255,181,46,1)}

kbd{
  background:rgba(255,255,255,.1);border:1px solid var(--stroke);
  border-radius:5px;padding:1px 7px;font-size:11px;font-family:inherit;font-weight:700;
}

/* ---------- top bar ---------- */
/* Logo centred, counters centred beneath it. Not logo-left/counters-right:
   at 375px the 88px wordmark and the ~290px counter strip overlap in the
   middle. Stacking also means the strip gets the full width, so the phone
   layout no longer has to drop the "opened" count to fit. */
#topbar{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:20px 24px 0;position:relative;z-index:3;
}
#brand{display:block;height:26px;width:auto;opacity:.95}

/* live counters, compact, visible for the whole run once play starts */
#live-strip{
  display:flex;align-items:center;gap:12px;
  font-size:12px;color:var(--dim);font-variant-numeric:tabular-nums;
  border:1px solid var(--stroke);background:rgba(12,10,34,.55);
  padding:8px 15px;border-radius:999px;backdrop-filter:blur(12px);
}
#live-strip b{color:var(--txt);font-weight:700}
#live-strip .sep{width:1px;height:12px;background:rgba(255,255,255,.14)}
#live-strip .hot{color:var(--gold-2);display:inline-flex;align-items:center;gap:6px}
#live-strip .hot b{color:var(--gold)}
/* the prize itself, on screen for the whole run */
#strip-grand-art{
  border-radius:50%;object-fit:cover;display:block;flex:0 0 auto;
  border:1px solid rgba(255,181,46,.6);box-shadow:0 0 12px -2px rgba(255,181,46,.8);
}

/* ---------- landing ---------- */
/* Sits over the board, not in front of it — the nine boxes are already on
   screen while the player reads "one of these boxes". The scrims keep the copy
   legible without hiding the board. */
#landing{
  position:absolute;inset:0;z-index:2;
  display:flex;flex-direction:column;justify-content:space-between;
  padding:112px 20px 24px;text-align:center;
  pointer-events:none;transition:opacity .5s ease,transform .5s ease;
}
#landing::before,#landing::after{content:"";position:absolute;left:0;right:0;pointer-events:none}
#landing::before{top:0;height:52%;background:linear-gradient(180deg,rgba(5,4,19,.95) 20%,rgba(5,4,19,0))}
#landing::after{bottom:0;height:44%;background:linear-gradient(0deg,rgba(5,4,19,.96) 25%,rgba(5,4,19,0))}
.landing-top,.landing-bottom{position:relative;z-index:1}

.eyebrow{font-size:10px;letter-spacing:.32em;color:var(--violet-2);font-weight:800;margin-bottom:12px}
.landing-title{
  font-size:clamp(30px,5.4vw,60px);line-height:1.05;font-weight:600;letter-spacing:-.025em;
  max-width:15ch;margin:0 auto;
  text-shadow:0 0 70px rgba(139,92,246,.5);
}
.landing-title em{
  font-style:normal;font-weight:700;
  background:linear-gradient(100deg,#ffe9a8,#ffb52e 45%,#fff3cf);
  -webkit-background-clip:text;background-clip:text;color:transparent;
  text-shadow:none;
  filter:drop-shadow(0 0 24px rgba(255,181,46,.55));
}
.landing-sub{
  font-size:13px;color:var(--dim);line-height:1.55;
  max-width:60ch;margin:11px auto 0;
}
.landing-sub b{color:rgba(234,231,255,.92);font-weight:600}

/* ---------- the two rewards every box wins ---------- */
/* Shared shape with #reveal-headline's pills, so what the landing promises and
   what the reveal hands over are visibly the same two things. */
.wins,#reveal-headline{
  display:flex;align-items:center;justify-content:center;
  gap:8px;flex-wrap:wrap;
}
.wins{margin-top:16px}
.win,.rw{
  display:inline-flex;align-items:center;gap:9px;text-align:left;
  border:1px solid var(--stroke);border-radius:14px;
  background:rgba(12,10,34,.72);backdrop-filter:blur(12px);
  padding:7px 14px 7px 7px;
}
.win img,.rw img{
  border-radius:9px;object-fit:cover;display:block;flex:0 0 auto;
  background:rgba(255,255,255,.04);
}
.win span,.rw span{display:block;font-size:10.5px;color:var(--dim);line-height:1.3}
.win b,.rw b{
  display:block;font-size:14px;font-weight:700;color:var(--txt);
  letter-spacing:-.01em;line-height:1.25;
}
.win-plus,.rw-plus{font-size:13px;font-weight:700;color:rgba(154,148,196,.7)}

.stats{display:flex;gap:10px;justify-content:center;margin-top:22px;flex-wrap:wrap}
.stat{
  min-width:132px;padding:11px 18px;border-radius:15px;
  border:1px solid var(--stroke);background:rgba(12,10,34,.6);backdrop-filter:blur(12px);
}
.stat b{
  display:block;font-size:23px;font-weight:800;letter-spacing:-.01em;
  font-variant-numeric:tabular-nums;line-height:1.15;
}
.stat span{display:block;font-size:10.5px;color:var(--dim);margin-top:3px;letter-spacing:.03em}
.stat.hot{border-color:rgba(255,181,46,.38);background:rgba(255,181,46,.09)}
.stat.hot b{color:var(--gold)}
.stat.hot span{color:var(--gold-2);opacity:.85}

/* counter tick — a number that changes silently reads as decoration */
@keyframes countPop{
  0%{transform:translateY(-3px);color:var(--gold-2)}
  100%{transform:translateY(0);color:inherit}
}
.pop{animation:countPop .5s ease-out}

/* Prize strip: real art per prize, so the shard-bonus ladder reads as a
   ladder — the pile visibly grows — instead of as five identical dots. */
.odds{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-top:18px}
.odd{
  display:inline-flex;align-items:center;gap:8px;
  font-size:11px;color:var(--dim);
  border:1px solid var(--stroke);border-radius:999px;padding:4px 13px 4px 4px;
  background:rgba(12,10,34,.6);
}
.odd img{
  width:30px;height:30px;border-radius:50%;object-fit:cover;display:block;
  background:rgba(255,255,255,.04);
}
/* The prize is the bright thing; the odds beside it are reference. Two equally
   loud percentages side by side ("+5%  45%") read as one confusing number. */
.odd .odd-name{font-weight:700;font-size:12.5px}
.odd b{
  color:rgba(154,148,196,.85);font-weight:600;font-size:10.5px;
  font-variant-numeric:tabular-nums;
  padding-left:8px;border-left:1px solid rgba(255,255,255,.12);
}
.odd-grand{
  border-color:rgba(255,181,46,.5);background:rgba(255,181,46,.10);
  box-shadow:0 0 22px -8px rgba(255,181,46,.8);
}
/* a refusal or an auth bounce, shown where the small print lives */
.odds-note.error{color:var(--coral);font-weight:600}
/* local mode is not a working promotion; say so rather than looking live */
body.test-mode #live-strip::after{
  content:"test";
  font-size:9px;letter-spacing:.14em;text-transform:uppercase;
  color:var(--gold);border:1px solid rgba(255,181,46,.55);
  border-radius:999px;padding:2px 7px;margin-left:2px;
}
body.demo-mode #live-strip::after{
  content:"demo";
  font-size:9px;letter-spacing:.14em;text-transform:uppercase;
  color:var(--coral);border:1px solid rgba(255,107,91,.5);
  border-radius:999px;padding:2px 7px;margin-left:2px;
}
.odds-note{
  font-size:10.5px;color:rgba(154,148,196,.7);margin:12px auto 0;
  line-height:1.55;max-width:64ch;
}

/* ---------- stage prompt ---------- */
/* Bottom-anchored, not centre-offset: the 3D board is vertically centred and
   grows with the viewport, so a fixed offset from centre collides with it. */
#prompt{
  position:absolute;left:50%;bottom:56px;transform:translateX(-50%);
  text-align:center;width:min(560px,86vw);transition:opacity .45s ease,transform .45s ease;
}
/* The prompt sits over the board, and on a portrait phone the nearest box is
   right behind it. Its own soft scrim keeps it readable without a hard panel. */
#prompt::before{
  content:"";position:absolute;left:50%;bottom:-80px;transform:translateX(-50%);
  width:min(820px,132vw);height:calc(100% + 160px);z-index:-1;pointer-events:none;
  background:radial-gradient(ellipse at center,
    rgba(5,4,19,.94) 0%,rgba(5,4,19,.72) 42%,rgba(5,4,19,0) 72%);
}
#prompt-kicker{font-size:10px;letter-spacing:.3em;color:var(--violet-2);font-weight:700;margin-bottom:8px}
#prompt-title{font-size:24px;font-weight:600;letter-spacing:-.01em}
#prompt-sub{font-size:13px;color:var(--dim);margin-top:7px;line-height:1.5}
#prompt-counter{margin-top:14px;display:flex;gap:7px;justify-content:center}
#prompt-counter .slot{
  width:34px;height:5px;border-radius:99px;background:rgba(255,255,255,.13);
  transition:background .3s,box-shadow .3s;
}
#prompt-counter .slot.on{background:var(--violet-2);box-shadow:0 0 14px var(--violet)}

/* ---------- reveal + CTA ---------- */
#reveal-panel{
  position:absolute;left:50%;bottom:32px;transform:translateX(-50%);
  text-align:center;width:min(680px,92vw);z-index:2;
  transition:opacity .5s ease,transform .5s ease;
}
#reveal-headline{margin-top:2px}
#reveal-headline .rw{background:rgba(10,8,26,.88)}
/* Not fine print — this is the line that says the watch is still gettable, and
   it is the reason a losing player clicks through. */
#reveal-note{
  font-size:12.5px;color:var(--violet-2);margin-top:10px;min-height:18px;
  text-shadow:0 0 30px rgba(0,0,0,.9);
}
/* on a win the note carries the verdict, so it gets the verdict's weight */
#reveal-note.won{
  color:var(--gold-2);font-weight:800;letter-spacing:.1em;font-size:12px;
  text-shadow:0 0 26px rgba(255,181,46,.85);
}

#cta{
  margin-top:16px;padding:18px 22px 18px;border-radius:20px;
  border:1px solid rgba(255,181,46,.28);
  background:linear-gradient(160deg,rgba(38,27,10,.82),rgba(12,10,34,.9));
  backdrop-filter:blur(18px);
  box-shadow:0 24px 70px -30px rgba(0,0,0,.95);
}
.cta-q{font-size:15px;font-weight:500;margin-bottom:14px;line-height:1.45}
.cta-q b{font-weight:700;color:var(--gold-2)}
.cta-fine{
  font-size:10px;color:rgba(154,148,196,.62);line-height:1.5;
  margin:12px auto 0;max-width:62ch;
}
#reveal-actions{display:flex;gap:9px;justify-content:center;margin-top:14px;flex-wrap:wrap}

/* ---------- invite ---------- */
#invite{
  margin-top:12px;padding:14px 16px;border-radius:18px;
  border:1px solid rgba(139,92,246,.32);
  background:linear-gradient(160deg,rgba(26,18,54,.9),rgba(12,10,34,.92));
  backdrop-filter:blur(18px);
  transition:opacity .45s ease,transform .45s ease;
}
.invite-head{font-size:15px;font-weight:700;letter-spacing:-.01em}
.invite-sub{font-size:11.5px;color:var(--dim);margin:4px 0 11px;line-height:1.45}
.invite-row{display:flex;gap:7px;align-items:center}
#invite-link{
  flex:1 1 auto;min-width:0;
  font:inherit;font-size:12px;color:var(--txt);
  background:rgba(0,0,0,.32);border:1px solid var(--stroke);
  border-radius:999px;padding:9px 14px;
  pointer-events:auto;text-overflow:ellipsis;
}
#invite-link:focus{outline:1px solid rgba(139,92,246,.7)}
#btn-share-x{margin-top:8px}
.invite-stats{
  display:flex;gap:14px;justify-content:center;flex-wrap:wrap;
  margin-top:12px;font-size:11px;color:var(--dim);
}
.invite-stats b{color:var(--txt);font-weight:700;font-size:13px;margin-right:3px}
.invite-stats .hot b{color:var(--gold)}
.invite-fine{font-size:10px;color:rgba(154,148,196,.7);margin-top:9px;line-height:1.5}

@media (max-width:760px){
  #invite{padding:12px 13px;margin-top:10px}
  .invite-head{font-size:14px}
  .invite-sub{font-size:11px;margin:3px 0 9px}
  #invite-link{font-size:11px;padding:8px 12px}
  .invite-stats{gap:10px;font-size:10px}
  .invite-stats b{font-size:12px}
}

/* ---------- "what you walked past" sheet ---------- */
#regret{
  position:absolute;inset:0;background:rgba(4,3,14,.78);backdrop-filter:blur(18px);
  display:flex;align-items:center;justify-content:center;pointer-events:auto;z-index:20;
}
#regret-card{
  width:min(880px,92vw);border:1px solid var(--stroke);border-radius:26px;
  background:linear-gradient(160deg,rgba(30,24,64,.9),rgba(12,10,34,.95));
  padding:26px 28px 22px;box-shadow:0 40px 120px -30px rgba(0,0,0,.9);
}
.regret-head{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:20px}
.regret-kicker{font-size:10px;letter-spacing:.3em;color:var(--coral);font-weight:800}
.regret-title{font-size:20px;font-weight:600;margin-top:6px}
#regret-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:11px}
.regret-item{
  border:1px solid var(--stroke);border-radius:15px;padding:14px 13px;
  background:rgba(255,255,255,.03);position:relative;overflow:hidden;
}
.regret-item .rt{font-size:9px;letter-spacing:.2em;font-weight:800;opacity:.9}
.regret-item .rn{font-size:21px;font-weight:700;margin-top:7px;line-height:1.2}
.regret-item .rv{font-size:11px;color:var(--dim);margin-top:4px}
.regret-item.big::after{
  content:"";position:absolute;inset:0;border-radius:15px;
  box-shadow:inset 0 0 40px -8px currentColor;pointer-events:none;
}
.regret-foot{font-size:11.5px;color:var(--dim);margin-top:18px;text-align:center}

/* ---------- fx ---------- */
#fx-flash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none;mix-blend-mode:screen}
#fx-vignette{
  position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(ellipse at center,transparent 42%,rgba(3,2,12,.72) 100%);
}

.hidden{display:none !important}
.faded{opacity:0 !important;transform:translateY(8px)}
/* the centred panels are already translated on X — a bare translateY would
   snap them to the left edge on the way out */
#prompt.faded,#reveal-panel.faded{transform:translateX(-50%) translateY(8px)}

@media (max-width:760px){
  #regret-grid{grid-template-columns:repeat(2,1fr)}
  #topbar{padding:14px 16px}
  /* nowrap is the point: with the watch thumbnail added, this strip wrapped to
     two lines at 375 and doubled the header height */
  #live-strip{font-size:10.5px;gap:8px;padding:6px 11px;white-space:nowrap}
  #strip-grand-art{width:18px;height:18px}
  #landing{padding:104px 14px 16px}
  .landing-sub{font-size:11.5px;margin-top:9px;line-height:1.5}
  .wins{margin-top:12px;gap:6px}
  .win,.rw{padding:5px 11px 5px 5px;gap:7px;border-radius:12px}
  .win img,.rw img{width:28px;height:28px;border-radius:8px}
  .win b,.rw b{font-size:12.5px}
  .win span,.rw span{font-size:9.5px}

  /* Stats go inline: three stacked cards cost ~130px of a 812px screen, and
     that is board the player should be looking at. */
  .stats{gap:6px;margin-top:13px}
  .stat{
    min-width:0;flex:1 1 0;padding:7px 6px;border-radius:12px;
    display:flex;flex-direction:column;justify-content:center;
  }
  .stat b{font-size:16px}
  .stat span{font-size:9px;margin-top:1px;line-height:1.25}

  /* One scrolling row, not three wrapped ones. Every prize stays visible and
     the odds stay on screen — they just scroll instead of stacking. */
  .odds{
    flex-wrap:nowrap;justify-content:flex-start;gap:6px;margin-top:12px;
    overflow-x:auto;overflow-y:hidden;pointer-events:auto;
    padding:2px 14px;margin-left:-14px;margin-right:-14px;
    scrollbar-width:none;-webkit-overflow-scrolling:touch;
  }
  .odds::-webkit-scrollbar{display:none}
  .odd{flex:0 0 auto;font-size:10px;padding:3px 11px 3px 3px;gap:6px}
  .odd img{width:26px;height:26px}
  .odd .odd-name{font-size:11.5px}
  .odd b{font-size:9.5px;padding-left:6px}

  /* a refusal or an auth bounce, shown where the small print lives */
.odds-note.error{color:var(--coral);font-weight:600}
/* local mode is not a working promotion; say so rather than looking live */

.odds-note{font-size:9px;margin-top:9px;line-height:1.45}
  #reveal-actions .btn{padding:9px 14px;font-size:12px}
  .cta-q{font-size:13px}
  .cta-fine{font-size:9px}
}
/* short landscape (laptop at 1080p, phone rotated): give the board the room */
@media (max-height:720px){
  #prompt{bottom:40px}
  #prompt-sub{display:none}
  /* .landing-sub goes, .wins stays — the two rewards ARE the offer, and this
     query is what made the free box invisible on a rotated phone. */
  .landing-sub{display:none}
  #landing{padding-top:94px}
  .wins{margin-top:12px}
  .stats{margin-top:12px}
  #cta{margin-top:10px;padding:12px 16px 14px}
  #reveal-note{margin-top:5px}
  #reveal-actions{margin-top:10px}
}
/* Only the very narrowest phones still can't hold all three counts on one line.
   "USDC unclaimed" is the one segment that must never be the one to go: drop
   the running total instead. */
@media (max-width:360px){
  #live-strip .seg-opened{display:none}
}
