html, body { min-height: 100%; }
body { font-size: 17px; line-height: 1.4; padding-bottom: calc(96px + env(safe-area-inset-bottom)); overscroll-behavior-y: none; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--stage); border-bottom: 1px solid var(--line); }
.brand { font-size: 14px; letter-spacing: .04em; }
.brand::after { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--accent); margin-left: 5px; vertical-align: 1px; }
.who { font-size: 14px; color: var(--grey); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.top-r { text-align: right; }
.bal { font-size: 28px; font-variant-numeric: tabular-nums; }
.streak { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 4px; padding: 2px 7px; margin-top: 4px; }
main { padding: 20px 16px 0; max-width: 560px; margin: 0 auto; }
.scr { display: none; animation: scrIn .4s var(--ease) both; }
.scr.on { display: block; }
@keyframes scrIn { from { opacity: 0; transform: translateY(10px); } }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); }
.lbl { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); margin-bottom: 6px; }
.big { font-size: 44px; margin: 8px 0 14px; }
.mid { font-size: 32px; margin: 10px 0 12px; line-height: 1.08; }
.huge { font-size: 48px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.msg { font-size: 18px; margin: 10px 0; }
.big2 { font-size: 22px; font-weight: 700; }
.center { text-align: center; }
.btn { display: flex; align-items: center; justify-content: center; min-height: 56px; width: 100%; padding: 0 16px; border-radius: 10px; background: var(--line); font-weight: 700; font-size: 18px; transition: transform .15s var(--ease), background-color .2s; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--stage); }
.btn:disabled { opacity: .45; }
.btn.sel { background: var(--text); color: var(--stage); }

/* join */
.jt { font-size: 40px; }
.jsub { margin: 10px 0 14px; }
form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); }
label input { min-height: 56px; border-radius: 10px; border: 1.5px solid var(--line); background: #1a1a19; padding: 0 16px; font-size: 22px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); outline: none; -webkit-appearance: none; }
label input:focus { border-color: var(--accent); }
#pinIn { font-family: var(--head); font-weight: 800; letter-spacing: .12em; font-size: 28px; }
.err { color: var(--accent); font-weight: 600; min-height: 22px; }

/* lobby */
.rows { margin-top: 24px; }
.rowbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* timer bar */
.timebar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; }

/* insurance */
.ins-btns { display: grid; gap: 10px; margin-top: 20px; }

/* invest */
.inv-head { display: flex; justify-content: space-between; align-items: baseline; }
.secs { font-size: 28px; font-variant-numeric: tabular-nums; }
.scen { font-size: 19px; font-weight: 600; margin: 8px 0 14px; }
.opts { display: grid; gap: 10px; }
.opt { position: relative; min-height: 72px; border-radius: 10px; background: var(--line); overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; text-align: left; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.opt .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 75, 18, .28); transition: width .3s var(--ease); }
.opt .on { position: relative; font-size: 17px; font-weight: 700; line-height: 1.2; }
.opt .pc { position: relative; text-align: right; white-space: nowrap; }
.opt .pc b { display: block; font-family: var(--head); font-weight: 800; font-size: 22px; }
.opt .pc span { font-size: 13px; color: var(--grey); }
.opt.has .pc b { color: var(--accent); }
.opt:active { transform: scale(.99); }
.opt:disabled { opacity: .8; }
.cash { margin: 14px 0; font-size: 17px; display: flex; justify-content: space-between; }
.inv-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.locked-msg { font-size: 18px; font-weight: 700; color: var(--accent); text-align: center; margin: 10px 0; min-height: 56px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--accent); border-radius: 10px; }
.hint { font-size: 14px; margin-top: 12px; }

/* reveal */
.wait { padding: 30px 0; }
.res { margin-top: 14px; }
.delta { font-size: 56px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--accent); }
.delta.down { color: var(--grey); }
.bonus { font-weight: 700; color: var(--accent); margin-top: 6px; }
.breakdown { margin: 18px 0; border-top: 1px solid var(--line); }
.bk { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.bk .m { font-family: var(--head); font-weight: 800; white-space: nowrap; }
.bk .m.w { color: var(--accent); }
.bk .m.l { color: var(--grey); }
.bk .n { flex: 1; }
.bk .v { color: var(--grey); white-space: nowrap; }
.newbal { display: flex; justify-content: space-between; font-size: 18px; }

/* event */
.evres { margin: 20px 0; padding: 18px; border-radius: 10px; background: var(--line); font-size: 20px; font-weight: 700; }
.evres.hit { background: var(--accent); color: var(--stage); }
.evres.saved { box-shadow: inset 0 0 0 2px var(--accent); background: transparent; }

/* leaderboard */
.you { margin-bottom: 14px; }
.rank { font-size: 52px; }
.rank small { font-family: var(--body); font-weight: 600; font-size: 18px; color: var(--grey); margin-left: 6px; letter-spacing: 0; }
.plb { border-top: 1px solid var(--line); }
.pr { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 16px; }
.pr .k { font-family: var(--head); font-weight: 800; color: var(--grey); }
.pr .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr .n .tag { font-size: 10px; margin-left: 6px; }
.pr .v { font-family: var(--head); font-weight: 800; font-variant-numeric: tabular-nums; }
.pr.me { background: rgba(255, 75, 18, .14); box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.pr.gap { min-height: 24px; color: var(--grey); border: 0; }
.pteams { margin-top: 20px; }

/* profile card */
.card { border-radius: 16px; background: #1a1a19; box-shadow: inset 0 0 0 1px var(--line); padding: 22px 20px 24px; position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 32px; }
.ptitle { font-size: 46px; color: var(--accent); margin: 4px 0 12px; line-height: .98; }
.pdesc { font-size: 18px; margin-bottom: 26px; }
.pstats { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.pnum { font-size: 28px; font-variant-numeric: tabular-nums; }
.card-name { margin-top: 22px; font-size: 20px; font-weight: 700; }

/* live winner check */
.ping { position: fixed; inset: 0; z-index: 20; background: var(--accent); color: var(--stage); display: flex; align-items: center; justify-content: center; text-align: center; animation: pingFlash .5s steps(1) infinite; }
.ping-in { padding: 24px; }
.ping-l { font-size: 16px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ping-r { font-size: 140px; line-height: 1; margin: 10px 0; }
.ping-n { font-size: 32px; font-weight: 700; }
.ping-m { font-size: 30px; margin-top: 8px; }
.ping-h { font-size: 16px; font-weight: 600; margin-top: 26px; }
@keyframes pingFlash { 0% { background: var(--accent); color: var(--stage); } 50% { background: var(--text); color: var(--stage); } }

/* bottom bars */
.reactbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--stage); border-top: 1px solid var(--line); }
.reactbar button { min-height: 64px; font-size: 32px; border-radius: 12px; background: var(--line); touch-action: manipulation; transition: transform .15s var(--ease), opacity .2s; }
.reactbar button:active { transform: scale(.92); }
.reactbar.cool button { opacity: .45; }
.pausebar, .netbar { position: fixed; left: 0; right: 0; top: 0; z-index: 8; text-align: center; padding: calc(8px + env(safe-area-inset-top)) 0 8px; font-weight: 700; background: var(--accent); color: var(--stage); }
.netbar { background: var(--text); }
