/* Poker Night: dark "felt" theme, phone first. */
:root {
  color-scheme: dark;
  --bg: #0b1a13;
  --felt: #10261b;
  --card: #153222;
  --card-2: #1b3d2a;
  --line: #24503a;
  --text: #eef5f0;
  --muted: #9bb8a8;
  --gold: #e8b84a;
  --gold-ink: #241a02;
  --win: #4fd68f;
  --lose: #ff7b72;
  --warn: #f2a33a;
  --blue: #6cb6ff;
  --radius: 16px;
  --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(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-top: var(--safe-t);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold); text-decoration: none; }

#app { max-width: 560px; margin: 0 auto; padding: 12px 16px calc(96px + var(--safe-b)); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; min-height: 40px; }
.top h1 { font-size: 22px; margin: 0; flex: 1; letter-spacing: -0.01em; }
.top .back { background: none; border: 0; color: var(--gold); font-size: 17px; padding: 8px 4px; cursor: pointer; }
.suit { color: var(--gold); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.tight { padding: 10px 12px; }
.card h2 { font-size: 15px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card h3 { font-size: 18px; margin: 0 0 4px; }
.card.link { cursor: pointer; }
.card.left { opacity: .62; }
.hero { text-align: center; padding: 18px 14px; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.hero .sub { color: var(--muted); margin-top: 2px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.mt { margin-top: 10px; }
.mb { margin-bottom: 10px; }
.win { color: var(--win); }
.lose { color: var(--lose); }
.gold { color: var(--gold); }
.warn { color: var(--warn); }
.strike { text-decoration: line-through; opacity: .55; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* ---------- pills ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.live { background: #3b1414; color: #ffb4ad; border-color: #6a2620; }
.pill.live::before { content: "● "; color: var(--lose); }
.pill.in { background: #123a26; color: var(--win); border-color: #22603f; }
.pill.wait { background: #3a2c0e; color: var(--gold); border-color: #6b5016; }
.pill.later { background: #3a2c0e; color: var(--gold); border-color: #6b5016; }
.pill.cash { background: #123a26; color: var(--win); border-color: #22603f; }
.pill.bank { background: #10273e; color: var(--blue); border-color: #1f4a73; }
.pill.admin { color: var(--gold); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  border-radius: 12px; padding: 11px 16px; font-weight: 650; cursor: pointer; min-height: 44px; text-align: center; }
.btn:active { transform: scale(.98); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.green { background: #1f7a4a; border-color: #2a9a5f; }
.btn.red { background: #5b1d1a; border-color: #8a2d27; color: #ffd2cd; }
.btn.blue { background: #143a5e; border-color: #24598b; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 8px 2px 0; cursor: pointer; text-decoration: underline; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btns { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.btns.three { grid-template-columns: 1fr 1fr 1fr; }
.btns.one { grid-template-columns: 1fr; }

/* ---------- forms ---------- */
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=number], input[type=date], input[type=time], select {
  width: 100%; background: var(--felt); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 46px; font-size: 17px; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 0; }
input.pin { -webkit-text-security: disc; letter-spacing: .3em; font-size: 22px; text-align: center; }
input.chips { font-size: 30px; text-align: center; font-weight: 800; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 4px; margin: 0; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--text); font-size: 17px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.err { color: var(--lose); font-size: 14px; margin-top: 8px; min-height: 1em; }

/* ---------- tabs / segmented ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--felt); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { background: none; border: 0; padding: 8px 4px; border-radius: 9px; color: var(--muted); font-weight: 650; cursor: pointer; }
.seg button.on { background: var(--card-2); color: var(--text); }

/* ---------- bottom nav ---------- */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(11, 26, 19, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); z-index: 20; }
nav.tabs .tabs-in { display: flex; width: 100%; max-width: 560px; }
nav.tabs a { flex: 1; text-align: center; color: var(--muted); padding: 8px 0 9px; font-size: 11px; font-weight: 600; }
nav.tabs a .ic { display: block; font-size: 21px; line-height: 1.25; }
nav.tabs a.on { color: var(--gold); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.link { cursor: pointer; }
.rank { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.rank.r1 { color: var(--gold); }
.amt { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles.three { grid-template-columns: 1fr 1fr 1fr; }
.tile { background: var(--felt); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- seat cards (live game) ---------- */
.seat .name { font-size: 18px; font-weight: 750; }
.seat .chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 11px; font-weight: 800;
  border: 3px dashed rgba(255,255,255,.55); }
.chip.cash { background: #1f7a4a; }
.chip.bank { background: #1f5a8f; }
.chip.later { background: #8a6512; }
.chip.void { background: #333; opacity: .4; }
.seat .acts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: 10px; }

.bar { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.bar::-webkit-scrollbar { display: none; }
.bar .tile { flex: 0 0 auto; min-width: 104px; }

/* ---------- sheet (bottom modal) ---------- */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .18s; }
#scrim.on { opacity: 1; pointer-events: auto; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; transform: translateY(105%); transition: transform .22s ease-out;
  display: flex; justify-content: center; pointer-events: none; }
#sheet.on { transform: none; }
#sheet .sheet-in { pointer-events: auto; width: 100%; max-width: 560px; background: var(--felt); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); max-height: 88vh; overflow-y: auto; }
#sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
#sheet h2 { margin: 0 0 4px; font-size: 21px; }

.toast { position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%); background: #f2f2f2; color: #111; padding: 10px 16px;
  border-radius: 12px; font-weight: 650; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.bad { background: var(--lose); color: #2a0000; }

.empty { text-align: center; color: var(--muted); padding: 22px 10px; }
.spin { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 8vh auto 0; }
.logo { text-align: center; font-size: 54px; line-height: 1; margin-bottom: 6px; }
.logo + h1 { text-align: center; margin: 0 0 18px; }

details summary { cursor: pointer; list-style-position: inside; }
details + details { margin-top: -4px; }

/* ---------- avatars & photo crop ---------- */
.av { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 50%; object-fit: cover;
  color: #fff; font-weight: 800; letter-spacing: .02em; border: 2px solid rgba(255,255,255,.12); background: var(--card-2); }
.crop { position: relative; width: min(280px, 80vw); aspect-ratio: 1; margin: 6px auto 10px; border-radius: 16px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.crop canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.crop-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
input[type=range] { width: 100%; accent-color: var(--gold); }
.crop-hint[hidden] { display: none; }
