/* Console UI (from the ride-the-multiplier prototype). Colors are the variables in :root. */
:root{
  --body:#c9df8f; --body-lo:#b3cb78;
  --lcd:#d3d8c6; --lcd-ink:#3c4232; --lcd-dim:#7d846c;
  --magenta:#c4177a; --magenta-lo:#8e0f57; --pill:#4b4b50;
  --text:#f3efe8; --muted:#8d8a95; --red:#ff4d4d; --green:#3fd16f; --gold:#ffd84a; --line:#2e2e37;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:#0d0d10;color:var(--text);font-family:Inter,system-ui,sans-serif;-webkit-tap-highlight-color:transparent}
body{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px 0}
button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}

/* On a desktop the console sits in a phone-sized frame; on a phone it fills the screen. */
.phone{position:relative;width:min(100vw,400px);height:min(800px,calc(100vh - 32px));height:min(800px,calc(100dvh - 32px));min-height:600px;
  background:var(--body);border-radius:28px;overflow:hidden;display:flex;flex-direction:column;
  box-shadow:0 0 0 1px #2a2a30}
@media (max-width:430px){
  body{padding:0;justify-content:flex-start}
  .phone{width:100vw;border-radius:0;box-shadow:none;height:100vh;height:100dvh;min-height:560px;
    padding-bottom:env(safe-area-inset-bottom)}
}

/* ---------- scene ---------- */
.scene{position:relative;flex:1;min-height:300px;overflow:hidden;border-radius:0 0 22px 22px;background:#9fdcff}
#sky{position:absolute;inset:0;width:100%;height:100%;image-rendering:pixelated}
.hud{position:absolute;top:14px;left:14px;right:14px;display:flex;justify-content:space-between;align-items:center;z-index:2}
.hud .left{display:flex;align-items:center;gap:10px}
.sq{width:44px;height:44px;border-radius:9px;background:#fff8ec;display:grid;place-items:center;
  box-shadow:inset 0 -4px 0 #d9cdb8, 0 0 0 3px #2b2433, 0 4px 0 3px #2b2433}
.sq:active{transform:translateY(2px);box-shadow:inset 0 -2px 0 #d9cdb8, 0 0 0 3px #2b2433, 0 2px 0 3px #2b2433}
.sq svg{width:26px;height:26px;image-rendering:pixelated}
.count{font-family:"Press Start 2P",monospace;font-size:16px;color:#fff;
  text-shadow:3px 0 #2b2433,-3px 0 #2b2433,0 3px #2b2433,0 -3px #2b2433,3px 3px #2b2433,-3px 3px #2b2433,3px -3px #2b2433,-3px -3px #2b2433}
.hud .right{display:flex;gap:12px}
.center{position:absolute;left:0;right:0;top:70px;display:flex;flex-direction:column;align-items:center;gap:3px;z-index:2;pointer-events:none}
.state{font-family:"Press Start 2P",monospace;font-size:9px;letter-spacing:1px;color:#2b2433;background:#fff8ec;
  padding:6px 9px;border-radius:5px;box-shadow:0 0 0 2px #2b2433, 0 3px 0 2px #2b2433}
.mult{font-family:"Press Start 2P",monospace;font-size:48px;line-height:1.1;color:#fff;
  text-shadow:4px 0 #2b2433,-4px 0 #2b2433,0 4px #2b2433,0 -4px #2b2433,4px 4px #2b2433,-4px 4px #2b2433,4px -4px #2b2433,-4px -4px #2b2433,0 8px rgba(43,36,51,.35)}
.mult.bust{color:#ff6b8a}
.icon{position:absolute;left:calc(50% - 160px);bottom:-24px;width:320px;height:240px;background-repeat:no-repeat;image-rendering:pixelated;
  transform-origin:50% 90%;z-index:1}
.icon.pulse{animation:pulse var(--beat,1.1s) ease-in-out infinite}
@keyframes pulse{0%,100%{transform:scale(1)}18%{transform:scale(1.06)}36%{transform:scale(.99)}54%{transform:scale(1.03)}}

/* ---------- device ---------- */
.device{flex:none;padding:14px 16px 14px;background:linear-gradient(180deg,#cfe397 0%,var(--body) 30%,#c2d987 100%)}
.lcd{position:relative;background:var(--lcd);border-radius:14px 14px 30px 14px;padding:9px 14px 9px 12px;
  display:grid;grid-template-columns:100px 1px 1fr;gap:12px;align-items:center;
  box-shadow:inset 0 3px 0 rgba(0,0,0,.08), inset 0 0 0 2px rgba(60,66,50,.18), 0 0 0 5px #b8cd80, 0 0 0 6px rgba(0,0,0,.08)}
.lcd .ava{display:flex;flex-direction:column;align-items:center;gap:4px}
.lcd .ava i{display:block;width:96px;height:72px;background-size:96px 72px;image-rendering:pixelated;opacity:.92}
.lcd .name{font-family:VT323,monospace;font-size:22px;line-height:1;color:var(--lcd-ink);display:flex;gap:5px;align-items:center}
.lcd .name svg{width:13px;height:13px}
.lcd .rule{width:1px;height:88%;background:var(--lcd-dim);opacity:.6}
.lcd dl{display:grid;grid-template-columns:auto 1fr;row-gap:2px;column-gap:10px;font-family:VT323,monospace;color:var(--lcd-ink)}
.lcd dt{font-size:21px;line-height:1}
.lcd dd{font-size:21px;line-height:1;text-align:right}
.lcd .msg{grid-column:1/-1;font-size:17px;color:var(--lcd-dim);border-top:1px dashed rgba(60,66,50,.35);padding-top:4px;margin-top:3px;letter-spacing:.5px}
.lcd .blink{animation:blink 1s steps(1) infinite}
@keyframes blink{50%{opacity:.25}}

.controls{display:flex;flex-direction:column;gap:12px;margin-top:16px}
.wheelbox{display:flex;flex-direction:column;gap:8px}
.wlabel{display:flex;justify-content:space-between;align-items:baseline;font-family:"Space Mono",monospace;font-weight:700;color:#22261b;padding:0 2px}
.wlabel span{font-size:15px} .wlabel b{font-family:"Press Start 2P",monospace;font-size:20px;color:#22261b}
.wheel{position:relative;height:66px;border-radius:14px;overflow:hidden;cursor:ew-resize;touch-action:none;outline:none;
  background:#3b3b40;box-shadow:0 0 0 6px rgba(0,0,0,.07),0 0 0 3px #2c2c30 inset,0 5px 0 #2c2c30}
.wheel:focus-visible{box-shadow:0 0 0 3px var(--magenta),0 5px 0 #2c2c30}
.wheel.locked{cursor:not-allowed;filter:saturate(.3) brightness(1.15)}
.ridges{position:absolute;inset:3px;border-radius:11px;opacity:.55;
  background:repeating-linear-gradient(90deg,#6c6c74 0 6px,#4a4a51 6px 9px,#2e2e33 9px 12px);background-size:12px 100%}
.tape{position:absolute;left:50%;top:3px;bottom:3px;width:0;transition:transform .07s linear;will-change:transform}
.tape i{position:absolute;bottom:4px;width:2px;height:8px;background:#c9c9d2;transform:translateX(-50%)}
.tape i.mid{height:14px;background:#e4e4ea}
.tape i.big{height:20px;width:3px;background:#ffffff}
.tape b{position:absolute;top:7px;transform:translateX(-50%);font-family:"Space Mono",monospace;font-weight:700;font-size:16px;
  color:#fff;letter-spacing:-.3px;white-space:nowrap;text-shadow:0 1px 0 #000}
.shade{position:absolute;inset:3px;border-radius:11px;pointer-events:none;
  background:linear-gradient(90deg,rgba(0,0,0,.7) 0%,rgba(0,0,0,.1) 20%,rgba(255,255,255,.12) 50%,rgba(0,0,0,.1) 80%,rgba(0,0,0,.7) 100%),
             linear-gradient(180deg,rgba(255,255,255,.18),rgba(0,0,0,.25))}
.shade::after{content:"";position:absolute;left:50%;top:32px;bottom:-2px;width:3px;margin-left:-1.5px;background:var(--magenta);box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.shade::before{content:"";position:absolute;left:50%;top:-3px;margin-left:-7px;border:7px solid transparent;border-top:8px solid var(--magenta);filter:drop-shadow(0 1px 0 rgba(0,0,0,.35))}
.wrange{display:flex;justify-content:space-between;font-family:"Space Mono",monospace;font-weight:700;font-size:11px;color:#55603f;padding:0 2px}
.wrange .hint{opacity:.7}

.btnrow{display:flex;justify-content:center;gap:64px;padding:10px 0 8px;margin:0 auto;width:100%;max-width:300px;
  background:rgba(0,0,0,.05);border-radius:48px}
.rbwrap{display:flex;flex-direction:column;align-items:center;gap:7px}
.rbwrap span{font-family:"Space Mono",monospace;font-weight:700;font-size:13px;color:#3b4030;letter-spacing:.5px}
.rb{position:relative;width:58px;height:58px;border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#e4489e 0%,var(--magenta) 45%,#a3126a 100%);
  box-shadow:0 5px 0 var(--magenta-lo),0 7px 8px rgba(0,0,0,.25);transition:filter .15s}
.rb:active{transform:translateY(3px);box-shadow:0 2px 0 var(--magenta-lo)}
.rb:disabled{filter:saturate(.25) brightness(1.15);box-shadow:0 5px 0 #8a7a82}
.rb.cashed,.rb.cashed:disabled{filter:none;background:radial-gradient(circle at 35% 30%,#6fe39a,#24b45a 55%,#168043);box-shadow:0 5px 0 #0f5c2f}

.banner{position:absolute;left:12px;bottom:10px;z-index:2;font-family:"Press Start 2P",monospace;font-size:8px;color:#fff8ec;
  background:#2b2433;padding:6px 8px;border-radius:4px;box-shadow:0 3px 0 rgba(0,0,0,.25)}
.lcd dl{min-width:0}
.lcd dd,.lcd dt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lcd .venue{grid-column:1/-1;text-align:left;font-size:16px;color:var(--lcd-dim);letter-spacing:1px;border-bottom:1px dashed rgba(60,66,50,.35);padding-bottom:2px;margin-bottom:2px}

/* shop */
.card.shop{max-height:88%;overflow:auto;border-radius:20px 20px 0 0}
.shophead{display:flex;justify-content:space-between;align-items:center}
.shophead h3{margin:0;font-size:16px}
.x{width:36px;height:36px;border-radius:9px;background:#efe4d0;color:#2b2433;font-size:16px;font-weight:800}
.lede{color:#6c6075;margin:8px 0 14px}
.item{display:flex;align-items:center;gap:12px;padding:12px;border-radius:12px;background:#fff;border:2px solid #2b2433;box-shadow:0 3px 0 #2b2433;margin-bottom:10px}
.item .em{font-size:26px;width:34px;text-align:center}
.item .nm{flex:1;font-weight:800;font-size:14px;line-height:1.25}
.item .nm small{display:block;font-weight:600;color:#7c7086;font-size:12px}
.buy{min-width:96px;padding:10px 12px;border-radius:10px;font-weight:800;font-size:13px;background:var(--magenta);color:#fff;box-shadow:0 3px 0 var(--magenta-lo)}
.buy.confirm{background:#24b45a;box-shadow:0 3px 0 #168043}
.buy:disabled{background:#efe4d0;color:#9a8ea2;box-shadow:none}
.card.shop h4{font-size:11px;letter-spacing:1.5px;color:#7c7086;margin:18px 0 8px}
.empty{color:#9a8ea2;text-align:center;padding:10px 0}
.bought{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:10px 12px;border-radius:10px;background:#f6ecdb;margin-bottom:8px;font-weight:700;font-size:14px}
.bought .em{font-size:20px} .bought .code{margin-left:auto;font-family:VT323,monospace;font-size:20px;color:#6c6075}
.card.receipt{text-align:center;border-radius:20px 20px 0 0}
.rhead{font-family:"Press Start 2P",monospace;font-size:11px;letter-spacing:2px;color:#7c7086}
.remoji{font-size:54px;margin:10px 0 4px}
.rname{font-weight:800;font-size:18px}
.rcode{font-family:"Press Start 2P",monospace;font-size:22px;margin:14px auto 8px;padding:12px 14px;border:3px dashed #2b2433;border-radius:10px;display:inline-block;background:#fff}
.rmeta{color:#6c6075;font-size:13px}
.rnote{margin-top:10px;font-size:13px;color:#2b2433;font-weight:600}

/* ---------- charge result (over the whole phone) ---------- */
.bull{position:absolute;left:0;top:0;pointer-events:none;background-repeat:no-repeat;image-rendering:pixelated;will-change:transform}
.flash{position:absolute;inset:0;background:var(--red);opacity:0;z-index:7;pointer-events:none}
.result{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:10px;padding:24px;text-align:center;visibility:hidden;z-index:4}
.result .tag{font-family:"Press Start 2P",monospace;font-size:11px;letter-spacing:2px;padding:7px 10px;border-radius:6px}
.lost .tag{background:var(--red);color:#2a0606} .won .tag{background:var(--green);color:#06210f} .none .tag{background:var(--line);color:var(--text)}
.result .big{font-family:"Press Start 2P",monospace;font-size:40px}
.result .sub{font-size:14px}
.result .btn{margin-top:18px;width:100%;max-width:280px;border:none;border-radius:16px;padding:18px;font:800 15px Inter,sans-serif;letter-spacing:.5px;cursor:pointer;pointer-events:auto}
.result.dusty .sub{color:#5b1b3d;font-weight:600}
.result.dusty .big{text-shadow:0 4px 0 rgba(91,27,61,.28)}
.result.dusty.lost .big{color:#c8143f} .result.dusty.won .big{color:#0b8a3c} .result.dusty.none .big{color:#5b1b3d}
.result.dusty.none .tag{background:#5b1b3d;color:#ffd8ea}
.result.dusty .btn{background:#3a1029;color:#ffe3f0;box-shadow:0 5px 0 #1e0715}
.shake{animation:shake .32s linear}
@keyframes shake{0%{transform:translate(0)}15%{transform:translate(-9px,4px)}30%{transform:translate(8px,-5px)}
  45%{transform:translate(-6px,3px)}60%{transform:translate(5px,-2px)}75%{transform:translate(-3px,1px)}100%{transform:translate(0)}}

/* info sheet */
.sheet{position:absolute;inset:0;z-index:8;background:rgba(20,16,24,.55);display:none;align-items:flex-end}
.sheet.open{display:flex}
.sheet .card{width:100%;background:#fff8ec;color:#2b2433;border-radius:20px 20px 0 0;padding:20px 20px 26px;box-shadow:0 -4px 0 #2b2433}
.sheet h3{font-family:"Press Start 2P",monospace;font-size:12px;margin-bottom:12px}
.sheet p,.sheet li{font-size:14px;line-height:1.5}
.sheet ul{padding-left:18px;margin:6px 0 14px}
.sheet .row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-top:1px dashed #d9cdb8;font-weight:700;font-size:14px}
.sheet .close{margin-top:10px;width:100%;padding:13px;border-radius:12px;background:#2b2433;color:#fff8ec;font-weight:800}


/* ---------- additions for the live game ---------- */
[hidden]{display:none !important}
.hud{top:max(14px, env(safe-area-inset-top))}

/* reconnecting badge, under the HUD */
.offline{position:absolute;left:50%;top:calc(max(14px, env(safe-area-inset-top)) + 54px);transform:translateX(-50%);z-index:3;
  font-family:"Press Start 2P",monospace;font-size:8px;letter-spacing:1px;color:#fff8ec;background:#c8143f;
  padding:6px 9px;border-radius:5px;box-shadow:0 0 0 2px #2b2433, 0 3px 0 2px #2b2433;animation:blink 1s steps(1) infinite}
.center{top:calc(max(14px, env(safe-area-inset-top)) + 64px)}
.offline:not([hidden]) ~ .center{top:calc(max(14px, env(safe-area-inset-top)) + 84px)}

/* rider + bettors line under the state pill */
.who{margin-top:5px;font-family:"Press Start 2P",monospace;font-size:8px;color:#2b2433;background:rgba(255,248,236,.75);padding:4px 7px;border-radius:4px}
.who:empty{display:none}

/* balance bump when tokens come in */
.count.bump{animation:bump .5s ease-out}
@keyframes bump{0%{transform:scale(1)}30%{transform:scale(1.25);color:var(--gold)}100%{transform:scale(1)}}

/* toast */
.toast{position:absolute;left:50%;bottom:24px;transform:translate(-50%,20px);z-index:9;opacity:0;pointer-events:none;max-width:86%;
  font-family:"Press Start 2P",monospace;font-size:9px;line-height:1.5;text-align:center;color:#fff8ec;background:#2b2433;
  padding:9px 12px;border-radius:6px;box-shadow:0 3px 0 rgba(0,0,0,.3);transition:opacity .2s, transform .2s}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.bad{background:#c8143f} .toast.good{background:#168043}

/* info sheet: your name + recent rides */
.sheet .row .link{font-weight:800;color:var(--magenta);text-decoration:underline}
.sheet .rides{display:flex;flex-wrap:wrap;gap:6px;padding:4px 0 6px}
.sheet .rides span{font-family:VT323,monospace;font-size:18px;line-height:1;padding:4px 7px;border-radius:5px;background:#efe4d0;color:#2b2433}
.sheet .rides .mid{background:#ffe7a0} .sheet .rides .high{background:#b9efcb}
.sheet .rides .low{background:#ffd0d8}
.sheet .rides:empty::before{content:"No rides yet";color:#9a8ea2;font-size:13px}

/* shop extras */
.item .nm small .sold{color:#c8143f}
.bought .st{font-size:11px;font-weight:800;padding:3px 6px;border-radius:5px;background:#efe4d0;color:#6c6075}
.bought .st.pending{background:var(--magenta);color:#fff}
.bought .st.fulfilled{background:#24b45a;color:#fff}
.bought.cancelled{opacity:.6}

/* receipt: status + live clock (so an old screenshot is easy to spot) */
.rstatus{display:inline-block;margin-top:10px;font-family:"Press Start 2P",monospace;font-size:9px;letter-spacing:1px;padding:6px 9px;border-radius:5px;background:var(--magenta);color:#fff}
.receipt.fulfilled .rstatus{background:#24b45a}
.receipt.cancelled .rstatus{background:#7c7086}
.receipt.cancelled .rcode{text-decoration:line-through;opacity:.6}
.rclock{font-family:VT323,monospace;font-size:26px;margin-top:6px;color:#2b2433}
.receipt.pending .rcode{animation:rpulse 1.6s ease-in-out infinite}
@keyframes rpulse{50%{transform:scale(1.04)}}

@media (prefers-reduced-motion: reduce){
  .icon.pulse,.receipt.pending .rcode,.offline,.count.bump{animation:none}
}
.lcd .name span{max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

