:root {
  --felt: #0b3d2e; --felt2: #0e4d3a; --ink: #101820; --card: #fdfdfb; --red: #c62828; --gold: #f2b705;
  --good: #1b8a4b; --bad: #c0392b; --warn: #b9770e; --muted: #9fb9ae; --panel: #12251f;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--felt); color: #eef6f1; font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
button { font: inherit; color: inherit; touch-action: manipulation; }
#app { max-width: 560px; margin: 0 auto; padding: calc(8px + var(--safe-t)) 10px calc(24px + var(--safe-b)); }

.top { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; }
.stat { display: flex; flex-direction: column; min-width: 90px; }
.stat.center { flex: 1; align-items: center; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.icons { display: flex; gap: 6px; }
.icon { width: 44px; height: 44px; border-radius: 22px; border: 1px solid #ffffff30; background: #ffffff12; font-size: 20px; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); background: #00000040; border-radius: 12px; padding: 3px; margin-bottom: 8px; }
.modes button { border: 0; background: transparent; padding: 10px 4px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--muted); min-height: 44px; }
.modes button[aria-selected="true"] { background: var(--gold); color: #1d1600; }

#table { display: flex; flex-direction: column; gap: 6px; }
.seat { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--felt2); border: 2px solid transparent; border-radius: 14px; padding: 8px 10px; min-height: 76px; }
.seat.me { background: #14583f; min-height: 110px; }
.seat.active { border-color: var(--gold); }
.seat.winner { border-color: #4cd98a; box-shadow: 0 0 0 2px #4cd98a55; }
.seat.folded { opacity: .45; }
.who { display: flex; flex-direction: column; min-width: 74px; }
.who b { font-size: 17px; }
.who small { color: var(--muted); font-size: 13px; }
.cards-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cards { display: flex; gap: 4px; }
.hn { font-size: 12px; color: var(--gold); font-weight: 600; }

.card { position: relative; width: 38px; height: 54px; border-radius: 6px; background: var(--card); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; line-height: 1; box-shadow: 0 1px 3px #0008; }
.card .r { font-size: 18px; }
.card .s { font-size: 20px; margin-top: 1px; }
.card.red { color: var(--red); }
.card.back { background: repeating-linear-gradient(45deg, #1c4f9c 0 5px, #173f7d 5px 10px); border: 2px solid #fff; }
.card.wild { outline: 2px solid var(--gold); }
.card .w { position: absolute; top: -7px; right: -5px; background: var(--gold); color: #1d1600; font-style: normal; font-size: 10px; border-radius: 8px; padding: 1px 4px; }
.card.hole { box-shadow: 0 0 0 2px #fff6, 0 1px 3px #0008; border-bottom: 4px solid #1c4f9c; }
.me .card { width: 47px; height: 68px; border-radius: 8px; }
.me .card .r { font-size: 23px; } .me .card .s { font-size: 25px; }
.me .cards { gap: 3px; }
@media (max-width: 380px) { .me .card { width: 42px; height: 62px; } .card { width: 33px; height: 47px; } .who { min-width: 62px; } .card .r { font-size: 16px; } }

.banner { margin: 8px 0 0; padding: 12px; border-radius: 12px; text-align: center; font-weight: 700; background: #ffffff18; }
.banner.win { background: #1b8a4b; } .banner.lose { background: #7d2a22; }
.log { min-height: 22px; margin: 6px 2px; font-size: 13px; color: var(--muted); max-height: 5.6em; overflow: hidden; }

.actions { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; width: 100%; }
.act-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.act-row .btn { width: 100%; min-width: 0; }
.btn { min-height: 56px; padding: 8px 8px; border-radius: 14px; border: 0; font-size: 18px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.btn .btn-label { line-height: 1.15; white-space: nowrap; }
.btn .btn-amt, .btn small { font-size: 13px; font-weight: 600; opacity: .85; line-height: 1.2; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.btn:disabled { opacity: .3; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.fold { background: #8d3328; } .btn.call { background: #2f6fb5; } .btn.bet { background: var(--good); }
.btn.primary { background: var(--gold); color: #1d1600; }
.btn.wide { width: 100%; }
.btn.small { min-height: 44px; width: auto; font-size: 15px; background: #ffffff1c; padding: 0 12px; }

.coach { background: var(--panel); border: 1px solid #ffffff20; border-radius: 14px; padding: 12px 14px; }
.coach-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tag { font-size: 12px; background: #ffffff18; border-radius: 10px; padding: 2px 8px; color: var(--muted); }
.tips { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.tips li { padding-left: 12px; border-left: 4px solid #ffffff30; font-size: 15px; }
.tips li.hand { border-color: var(--gold); font-weight: 600; }
.tips li.good { border-color: #4cd98a; } .tips li.bad { border-color: #ff7a6b; } .tips li.warn { border-color: #f5b041; }
.verdict { padding: 10px 12px; border-radius: 10px; margin: 4px 0 8px; font-size: 15px; font-weight: 600; }
.verdict.good { background: #1b8a4b55; } .verdict.bad { background: #c0392b66; } .verdict.warn { background: #b9770e66; }
.ai { padding: 10px 12px; border-radius: 10px; margin: 4px 0 8px; font-size: 15px; background: #2f6fb533; }
.ai p { margin: 4px 0 0; } .ai small { color: var(--muted); } .ai.fb, .ai.loading { color: var(--muted); font-size: 14px; background: #ffffff10; }
.hint { margin-top: 6px; font-size: 15px; } .muted { color: var(--muted); }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 10px 0; font-size: 15px; min-height: 44px; }
.score { margin-top: 8px; font-size: 12px; color: var(--muted); }

.sheet { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden] { display: none; }
.panel { background: #10211b; width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 16px calc(24px + var(--safe-b)); }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; } .panel h3 { margin: 16px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { text-align: left; background: #ffffff10; border: 2px solid transparent; border-radius: 12px; padding: 10px 12px; min-height: 56px; display: flex; flex-direction: column; }
.opt.on { border-color: var(--gold); background: #f2b70522; }
.opt small { color: var(--muted); font-size: 13px; } .opt small.ready { color: #4cd98a; } .opt small.needs { color: #f5b041; }
select { width: 100%; min-height: 48px; font-size: 17px; border-radius: 10px; background: #ffffff14; color: #fff; border: 1px solid #ffffff30; padding: 0 10px; }
select option { color: #000; }
.note { font-size: 13px; color: var(--muted); margin: 6px 0; }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; min-height: 44px; }
.toggle input { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.toggle small { color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.help { padding-left: 20px; } .help li { margin-bottom: 6px; }

.bet-ctrl { width: 100%; margin: 0; padding: 4px 0 0; }
.bet-ctrl input[type=range] { width: 100%; height: 32px; accent-color: var(--gold); }
.bet-qs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.qbtn { min-height: 48px; border: 1px solid #ffffff30; background: #ffffff14; border-radius: 10px; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.qbtn small { font-weight: 600; opacity: .85; }
.qbtn.on { border-color: var(--gold); background: #f2b70533; color: var(--gold); }
.tips li.hint { border-color: #6cb6ff; }
.spread-row, .buyin { display: flex; gap: 12px; align-items: center; }
.spread-row label, .buyin { font-size: 15px; }
.spread-row input, .buyin input { width: 88px; min-height: 44px; font-size: 17px; border-radius: 10px; background: #ffffff14; color: #fff; border: 1px solid #ffffff30; padding: 0 8px; }

.whoami { font-size: 13px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }
.gate { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.gate[hidden], #app[hidden] { display: none !important; }
.gate-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid #ffffff22; border-radius: 18px; padding: 22px 18px 20px; }
.gate-card h1 { margin: 0 0 6px; font-size: 26px; }
.lede { color: var(--muted); margin: 0 0 16px; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #00000040; border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.gate-tabs button { border: 0; background: transparent; min-height: 44px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.gate-tabs button.on { background: var(--gold); color: #1d1600; }
.gate-form label { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.gate-form input, .keyin { width: 100%; min-height: 48px; font-size: 17px; border-radius: 10px; background: #ffffff14; color: #fff; border: 1px solid #ffffff30; padding: 0 12px; }
.gate-err { color: #ff7a6b; min-height: 1.2em; }
.cf-turnstile { margin: 10px 0; }
.keylist, .adminlist { list-style: none; padding: 0; margin: 8px 0; }
.keylist li, .adminlist li { padding: 8px 0; border-bottom: 1px solid #ffffff18; font-size: 15px; }
.fresh { background: #f2b70522; border: 1px solid var(--gold); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.fresh code { font-size: 18px; color: var(--gold); }
#selKeyProv { min-height: 48px; flex: 1; }

.freshlist { list-style: none; padding: 0; margin: 0; }
.fresh-invite .invite-url { word-break: break-all; }
.fresh-invite code { font-size: 14px; }
.invite-create { align-items: center; gap: 10px; margin: 8px 0 12px; }
.invite-create select { min-height: 44px; }
button.link { background: none; border: 0; color: var(--gold); text-decoration: underline; font: inherit; padding: 0; min-height: 44px; cursor: pointer; }

@media (max-width: 360px) {
  .btn { font-size: 16px; padding: 6px 4px; }
  .btn .btn-amt, .btn small { font-size: 12px; }
  .act-row { gap: 6px; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .act-row .btn, .actions > .btn { min-height: 48px; padding: 4px 6px; font-size: 16px; }
  .qbtn { min-height: 40px; }
  .bet-ctrl input[type=range] { height: 28px; }
  .seat { min-height: 56px; padding: 4px 8px; }
  .seat.me { min-height: 72px; }
  .log { margin: 2px; max-height: 2.4em; }
  .modes { margin-bottom: 4px; }
  .modes button { padding: 6px 4px; min-height: 36px; }
}

/* AI credits meter, upgrade screen, ad slot */
.meter { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: #ffffff10; }
.meter-text { font-size: 14px; font-weight: 600; }
.meter .bar { height: 8px; border-radius: 4px; background: #ffffff1f; margin: 7px 0 2px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: #4cd98a; border-radius: 4px; }
.meter.low .bar i { background: #f5b041; } .meter.out .bar i { background: #ff7a6b; }
.meter .link { padding: 0; min-height: 36px; font-size: 14px; }
.coach .meter { margin: 6px 0 4px; padding: 6px 10px; }
.coach .meter-text { font-size: 13px; font-weight: 500; color: var(--muted); }
.coach .meter .bar { height: 5px; margin: 5px 0 0; }
.coach .meter .link { display: none; }
.coach .meter.low .link { display: inline; }
.ai .link, .ai.fb .link { padding: 0; min-height: 0; font-size: inherit; }
.plans { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #ffffff10; border-radius: 12px; padding: 10px 12px; }
.plan-main { display: flex; flex-direction: column; min-width: 0; } .plan-main small { color: var(--muted); font-size: 13px; }
.plan-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.plan-price { font-weight: 800; font-variant-numeric: tabular-nums; }
.plan .btn.small { min-height: 40px; font-size: 14px; }
.plan .btn:disabled { opacity: .55; }
.note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.ad-slot { min-height: 0; margin: 8px 0; }
.ad-slot[hidden] { display: none; }
.grantrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.grantrow .link { font-size: 13px; min-height: 32px; }
.planline { color: var(--muted); font-size: 13px; }
.bot-tag { display: inline-block; font-size: 11px; line-height: 1; opacity: .55; vertical-align: 1px; margin-left: 2px; filter: grayscale(.4); }
.who b { overflow-wrap: anywhere; }
.meter-own { margin: 6px 0 4px; font-size: 13px; color: var(--muted); }

/* Multiplayer (separate screen; solo layout untouched) */
.mp-entry-row { margin: -2px 0 8px; }
.mp-entry { width: 100%; min-height: 44px; border-radius: 12px; border: 1px dashed #ffffff40; background: #ffffff0d; color: #eef6f1; font-weight: 700; font-size: 15px; }
.mp-entry small { font-weight: 500; color: var(--muted); margin-left: 4px; }
body.mp-on main, body.mp-on .modes, body.mp-on .mp-entry-row { display: none; }
.mp { display: block; }
.mp[hidden] { display: none; }
.mp-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin: 2px 0 6px; }
.mp-top h2 { margin: 0; font-size: 18px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-top .link { padding: 0; min-height: 40px; }
.mp-card { background: var(--panel); border: 1px solid #ffffff20; border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; }
.mp-card h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mp-list { list-style: none; margin: 0 0 8px; padding: 0; }
.mp-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #ffffff14; }
.mp-list li > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-list small { color: var(--muted); font-size: 12px; }
.mp-list code, .mp-meta code { font-size: 12px; background: #ffffff14; padding: 1px 5px; border-radius: 6px; }
.mp-btns { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.mp-btns .link { min-height: 28px; padding: 0; font-size: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; background: #ffffff18; color: var(--muted); margin: 2px 4px 0 0; }
.badge.coach-on { background: #1b8a4b; color: #fff; }
.mp-meta { margin: 0 0 2px; }
.mp-flash { background: #b9770e55; border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; font-size: 14px; }
.link.inline { padding: 0; min-height: 0; font-size: inherit; }
.queue { display: flex; gap: 10px; align-items: center; margin: 6px 0 8px; }
.queue b { display: block; font-size: 17px; } .queue small { color: var(--muted); font-size: 13px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #ffffff30; border-top-color: var(--gold); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.offer { background: #ffffff10; border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; } .offer p { margin: 0 0 6px; font-size: 14px; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid #ffffff30; background: #00000030; color: #fff; font-size: 17px; padding: 0 12px; letter-spacing: .08em; min-width: 0; }
.mp-seats { display: flex; flex-direction: column; gap: 6px; }
.seat.empty { min-height: 44px; opacity: .45; border: 1px dashed #ffffff30; background: transparent; }
.seat.sitout { opacity: .6; }
.who small.you { color: var(--gold); font-size: 12px; font-weight: 600; }
.turnbar { height: 6px; border-radius: 3px; background: #ffffff1f; overflow: hidden; }
.turnbar i { display: block; height: 100%; background: var(--gold); transition: width 1s linear; }
.act-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chips { display: inline-flex; gap: 4px; }
.chip { border: 1px solid #ffffff30; background: transparent; border-radius: 12px; font-size: 12px; padding: 4px 9px; min-height: 30px; color: var(--muted); }
.chip.on { background: var(--gold); color: #1d1600; border-color: var(--gold); font-weight: 700; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; font-size: 15px; }
.field select, .field input, .opt select { min-height: 40px; border-radius: 10px; background: #00000030; color: #fff; border: 1px solid #ffffff30; padding: 0 8px; font-size: 15px; }
.field input { flex: 1; max-width: 60%; }
.opt.radio { flex-direction: column; position: relative; padding-left: 40px; }
.opt.radio input { position: absolute; left: 12px; top: 14px; width: 18px; height: 18px; }
.opt.radio select { min-height: 30px; padding: 0 4px; }
.note.err { color: #ff9b8f; } .note.center { text-align: center; }
.mp-log { max-height: 7.2em; }
.btn.small.primary { background: var(--gold); color: #1d1600; }
.mp-list code { align-self: flex-start; display: inline-block; }
.mp-list li > div:first-child > b + code { margin-left: 0; }
body.mp-on .stat.center { visibility: hidden; }
.grantrow { gap: 8px; }
.grantrow .btn { min-height: 44px; padding: 8px 12px; font-size: 14px; }
.adminlist li { display: flex; flex-direction: column; gap: 4px; }
.panel { max-height: min(88dvh, 100dvh - 12px); padding-bottom: calc(36px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.hist-list { list-style: none; padding: 0; margin: 0; }
.hist-list li { border-bottom: 1px solid #ffffff18; }
.hist-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: 12px 4px; min-height: 56px; }
.hist-net { font-weight: 800; font-size: 18px; min-width: 4.2em; }
.hist-net.win, .hist-row.win .hist-net { color: #6ee7a8; }
.hist-net.lose, .hist-row.lose .hist-net { color: #ff9b8f; }
.hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-main b { font-size: 15px; }
.hist-main small { color: var(--muted); font-size: 12px; }
.hist-upgrade { margin-top: 12px; }
.hist-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 12px; }
.hist-nav b { font-size: 16px; }
.hist-seats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.hist-acts { margin: 0 0 10px; }
.hist-ai { background: #ffffff10; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.hist-ai p { margin: 6px 0 0; }
.hist-pacing { margin: 8px 0 0; }
