/* River — pure black, hairline borders, big light numerals, large rounded cards, one mint accent plus a
   pink→mint gradient for meters. Mobile-first (iPhone portrait 375–430px). The app stays dark even when
   the system is in light mode (color-scheme: dark keeps native controls legible). */

:root {
  --bg: #000;
  --surface: #0a0a0b;
  --surface2: #151517;
  --surface3: #1c1c1f;
  --line: #2a2a2e;
  --text: #fff;
  --muted: #8e8e96;
  --accent: #4be3c4;
  --accent-ink: #03201a;
  --pink: #ff6fae;
  --danger: #ff6676;
  --felt1: #0e3b35;
  --felt2: #061d1c;
  --card: #f7f4ee;
  --card-red: #cf3447;
  --ink: #14171c;
  --gut: 18px;
  --tab-h: 58px;
  --r-card: 28px;
  --r-inner: 20px; /* radius of shapes inside a card (corner pills, glyph tiles) */
  --gap: 12px; /* the one gap between tiles */
  --pad: 16px; /* the one tile padding */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
body.in-table { position: fixed; inset: 0; width: 100%; overflow: hidden; touch-action: manipulation; }
body.sheet-open { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
input { font: inherit; color: var(--text); }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 24px; height: 24px; flex: none; }
.center { text-align: center; }

/* ------------------------------------------------------------------ screens */
.screen {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-t)) calc(var(--gut) + var(--safe-r)) calc(28px + var(--safe-b)) calc(var(--gut) + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fadeIn 0.22s both;
}
.screen.has-tabs { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 28px); }
.lead { color: var(--muted); font-size: 16px; }
.lead b { color: var(--text); }
.small { color: var(--muted); font-size: 14px; }
.small.warn, .lead.warn { color: var(--danger); }
.fine { color: var(--muted); font-size: 12px; opacity: 0.85; padding-top: 8px; }
.muted-label { color: var(--muted); font-size: 14px; }
.muted-line { color: var(--muted); font-size: 13px; margin-top: -8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.tab-title { font-size: 30px; font-weight: 500; letter-spacing: -0.02em; margin-top: 6px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.sec-head h2 { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }

/* bottom tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: #000d; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
}
.tab .ico { width: 26px; height: 26px; }
.tab.on { color: var(--text); }
.tab.on .ico { stroke-width: 2.2; fill: #ffffff26; }
.tab:active { opacity: 0.7; }

/* home */
.top-row { display: flex; align-items: center; justify-content: space-between; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 99px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 15px; font-weight: 600;
}
.pill-gem { width: 22px; height: 22px; }
.ring-btn { position: relative; width: 48px; height: 48px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.ring-btn.ready { color: var(--text); }
.bonus-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-btn .ico { width: 22px; height: 22px; }
.ring-btn.ready::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 #4be3c488; animation: pulse 2.4s ease-out infinite; }
.hero-num { margin-top: 6px; }
.numeral { font-size: 88px; font-weight: 300; letter-spacing: -0.05em; line-height: 1; white-space: nowrap; font-family: -apple-system, "SF Pro Display", "Segoe UI Light", "Segoe UI", system-ui, sans-serif; }
.hero-num .muted-label { margin-top: 6px; padding-left: 4px; }

.carousel {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gut);
  margin: 0 calc(var(--gut) * -1); padding: 2px var(--gut) 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; outline: none;
}
.carousel::-webkit-scrollbar { display: none; }
.mode {
  flex: 0 0 78%; max-width: 330px; min-height: 206px; scroll-snap-align: start; border: 0; border-radius: var(--r-card); padding: 20px 22px;
  text-align: left; color: #14141a; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; position: relative;
}
.mode .art { position: absolute; left: 20px; top: 18px; width: 68px; height: 68px; }
.mode b { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.mode span { font-size: 15px; opacity: 0.68; }
.mode:active { transform: scale(0.985); }

.lb-wrap { display: flex; flex-direction: column; gap: 6px; }
.lb { display: flex; flex-direction: column; }
.lb-row, .you-pin { display: grid; grid-template-columns: 34px 52px 1fr; align-items: center; gap: 14px; min-height: 66px; }
.lb-row.me { background: #ffffff0d; border-radius: 18px; margin: 0 -10px; padding: 0 10px; }
.lb-note { color: var(--muted); padding: 18px 0; font-size: 15px; }
.rk { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 600; color: var(--muted); justify-self: center; }
.rk.r1 { background: #f2c14e; color: #2a2000; }
.rk.r2 { background: #cfd3dc; color: #1a1d24; }
.rk.r3 { background: #d99a68; color: #2b1606; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who b { font-size: 19px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b em { font-style: normal; font-size: 12px; color: var(--accent); margin-left: 6px; font-weight: 600; }
.who small { font-size: 15px; color: var(--muted); }
.you-pin {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); z-index: 30; margin-top: auto; padding: 8px 14px;
  background: #0b0b0dee; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 24px;
}

/* emoji avatars */
.emo-av { display: inline-grid; place-items: center; border-radius: 50%; background: var(--bg, #444); flex: none; line-height: 1; font-family: var(--emoji); }
.emo-av > span { display: block; line-height: 1; }
.emo-av.sm { width: 28px; height: 28px; font-size: 16px; }
.emo-av.md { width: 52px; height: 52px; font-size: 30px; }
.emo-av.xl { width: 148px; height: 148px; font-size: 84px; }

/* wallet */
.hero-card { border-radius: var(--r-card); padding: 22px; color: #14141a; display: grid; gap: 4px; justify-items: start; }
.hero-card small { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.6; font-weight: 600; }
.hero-card b { font-size: 58px; font-weight: 300; letter-spacing: -0.04em; line-height: 1.05; }
.hero-card span { font-size: 15px; opacity: 0.7; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; min-height: 124px; padding: var(--pad);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); color: var(--text);
}
.tile .ico { width: 28px; height: 28px; color: var(--accent); }
.tile b { font-size: 17px; font-weight: 500; }
.tile span, .tile small { font-size: 13px; color: var(--muted); }
.tile:disabled { opacity: 0.5; }
.tile:active:not(:disabled):not(.locked):not(.static) { background: var(--surface2); }
.tile.locked { opacity: 0.55; pointer-events: none; }
.tile.static { min-height: 108px; justify-content: space-between; }
.tile.static small { font-size: 14px; }
.tile.static b { font-size: 36px; font-weight: 300; letter-spacing: -0.03em; }
.tiles.three .tile { min-height: 116px; padding: 14px; align-items: center; text-align: center; }
.tiles.three .tile b { font-size: 22px; font-weight: 400; }
.tile-gem { width: 30px; height: 30px; }

/* profile */
.avatar-block { position: relative; width: 148px; margin: 6px auto 0; }
.big-av .emo-av { box-shadow: 0 0 0 1px #ffffff14; }
.edit-badge { position: absolute; right: -8px; bottom: 6px; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--bg); background: #fff; color: #000; display: grid; place-items: center; }
.edit-badge .ico { width: 20px; height: 20px; }
.p-name { background: none; border: 0; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; text-align: center; min-height: 44px; cursor: pointer; }
.surf { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); color: var(--text); }
.rank-card { display: grid; grid-template-columns: 52px 1fr; grid-template-areas: "g t" "b b"; align-items: center; gap: 12px 14px; padding: 16px; text-align: left; }
.rank-glyph { grid-area: g; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; font-weight: 600; background: linear-gradient(135deg, #ffd9cf, #c9e6ff); color: #14141a; }
.rank-text { grid-area: t; display: flex; flex-direction: column; min-width: 0; }
.rank-text b { font-size: 20px; font-weight: 500; }
.rank-text small { color: var(--muted); font-size: 14px; }
.xpbar { grid-area: b; display: block; height: 10px; border-radius: 6px; background: #1d1d20; overflow: hidden; }
.xpbar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--pink), #5ee6b5); transition: width 0.4s; }

.style-card { display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; gap: 4px; padding: 14px 12px 12px; position: relative; width: 100%; text-align: center; }
.style-card .diamond { width: 100%; height: auto; aspect-ratio: 1; display: block; }
.corner { min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-inner); display: grid; place-items: center; font-size: 12.5px; color: var(--muted); line-height: 1.15; }
.corner.tl, .corner.bl { justify-self: start; width: 100%; }
.axis { display: flex; flex-direction: column; font-size: 12px; line-height: 1.2; }
.axis b { font-size: 15px; font-weight: 500; }
.axis small { color: var(--muted); font-size: 11px; }
.axis.top b { color: #ff6fae; } .axis.left b { color: #b58cff; } .axis.right b { color: #ffb44d; } .axis.bottom b { color: #6fb8ff; }
.axis.left { align-items: flex-end; text-align: right; } .axis.right { align-items: flex-start; text-align: left; }
.style-note { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding-top: 6px; }

/* statistics -------------------------------------------------------------------------------------------------
   One grid: 2 equal columns (each 3 of 6 tracks) with a single gap token. Big tiles span 3 tracks (half), the three
   showdown tiles span 2 tracks (a third) on the same outer edges, wide tiles span all 6. Every tile shares one radius,
   one padding and one header (28px tall, title baseline fixed), and the (?) button is pinned to the same corner. */
header.bar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.stats-screen header.bar { margin: 0 -12px; }
header.bar h2 { text-align: center; font-size: 18px; font-weight: 600; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 0; background: transparent; display: grid; place-items: center; color: var(--text); }
.icon-btn:active { background: var(--surface2); }
.icon-btn.small { width: 44px; height: 44px; color: var(--muted); margin-right: -10px; }
.icon-btn .ico { width: 24px; height: 24px; }
.seg-tabs { display: flex; gap: 6px; }
.seg-tabs button { flex: 1; height: 44px; min-height: 44px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; padding: 0 6px; }
.seg-tabs button.on { background: var(--surface3); color: var(--text); }
.stats-screen #body { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.stat { position: relative; grid-column: span 3; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: var(--pad); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.stat.sm { grid-column: span 2; }
.stat.wide { grid-column: 1 / -1; gap: 12px; }
.stat-h { display: flex; align-items: center; min-height: 28px; padding-right: 32px; color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.03em; line-height: 1.2; white-space: nowrap; }
.stat.sm .stat-h { padding-right: 0; }
.help { position: absolute; top: 8px; right: 4px; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; background: transparent; color: #55555c; display: grid; place-items: center; border-radius: 50%; }
.help .ico { width: 20px; height: 20px; }
.help:active { color: var(--text); }
.stat-n { font-size: 54px; font-weight: 300; letter-spacing: -0.04em; line-height: 1; height: 54px; display: flex; align-items: baseline; white-space: nowrap; }
.stat.sm .stat-n { font-size: 38px; height: 38px; }
.stat-n.empty, .ring-wrap b.empty, .agg-list b.empty { color: #55555c; }
.u { font-style: normal; font-size: 0.42em; font-weight: 400; margin-left: 2px; letter-spacing: 0; }
.meter { display: flex; gap: 3px; }
.meter i { flex: 1; height: 8px; border-radius: 4px; background: #232327; }
.meter i.on { background: var(--c); }
.stat-w { font-size: 15px; line-height: 21px; height: 21px; }
.stat-w.empty { color: var(--muted); }
.rings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ring-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; line-height: 18px; color: var(--muted); }
.ring-wrap { position: relative; display: grid; place-items: center; width: min(100%, 72px); aspect-ratio: 1; }
.ring-wrap .gauge { width: 100%; height: 100%; display: block; }
.ring-wrap b { position: absolute; display: flex; align-items: baseline; font-size: 17px; font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.ring-wrap.big { width: 132px; }
.ring-wrap.big b { font-size: 34px; font-weight: 300; }
.agg { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: 16px; }
.agg-main { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; line-height: 20px; text-align: center; }
.agg-main small { font-size: 14px; color: var(--text); }
.agg-list li { display: flex; justify-content: space-between; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); color: var(--muted); }
.agg-list li:last-child { border-bottom: 0; }
.agg-list li.pre { opacity: 0.7; }
.agg-list b { display: flex; align-items: baseline; color: var(--text); font-weight: 400; font-size: 20px; line-height: 28px; }
.stats-screen .fine { grid-column: 1 / -1; padding-top: 4px; }
.stats-screen .muted-line { grid-column: 1 / -1; margin-top: 0; padding: 24px 0; }

/* sheets (global, bottom aligned) */
.modal-back { position: fixed; inset: 0; z-index: 100; background: #000a; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 0.18s both; }
.modal {
  width: 100%; max-width: 480px; max-height: 90dvh; overflow-y: auto; background: #0f0f11; border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0;
  padding: 10px var(--gut) calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; animation: slideUp 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: #3a3a40; align-self: center; flex: none; }
.modal h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.edit-preview { display: grid; place-items: center; }
.emoji-grid, .swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.emoji-grid button { aspect-ratio: 1; min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); font-size: 26px; font-family: var(--emoji); line-height: 1; }
.emoji-grid button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatches button { aspect-ratio: 1; min-height: 46px; border-radius: 50%; border: 3px solid var(--bg); background: var(--bg); background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
.swatches button.on { box-shadow: 0 0 0 2px var(--accent); }

/* ------------------------------------------------------------ buttons, forms */
.btn {
  min-height: 52px; padding: 0 20px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface2); font-weight: 600; font-size: 17px; text-align: center;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 22px; }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 14px; border-radius: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.dark { background: #14141a; color: #fff; border-color: transparent; min-height: 50px; padding: 0 26px; }
.btn.danger { background: #3a1b20; border-color: var(--danger); color: #ffd3d8; }
.btn:disabled { opacity: 0.45; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.field small { color: var(--muted); font-size: 13px; }
.field input:not([type=range]):not([type=checkbox]) {
  min-height: 54px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 16px; font-size: 18px; width: 100%;
}
.code-input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-size: 26px !important; font-weight: 700; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 4px; gap: 4px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1 1 auto; min-height: 46px; min-width: 0; padding: 0 4px; white-space: nowrap; border: 0; background: transparent; border-radius: 14px; font-weight: 600; font-size: 15px; color: var(--muted); letter-spacing: -0.02em; }
@media (max-width: 400px) { .seg button { font-size: 14px; } }
.seg button.on { background: var(--surface3); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 4px; }
.stepper button { width: 56px; height: 48px; border: 0; background: var(--surface2); border-radius: 14px; font-size: 26px; }
.stepper b { font-size: 22px; }
.screen.form .btn.primary.big { margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.check input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; margin-top: 1px; }

/* ---------------------------------------------------- profile: friends, emotes, backs, ranks, settings */
.profile-tab .top-row { margin-bottom: -6px; }
.profile-tab .top-row .icon-btn { color: var(--muted); margin-right: -8px; }
button.tile.btn-tile { width: 100%; font: inherit; }
.tile.static.btn-tile:active { background: var(--surface2); }
.tile.static b .u { font-size: 0.5em; color: var(--muted); margin-left: 4px; }
.add-friends { min-height: 108px; border-radius: var(--r-card); border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: 0.12em; }
.add-friends:active { background: var(--surface2); }
.rank-glyph { background: none; border-radius: 0; width: 56px; height: 56px; }
.rank-card { grid-template-columns: 56px 1fr; }
.emblem { display: block; }
.rk-list { display: grid; }
.rk-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; min-height: 64px; border-bottom: 1px solid var(--line); }
.rk-row:last-child { border-bottom: 0; }
.rk-row.ahead .emblem { opacity: 0.45; }
.rk-row.now { background: #ffffff0d; border-radius: 18px; margin: 0 -10px; padding: 0 10px; border-bottom-color: transparent; }
.rk-row .who small { font-size: 13px; }
.you-tag { font-style: normal; font-size: 12px; font-weight: 700; color: #0c0d10; background: linear-gradient(135deg, var(--pink), var(--accent)); padding: 3px 10px; border-radius: 99px; }
.done { color: var(--accent); }
.done .ico { width: 20px; height: 20px; }

.emo-grid-big { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.emo-cell { border: 1px solid var(--line); border-radius: 20px; padding: 10px 4px 6px; display: grid; justify-items: center; gap: 2px; background: var(--surface); }
.emo-cell .e { font-size: 34px; line-height: 1.2; font-family: var(--emoji); }
.emo-cell small { min-height: 15px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.emo-cell small .ico { width: 12px; height: 12px; }
.emo-cell.locked .e { opacity: 0.28; filter: grayscale(1); }

.bk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bk-cell { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: 12px 4px 8px; display: grid; justify-items: center; gap: 4px; min-height: 124px; align-content: start; }
.bk-cell b { font-size: 14px; font-weight: 500; }
.bk-cell small { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; text-align: center; }
.bk-cell small .ico { width: 12px; height: 12px; flex: none; }
.bk-cell.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bk-cell.locked .card { opacity: 0.4; filter: grayscale(0.7); }
.bk-cell:active { background: var(--surface2); }

.set-list { display: grid; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.set-row:last-child { border-bottom: 0; }
.set-row span { display: flex; flex-direction: column; min-width: 0; }
.set-row b { font-size: 17px; font-weight: 500; }
.set-row small { font-size: 13px; color: var(--muted); }
.set-row.danger b { color: var(--danger); }
.set-row .ico { width: 20px; height: 20px; color: var(--muted); }
.sw { position: relative; flex: none; width: 52px; height: 32px; border-radius: 99px; background: #26262b; transition: background 0.2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.sw.on { background: linear-gradient(135deg, var(--pink), var(--accent)); }
.sw.on::after { transform: translateX(20px); }

.fr-list { display: grid; }
.fr-row { display: grid; grid-template-columns: 52px 1fr auto auto; align-items: center; gap: 10px; min-height: 66px; border-bottom: 1px solid var(--line); }
.fr-row .who small em { font-style: normal; color: var(--accent); font-weight: 600; }
.fr-row .join { min-height: 40px; padding: 0 18px; border-radius: 99px; background: linear-gradient(135deg, var(--pink), var(--accent)); color: #0c0d10; border: 0; font-weight: 700; }
.fr-row .icon-btn.small { margin-right: -10px; color: #55555c; }
.fr-empty { color: var(--muted); padding: 16px 0; font-size: 15px; }
.fr-h { margin: 18px 0 2px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.fr-row.req { grid-template-columns: 52px 1fr auto auto; }
.fr-row.sent { grid-template-columns: 1fr auto; }
.fr-row .who small em.warn { font-style: normal; color: #ff9b8f; font-weight: 600; }
.fr-row .btn.ghost, .btn.small.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.fr-warn { color: #ff9b8f; font-size: 14px; margin: 10px 0 0; }
.fr-warn .link, button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; min-height: 32px; }
#fr-more { width: 100%; margin-top: 10px; }
.tile .badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 8px; border-radius: 99px; background: linear-gradient(135deg, var(--pink), var(--accent)); color: #0c0d10; font-size: 13px; font-weight: 700; font-style: normal; letter-spacing: 0; vertical-align: middle; }
.code-card .code-actions { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.code-card .code-actions .btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; }
.code-card .code-actions .ico { width: 18px; height: 18px; }
.fr-count { text-align: right; }

.seg-tabs.scroll { position: relative; flex: none; align-items: center; height: 44px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; margin: 0 calc(var(--gut) * -1); padding: 0 var(--gut); scroll-padding-inline: var(--gut); }
.seg-tabs.scroll::-webkit-scrollbar { display: none; }
.seg-tabs.scroll button { flex: 0 0 auto; padding: 0 18px; }

.rules { display: grid; gap: 0; }
.rules li { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 12px; min-height: 58px; border-bottom: 1px solid var(--line); }
.rules li b { font-size: 26px; font-weight: 300; letter-spacing: -0.03em; }
.rules li span { color: var(--muted); font-size: 15px; }
.sng-done { display: grid; justify-items: center; gap: 2px; text-align: center; }
.sng-done small { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; }
.sng-done .place { font-size: 84px; font-weight: 300; letter-spacing: -0.05em; line-height: 1.05; background: linear-gradient(135deg, var(--pink), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sng-done .of { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.sng-stats { width: 100%; display: grid; margin-top: 4px; }
.sng-stats li { display: flex; justify-content: space-between; align-items: center; min-height: 44px; border-top: 1px solid var(--line); color: var(--muted); }
.sng-stats b { color: var(--text); font-weight: 400; font-size: 20px; }

/* -------------------------------------------------------------------- table
   The table uses the same language as Home and Statistics: pure black, hairline rounded shapes, thin numerals,
   white + grey text and the pink→mint gradient as the single accent. Layout (phase 1.7 part A): opponents in one
   scroll-snapping row at the top, the board and pot in the middle, the action bar and two tiles (your cards, your
   avatar + stack) at the bottom. Turns stay obvious: a small ring above the acting seat (a ring on your tile when it is
   you) drains with the timer, actions pop up as bubbles, streets flip in one card at a time. */
@property --f { syntax: '<number>'; inherits: false; initial-value: 1; }

.table-root, .tbl { position: fixed; inset: 0; }
.tbl {
  --grad: linear-gradient(135deg, var(--pink), var(--accent));
  display: flex; flex-direction: column; background: #000;
  padding-top: var(--safe-t); padding-left: var(--safe-l); padding-right: var(--safe-r);
  user-select: none; -webkit-user-select: none; overflow: hidden;
}
.tbl-top { height: 52px; flex: none; display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; padding: 0 2px; }
.tbl-right { display: flex; justify-content: flex-end; }
.tbl-top .icon-btn { width: 48px; height: 48px; color: var(--muted); }
.tbl-top .icon-btn:active { color: var(--text); }
.tbl-title { text-align: center; line-height: 1.2; min-width: 0; }
.tbl-title b { display: block; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-title span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* opponents: one horizontal row across the top; with 6+ it scroll-snaps inside itself (the page never scrolls) */
.opps {
  flex: none; display: flex; align-items: flex-start; overflow-x: auto; overflow-y: hidden; padding: 10px 6px 2px;
  scroll-snap-type: x mandatory; scroll-padding-inline: 6px; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.opps::-webkit-scrollbar { display: none; }
.opps > .seat:first-child { margin-left: auto; }
.opps > .seat:last-child { margin-right: auto; }
/* middle: the board, the pot under it */
.mid { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.centre { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.street { height: 16px; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 0; }
.street.show { animation: streetIn 1.5s both; }
.potzone { position: relative; width: 100%; min-height: 70px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pot { display: flex; flex-direction: column; align-items: center; min-height: 54px; line-height: 1; }
.pot small { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.pot b { font-size: 46px; font-weight: 200; letter-spacing: -0.04em; }
.sidepots { display: flex; gap: 10px; font-size: 11px; color: var(--muted); min-height: 14px; }
.sidepots b { color: var(--text); font-weight: 500; }
.board { display: flex; gap: 5px; justify-content: center; perspective: 700px; --cw: clamp(40px, min(15.4vw, 9.4vh), 64px); }
.board .card { --cw: clamp(40px, min(15.4vw, 9.4vh), 64px); }
.banner { position: absolute; left: 0; right: 0; top: 0; max-height: 100%; overflow: hidden; text-align: center; transition: opacity 0.4s; } /* stays inside the pot area */
.banner.show { animation: bannerIn 0.35s both; }
.win-box { display: grid; gap: 2px; }
.win-line b, .win-line span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 6px; }
.win-line b { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.win-line.you b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.win-line i { font-style: normal; color: var(--muted); }
.win-line span { font-size: 14px; color: var(--muted); }
.win-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.banner.quiet .win-box { display: none; }

/* playing cards (not to be confused with .card surfaces above, which have no size) */
i.card { display: inline-block; position: relative; width: var(--cw, 44px); height: calc(var(--cw, 44px) * 1.4); border-radius: calc(var(--cw, 44px) * 0.14); flex: none; vertical-align: top; font-style: normal; background: none; border: 0; color: inherit; }
.card.face { background: #fff; color: #0c0d10; box-shadow: 0 3px 10px #000a; }
.card.face.red { color: #d83a52; }
.fourc .card.face.s0 { color: #14804a; }
.fourc .card.face.s1 { color: #1f63d8; }
.fourc .card.face.s2 { color: #d83a52; }
.fourc .card.face.s3 { color: #0c0d10; }
.card .cr { position: absolute; left: 9%; top: 4%; font-size: calc(var(--cw, 44px) * 0.5); line-height: 1; font-weight: 700; letter-spacing: -0.06em; }
.card .cs { position: absolute; right: 9%; bottom: 4%; font-size: calc(var(--cw, 44px) * 0.6); line-height: 1; font-weight: 400; }
.card.slot { border: 1px solid var(--line); background: transparent; }
.card.mini { --cw: 20px; }
.card.mini .cr { font-size: 11px; }
.card.mini .cs { font-size: 12px; }
.card.big { --cw: clamp(50px, min(15vw, 8.4vh), 64px); }
.card.dim { opacity: 0.32; filter: saturate(0.5); }
.card.hl { box-shadow: 0 0 0 1.5px var(--accent), 0 0 16px #4be3c455; transform: translateY(-6px); }
.deal-in { animation: dealIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
/* a card that turns over: both faces share the box, the back is rotated away */
.card.flip { transform-style: preserve-3d; animation: flipIn 0.55s var(--d, 0ms) cubic-bezier(0.3, 0.8, 0.3, 1) both; }
.card.flip > .card { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card.flip > .back { transform: rotateY(180deg); }
.card.flip.hl { transform-style: preserve-3d; }

/* card backs: twelve River designs drawn in CSS / SVG (never bought, never random: see unlocks.js) */
.card.back { background-color: #0d0d12; border: 1.5px solid #ffffff2b; overflow: hidden; box-shadow: 0 3px 8px #0009; background-size: 100% 100%; }
i.card.bk-river { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 84' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ff6fae'/%3E%3Cstop offset='1' stop-color='%234be3c4'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M-4 62C12 44 22 74 36 54S56 34 66 40' fill='none' stroke='url(%23g)' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M-4 74C12 58 22 84 36 66S56 50 66 56' fill='none' stroke='%234be3c4' stroke-opacity='.35' stroke-width='2'/%3E%3C/svg%3E"), linear-gradient(160deg, #0f3a40, #08191d); }
i.card.bk-pinstripe { background-image: repeating-linear-gradient(90deg, #16161c 0 3px, #2c2c35 3px 4px); }
i.card.bk-waves { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 84' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%236fb8ff' stroke-width='1.4'%3E%3Cpath d='M0 12q7.5-6 15 0t15 0 15 0 15 0'/%3E%3Cpath d='M0 26q7.5-6 15 0t15 0 15 0 15 0'/%3E%3Cpath d='M0 40q7.5-6 15 0t15 0 15 0 15 0'/%3E%3Cpath d='M0 54q7.5-6 15 0t15 0 15 0 15 0'/%3E%3Cpath d='M0 68q7.5-6 15 0t15 0 15 0 15 0'/%3E%3Cpath d='M0 82q7.5-6 15 0t15 0 15 0 15 0'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #0a1b2e, #07101c); }
i.card.bk-dots { background-image: radial-gradient(circle, #4be3c4 0 1.4px, transparent 1.9px), linear-gradient(#0e1514, #0e1514); background-size: 9px 9px, 100% 100%; }
i.card.bk-rings { background-image: repeating-radial-gradient(circle at 50% 50%, #ff6fae 0 1.2px, transparent 1.7px 7px), linear-gradient(#160d16, #160d16); }
i.card.bk-mosaic { background-image: conic-gradient(#4be3c455 0 25%, #ff6fae55 0 50%, #4be3c455 0 75%, #ff6fae55 0), linear-gradient(#0c0c12, #0c0c12); background-size: 14px 14px, 100% 100%; }
i.card.bk-ember { background-image: linear-gradient(165deg, #ff6fae 0%, #a2305a 45%, #2a0b1c 100%); }
i.card.bk-lattice { background-image: repeating-linear-gradient(45deg, #4be3c466 0 1px, transparent 1px 8px), repeating-linear-gradient(-45deg, #4be3c466 0 1px, transparent 1px 8px), linear-gradient(#0b1416, #0b1416); }
i.card.bk-dusk { background-image: linear-gradient(180deg, #2b1b4a 0%, #b0507f 65%, #f4b184 100%); }
i.card.bk-aurora { background-image: linear-gradient(115deg, #0a1020 0%, #17d6a8 38%, #7b5cff 68%, #0a1020 100%); }
i.card.bk-orbit { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 84'%3E%3Cg fill='none' stroke='%234be3c4' stroke-opacity='.65' stroke-width='1.2'%3E%3Cellipse cx='30' cy='42' rx='25' ry='9' transform='rotate(-35 30 42)'/%3E%3Cellipse cx='30' cy='42' rx='25' ry='9' transform='rotate(35 30 42)'/%3E%3Cellipse cx='30' cy='42' rx='25' ry='9' transform='rotate(90 30 42)'/%3E%3C/g%3E%3Ccircle cx='30' cy='42' r='5' fill='%23ff6fae'/%3E%3C/svg%3E"), linear-gradient(#0c0c16, #0c0c16); }
i.card.bk-glass { background-image: linear-gradient(135deg, #ffffff66, #ffffff10 45%, #ffffff44), linear-gradient(#1b1b25, #1b1b25); border-color: #ffffff77; }

/* seats: avatar, name, stack. No cards on the avatar; a pair shows under the seat at showdown only */
.seat { flex: 0 0 19%; min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.seat.folded, .seat.out { opacity: 0.35; }
.seat.offline .av { filter: grayscale(0.8); }
.seat.empty { opacity: 0.85; }
.cue { height: 22px; width: 100%; display: grid; place-items: center; }
.av-wrap { position: relative; width: 44px; height: 44px; display: block; border: 0; background: transparent; padding: 0; color: inherit; }
.av { position: relative; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--bg, #556); box-shadow: 0 0 0 2px #000; }
.av .emo { font-family: var(--emoji); font-size: 24px; line-height: 1; }
.av.ghost { background: transparent; border: 1px solid var(--line); color: #ffffff4d; font-size: 20px; font-weight: 200; box-shadow: none; }
/* the turn ring: a gradient arc that drains as the timer runs (--f from 1 to 0).
   Opponents: a small ring above the seat. You: a ring around your avatar tile. */
.ring {
  position: absolute; pointer-events: none; opacity: 0; --f: 1; transition: --f 0.2s linear, opacity 0.2s;
  background: conic-gradient(from 0deg, var(--pink), var(--accent) calc(var(--f) * 360deg), transparent calc(var(--f) * 360deg));
}
.cue .ring {
  position: relative; width: 18px; height: 18px; border-radius: 50%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
}
.ptile > .ring {
  inset: -4px; border-radius: 32px; padding: 3px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.urgent .ring { background: conic-gradient(from 0deg, #ff6676, #ffb44d calc(var(--f) * 360deg), transparent calc(var(--f) * 360deg)); }
.active .ring { opacity: 1; }
.active .av { animation: seatPulse 1.8s ease-in-out infinite; }
.active.urgent .av { animation-duration: 0.7s; } /* .urgent sits on the seat / your tile, not on the ring */
.dbtn {
  position: absolute; right: -8px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; color: #000; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px #000; font-style: normal; font-family: inherit; z-index: 2;
}
.nm { font-size: 12px; font-weight: 500; max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 5px; }
.badge { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-left: 4px; font-weight: 600; }
.badge.host { color: var(--accent); }
.st { font-size: 16px; font-weight: 200; letter-spacing: -0.02em; line-height: 1.2; }
.allin-pill { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 0.12em; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--accent); color: var(--accent); }
.bi { font-size: 10px; color: var(--muted); }
/* under the stack: the bet while betting, the cards + hand name at showdown (a fixed slot so nothing jumps) */
.sd { height: 46px; margin-top: 5px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sd > * { flex: none; } /* nothing in the slot ever shrinks: the label keeps its height, the slot grows instead */
/* ledger tables also show "in 1,000" under the seat: cards + hand label + buy-in need their own height (no clipping) */
.tbl.ledger .sd { height: 64px; }
.hole { display: flex; z-index: 1; perspective: 400px; }
.hole .card + .card { margin-left: 3px; }
.hole .card.hl { transform: none; } /* the winner's glow is enough: a lifted pair would sit on the stack numeral */
.tag { font-size: 9.5px; font-weight: 600; color: var(--text); border: 1px solid var(--line); padding: 0 4px; border-radius: 99px; max-width: calc(100% + 8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.win { background: var(--grad); color: #0c0d10; border-color: transparent; }
.seat.win .av, .me.win .av { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--accent), 0 0 24px #4be3c488; }

.bet {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 7px 3px 5px; max-width: 100%; min-width: 0; box-sizing: border-box;
  border-radius: 99px; border: 1px solid var(--line); background: #0b0b0c;
  font-size: 12.5px; font-weight: 300; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap;
}
.bet span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bet .chip { width: 10px; height: 10px; border-width: 1.5px; box-shadow: inset 0 0 0 1.5px #000, inset 0 0 0 2.5px var(--pink); }
.bet.pop { animation: betPop 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
.chip { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--accent); box-shadow: inset 0 0 0 2px #000, inset 0 0 0 3px var(--pink); background: #000; }
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 12; }
.chip.flying { position: absolute; width: 16px; height: 16px; }

/* bubbles: actions, "thinking", emotes */
.bubble {
  position: absolute; transform: translate(-50%, calc(-100% - 6px)); padding: 5px 12px; border-radius: 99px; background: #fff; color: #0c0d10;
  font-size: 13px; font-weight: 600; white-space: nowrap; animation: bubbleLife 1.6s both; z-index: 3;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.bubble.fold { background: #26262b; color: #c9ced6; }
.bubble.check { background: #e9e9ee; }
.bubble.raise, .bubble.allin { background: var(--grad); }
.emote-pop { position: absolute; transform: translate(-50%, -100%); font-size: 40px; line-height: 1; font-family: var(--emoji); animation: emotePop 2s both; z-index: 4; filter: drop-shadow(0 4px 8px #000a); }
.dots { display: inline-block; width: 1.4em; text-align: left; font-style: normal; }
.dots::after { content: ""; animation: dots 1.2s steps(4, end) infinite; }

/* bottom: the action bar above two tiles: your cards (big) and your avatar + stack */
.dock-wrap { position: relative; flex: none; padding: 0 12px calc(10px + var(--safe-b)); }
.dock { display: flex; align-items: stretch; gap: 10px; }
.ptile { position: relative; border: 1px solid var(--line); border-radius: var(--r-card); background: #060607; }
.ptile.hand { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px 8px; }
.ptile.me { flex: none; width: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 6px 8px; }
.ptile.folded { opacity: 0.5; }
.ptile.me.active { border-color: transparent; }
.ptile.me.win { border-color: var(--accent); box-shadow: 0 0 24px #4be3c444; }
.ptile .nm { margin-top: 1px; font-size: 11px; color: var(--muted); font-weight: 400; }
.ptile .st { font-size: 24px; margin-top: 5px; }
.ptile.me .av-wrap { width: 52px; height: 52px; cursor: pointer; }
.ptile.me .av .emo { font-size: 29px; }
.ptile.me .bet { position: absolute; top: -12px; left: 50%; translate: -50% 0; z-index: 2; gap: 5px; padding: 3px 9px 3px 6px; font-size: 13px; max-width: none; }
.ptile.me .bet .chip { width: 12px; height: 12px; border-width: 2px; box-shadow: inset 0 0 0 2px #000, inset 0 0 0 3px var(--pink); }
.ptile.spectate { flex: 1; text-align: center; color: var(--muted); padding: 34px 12px; }
.emo-hint { position: absolute; left: -8px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; background: #1c1c1f; color: var(--muted); display: grid; place-items: center; box-shadow: 0 0 0 2px #000; }
.emo-hint .ico { width: 13px; height: 13px; }
.mine { display: flex; justify-content: center; }
.mine .card { --rot: -5deg; transform: rotate(var(--rot)); transform-origin: 50% 100%; }
.mine .card + .card { --rot: 5deg; margin-left: -8px; }
.mine .card.hl { transform: rotate(var(--rot)) translateY(-8px); }
.hint { min-height: 18px; font-size: 13px; color: var(--text); font-weight: 500; text-align: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-chip { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); z-index: 6; padding: 5px 16px; border-radius: 99px; background: var(--grad); color: #0c0d10; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; pointer-events: none; }
.turn-chip.show { animation: chipLife 2s both; }
.bottom { position: relative; flex: none; }
/* the tray opens above the action bar (it lives in .bottom, the block holding bar + tiles), so Fold / Call / Raise stay tappable */
.tray {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 2px); z-index: 15; padding: 8px; border-radius: 24px;
  background: #0f0f11; border: 1px solid var(--line); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; animation: slideUp 0.2s both;
}
.emo-btn { position: relative; min-height: 46px; border: 0; background: transparent; border-radius: 14px; font-size: 28px; line-height: 1; font-family: var(--emoji); }
.emo-btn:active:not(.locked) { background: var(--surface2); transform: scale(1.1); }
.emo-btn.locked { opacity: 0.3; }
.emo-btn i { position: absolute; right: 4px; bottom: 4px; width: 14px; height: 14px; color: #fff; }
.emo-btn i .ico { width: 14px; height: 14px; }

/* action bar: pill buttons in the hairline style */
.actions { flex: none; position: relative; padding: 4px 12px 10px; min-height: 78px; z-index: 5; }
.btns { display: grid; grid-template-columns: 1fr 1.25fr 1.1fr; gap: 8px; }
.act {
  min-height: 58px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--text);
  font-weight: 600; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px;
}
.act b { font-weight: 700; }
.act:active:not(:disabled) { transform: scale(0.97); }
.act.fold { color: #c9ced6; }
.act.fold.soft { opacity: 0.6; }
.act.fold.armed { background: #3a1b20; border-color: var(--danger); color: #ffd3d8; opacity: 1; }
.act.call { background: #fff; color: #000; border-color: #fff; }
.act.raise { background: var(--grad); color: #0c0d10; border-color: transparent; }
.act.raise:disabled { background: transparent; color: var(--muted); border-color: var(--line); opacity: 0.5; }
.actions.mine-turn { animation: turnIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.waiting { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 18px; }
.pre { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pre button { min-height: 50px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; padding: 0 4px; }
.pre button.on { color: #0c0d10; background: var(--grad); border-color: transparent; }
/* raise: a bottom sheet in the layout (the felt gives up some height, so your cards stay visible) */
.raise-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 6px 12px 12px; display: grid; gap: 6px; }
.rs-head { display: flex; align-items: center; justify-content: space-between; }
.rs-num { display: flex; align-items: baseline; gap: 10px; }
.rs-num small { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.rs-num b { font-size: 44px; font-weight: 300; letter-spacing: -0.04em; line-height: 1.1; }
.rs-x { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; display: grid; place-items: center; }
.rs-x .ico { width: 20px; height: 20px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.presets button { min-height: 42px; border-radius: 99px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 14px; }
.presets .shove { color: var(--accent); border-color: #4be3c455; }
.slide { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; }
.step { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 24px; }
.raise-sheet .act { min-height: 52px; }
input[type=range] { width: 100%; height: 44px; background: transparent; -webkit-appearance: none; appearance: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -12px; border-radius: 50%; background: #fff; border: 3px solid var(--bg); box-shadow: 0 0 0 1px #fff; }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--bg); }

.idle { display: grid; gap: 10px; text-align: center; }
.idle p { color: var(--muted); font-size: 14px; }
.idle-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.idle-btns .btn { min-height: 54px; font-size: 16px; border-radius: 99px; }

/* table overlays and sheets */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 14px calc(16px + var(--safe-b)); background: #000d; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.panel { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; background: #0a0a0b; border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; display: grid; gap: 14px; user-select: text; -webkit-user-select: text; }
.panel h2 { font-size: 22px; letter-spacing: -0.02em; }
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 4px; }
.panel-btns { display: grid; gap: 10px; }
.buyin { display: grid; gap: 4px; }
.buyin b { font-size: 34px; font-weight: 300; letter-spacing: -0.03em; }
.code-card { background: var(--surface2); border: 1px solid var(--line); border-radius: 22px; padding: 14px; text-align: center; display: grid; gap: 4px; }
.code-card small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.code-card b { font-size: clamp(20px, 7vw, 28px); letter-spacing: 0.08em; color: var(--accent); padding-left: 0.08em; white-space: nowrap; }
.code-card span { font-size: 12px; color: var(--muted); word-break: break-all; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.players li { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); }
.players em { font-style: normal; font-size: 12px; color: var(--muted); }
.settle { width: 100%; border-collapse: collapse; font-size: 15px; }
.settle th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 4px 6px; font-weight: 600; }
.settle th:first-child, .settle td:first-child { text-align: left; }
.settle td { text-align: right; padding: 8px 6px; border-top: 1px solid var(--line); }
.settle td:last-child { font-weight: 800; }
.pos { color: var(--accent); }
.neg { color: var(--danger); }
.pay { list-style: none; padding: 0; margin: 0; }
.pay li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pay li span { flex: 1; min-width: 0; }
.pay li i { font-style: normal; color: var(--muted); }
.pay li b { font-size: 18px; }
.copy { min-height: 44px; min-width: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); font-size: 14px; font-weight: 600; }

.sheet-back { position: absolute; inset: 0; z-index: 30; display: flex; align-items: flex-end; background: #000a; }
.sheet { width: 100%; background: #0f0f11; border-radius: 28px 28px 0 0; border-top: 1px solid var(--line); padding: 10px 12px calc(12px + var(--safe-b)); display: grid; gap: 4px; max-height: 88%; animation: slideUp 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.sheet.tall { max-height: 80%; overflow-y: auto; grid-auto-rows: max-content; }
.sheet .grab { margin-bottom: 6px; }
.sheet-title { font-size: 20px; font-weight: 600; padding: 4px 8px 8px; }
.sheet-item { min-height: 54px; border: 0; background: transparent; text-align: left; padding: 0 12px; font-size: 17px; border-radius: 14px; }
.sheet-item:active { background: var(--surface2); }
.sheet-item.danger { color: var(--danger); }
.sheet-item.muted { color: var(--muted); text-align: center; border-top: 1px solid var(--line); border-radius: 0; }
.sheet-item.toggle { display: flex; align-items: center; justify-content: space-between; }
.sheet-item.toggle b { font-weight: 500; font-size: 15px; color: var(--muted); }
.sheet-item.toggle[aria-pressed="true"] b { color: var(--accent); }
.sheet-sep { height: 1px; background: var(--line); margin: 4px 0; }
.h-list { display: grid; gap: 2px; }
.h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.h-cards { display: flex; align-items: center; gap: 2px; min-width: 0; }
.h-cards .card.mini { --cw: 20px; }
.h-sep { width: 8px; }
.h-meta { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.25; }
.h-meta b { font-size: 20px; font-weight: 300; letter-spacing: -0.02em; }
.h-meta small { font-size: 12px; color: var(--muted); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-empty { color: var(--muted); font-size: 15px; padding: 18px 8px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 10px); opacity: 0; z-index: 200;
  background: #1c1c1f; border: 1px solid #3a3a40; padding: 10px 18px; border-radius: 99px; font-size: 14px; max-width: 86vw; text-align: center;
  pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
body.has-tabs #toast { bottom: calc(var(--tab-h) + var(--safe-b) + 18px); }
body.in-table #toast { bottom: calc(200px + var(--safe-b)); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* small phones: tighten the dock */
@media (max-height: 700px) {
  .act { min-height: 52px; }
  .pre button { min-height: 44px; }
  .actions { min-height: 70px; }
  .numeral { font-size: 76px; }
  .pot b { font-size: 38px; }
  .pot { min-height: 44px; }
  .potzone { min-height: 58px; }
  .rs-num b { font-size: 36px; }
  .raise-sheet .act { min-height: 46px; }
  .presets button { min-height: 38px; }
  .ptile.me .av-wrap { width: 46px; height: 46px; }
  .ptile .st { font-size: 20px; }
}
@media (max-width: 360px) {
  .agg { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
  .ring-wrap.big { width: 120px; }
  .ring-wrap.big b { font-size: 30px; }
  .stat-n { font-size: 46px; height: 46px; }
  .stat.sm .stat-n { font-size: 34px; height: 34px; }
}
@media (min-width: 520px) {
  .tbl { max-width: 520px; margin: 0 auto; }
}
/* short screens, or the raise sheet open: seats and tiles shrink so nothing overlaps (9 seats still fit) */
@media (max-height: 700px) {
  .cue { height: 18px; }
  .seat .av-wrap { width: 40px; height: 40px; }
  .seat .av .emo { font-size: 22px; }
  .seat .nm { font-size: 11px; margin-top: 3px; }
  .seat .st { font-size: 14px; }
  .sd { height: 42px; margin-top: 3px; }
  .tbl.ledger .sd { height: 58px; }
  .hole .card.mini { --cw: 17px; }
  .ptile.hand { padding: 8px 8px 6px; gap: 4px; }
  .ptile.me { padding: 6px 6px 6px; }
  .ptile .nm { display: none; }
}
.tbl.raising .cue { height: 12px; }
.tbl.raising .seat .av-wrap { width: 34px; height: 34px; }
.tbl.raising .seat .av .emo { font-size: 19px; }
.tbl.raising .seat .nm { font-size: 10.5px; margin-top: 2px; }
.tbl.raising .seat .st { font-size: 12px; }
.tbl.raising .sd { height: 24px; margin-top: 2px; }
.tbl.ledger.raising .sd { height: 42px; } /* the live bet pill + "in 1,000" */
.tbl.raising .street { display: none; }
.tbl.raising .pot { min-height: 34px; }
.tbl.raising .pot b { font-size: 28px; }
.tbl.raising .pot small { display: none; }
.tbl.raising .potzone { min-height: 38px; }
.tbl.raising .board, .tbl.raising .board .card { --cw: 34px; }
.tbl.raising .ptile .nm, .tbl.raising .ptile .bi, .tbl.raising .hint { display: none; }
.tbl.raising .ptile .st { font-size: 18px; margin-top: 2px; }
.tbl.raising .ptile.me .av-wrap { width: 38px; height: 38px; }
.tbl.raising .ptile.me { width: 96px; padding: 6px; }
.tbl.raising .ptile.hand { padding: 6px 8px; }
.tbl.raising .card.big { --cw: 40px; }
.tbl.raising .dock-wrap { padding-bottom: calc(6px + var(--safe-b)); }

/* notes for a seat scrolled out of the opponents' row: under the row at the edge on its side, arrow + name */
.bubble.edge, .emote-pop.edge { display: flex; align-items: center; gap: 5px; transform: none; max-width: 60%; font-family: inherit; animation: edgeLife 1.6s both; }
.bubble.edge { padding: 4px 11px; font-size: 12.5px; }
.bubble.edge::after { display: none; }
.emote-pop.edge { font-size: 24px; padding: 3px 11px; border-radius: 99px; background: #1c1c1f; border: 1px solid var(--line); color: #fff; filter: none; animation-duration: 2s; }
.emote-pop.edge span { font-family: var(--emoji); }
.edge small { font-size: 11px; font-weight: 600; opacity: 0.7; min-width: 0; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.edge .arr { font-style: normal; font-size: 9px; opacity: 0.6; }
@keyframes edgeLife { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dealIn { from { opacity: 0; transform: translateY(-28px) scale(0.8) rotate(-7deg); } to { opacity: 1; transform: rotate(var(--rot, 0deg)); } }
@keyframes flipIn { from { transform: rotateY(180deg) translateY(-12px); } to { transform: none; } }
@keyframes betPop { from { scale: 0.7; } to { scale: 1; } }
@keyframes bannerIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes turnIn { from { opacity: 0.2; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #4be3c488; } 70% { box-shadow: 0 0 0 12px #4be3c400; } 100% { box-shadow: 0 0 0 0 #4be3c400; } }
@keyframes seatPulse { 0%, 100% { box-shadow: 0 0 0 2px #000, 0 0 0 0 #4be3c400; } 50% { box-shadow: 0 0 0 2px #000, 0 0 16px 3px #4be3c455; } }
@keyframes bubbleLife { 0% { opacity: 0; transform: translate(-50%, calc(-100% + 2px)) scale(0.85); } 12% { opacity: 1; transform: translate(-50%, calc(-100% - 6px)) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, calc(-100% - 14px)); } }
@keyframes emotePop { 0% { opacity: 0; transform: translate(-50%, -60%) scale(0.3); } 12% { opacity: 1; transform: translate(-50%, -100%) scale(1.25); } 22% { transform: translate(-50%, -100%) scale(1); } 80% { opacity: 1; transform: translate(-50%, -112%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -125%) scale(0.9); } }
@keyframes streetIn { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes chipLife { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .bubble, .emote-pop, .turn-chip.show { animation: none !important; opacity: 1; }
  .ring { transition: none; }
}
