/* 20 Dollar friend play: the game's navy and gold, glass panels over a slowly moving light. */
:root {
  --navy: #071a40;
  --navy-2: #0f2f6e;
  --ink: #eef4ff;
  --dim: #9fb4dc;
  --gold: #f6c544;
  --gold-2: #ff9f2e;
  --go: #5ee07a;
  --bad: #ff6b6b;
  --you: #4fb3ff;
  --opp: #ff7a9a;
  --glass: rgba(255, 255, 255, .06);
  --line: rgba(159, 180, 220, .2);
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink); font: 15px/1.5 var(--text); background: var(--navy); overflow-x: hidden;
  padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; }
[hidden] { display: none !important; }

/* moving background light */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 50% -10%, var(--navy-2), var(--navy) 65%); }
.bg i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .35; animation: drift 28s ease-in-out infinite alternate; }
.bg i:nth-child(1) { background: #2b6cff; left: -20vmax; top: -25vmax; }
.bg i:nth-child(2) { background: #f6c544; right: -30vmax; top: 20vh; opacity: .14; animation-duration: 36s; }
.bg i:nth-child(3) { background: #b04fff; left: 10vw; bottom: -40vmax; opacity: .22; animation-duration: 44s; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1080px; margin: 0 auto; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 800 22px/1 var(--display); }
.brand small { font: 600 12px var(--text); color: var(--dim); letter-spacing: .04em; text-transform: uppercase; padding-top: 3px; }
.coin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #4a2a00;
  background: radial-gradient(circle at 35% 30%, #fff3b8, var(--gold) 45%, var(--gold-2)); box-shadow: 0 0 0 3px rgba(246,197,68,.25), 0 6px 18px rgba(246,197,68,.35); }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line);
  font: 600 13px var(--text); color: var(--dim); }
.chip b { color: var(--ink); letter-spacing: .12em; font-family: ui-monospace, Menlo, monospace; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--go); box-shadow: 0 0 8px var(--go); }
.dot.off { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

main { max-width: 1080px; margin: 0 auto; }
.panel { background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)); border: 1px solid var(--line); border-radius: 24px;
  padding: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.muted { color: var(--dim); }
.center { text-align: center; }
.screen { animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px;
  font: 700 16px var(--text); background: rgba(255,255,255,.1); border: 1px solid var(--line); transition: transform .12s ease, filter .12s ease, background .12s; }
.btn:not(:disabled):hover { filter: brightness(1.12); }
.btn:not(:disabled):active { transform: scale(.97); }
.btn.gold { color: #3b2400; border: 0; background: linear-gradient(180deg, #ffe07a, var(--gold) 50%, var(--gold-2)); box-shadow: 0 8px 24px rgba(246,197,68,.35), inset 0 -3px 0 rgba(0,0,0,.15); }
.btn.go { color: #06290f; border: 0; background: linear-gradient(180deg, #8ff5a3, var(--go)); box-shadow: 0 8px 24px rgba(94,224,122,.3), inset 0 -3px 0 rgba(0,0,0,.15); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 18px; }
.btn.wide { width: 100%; }

input.field { width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-size: 17px; }
input.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,197,68,.2); }
input.code { text-transform: uppercase; letter-spacing: .3em; font: 700 22px ui-monospace, Menlo, monospace; text-align: center; }
label.lbl { display: block; font: 600 12px var(--text); text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 0 0 6px 4px; }

/* home */
.home { display: grid; gap: 22px; max-width: 460px; margin: 4vh auto 0; }
.hero { text-align: center; }
.hero h1 { font-size: clamp(40px, 9vw, 64px); background: linear-gradient(180deg, #fff, #ffe7a0 55%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 24px rgba(246,197,68,.25)); }
.hero p { margin: 8px 0 0; color: var(--dim); }
.fan { position: relative; height: 150px; margin: 6px auto 0; width: 260px; }
.fan .fan-i { position: absolute; left: 50%; top: 10px; width: 92px; margin-left: -46px; transform-origin: 50% 160%; animation: fan .9s cubic-bezier(.2,.9,.3,1.2) both; }
.fan .cname { display: none; }
@keyframes fan { from { transform: rotate(0deg) translateY(30px); opacity: 0; } }
.stack { display: grid; gap: 12px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.row { display: flex; gap: 10px; }
.row > .field { flex: 1; }

/* lobby */
.lobby { display: grid; gap: 18px; max-width: 760px; margin: 2vh auto 0; }
.codebox { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.codebox .code { font: 800 44px/1 ui-monospace, Menlo, monospace; letter-spacing: .22em; color: var(--gold); text-shadow: 0 0 24px rgba(246,197,68,.35); }
.seats { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.seat { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: rgba(0,0,0,.2); border: 1px solid var(--line); min-width: 0; }
.seat .av { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font: 800 22px var(--display); }
.seat.you .av { background: linear-gradient(135deg, #7fd0ff, #2b6cff); }
.seat.opp .av { background: linear-gradient(135deg, #ffb0c4, #e0406a); }
.seat.empty .av { background: rgba(255,255,255,.08); color: var(--dim); }
.seat .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat small { display: block; color: var(--dim); font-size: 12px; }
.vs { font: 800 22px var(--display); color: var(--dim); }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
/* the tile art is a whole portrait card (240x318) with its own frame: show all of it, never crop */
.cat { position: relative; aspect-ratio: 240 / 318; border-radius: 12px; overflow: hidden; background: center / 100% 100% no-repeat;
  border: 0; outline: 3px solid transparent; outline-offset: 2px;
  display: flex; align-items: flex-end; padding: 0 12% 11%; font: 700 13px/1.15 var(--text); text-align: left; transition: transform .15s, outline-color .15s; }
.cat::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.6)); }
.cat span { position: relative; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.cat.on { outline-color: var(--gold); box-shadow: 0 10px 30px rgba(246,197,68,.25); transform: translateY(-2px); }
.cat:disabled { opacity: .35; }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.seg button { padding: 8px 16px; border-radius: 10px; font-weight: 700; color: var(--dim); }
.seg button.on { background: var(--gold); color: #3b2400; }
.opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* the in-game card, layer by layer (fold, masked art, OVR frame, category badge, OVR badge) */
.card { position: relative; width: 100%; }
.fc { position: relative; width: 100%; aspect-ratio: 3 / 4; container-type: inline-size; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); }
.fc > * { position: absolute; }
.fc .fold, .fc .front { left: -3.7%; top: -2.78%; width: 26%; }
.fc .fold img, .fc .front img, .fc .score img { width: 100%; display: block; }
.fc .art { inset: 0; background: var(--art) center / cover no-repeat, linear-gradient(160deg, #4f6fb8, #23336a);
  -webkit-mask: url(/ui/mask.webp) center / 100% 100% no-repeat; mask: url(/ui/mask.webp) center / 100% 100% no-repeat; }
.fc .frame { inset: 0; width: 100%; height: 100%; }
.fc .front .icon { position: absolute; width: 62%; left: 45%; top: 47%; transform: translate(-50%, -50%); }
.fc .score { right: -3.7%; top: -2.78%; width: 28%; }
.fc .score b { position: absolute; inset: 0 0 6% 0; display: grid; place-items: center; font: 800 14.5cqw/1 var(--display); color: #fff; text-shadow: 0 .6cqw 0 rgba(0,0,0,.45); }
.cname { margin-top: 6px; text-align: center; font: 700 14px/1.2 var(--text); text-wrap: balance; }
.card.sm .cname { font-size: 11px; font-weight: 600; margin-top: 3px; }
.card.back .fc { border-radius: 9% / 7%; background: repeating-linear-gradient(45deg, #183d8a 0 10px, #12306e 10px 20px); border: 3px solid rgba(246,197,68,.6); }
.card.back .fc::after { content: "$"; position: absolute; inset: 0; display: grid; place-items: center; font: 800 40cqw var(--display); color: rgba(246,197,68,.6); }

/* match hud */
.hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; margin-bottom: 14px; }
.side { padding: 12px 14px; border-radius: 18px; background: rgba(0,0,0,.22); border: 1px solid var(--line); min-width: 0; }
.side.you { border-color: rgba(79,179,255,.35); }
.side.opp { border-color: rgba(255,122,154,.35); text-align: right; }
.side .who { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.side.opp .who { justify-content: flex-end; }
.side .who .nm { overflow: hidden; text-overflow: ellipsis; }
.money { font: 800 30px/1 var(--display); color: var(--gold); }
.money small { font-size: 16px; opacity: .8; }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 8px; }
.side.opp .slots { direction: rtl; }
.slot { aspect-ratio: 3 / 4; border-radius: 6px; border: 1px dashed rgba(255,255,255,.18); }
.slot .card .cname { display: none; }
.slot .fc { filter: none; }
.slot.new { animation: pop .5s cubic-bezier(.2,.9,.3,1.4); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.progress { text-align: center; padding-top: 6px; }
.progress b { display: block; font: 800 26px/1 var(--display); }
.progress small { color: var(--dim); font-size: 12px; }

/* auction stage */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: center; }
.reveal { position: relative; width: min(300px, 70vw); margin: 0 auto; }
.reveal .card { animation: flip .6s cubic-bezier(.2,.8,.3,1.1) both; }
@keyframes flip { from { transform: perspective(900px) rotateY(80deg) scale(.85); opacity: 0; } }
.ring { position: absolute; inset: -18px; pointer-events: none; }
.ring svg { width: 100%; height: 100%; overflow: visible; }
.ring rect { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .bar { stroke: var(--gold); transition: stroke .3s; filter: drop-shadow(0 0 6px currentColor); }
.ring .bar.warn { stroke: var(--bad); }
.decide { display: grid; gap: 14px; }
.bidnow { text-align: center; }
.bidnow .amt { font: 800 64px/1 var(--display); color: var(--gold); text-shadow: 0 0 30px rgba(246,197,68,.35); }
.bidnow .by { font-weight: 700; }
.by.you { color: var(--you); }
.by.opp { color: var(--opp); }
.turn { text-align: center; font: 700 18px var(--text); padding: 10px; border-radius: 14px; }
.turn.mine { background: rgba(94,224,122,.12); color: var(--go); }
.turn.theirs { background: rgba(255,255,255,.06); color: var(--dim); }
.secs { font-variant-numeric: tabular-nums; }
.picker { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; align-items: center; }
.picker .val { text-align: center; font: 800 40px/1 var(--display); }
.picker button { height: 56px; border-radius: 16px; background: rgba(255,255,255,.1); font: 800 26px var(--display); }
.quick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.quick button { padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.quick button.on { border-color: var(--gold); color: var(--gold); }
.acts { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }

/* ordering */
.order { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(8px, 2vw, 18px); margin: 18px 0; }
.oslot { display: grid; gap: 6px; justify-items: center; }
.oslot .rn { font: 700 12px var(--text); color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.oslot button { width: 100%; padding: 0; border-radius: 12px; transition: transform .18s cubic-bezier(.2,.9,.3,1.3); }
.oslot button.sel { transform: translateY(-10px) scale(1.04); }
.oslot button.sel .fc { filter: drop-shadow(0 0 14px var(--gold)); }
.oslot button.drop { transform: scale(1.05); }
.locked .oslot button { cursor: default; }
.bar-t { height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar-t i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: inherit; transition: width .25s linear; }
.oppcards { display: grid; grid-template-columns: repeat(5, minmax(0, 72px)); gap: 8px; justify-content: center; margin-top: 8px; }

/* battle */
.score-big { display: flex; justify-content: center; align-items: center; gap: 18px; font: 800 64px/1 var(--display); margin: 6px 0 14px; }
.score-big .y { color: var(--you); }
.score-big .o { color: var(--opp); }
.score-big .sep { color: var(--dim); font-size: 40px; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; max-width: 620px; margin: 0 auto; }
.duel .card { max-width: 230px; margin: 0 auto; transition: transform .4s, filter .4s, opacity .4s; }
.duel .left { animation: in-l .55s cubic-bezier(.2,.9,.3,1.2) both; }
.duel .right { animation: in-r .55s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes in-l { from { transform: translateX(-60px) rotate(-8deg); opacity: 0; } }
@keyframes in-r { from { transform: translateX(60px) rotate(8deg); opacity: 0; } }
.duel .won .fc { filter: drop-shadow(0 0 22px var(--gold)); }
.duel .lost { opacity: .45; filter: grayscale(.6); transform: scale(.92); }
.duel .mid { font: 800 30px var(--display); color: var(--dim); text-align: center; }
.verdict { text-align: center; margin-top: 12px; font: 800 26px var(--display); animation: enter .4s .35s both; }
.verdict.win { color: var(--go); }
.verdict.loss { color: var(--bad); }
.pips { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.pip { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 800 16px var(--display); background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--dim); }
.pip.w { background: rgba(94,224,122,.18); border-color: var(--go); color: var(--go); }
.pip.l { background: rgba(255,107,107,.15); border-color: var(--bad); color: var(--bad); }
.pip.now { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(246,197,68,.2); border-color: var(--gold); } }

/* result */
.result h1 { font-size: clamp(48px, 12vw, 88px); text-align: center; }
.result h1.win { background: linear-gradient(180deg, #fff, #ffe7a0 50%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result h1.loss { color: #c9d6f2; }
.rounds { display: grid; gap: 8px; margin: 16px 0; }
.rline { display: grid; grid-template-columns: 34px 1fr 36px 1fr; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.2); }
.rline .n { font: 800 18px var(--display); color: var(--dim); }
.rline .c { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rline .c.r { flex-direction: row-reverse; text-align: right; }
.rline .c .card { width: 40px; flex: none; }
.rline .c .card .cname { display: none; }
.rline .c span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rline .c.w span { color: var(--gold); }
.rline .mark { text-align: center; font: 800 16px var(--display); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 10; width: min(420px, 92vw); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: rgba(10,25,60,.92); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,.5); animation: toast-in .3s cubic-bezier(.2,.9,.3,1.3) both; backdrop-filter: blur(10px); }
.toast.out { animation: toast-out .3s ease forwards; }
.toast .card { width: 38px; flex: none; }
.toast .card .cname { display: none; }
.toast b.you { color: var(--you); }
.toast b.opp { color: var(--opp); }
.toast.err { border-color: var(--bad); }
@keyframes toast-in { from { transform: translateY(20px) scale(.95); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(10px); opacity: 0; } }

.notice { margin: 0 auto 12px; max-width: 640px; padding: 10px 14px; border-radius: 14px; background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.4); text-align: center; font-weight: 600; }

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; gap: 16px; }
  .reveal { width: min(220px, 58vw); }
  .money { font-size: 24px; }
  .side { padding: 10px; }
  .progress b { font-size: 20px; }
  .bidnow .amt { font-size: 48px; }
  .score-big { font-size: 48px; }
  .codebox .code { font-size: 34px; }
  .seats { grid-template-columns: 1fr; }
  .vs { display: none; }
  .cname { font-size: 12px; }
  .oslot .cname { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
