:root {
  --bg: #000;
  --s1: #0a0a0c;
  --s2: #111115;
  --line: rgba(255,255,255,.08);
  --red: #e3202b;
  --red-hi: #ef4444;
  --text: #fff;
  --mut: #a3a3ab;
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
  --tabh: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.lock { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

#app { min-height: 100vh; min-height: 100dvh; }
.wrap { max-width: 560px; margin: 0 auto; padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar)); }

/* header + banner */
.top { padding-top: calc(18px + var(--sat)); padding-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.sub { color: var(--mut); font-size: 14px; margin-top: 4px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--s1); display: grid; place-items: center; color: var(--mut); flex: none; }
.icon-btn:active { background: var(--s2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.banner button { width: 100%; min-height: 44px; margin: 6px 0 0; padding: 0 14px; border: 1px solid rgba(227,32,43,.5); border-radius: 12px; background: var(--s1); text-align: left; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.banner b { color: var(--red-hi); font-weight: 600; }
.banner span { color: var(--mut); }
.banner:empty { display: none; }
main { padding-bottom: calc(var(--tabh) + var(--sab) + 24px); }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: var(--sab); padding-left: var(--sal); padding-right: var(--sar); }
.tabs-in { display: flex; max-width: 560px; margin: 0 auto; }
.tab { flex: 1; height: var(--tabh); background: none; border: 0; color: var(--mut); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; min-width: 44px; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--red); }

/* lists */
.search input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); padding: 0 14px; font-size: 16px; outline: none; margin-bottom: 14px; -webkit-appearance: none; appearance: none; }
.search input::placeholder, .inp::placeholder { color: #6b6b73; }
input:focus { border-color: rgba(227,32,43,.7); }
.list { background: var(--s1); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; }
.row:first-child { border-top: 0; }
button.row:active { background: var(--s2); }
.row .grow { flex: 1; min-width: 0; }
.name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.meta { color: var(--mut); font-size: 13px; margin-top: 2px; }
.amt-r { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { color: var(--mut); width: 18px; height: 18px; flex: none; }
.pend { color: var(--red-hi); font-size: 13px; margin-top: 2px; font-weight: 600; }
.void .name, .void .amt-r { text-decoration: line-through; color: var(--mut); }
.empty { padding: 28px 16px; text-align: center; color: var(--mut); font-size: 15px; }
.mini { margin-top: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2); font-size: 14px; }

/* leaderboard */
.seg { display: flex; background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; height: 44px; border: 0; border-radius: 9px; background: none; color: var(--mut); font-weight: 600; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; }
.rank { width: 28px; color: var(--mut); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; flex: none; }
.me { background: var(--s2); box-shadow: inset 3px 0 0 var(--red); }
.me .rank { color: var(--red-hi); }
.right { text-align: right; flex: none; }

/* account */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 14px; min-height: 52px; border-top: 1px solid var(--line); align-items: center; }
.kv:first-child { border-top: 0; }
.kv span:first-child { color: var(--mut); }
.kv span:last-child { text-align: right; overflow-wrap: anywhere; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-weight: 600; font-size: 17px; padding: 0 16px; }
.btn:hover, .btn:active { background: var(--red-hi); }
.btn:disabled { opacity: .5; }
.btn.ghost { background: var(--s2); border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover, .btn.ghost:active { background: #1a1a20; }
.btn.danger { color: var(--red-hi); }
.gap { height: 16px; }

/* login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-top: calc(32px + var(--sat)); padding-bottom: calc(32px + var(--sab)); }
.logo { display: block; width: min(100%, 320px); height: auto; margin: 0 auto 36px; }
.login h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 18px; }
.login label, .lbl { display: block; color: var(--mut); font-size: 13px; font-weight: 500; margin: 0 0 6px; }
.inp, .login input { width: 100%; height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); padding: 0 14px; font-size: 16px; outline: none; margin-bottom: 16px; -webkit-appearance: none; appearance: none; }
.login input#p { letter-spacing: .3em; }
.err { color: var(--red-hi); font-size: 14px; min-height: 20px; margin: -4px 0 12px; }
.foot { color: var(--mut); font-size: 12px; text-align: center; margin-top: 24px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.panel { width: 100%; max-width: 560px; max-height: 94vh; max-height: 94dvh; overflow-y: auto; background: var(--s1); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 10px calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal)); }
.grab { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); margin: 0 auto 12px; }
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.eyebrow { color: var(--mut); font-size: 13px; }
.panel h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.amt { display: flex; align-items: center; gap: 8px; height: 80px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--s2); margin-bottom: 18px; }
.amt:focus-within { border-color: rgba(227,32,43,.7); }
.amt span { font-size: 34px; color: var(--mut); font-weight: 600; }
.amt input { flex: 1; min-width: 0; height: 100%; border: 0 !important; background: none; outline: none; font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0; -webkit-appearance: none; appearance: none; }
.filein { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.photo .btn { min-height: 48px; font-size: 16px; flex: 1; }
.thumb { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.row2 { display: flex; gap: 12px; }
.row2 .btn { flex: 1; }
.big { font-size: 52px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.center { text-align: center; padding: 14px 0 22px; }
.center p { color: var(--mut); margin-top: 6px; font-size: 17px; overflow-wrap: anywhere; }
.center p b { color: var(--text); }
.note { color: var(--mut); font-size: 14px; text-align: center; margin: -6px 0 18px; overflow-wrap: anywhere; }
.tick { width: 56px; height: 56px; border-radius: 50%; background: var(--red); display: grid; place-items: center; margin: 8px auto 16px; }
.tick svg { width: 28px; height: 28px; }
@media (max-width: 380px) { .big { font-size: 44px; } .amt input { font-size: 36px; } }

/* ---------- motion: transform + opacity only, all off under reduced motion ---------- */
:root { --ease: cubic-bezier(.22,.8,.26,1); }

/* launch splash (logo markup from the owner dashboard intro, timings halved) */
.lg { display: block; width: 100%; height: auto; overflow: visible; }
.lg-sh { opacity: 0; }
#splash { position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center; transition: opacity .25s ease-out; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .lgw { width: min(86vw, 520px); }
#splash .lg-cam { transform-box: fill-box; transform-origin: 50% 50%; animation: lgPush 1.4s var(--ease) both; }
#splash .lg-f { stroke-dasharray: 1 1; animation: lgDraw .4s .05s cubic-bezier(.65,0,.35,1) both; }
#splash .lg-f2 { stroke-dasharray: 1 1; animation: lgDraw .4s .14s cubic-bezier(.65,0,.35,1) both; }
#splash .lg-o, #splash .lg-w, #splash .lg-t { stroke-dasharray: 1 1; animation: lgDraw .25s calc(var(--d) * .5) cubic-bezier(.65,0,.35,1) both; }
#splash .lg-t { animation-duration: .2s; }
#splash .lg-n { animation: lgSlam .3s calc(var(--d) * .5) var(--ease) both; }
#splash .lg-sw, #splash .lg-sw2 { transform-box: fill-box; transform-origin: 0 50%; animation: lgGrow .3s .65s var(--ease) both; }
#splash .lg-sw2 { animation-delay: .71s; }
#splash .lg-r { transform-box: fill-box; transform-origin: 0 50%; animation: lgGrow .25s .87s var(--ease) both; }
#splash .lg-sh { animation: lgSheen .5s .8s cubic-bezier(.45,0,.25,1) both; }
@keyframes lgDraw { 0% { stroke-dashoffset: 1; opacity: 0; } 1% { opacity: 1; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes lgSlam { 0% { transform: translateX(130px); opacity: 0; } 40% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes lgGrow { 0% { transform: scaleX(0); } to { transform: none; } }
@keyframes lgSheen { 0% { transform: translateX(0); opacity: 0; } 20%, 80% { opacity: 1; } to { transform: translateX(1260px); opacity: 0; } }
@keyframes lgPush { 0% { transform: scale(.94); } to { transform: none; } }
/* screens wait behind the splash, then play their entrance as it fades */
html.splash #app, html.splash #app * { animation-play-state: paused !important; }

/* screens and rows */
@keyframes up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#view.enter { animation: up .26s var(--ease) both; }
.login > * { animation: up .4s var(--ease) both; }
.login > :nth-child(2) { animation-delay: .06s; }
.login > :nth-child(3) { animation-delay: .12s; }
.login > :nth-child(4) { animation-delay: .18s; }
.list.in > .row, .list.in > .kv { animation: up .3s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 32ms); }
.banner button.pop { animation: up .28s var(--ease) backwards; }

/* press feedback */
.btn, .icon-btn, .mini, .seg button, .tab, button.row { transition: transform .14s var(--ease), background-color .14s; }
.btn:active, .icon-btn:active, .mini:active, .seg button:active { transform: scale(.97); }
.tab:active { transform: scale(.94); }
button.row:active { transform: scale(.99); }

/* collect sheet */
.sheet.open { animation: fade .2s ease-out both; }
.sheet.open .panel { animation: sheetUp .32s var(--ease) both; }
.sheet.closing { opacity: 0; pointer-events: none; transition: opacity .18s ease-in; }
.sheet.closing .panel { transform: translateY(16px); transition: transform .18s ease-in; }
.panel.stp { animation: fade .22s ease-out both; }
@keyframes sheetUp { from { transform: translateY(40px); } to { transform: none; } }

/* result mark: spinning arc while sending, check on success, clock when queued */
.tick { position: relative; }
.tick.wait { background: none; }
.tick.wait svg { width: 56px; height: 56px; position: absolute; inset: 0; animation: spin 1s linear infinite; }
.tick.ok { animation: pop .3s var(--ease) both; }
.tick.ok path { stroke-dasharray: 1; animation: draw .36s .1s var(--ease) both; }
.tick.queued, .tick.fail { background: var(--s2); border: 1px solid var(--line); color: var(--mut); animation: pop .3s var(--ease) both; }
.tick.fail { color: var(--red-hi); }
.tick.queued svg, .tick.fail svg { width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.done-t { animation: fade .3s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
