/* Open Face — visual system
   App colors come from the player's App color (default maroon, set in app.js), a real table (felt + rail) as the one bold element, brass for actions.
   Felt and rail colors come from the player's Table style (set in app.js). */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-var.woff') format('woff');
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}

:root {
  --ink: #1f0a10;
  --ink-2: #260c13;
  --panel: #3a121c;
  --panel-2: #4a1824;
  --panel-hi: #5a1d2b;
  --line: #6b2a39;
  --text: #f7eef0;
  --muted: #c6a7ad;
  --head: #f2d58f;
  --brass: #e0b45c;
  --brass-2: #f3d08b;
  --pos: #5fd39a;
  --neg: #ff6b5e;
  --warn: #ffb547;
  --felt-1: #2b2c2f; --felt-2: #151618;
  --rail-1: #5e1a22; --rail-2: #320b11;
  --card: #fbf7ec; --card-edge: #ddd3bd;
  --s: #1b1e24; --h: #d12f2f; --d: #2a5bc8; --c: #17703f;
  --cw: 46px; --ch: 64px;
  --display: 'Archivo', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-family: var(--display);
  color-scheme: dark;
}
:root.deck-classic { --d: #d12f2f; --c: #1b1e24; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); min-height: 100%; }
body { font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
h1, h2, h3 { margin: 0; font-stretch: 112%; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 750; }
.panel h2, .page-head h2, .modal h2, .auth h1 { color: var(--head); }
p { margin: 0 0 .6rem; }
b { font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.hidden { display: none !important; }
kbd { font: 700 .66rem var(--display); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; color: var(--muted); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- controls ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 650 .92rem var(--display);
  padding: .55rem .95rem; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1d1606; }
.btn.primary:hover:not(:disabled) { background: var(--brass-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--neg); }
.btn.small { padding: .32rem .62rem; font-size: .82rem; border-radius: 8px; }
.btn.icon { padding: .28rem .5rem; }
.btn.wide { width: 100%; }
.btn.searching { border-color: var(--brass); color: var(--brass-2); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 4px rgba(224,180,92,.18); } }
input, select { font: inherit; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: .58rem .75rem; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--brass); }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--brass); }
input[type=checkbox] { width: auto; accent-color: var(--brass); transform: scale(1.15); }
label { display: grid; gap: .3rem; font-size: .84rem; color: var(--muted); margin-bottom: .75rem; }
.field-label { font-size: .8rem; color: var(--muted); margin: .9rem 0 .4rem; font-weight: 600; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn { appearance: none; border: 0; background: transparent; color: var(--muted); font: 650 .84rem var(--display); padding: .42rem .6rem; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg-btn.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--brass); }
.seg-btn:disabled { opacity: .3; cursor: default; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }

.tag { display: inline-flex; align-items: center; gap: .2rem; font-style: normal; font-size: .68rem; font-weight: 700; padding: .08rem .45rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); margin-left: .3rem; white-space: nowrap; color: var(--text); }
.tag.fl { background: #3a2c0c; border-color: var(--brass); color: var(--brass-2); }
.tag.bad { background: #3b1513; border-color: #7a2a25; color: var(--neg); }
.tag.btn-tag { background: var(--text); color: var(--ink); border-color: var(--text); }
.tag.bot { background: #18263f; border-color: #33507a; color: #a9c8f5; }
.tag.var { background: #2c2a10; border-color: #8a7a2a; color: #f2d97a; }
.tag.turn-tag { background: var(--brass); color: #1d1606; border-color: var(--brass); }
.badge { display: inline-block; min-width: 1.15rem; padding: 0 .32rem; border-radius: 999px; background: #c0392b; color: #fff; font-size: .68rem; font-weight: 800; text-align: center; line-height: 1.15rem; }
.chip { appearance: none; display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px; padding: .28rem .65rem; font: 600 .8rem var(--display); cursor: pointer; }
.chip.on { border-color: var(--brass); color: var(--brass-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 45%, transparent); }
.dot.on { background: var(--pos); }

/* ---------- cards ---------- */
.card { display: inline-grid; place-items: center; align-content: center; width: var(--cw); height: var(--ch); border-radius: 7px; background: var(--card);
  border: 1px solid var(--card-edge); box-shadow: 0 2px 0 rgba(0,0,0,.28), 0 6px 12px -8px rgba(0,0,0,.6); line-height: 1; user-select: none; position: relative;
  font-family: var(--display); font-stretch: 85%; }
.card b { font-size: calc(var(--ch) * .34); font-weight: 800; letter-spacing: -.04em; }
.card i { font-style: normal; font-size: calc(var(--ch) * .28); margin-top: 1px; }
.card.s-s { color: var(--s); } .card.s-h { color: var(--h); } .card.s-d { color: var(--d); } .card.s-c { color: var(--c); }
.card.empty { background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.18); box-shadow: none; }
.card.back { background: repeating-linear-gradient(45deg, #2b3f6b 0 5px, #34497a 5px 10px); border-color: #1b2a4a; }
.card.staged { outline: 2px solid var(--brass); outline-offset: 1px; cursor: pointer; }
.card.staged.peek { outline-style: dashed; cursor: default; opacity: .82; }
.peek-strip { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.peek-strip .card.peek { outline: 1px dashed var(--brass); outline-offset: 1px; }
.card.pick { cursor: pointer; transition: transform .12s; }
.card.pick:hover { transform: translateY(-3px); }
.card.sel { transform: translateY(-8px); outline: 3px solid var(--brass); outline-offset: 2px; }
.card.discarded { filter: grayscale(.65) brightness(.78); transform: rotate(-5deg); }
.card.xs { --cw: 22px; --ch: 30px; border-radius: 4px; }
.card.xs b { font-size: .7rem; } .card.xs i { font-size: .58rem; margin: 0; }
.card.deal-in { animation: deal .38s cubic-bezier(.2,.8,.25,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes deal { from { transform: translate(-60px, -90px) rotate(-14deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.card.land { animation: land .32s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes land { from { transform: translateY(-14px) scale(1.12); box-shadow: 0 18px 24px -10px rgba(0,0,0,.7); } to { transform: none; } }

/* ---------- avatars ---------- */
.av { --size: 40px; position: relative; flex: none; width: var(--size); height: var(--size); border-radius: 50%; display: inline-grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c) 55%, color-mix(in srgb, var(--c) 70%, black));
  color: #fff; font-weight: 800; font-stretch: 110%; font-size: calc(var(--size) * .44); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.av-s { --size: 30px; } .av-m { --size: 42px; } .av-xl { --size: 84px; }
.av-in { display: grid; place-items: center; width: 100%; height: 100%; }
.av-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.av.ringed::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--brass) calc(var(--p, 1) * 360deg), rgba(255,255,255,.12) 0);
  -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)); }
.av.ringed.low::after { background: conic-gradient(var(--neg) calc(var(--p, 1) * 360deg), rgba(255,255,255,.12) 0); }

/* ---------- app shell ---------- */
body.in-app #app { padding-left: 88px; }
.rail { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 88px; background: var(--ink-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; gap: .2rem; padding: .8rem .45rem; }
.rail-logo { display: grid; place-items: center; margin-bottom: .7rem; }
.rail-logo .card { --cw: 30px; --ch: 42px; transform: rotate(-6deg); }
.rail-btn { appearance: none; position: relative; border: 0; background: transparent; color: var(--muted); border-radius: 12px; padding: .55rem .2rem;
  display: grid; justify-items: center; gap: .2rem; font: 600 .7rem var(--display); cursor: pointer; }
.rail-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.rail-btn.on { color: var(--brass-2); background: rgba(224,180,92,.1); }
.rail-btn.on::before { content: ''; position: absolute; left: -.45rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.rail-btn span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-badge { position: absolute; top: 4px; right: 14px; font-style: normal; min-width: 18px; height: 18px; border-radius: 9px; background: var(--panel-2);
  color: var(--text); font-size: .68rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 1px solid var(--line); }
.rail-badge.hot { background: #c0392b; border-color: #c0392b; color: #fff; }
.rail-fill { flex: 1; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem 1.2rem; background: color-mix(in srgb, var(--ink) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 60px; }
.tb-left, .tb-right { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.page-title { font-size: 1.35rem; font-weight: 800; font-stretch: 118%; white-space: nowrap; }
.tb-sep { color: var(--line); }
.page { max-width: 1240px; margin: 0 auto; padding: 1.2rem 1.2rem 2rem; }
.ver-warn { background: #4a1a14; border-bottom: 2px solid var(--neg); color: #ffd9d4; padding: .7rem 1rem; font-size: .92rem; text-align: center; position: relative; z-index: 31; }

.sound-ctl, .felt-ctl { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; }
.snd-btn { appearance: none; background: transparent; border: 0; color: var(--text); padding: .38rem .5rem; cursor: pointer; display: inline-flex; align-items: center; border-radius: 9px; }
.snd-btn:hover { background: var(--panel-2); }
.snd-btn.caret { font-size: .7rem; color: var(--muted); border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; padding: .38rem .4rem; }
.snd-btn.caret.open { color: var(--brass); }
.sound-ctl.muted .snd-btn:first-child { color: var(--neg); }
.felt-dot { display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--a), var(--b)); box-shadow: 0 0 0 2px var(--rail-1); }
.snd-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 420px; z-index: 50; box-shadow: 0 18px 50px rgba(0,0,0,.55); padding: .9rem 1rem; }
.snd-row { display: grid; grid-template-columns: 1fr 130px 2rem 1.6rem; align-items: center; gap: .5rem; margin: 0 0 .55rem; color: var(--text); font-size: .85rem; }
.snd-row.head { grid-template-columns: 1fr auto; margin-bottom: .6rem; }
.snd-row small { display: block; color: var(--muted); font-size: .7rem; line-height: 1.3; }
.snd-row > span { min-width: 0; }
.snd-row output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .78rem; text-align: right; }
.snd-test { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 6px; font-size: .65rem; padding: .2rem .3rem; cursor: pointer; }
.snd-test:hover { color: var(--brass); border-color: var(--brass); }
.felt-panel { width: 380px; max-height: calc(100vh - 90px); overflow-y: auto; }
.style-preview { display: grid; place-items: center; padding: .4rem 0 .2rem; }
.mini-table { padding: 8px; border-radius: 60px; background: linear-gradient(180deg, var(--rail-1), var(--rail-2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.mini-felt { display: flex; gap: 5px; padding: 14px 34px; border-radius: 52px; background: radial-gradient(ellipse at 50% 35%, var(--felt-1), var(--felt-2)); box-shadow: inset 0 0 18px rgba(0,0,0,.45); }
.swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.sw { appearance: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 40% 35%, var(--a), var(--b)); box-shadow: 0 0 0 1px rgba(255,255,255,.15); position: relative; margin: 0; }
.sw.rail { border-radius: 9px; background: linear-gradient(180deg, var(--a), var(--b)); }
.sw.on { border-color: var(--brass-2); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--brass); }
.sw.custom { display: grid; place-items: center; color: #fff; font-weight: 800; overflow: hidden; }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.sw-name { margin: .35rem 0 0; }
.deck-opts { display: grid; gap: .4rem; }
.deck-opt { appearance: none; text-align: left; display: grid; gap: .1rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: .5rem .7rem; cursor: pointer; font-family: var(--display); }
.deck-opt.on { border-color: var(--brass); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-content: center; gap: 1.6rem; padding: 1.5rem; width: min(420px, 100%); margin: 0 auto; }
.brand { text-align: center; }
.brand h1 { font-size: 2.8rem; font-weight: 850; font-stretch: 125%; letter-spacing: -.02em; }
.logo { display: flex; justify-content: center; gap: .2rem; margin-bottom: 1rem; --cw: 64px; --ch: 90px; }
.tilt-l { transform: rotate(-8deg); } .tilt-r { transform: rotate(8deg) translateY(4px); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--ink); border-radius: 10px; padding: 3px; margin-bottom: 1rem; border: 1px solid var(--line); }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: 650 .9rem var(--display); padding: .55rem; border-radius: 7px; cursor: pointer; }
.tab.on { background: var(--panel-2); color: var(--text); }
.hint { font-size: .8rem; color: var(--muted); margin: -.3rem 0 1rem; }

/* ---------- lobby ---------- */
.back-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem .9rem; margin-bottom: 1rem;
  background: #2a2210; border: 1px solid var(--brass); border-radius: 12px; }
.invites { display: grid; gap: .5rem; margin-bottom: 1rem; }
.invite { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; background: var(--panel); border: 1px solid var(--brass); border-radius: 12px; }
.invite > span:nth-child(2) { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.game-tile { display: grid; grid-template-columns: 210px 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.tile-art { position: relative; display: flex; justify-content: center; align-items: center; padding: 1rem;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 75%); box-shadow: inset -10px 0 0 var(--rail-2), inset -14px 0 0 var(--rail-1); --cw: 60px; --ch: 84px; }
.tile-art .card { margin: 0 -14px; }
.tile-art .card:nth-child(1) { transform: rotate(-12deg) translateY(6px); }
.tile-art .card:nth-child(3) { transform: rotate(12deg) translateY(6px); }
.tile-art.pine .card:nth-child(3) { transform: rotate(18deg) translate(10px, 18px); filter: grayscale(.7) brightness(.7); }
.tile-body { padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: .35rem; align-content: start; }
.tile-title { font-size: 1.9rem; font-weight: 850; font-stretch: 122%; line-height: 1; }
.tile-title span { font-size: .9rem; color: var(--muted); font-weight: 700; font-stretch: 100%; margin-left: .25rem; }
.tile-rule { color: var(--text); margin: .2rem 0 0; }
.tile-meta { color: var(--muted); font-size: .82rem; margin: 0 0 .4rem; }
.tile-meta b { color: var(--pos); }
.tile-actions { display: grid; gap: .5rem; }
.tile-group { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tile-label { width: 100%; font-size: .74rem; color: var(--muted); font-weight: 650; }
.lobby-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; align-items: start; }
.lobby-side { display: grid; gap: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .6rem; }
.stat { background: var(--panel-2); border-radius: 10px; padding: .6rem .65rem; display: grid; gap: .1rem; }
.stat span { font-size: .72rem; color: var(--muted); }
.stat b { font-size: 1.3rem; font-weight: 800; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.row-item:first-of-type { border-top: 0; }
.row-item small { margin-left: .4rem; }
.row-item.req { background: rgba(224,180,92,.07); border-radius: 10px; padding: .55rem; }
.row-item.me b { color: var(--brass-2); }
.friend { display: inline-flex; align-items: center; gap: .45rem; }
.add-friend { display: flex; gap: .4rem; margin-bottom: .45rem; }
.search-results { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }

/* Waiting lobby: playlists on the left, your roster of seats on the right */
.waiting-lobby { margin-bottom: 1.2rem; padding: 0; overflow: hidden; border-color: var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 40%); }
.wl-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.wl-head h2 { font-size: 1.5rem; font-weight: 850; font-stretch: 122%; }
.wl-tabs { min-width: 300px; }
.wl-body { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; }
.wl-left { padding: 1rem 1.2rem 1.2rem; border-right: 1px solid var(--line); background: rgba(0,0,0,.14); }
.wl-right { padding: 1rem 1.4rem 1.3rem; display: flex; flex-direction: column; gap: .7rem; }
.wl-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; font-weight: 750; font-stretch: 110%; margin: 0 0 .6rem; }
.wl-col-head .muted { font-weight: 500; font-size: .8rem; font-stretch: 100%; }
.wl-left .wl-col-head:not(:first-child) { margin-top: 1rem; }
.playlists { display: grid; gap: .4rem; }
.playlist { appearance: none; position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "game wait" "size wait"; align-items: center;
  text-align: left; gap: 0 .6rem; padding: .55rem .8rem .55rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); cursor: pointer; font-family: var(--display); }
.playlist:hover:not(:disabled) { border-color: color-mix(in srgb, var(--line) 60%, white); }
.playlist:disabled { opacity: .35; cursor: default; }
.playlist::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.playlist.on { border-color: var(--brass); background: var(--panel-hi); }
.playlist.on::before { background: var(--brass); }
.pl-game { grid-area: game; font-weight: 800; font-stretch: 115%; }
.pl-size { grid-area: size; color: var(--muted); font-size: .82rem; }
.pl-wait { grid-area: wait; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.pl-wait.some { color: var(--pos); font-weight: 700; }
.playlist.live .pl-wait { color: var(--brass-2); }
.wl-set { display: grid; gap: .45rem; }
.wl-set .variant-seg { max-width: none; }
.wl-friends { display: grid; gap: .35rem; max-height: 250px; overflow-y: auto; }
.wl-friend { appearance: none; display: flex; align-items: center; gap: .6rem; text-align: left; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text); cursor: pointer; font: 600 .9rem var(--display); }
.wl-friend > span:not(.av) { flex: 1; display: grid; } .wl-friend small { font-weight: 500; font-size: .74rem; }
.wl-friend.on { border-color: var(--brass); background: var(--panel-hi); }
.wl-friend:disabled { opacity: .4; cursor: default; }

/* Name plates: long bars with an emblem block and a cut corner */
.roster { display: grid; gap: .45rem; }
.plate { position: relative; display: flex; align-items: center; gap: .8rem; min-height: 58px; padding: .45rem 1.6rem .45rem .5rem;
  background: linear-gradient(90deg, var(--panel-hi), var(--panel-2) 70%); border-left: 3px solid color-mix(in srgb, var(--line) 50%, white);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%); }
.plate.you { background: linear-gradient(90deg, #4a3a14, #2c2412 70%); border-left-color: var(--brass); }
.plate.found { animation: plate-in .35s cubic-bezier(.2,.8,.25,1); }
@keyframes plate-in { from { transform: translateX(-24px); opacity: 0; } }
.plate .av { border-radius: 8px; } .plate .av-img { border-radius: 8px; }
.plate-name { display: grid; line-height: 1.2; }
.plate-name b { font-size: 1.05rem; font-stretch: 112%; }
.plate-name small { color: var(--muted); font-size: .76rem; }
.plate.you .plate-name small { color: #d8c28a; }
.plate.empty { background: rgba(255,255,255,.03); border-left-color: var(--line); color: var(--muted); }
.plate-emblem { width: 42px; height: 42px; border-radius: 8px; border: 1px dashed rgba(255,255,255,.18); flex: none; }
.plate.scan { overflow: hidden; color: var(--text); }
.plate.scan::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(224,180,92,.16), transparent);
  width: 40%; animation: scan 1.8s ease-in-out infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.wl-status { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; min-height: 2rem; font-size: .9rem; }
.wl-status.live b { color: var(--brass-2); font-stretch: 112%; }
.wl-time { font-weight: 800; font-variant-numeric: tabular-nums; margin-left: .2rem; }
.wl-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 0 rgba(224,180,92,.6); animation: pulse 1.4s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 10px rgba(224,180,92,0); } }
.wl-go { display: flex; justify-content: flex-end; margin-top: auto; }
.wl-btn { min-width: 240px; padding: .8rem 1.4rem; font-size: 1.05rem; font-weight: 800; font-stretch: 112%; }

.setup-line { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .6rem 0; }
.setup-label { font-weight: 650; }
.seg.four { grid-template-columns: repeat(4, 3rem); grid-auto-flow: row; }
.seg.three { max-width: 270px; flex: 1; }
.variant-seg { min-width: 190px; max-width: 230px; }
.table-setups { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin-bottom: .9rem; }
.table-setup { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: .75rem .85rem; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .45rem; }
.bot-cfg { border-top: 1px solid var(--line); padding-top: .55rem; margin-top: .35rem; }
.bot-num { font-size: .75rem; color: var(--muted); font-weight: 700; margin-bottom: .3rem; }
.bot-row, .add-bot { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.add-bot { grid-template-columns: 1fr 1fr auto; align-items: end; width: 100%; text-align: left; }
.add-bot .btn { margin-bottom: .75rem; }
label.sel { margin-bottom: .45rem; }
.bot-cfg p.small { margin: -.15rem 0 .25rem; }

/* ---------- the table ---------- */
.table-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; padding: 1rem 1.2rem; max-width: 1500px; margin: 0 auto; }
.felt { position: relative; display: flex; flex-direction: column; gap: .9rem; padding: 1.4rem 1.6rem; min-height: calc(100vh - 110px);
  border-radius: 140px / 90px; background: radial-gradient(ellipse at 50% 38%, var(--felt-1), var(--felt-2) 78%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 0 60px rgba(0,0,0,.45), 0 0 0 12px var(--rail-1), 0 0 0 16px var(--rail-2), 0 24px 50px -10px rgba(0,0,0,.7);
  margin: 16px; }
.pine-banner { align-self: center; background: rgba(0,0,0,.28); border: 1px solid rgba(242,217,122,.35); color: #f2d97a; border-radius: 999px; padding: .32rem .9rem; font-size: .8rem; text-align: center; }
.opponents { display: grid; gap: .8rem; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); }
.opponents.n2 { --n: 2; } .opponents.n3 { --n: 3; }
.opponents .seat { --cw: 36px; --ch: 50px; }
.my-area { margin-top: auto; display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: end; }
.seat { position: relative; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.07); border-radius: 18px; padding: .7rem .8rem; transition: border-color .2s, box-shadow .2s; }
.seat.turn { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(224,180,92,.16); }
.seat.mine { --cw: 54px; --ch: 76px; background: rgba(0,0,0,.28); }
.seat-head { position: relative; display: flex; align-items: center; gap: .55rem; margin-bottom: .5rem; }
.seat-name { display: flex; align-items: center; flex-wrap: wrap; gap: .1rem; min-width: 0; }
.seat-name b { font-stretch: 108%; }
.seat-score { margin-left: auto; font-weight: 800; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.clock { font: 800 .86rem var(--display); font-variant-numeric: tabular-nums; padding: .1rem .45rem; border-radius: 6px; background: rgba(0,0,0,.4); }
.clock.big { font-size: 1.1rem; }
.clock.low { color: var(--neg); }
.emote-bubble { position: absolute; left: 30px; top: -34px; z-index: 5; background: var(--card); color: #1b1e24; font-weight: 800; font-size: 1.05rem;
  padding: .25rem .6rem; border-radius: 14px; box-shadow: 0 8px 18px rgba(0,0,0,.4); animation: pop .25s cubic-bezier(.2,.9,.3,1.4); white-space: nowrap; }
.emote-bubble::after { content: ''; position: absolute; left: 12px; bottom: -6px; border: 6px solid transparent; border-top-color: var(--card); border-bottom: 0; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.react-btn { margin-left: .2rem; font-size: 1rem; line-height: 1; }
.react-bar { display: flex; flex-wrap: wrap; gap: .3rem; margin: -.1rem 0 .5rem; }
.react { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: .22rem .55rem; font: 650 .82rem var(--display); cursor: pointer; }
.react:hover { border-color: var(--brass); }
.timebar { height: 3px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-bottom: .5rem; }
.timebar i { display: block; height: 100%; background: var(--brass); width: 100%; transition: width .25s linear; }
.board { display: grid; gap: .32rem; }
.brow { display: grid; grid-template-columns: max(58px, var(--rlw, 0px)) auto 1fr; align-items: center; gap: .5rem; border-radius: 10px; padding: .12rem .25rem; }
.brow .cards { display: flex; gap: .25rem; }
.brow .rlabel { font-size: .7rem; color: rgba(255,255,255,.62); font-weight: 650; }
.brow .rhand { font-size: .78rem; color: rgba(255,255,255,.72); line-height: 1.15; min-width: 0; overflow-wrap: break-word; }
.brow.target { cursor: pointer; background: rgba(224,180,92,.08); outline: 1px dashed rgba(224,180,92,.5); }
.brow.target:hover { background: rgba(224,180,92,.16); }
.opponents .brow { grid-template-columns: max(46px, var(--rlw, 0px)) auto 1fr; }
.warn { margin-top: .45rem; color: var(--warn); font-weight: 650; font-size: .84rem; }
.roy { margin-top: .45rem; color: var(--brass-2); font-size: .84rem; }
.my-discards { display: flex; align-items: center; gap: .3rem; margin-top: .45rem; }

.placer { background: color-mix(in srgb, var(--ink) 84%, transparent); border: 1px solid var(--brass); border-radius: 18px; padding: .8rem 1rem; --cw: 58px; --ch: 81px; backdrop-filter: blur(4px); }
.placer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; gap: .6rem; }
.placer-head b { font-stretch: 110%; font-size: 1.02rem; }
.hand-cards { display: flex; flex-wrap: wrap; gap: .45rem; min-height: var(--ch); padding: .6rem 0 .25rem; align-items: center; }
.placer-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.discard-zone { display: grid; grid-template-columns: max(58px, var(--rlw, 0px)) auto 1fr; gap: .5rem; align-items: center; margin-top: .4rem; padding: .3rem .45rem; border-radius: 12px;
  border: 1px dashed rgba(255,107,94,.5); background: rgba(255,107,94,.06); cursor: pointer; }
.discard-zone.target { background: rgba(255,107,94,.13); }
.discard-zone .rlabel { font-size: .72rem; color: var(--neg); font-weight: 700; }
.discard-zone .cards { display: flex; gap: .25rem; }

.center-card { text-align: center; align-self: center; margin: auto; display: grid; gap: .6rem; justify-items: center; padding: 1.5rem 2rem; }
.result { align-self: center; width: min(860px, 100%); overflow-x: auto; background: color-mix(in srgb, var(--ink) 93%, transparent); }
.result-head { display: flex; justify-content: space-between; align-items: center; }
.big-pts { font-size: 2rem; font-weight: 850; font-stretch: 115%; font-variant-numeric: tabular-nums; }
.res-table, .data-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .5rem 0; }
.res-table th, .data-table th { text-align: left; font-size: .72rem; color: var(--muted); padding: .4rem; border-bottom: 1px solid var(--line); font-weight: 650; }
.res-table td, .data-table td { padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.res-table tr.me td, .data-table tr.me td { background: rgba(224,180,92,.07); }
.foul-why { color: var(--neg); font-size: .78rem; font-weight: 650; margin-top: .2rem; }
.foul-row { color: var(--neg); font-weight: 700; text-decoration: underline wavy rgba(255,107,94,.6); text-underline-offset: 3px; }
details { margin: .5rem 0; font-size: .86rem; } summary { cursor: pointer; color: var(--muted); }
.h2h { padding: .3rem 0; }
.h2h-head { font-size: .8rem; color: var(--brass); font-weight: 750; margin: .8rem 0 .4rem; }
.h2h-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; }
.h2h-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.h2h-title { font-weight: 750; margin-bottom: .3rem; }
.h2h-line { display: flex; justify-content: space-between; gap: .8rem; font-size: .85rem; padding: .16rem 0; color: var(--muted); }
.h2h-line b { font-variant-numeric: tabular-nums; }
.h2h-line.total { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .4rem; color: var(--text); font-weight: 750; }
.result-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: .6rem; }

.side { display: flex; flex-direction: column; gap: 1rem; padding-top: 16px; }
.actions { display: grid; gap: .5rem; }
.fair-ok { color: var(--pos); font-weight: 750; } .fair-bad { color: var(--neg); font-weight: 750; }
.hash { font-size: .75rem; color: var(--muted); margin-top: .4rem; word-break: break-all; font-variant-numeric: tabular-nums; }

.chat .chat-log { max-height: 260px; overflow-y: auto; display: grid; gap: .35rem; margin-bottom: .2rem; font-size: .88rem; }
.cmsg div { white-space: pre-wrap; word-break: break-word; }
.cmsg.mine b { color: var(--brass-2); }
.chat.drawer { margin: 0 .8rem .8rem; padding: .6rem .7rem; background: var(--panel-2); }
.chat.drawer .chat-log { max-height: 150px; }
.composer { display: flex; gap: .4rem; margin-top: .6rem; }

/* ---------- split screen (2–4 tables) ---------- */
.hands-ctl { display: inline-flex; align-items: center; gap: .5rem; margin-left: .6rem; }
.hands-ctl .seg.four { grid-template-columns: repeat(4, 2.2rem); }
.hands-ctl .seg-btn { padding: .26rem; }
.multi { display: grid; gap: .9rem; padding: .9rem; grid-template-columns: 1fr 1fr; max-width: 1900px; margin: 0 auto; align-items: start; }
.multi-hint { text-align: center; margin: 0 0 1rem; }
.focus-tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.mt-table { border: 2px solid var(--line); border-radius: 20px; background: var(--panel); overflow: hidden; display: flex; flex-direction: column; min-width: 0; --cw: 30px; --ch: 42px; }
.mt-table.your-turn { border-color: rgba(224,180,92,.55); }
.mt-table.active { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(224,180,92,.25); }
.mt-table.on-break { opacity: .7; }
.mt-table.on-break .mt-head { background: #2a2210; }
.mt-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; padding: .45rem .7rem; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.mt-head > b { font-stretch: 112%; }
.mt-scores { display: flex; gap: .7rem; font-size: .78rem; color: var(--muted); margin-left: auto; flex-wrap: wrap; }
.mt-scores .me { color: var(--text); font-weight: 650; }
.mt-actions { display: flex; gap: .25rem; }
.mt-actions .btn.small { padding: .22rem .5rem; font-size: .76rem; }
.mt-table .felt { min-height: 0; margin: 12px; padding: .8rem 1rem; gap: .5rem; border-radius: 70px / 46px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.4), 0 0 0 7px var(--rail-1), 0 0 0 10px var(--rail-2); }
.mt-table .pine-banner { font-size: .68rem; padding: .18rem .6rem; }
.mt-table .seat { padding: .4rem .5rem; border-radius: 14px; }
.mt-table .seat-head { margin-bottom: .25rem; font-size: .84rem; gap: .4rem; }
.mt-table .seat-head .tag { font-size: .6rem; }
.mt-table .av-m { --size: 32px; } .mt-table .av-s { --size: 24px; }
.mt-table .opponents .seat { --cw: 22px; --ch: 31px; }
.mt-table .seat.mine { --cw: 34px; --ch: 47px; }
.mt-table .brow { grid-template-columns: max(46px, var(--rlw, 0px)) auto 1fr; gap: .35rem; padding: .04rem .2rem; }
.mt-table .opponents .brow { grid-template-columns: max(38px, var(--rlw, 0px)) auto 1fr; }
.mt-table .brow .rlabel { font-size: .6rem; }
.mt-table .brow .rhand { font-size: .7rem; }
.mt-table .brow .cards { gap: .15rem; }
.mt-table .placer { --cw: 38px; --ch: 53px; padding: .5rem .6rem; }
.mt-table .placer .help { display: none; }
.mt-table .hand-cards { min-height: 0; padding: .3rem 0; gap: .3rem; }
.mt-table .placer-actions .btn { padding: .35rem .65rem; font-size: .84rem; }
.mt-table .my-area { gap: .5rem; grid-template-columns: auto minmax(0, 1fr); margin-top: 0; }
.mt-table .warn, .mt-table .roy { font-size: .75rem; margin-top: .25rem; }
.mt-table .discard-zone { grid-template-columns: max(46px, var(--rlw, 0px)) auto 1fr; }
.mt-table .center-card { padding: .8rem 1rem; }
.result.compact { padding: .6rem .7rem; font-size: .85rem; }
.result.compact .res-table { font-size: .75rem; }
.result.compact .big-pts { font-size: 1.4rem; }

/* ---------- stats ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: .8rem .9rem; display: grid; gap: .15rem; }
.kpi span { font-size: .76rem; color: var(--muted); }
.kpi b { font-size: 1.7rem; font-weight: 850; font-stretch: 115%; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: .72rem; }
.stats-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.stats-grid .chart-panel { grid-row: span 2; position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.chart .grid.zero { stroke: rgba(255,255,255,.28); }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--display); }
.chart .line { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .end-dot { fill: var(--brass); stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: rgba(255,255,255,.35); stroke-width: 1; }
.chart .hover-dot { fill: var(--brass-2); stroke: var(--panel); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; display: grid; gap: .1rem; background: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: .5rem .65rem; font-size: .8rem; box-shadow: 0 10px 24px rgba(0,0,0,.5); min-width: 190px; margin-top: 46px; margin-left: 1.1rem; }
.chart-empty { padding: 2rem 0; text-align: center; }
.bars { display: grid; gap: .7rem; padding: .3rem 0; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: .6rem; font-variant-numeric: tabular-nums; }
.bar-label { color: var(--muted); font-size: .84rem; }
.bar-track { height: 14px; background: rgba(255,255,255,.05); border-radius: 0 4px 4px 0; }
.bar-track i { display: block; height: 100%; background: var(--brass); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row b { text-align: right; }
.lb-name { display: flex; align-items: center; gap: .5rem; }
.empty-state { text-align: center; display: grid; gap: .5rem; justify-items: center; padding: 2rem; }

/* ---------- history ---------- */
.check { display: inline-flex; align-items: center; gap: .45rem; margin: 0; color: var(--text); font-size: .9rem; }
.hist-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .5rem 0 .6rem; }
.hist { border-top: 1px solid var(--line); padding: .5rem 0; }
.hist.open { background: rgba(255,255,255,.02); }
.hist-row2 { display: grid; grid-template-columns: auto 180px minmax(120px, 1fr) auto auto 50px auto; gap: .7rem; align-items: center; }
.hist-when { display: grid; } .hist-pts { text-align: right; font-variant-numeric: tabular-nums; }
.hist-vs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-detail { padding: .7rem 0 .3rem 2rem; display: grid; gap: .6rem; justify-items: start; }
.hist-detail > * { width: 100%; }
.hist-detail > .btn { width: auto; }
.hist-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: .6rem; --cw: 32px; --ch: 45px; }
.mini-board { display: flex; gap: .6rem; flex-wrap: wrap; } .mini-board > span { display: flex; gap: 2px; }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; }
.conv { padding: .55rem .6rem; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.conv:hover { background: var(--panel-2); } .conv.sel { border-color: var(--brass); background: var(--panel-2); }
.conv-top { display: flex; gap: .4rem; align-items: center; } .conv-top .muted { margin-left: auto; }
.conv-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-friends .chip { margin: 0 .3rem .3rem 0; }
.thread-wrap { display: flex; flex-direction: column; min-height: 60vh; }
.thread { flex: 1; overflow-y: auto; max-height: 60vh; display: flex; flex-direction: column; gap: .5rem; padding: .3rem 0; }
.msg { max-width: 75%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: .45rem .7rem; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: #2a2210; border-color: rgba(224,180,92,.5); }
.msg-meta { font-size: .7rem; color: var(--muted); } .msg-body { white-space: pre-wrap; word-break: break-word; }

/* ---------- modals ---------- */
.modal-bg { position: fixed; inset: 0; background: color-mix(in srgb, var(--ink) 75%, transparent); display: grid; place-items: center; z-index: 60; padding: 1rem; }
.modal { width: min(1000px, 100%); max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; gap: 1rem; }
.avatar-modal { width: min(480px, 100%); }
.av-preview { display: flex; align-items: center; gap: 1rem; padding: .3rem 0 .4rem; }
.av-preview > span:last-child { display: grid; gap: .15rem; }
.av-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.av-pick { appearance: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 800 1.1rem var(--display); cursor: pointer; }
.av-pick.on { border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass); }
.av-swatch { appearance: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; }
.av-swatch.on { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--brass); }
.avatar-modal .btn.wide { margin-top: 1rem; }
.photo-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.photo-row label.btn { display: inline-flex; margin: 0; color: var(--text); }
.replay { width: min(1100px, 100%); }
.replay-felt { min-height: 0; margin: 14px; padding: 1rem 1.2rem; border-radius: 90px / 60px; }
.replay-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .7rem; --cw: 36px; --ch: 50px; }
.replay-desc { text-align: center; margin: .6rem 0; min-height: 1.4em; }
.replay-ctl { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.replay-ctl input[type=range] { width: 200px; }

/* ---------- Fantasy Land dragons ---------- */
/* Two gold dragons coil up the left and right edges of the felt, behind the boards. */
.felt > * { position: relative; z-index: 1; }
.felt > .fl-dragons { position: absolute; z-index: 0; inset: 4% -1.5%; pointer-events: none; display: flex; justify-content: space-between; align-items: center; }
.dragon { height: 92%; width: auto; max-width: 17%; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); opacity: .9;
  animation: dragon-float 7s ease-in-out infinite; animation-delay: var(--t, 0s); }
.dragon-right { animation-delay: calc(var(--t, 0s) - 3.5s); }
.fl-dragons.arriving .dragon { animation: dragon-in 1.5s cubic-bezier(.2,.8,.25,1) both, dragon-float 7s ease-in-out infinite; animation-delay: var(--t, 0s), var(--t, 0s); }
@keyframes dragon-float { 50% { transform: translateY(-8px); } }
@keyframes dragon-in { from { opacity: 0; transform: translateY(40px) scale(.9); } to { opacity: .9; } }
.dragon .skin { fill: var(--gold); stroke: #6e430b; stroke-width: 1.4; stroke-linejoin: round; }
.dragon .belly { fill: #fde9a6; opacity: .85; }
.dragon .plates { fill: none; stroke: #b98322; stroke-width: 1; opacity: .8; }
.dragon .scales { fill: none; stroke: #8f5c12; stroke-width: 1.1; opacity: .75; }
.dragon .fin, .dragon .mane { fill: var(--fin); stroke: #7a4a0c; stroke-width: 1; stroke-linejoin: round; }
.dragon .limb { fill: none; stroke: #7a4a0c; stroke-width: 9; stroke-linecap: round; }
.dragon .limb-hi { fill: none; stroke: #f0bd48; stroke-width: 6.5; stroke-linecap: round; }
.dragon .claw { fill: none; stroke: #fff3c4; stroke-width: 2.2; stroke-linecap: round; }
.dragon .horn { fill: none; stroke: #f6d27a; stroke-width: 4; stroke-linecap: round; }
.dragon .whisker { fill: none; stroke: #ffe39a; stroke-width: 1.8; stroke-linecap: round; }
.dragon .mouth { fill: #a3241c; }
.dragon .tooth { fill: #fffaf0; }
.dragon .brow { fill: none; stroke: #6e430b; stroke-width: 2.4; stroke-linecap: round; }
.dragon .eye { fill: #fffbe8; stroke: #6e430b; stroke-width: 1; }
.dragon .pupil { fill: #2a1600; }
.dragon .nose { fill: #e3a93a; stroke: #6e430b; stroke-width: 1; }
.dragon .pearl { fill: #fff8e6; stroke: #e8c06a; stroke-width: 1.5; }
.dragon .pearl-hi { fill: #fff; }
.dragon .pflame { fill: #f3b33d; opacity: .85; }
/* While the dragons are out, seat panels get a darker backing so every card and label stays easy to read. */
.felt.fl-on .seat { background: color-mix(in srgb, var(--ink) 60%, transparent); }
.mt-table .felt > .fl-dragons { inset: 3% -1%; }
.mt-table .dragon { max-width: 15%; opacity: .8; }
/* Phones: the felt is narrow, so the pair lies sideways in a slim band at the top of the table, heads toward each other. */
@media (max-width: 760px) {
  .felt > .fl-dragons { position: relative; inset: auto; height: 50px; justify-content: center; gap: 10px; margin: -4px 0 -6px; }
  .dragon { width: 50px; height: 132px; max-width: none; opacity: .95; margin: -41px 41px; animation: none !important; }
  .dragon-left { transform: rotate(90deg); }
  .dragon-right { transform: rotate(-90deg); }
}

/* Music switch: a small pill sitting on the table's rail, top center. */
.felt > .music-btn { position: absolute; z-index: 3; top: -15px; left: 50%; transform: translateX(-50%); appearance: none; cursor: pointer;
  font: 700 .74rem var(--display); padding: .22rem .7rem; border-radius: 999px; border: 1px solid #7a4a0c; background: #2a1d08; color: #e8c879; white-space: nowrap; }
.felt > .music-btn.on { background: linear-gradient(180deg, #f6d27a, #d89a26); color: #2a1600; border-color: #9c6512; }
.mt-table .felt > .music-btn { top: -11px; font-size: .66rem; padding: .14rem .55rem; }

/* ---------- language menu ---------- */
.lang-pick { position: relative; display: inline-flex; align-items: center; gap: .3rem; margin: 0; color: var(--text); font-size: .85rem; }
.lang-pick select { width: auto; padding: .38rem 1.6rem .38rem .55rem; border-radius: 10px; font-size: .85rem; background: var(--ink); cursor: pointer; }
.lang-pick.compact .lang-globe { display: none; }
.lang-pick.wide { display: flex; } .lang-pick.wide select { width: 100%; }
.auth-lang { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 5; }
@media (max-width: 760px) { .lang-pick.compact select { max-width: 92px; padding-right: 1.2rem; } }
/* Fonts for other writing systems (the app font covers Western European letters). */
:root:lang(zh-CN) { --display: 'Archivo', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', system-ui, sans-serif; }
:root:lang(zh-TW) { --display: 'Archivo', 'PingFang TC', 'Hiragino Sans CNS', 'Microsoft JhengHei', 'Noto Sans TC', 'Noto Sans CJK TC', system-ui, sans-serif; }
:root:lang(ja) { --display: 'Archivo', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', 'Noto Sans CJK JP', system-ui, sans-serif; }
:root:lang(ko) { --display: 'Archivo', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans CJK KR', system-ui, sans-serif; }
:root:lang(vi), :root:lang(ru) { --display: system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Roboto, Arial, sans-serif; }
:root:lang(zh-CN) body, :root:lang(zh-TW) body, :root:lang(ja) body, :root:lang(ko) body { letter-spacing: .01em; }

/* ---------- safety, alerts, settings ---------- */
textarea { font: inherit; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: .58rem .75rem; width: 100%; resize: vertical; }
textarea:focus { outline: none; border-color: var(--brass); }
.more-btn { margin-left: .1rem; color: var(--muted); }
.seat-score + .more-btn { margin-left: .2rem; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0 .4rem; }
.avatar-modal h2.mt, .player-modal h2.mt { margin: 1rem 0 .35rem; font-size: .98rem; }
.player-modal { width: min(460px, 100%); }
.reasons { display: grid; gap: .35rem; margin: .3rem 0 .7rem; }
.reasons .check, .player-modal .check { font-size: .9rem; }
input[type=radio] { width: auto; accent-color: var(--brass); }
.danger-zone { border: 1px solid #7a2a25; background: rgba(255,107,94,.06); border-radius: 12px; padding: .8rem .9rem; }
.btn.danger-fill { background: #b3372d; border-color: #b3372d; color: #fff; }
.btn.danger-fill:hover:not(:disabled) { background: #cf4337; border-color: #cf4337; }
.blocked-list .row-item:first-child { border-top: 0; }
.alerts-bar { background: var(--panel-2); border-color: var(--line); }
.fair-alert { border-color: var(--neg); background: #2b1416; }
.fair-alert h2 { color: var(--neg); }
.fair-record summary { font-size: .8rem; }

/* ---------- toasts & connection ---------- */
.toasts { position: fixed; bottom: calc(1rem + env(safe-area-inset-bottom)); right: 1rem; display: grid; gap: .4rem; z-index: 70; width: min(340px, calc(100% - 2rem)); pointer-events: none; }
.toast { font-size: .9rem; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--brass); padding: .62rem .85rem; border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.45); transition: opacity .4s, transform .4s; }
.toast.bad { border-left-color: var(--neg); }
.toast.out { opacity: 0; transform: translateX(8px); }
.toast:nth-last-child(n+4) { display: none; }
.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--warn); color: #1d1606; text-align: center; font-weight: 750; padding: .3rem; z-index: 80; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .multi { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid .chart-panel { grid-row: auto; }
}
@media (max-width: 900px) {
  .tiles, .lobby-cols, .table-wrap, .inbox { grid-template-columns: 1fr; }
  .game-tile { grid-template-columns: 150px 1fr; }
  .tile-art { --cw: 46px; --ch: 64px; }
  .my-area { grid-template-columns: 1fr; }
  .felt { min-height: auto; padding: 1rem; border-radius: 40px; margin: 12px; }
  .opponents, .opponents.n2, .opponents.n3 { grid-template-columns: 1fr; }
  .placer { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 6; }
  .placer .help { display: none; }
  .hist-row2 { grid-template-columns: auto 1fr auto auto; } .hist-row2 .hist-vs, .hist-row2 .mini-board { display: none; }
}
@media (max-width: 860px) {
  .wl-body { grid-template-columns: minmax(0, 1fr); }
  .wl-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .playlists { grid-template-columns: 1fr 1fr; }
  .wl-tabs { min-width: 0; width: 100%; }
  .wl-btn { width: 100%; min-width: 0; }
}
@media (max-width: 760px) {
  body { touch-action: manipulation; }
  input, select { font-size: 16px; }              /* stops iPhone zooming in when you tap a box */
  .card { -webkit-touch-callout: none; }
  .btn, .seg-btn, .chip, .playlist, .wl-friend { min-height: 40px; }
  .btn.small { min-height: 34px; }
  .focus-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .back-bar { padding: .5rem .6rem; }
  body.in-app #app { padding-left: 0; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .rail { top: auto; right: 0; width: auto; height: calc(62px + env(safe-area-inset-bottom)); flex-direction: row; padding: .3rem .4rem env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; }
  .rail-logo, .rail-fill { display: none; }
  .rail-btn { flex: 1 1 0; min-width: 0; padding: .35rem 0; }
  .rail-btn.on::before { left: 22%; right: 22%; top: -.3rem; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .rail-btn span { font-size: .62rem; max-width: 100%; }
  .rail-badge { right: 22%; }
  .topbar { padding: .55rem .8rem; gap: .5rem; }
  .tb-left { flex: 1; overflow: hidden; white-space: nowrap; }
  .tb-left > *:not(.page-title) { display: none; }
  .page-title { font-size: 1.1rem; }
  .hands-ctl, [data-act=fullscreen] { display: none !important; }
  .table-wrap { grid-template-columns: minmax(0, 1fr); padding: .4rem .6rem; }
  .page { padding: .8rem .8rem 1.5rem; }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom)); left: 1rem; width: auto; }
  .snd-panel { position: fixed; top: 64px; left: 8px; right: 8px; width: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .game-tile { grid-template-columns: 1fr; }
  .tile-art { padding: 1.2rem; box-shadow: inset 0 -8px 0 var(--rail-2), inset 0 -11px 0 var(--rail-1); }
}
@media (max-width: 520px) {
  :root { --cw: 38px; --ch: 54px; }
  .placer { --cw: 46px; --ch: 64px; }
  .seat.mine { --cw: min(46px, calc((100vw - 150px) / 5.3)); --ch: calc(var(--cw) * 1.39); }
  .opponents .seat { --cw: 30px; --ch: 42px; }
  .brow { grid-template-columns: max(46px, var(--rlw, 0px)) auto; } .brow .rhand { grid-column: 2; }
  .felt { padding: .8rem; border-radius: 26px; margin: 10px; }
  .res-table { font-size: .76rem; }
  .bot-row, .add-bot { grid-template-columns: 1fr; }
  .playlists { grid-template-columns: 1fr 1fr; }
  .playlist { grid-template-columns: 1fr; grid-template-areas: "game" "size" "wait"; padding: .45rem .7rem .45rem .85rem; }
  .pl-wait { margin-top: .1rem; }
  .wl-left, .wl-right { padding: .9rem; }
  .wl-head { padding: .8rem .9rem; } .wl-head h2 { font-size: 1.3rem; }
  .plate { min-height: 50px; }
  .plate { padding-right: 1.2rem; }
}
/* Longer words (German, Russian, Vietnamese…) — let the placer buttons wrap instead of spilling off a phone screen */
.placer-actions { flex-wrap: wrap; }
@media (max-width: 760px) { .placer-actions .btn { flex: 1 1 auto; min-width: 0; padding-left: .6rem; padding-right: .6rem; } }
/* Long row names (e.g. Russian “Середина”) hyphenate instead of running into the cards */
.brow .rlabel { white-space: nowrap; }

/* ---------- App color (v0.15) ---------- */
.sw.theme { border-radius: 10px; background: linear-gradient(135deg, var(--a), var(--b)); }
.linkish { appearance: none; background: none; border: 0; padding: 0; color: var(--brass-2); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Flags ---------- */
.flag { display: inline-block; width: 1.35em; height: 1em; object-fit: cover; border-radius: 2px; vertical-align: -.12em; margin-left: .35em;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35); flex: none; }
.flag-pick { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
.flag-pick .flag-preview { width: 2.6rem; display: grid; place-items: center; }
.flag-pick .flag-preview .flag { width: 2.2rem; height: 1.65rem; margin: 0; }
.check-line { display: flex; gap: .55rem; align-items: flex-start; font-size: .84rem; color: var(--muted); margin: 0 0 .75rem; }
.check-line input { margin-top: .2rem; }
.auth .hint, .fine { font-size: .76rem; color: var(--muted); }

/* ---------- Typing language + quick phrases (chat) ---------- */
.composer-wrap { margin-top: .6rem; }
.composer-wrap .composer { margin-top: 0; }
.kbd-btn { flex: none; min-width: 3.1rem; }
.kbd-panel { margin-top: .45rem; padding: .6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); }
.kbd-panel.hidden { display: none; }
.kbd-langs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.kbd-langs .chip.on { border-color: var(--brass); color: var(--brass-2); }
.phrases { display: flex; flex-wrap: wrap; gap: .3rem; }
.phrase { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px; padding: .32rem .7rem; font: 600 .84rem var(--display); cursor: pointer; }
.phrase:hover { border-color: var(--brass); }
.kbd-tip { margin: .5rem 0 0; }
@media (max-width: 760px) {
  .felt-panel { width: min(380px, calc(100vw - 20px)); }
  .phrase { padding: .45rem .8rem; font-size: .9rem; }   /* bigger tap targets */
}
.warn-text { color: var(--warn); }

/* ---------- "Your turn" banner (v0.16.1) ---------- */
.turn-banner { position: fixed; z-index: 90; left: 10px; right: 10px; margin: 0 auto; max-width: 520px; top: calc(env(safe-area-inset-top) + 10px); transform: translateY(-160%); display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; text-align: left;
  appearance: none; border: 1px solid var(--brass); border-radius: 16px; cursor: pointer; color: var(--text); font: inherit;
  background: color-mix(in srgb, var(--panel-2) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px rgba(0,0,0,.5); transition: transform .35s cubic-bezier(.2,.9,.25,1.15); }
.turn-banner.in { transform: translateY(0); }
.turn-banner.out { transform: translateY(-160%); transition-timing-function: ease-in; }
.turn-banner .tb-icon { font-size: 1.7rem; line-height: 1; }
.turn-banner .tb-text { display: grid; flex: 1; min-width: 0; }
.turn-banner .tb-text b { color: var(--head); font-size: 1rem; }
.turn-banner .tb-text span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-banner .tb-go { flex: none; background: var(--brass); color: #1d1606; font-weight: 750; font-size: .84rem; padding: .42rem .75rem; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .turn-banner { transition: none; } }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.seg-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Fitting long words (v0.16.2) ---------- */
/* fitText() in app.js shrinks text that doesn't fit; .fit-wrap lets it use two lines. */
.fit-wrap { white-space: normal !important; text-overflow: clip !important; line-height: 1.12; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; text-align: center; }
.btn.fit-wrap, .chip.fit-wrap { padding-top: .3rem; padding-bottom: .3rem; }
.seg-btn { overflow: hidden; text-overflow: ellipsis; }
.lbl-short { display: none; }
@media (max-width: 760px) {
  .rail-btn .lbl-full { display: none; }
  .rail-btn .lbl-short { display: block; }
  .rail-btn > span { max-width: 100%; }
  /* sound panel: labels wrap instead of pushing the sliders off screen */
  .snd-row { grid-template-columns: minmax(0, 1fr) minmax(70px, 110px) 1.9rem 1.6rem; }
  .snd-row small { white-space: normal; max-width: none; }
  .snd-row > span, .snd-row > label { min-width: 0; }
}
/* Filter switches in a page header never get squeezed narrower than their words;
   on phones each one gets its own full-width row. */
.page-head > .seg { flex: 0 1 auto; min-width: min(100%, max-content); }
@media (max-width: 760px) { .page-head > .seg { flex: 1 1 100%; } }
.brow .rlabel.fit-wrap { white-space: normal !important; overflow-wrap: normal; }
/* Hand results on a phone: one block per player (name + points, then one line per row)
   instead of a six-column table, so long hand names in any language have room. */
.cell-lbl { display: none; }
@media (max-width: 520px) {
  .res-table thead { display: none; }
  .res-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .6rem; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
  .res-table td { border: 0 !important; padding: .1rem 0 !important; }
  .res-table td.c-name { grid-column: 1; grid-row: 1; font-weight: 700; }
  .res-table td.c-pts { grid-column: 2; grid-row: 1; text-align: right; font-size: 1.1rem; }
  .res-table td.c-row, .res-table td.c-roy { grid-column: 1 / -1; display: flex; align-items: baseline; gap: .5rem; }
  .res-table td.c-roy:has(.desk-only) { display: none; }
  .res-table .cell-lbl { display: inline-block; flex: none; min-width: 5.2em; color: var(--muted); font-size: .72rem; }
  .res-table .c-row .small { font-size: .85rem; }
  .res-table tr.me { background: rgba(224,180,92,.07); border-radius: 10px; }
  .res-table tr.me td { background: none !important; }
}

/* Medium screens (small laptops, tablets): the top bar drops the extra words before anything
   can be pushed off the edge, and the table's side column gets a little narrower. */
.tb-left > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-left { flex: 1 1 auto; } .tb-right { flex: none; }
@media (max-width: 1180px) {
  .hands-ctl > .muted, .tb-left > .tb-sep, .tb-left > span.muted { display: none; }
  .tb-right .lang-pick:not(.wide) select { max-width: 140px; }
  @media (min-width: 761px) { .table-wrap { grid-template-columns: minmax(0, 1fr) 270px; } }
}
.tb-left > span.tb-status { flex: none; overflow: visible; }

/* ---------- Hand history filters (v0.17) ---------- */
.hist-filters { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(140px, 1fr); gap: .6rem .8rem; align-items: end; margin: .2rem 0 .5rem; }
.hist-filters label { margin: 0; }
.hist-filters input[type=date] { min-height: 2.6rem; }
.hf-quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem; }
.hf-quick .chip.on { border-color: var(--brass); color: var(--brass-2); }
.hf-quick .chip.clear { color: var(--neg); }
.hf-count { margin: 0 0 .6rem; }
.name-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.name-link:hover { color: var(--brass-2); }
.hist-btns { display: inline-flex; gap: .3rem; flex: none; }
@media (max-width: 760px) {
  .hist-filters { grid-template-columns: 1fr 1fr; }
  .hist-filters .hf-player { grid-column: 1 / -1; }
}

/* ---------- Replay: step list, showdown (v0.17) ---------- */
.replay-when { margin: -.3rem 0 .6rem; }
.replay-steps { position: relative; display: flex; gap: .3rem; overflow-x: auto; padding: .4rem .1rem .5rem; margin-top: .4rem; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.replay-steps .rs { appearance: none; flex: none; min-width: 2.6rem; display: grid; justify-items: center; gap: .05rem; padding: .3rem .4rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: 700 .78rem var(--display); cursor: pointer; }
.replay-steps .rs i { font-style: normal; font-weight: 600; font-size: .62rem; opacity: .8; }
.replay-steps .rs.wide { min-width: 4rem; }
.replay-steps .rs.done { color: var(--text); }
.replay-steps .rs.on { border-color: var(--brass); background: var(--brass); color: #1d1606; }
.replay-keys { margin: .2rem 0 0; }
.replay-score { margin-top: .8rem; }
.replay .replay-desc b { color: var(--head); }
.replay .seat .rhand { font-size: .74rem; }
@media (max-width: 760px) {
  .replay-ctl { flex-wrap: wrap; }
  .replay-ctl input[type=range] { flex: 1 1 100%; order: 9; }
  .replay-ctl .btn { min-width: 2.8rem; min-height: 2.6rem; }
}
/* The replay controls stay in reach: on a phone they stick to the bottom of the window
   while the boards scroll above them, and the boards use smaller cards. */
.replay-foot { background: var(--panel); }
@media (max-width: 760px) {
  .replay .replay-boards { --cw: 34px; --ch: 47px; }
  .replay .replay-boards .seat.mine { --cw: 34px; --ch: 47px; }
  .replay .replay-boards { grid-template-columns: minmax(0, 1fr); }
  .replay-foot { position: sticky; bottom: calc(-1 * var(--modal-pad, 1rem)); z-index: 2; margin: 0 -1.1rem; padding: .4rem 1.1rem .5rem;
    border-top: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(0,0,0,.35); }
  .replay-foot .replay-desc { font-size: .84rem; margin: 0 0 .35rem; }
  .replay-foot .replay-steps { margin-top: .2rem; padding-bottom: .2rem; }
}
/* History rows on a phone: date + points on top, opponents (tap a name to filter) + buttons below. */
@media (max-width: 760px) {
  .hist-row2 { grid-template-columns: auto minmax(0, 1fr) auto; gap: .3rem .6rem; }
  .hist-row2 > input { grid-column: 1; grid-row: 1; }
  .hist-row2 .hist-when { grid-column: 2; grid-row: 1; }
  .hist-row2 .hist-pts { grid-column: 3; grid-row: 1; text-align: right; }
  .hist-row2 .hist-vs { display: block !important; grid-column: 2; grid-row: 2; white-space: normal; }
  .hist-row2 .hist-tags { grid-column: 2; grid-row: 3; }
  .hist-row2 .hist-tags:empty { display: none; }
  .hist-row2 .hist-btns { grid-column: 3; grid-row: 2 / span 2; align-self: center; flex-direction: column; }
}

/* ---------- Fantasy Land dragons: big gold dragon emojis (v0.17.4) ---------- */
/* The emoji is drawn green by the phone/computer; the filter turns it gold:
   grayscale removes the green, sepia + saturate + brightness bring back a warm gold. */
.dragon-emoji { display: grid; place-items: center; line-height: 1; font-size: clamp(72px, 11vw, 168px); opacity: .95;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  animation: dragon-float 7s ease-in-out infinite; animation-delay: var(--t, 0s); }
.dragon-emoji i { font-style: normal; display: block;
  filter: grayscale(1) sepia(1) saturate(4.2) hue-rotate(-6deg) brightness(1.18) contrast(1.08) drop-shadow(0 0 10px rgba(255, 196, 70, .55)) drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.dragon-emoji.dragon-left i { transform: scaleX(-1); }   /* face the center of the table */
.dragon-emoji.dragon-right { animation-delay: calc(var(--t, 0s) - 3.5s); }
.fl-dragons.arriving .dragon-emoji { animation: dragon-in 1.5s cubic-bezier(.2,.8,.25,1) both, dragon-float 7s ease-in-out infinite; animation-delay: var(--t, 0s), var(--t, 0s); }
.mt-table .dragon-emoji { font-size: clamp(48px, 6vw, 96px); opacity: .85; }
@media (max-width: 760px) {
  .felt > .fl-dragons { height: 64px; gap: 28px; margin: -2px 0 -4px; }
  .dragon-emoji { font-size: 56px; animation: none !important; }
}

/* ---------- Invite friends (v0.18) ---------- */
.invite-box { margin: .2rem 0 .9rem; }
.invite-box.compact { padding: .7rem; border: 1px dashed var(--line); border-radius: 12px; background: var(--ink-2); }
.invite-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.invite-btns .btn.primary { flex: 1 1 auto; }
.invited-by { text-align: center; margin: 0 0 .7rem; padding: .55rem .8rem; border: 1px solid var(--brass); border-radius: 12px; background: var(--panel-2); }
.invited-by b { color: var(--head); }
.install-steps { margin: .5rem 0 0; padding: .5rem .7rem; border-radius: 10px; background: var(--ink-2); border: 1px solid var(--line); }

/* ---------- Home screen title + "brought to you by Dragons Full" (v0.19.1) ---------- */
.brand-title { display: grid; justify-items: center; gap: .1rem; line-height: 1; }
.brand-title .bt-main { font-size: 2.9rem; font-weight: 850; font-stretch: 125%; letter-spacing: -.02em; color: var(--head); }
.brand-title .bt-sub { font-size: 1.05rem; font-weight: 700; font-stretch: 125%; letter-spacing: .32em; text-transform: uppercase; color: var(--text); padding-left: .32em; }
.byline { display: grid; justify-items: center; gap: .15rem; margin-top: 1.1rem; }
.by-rule { width: 140px; height: 9px; margin-bottom: .45rem;
  background: linear-gradient(90deg, transparent, var(--brass) 30%, var(--brass) 70%, transparent) center / 100% 1px no-repeat; position: relative; }
.by-rule::after { content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; background: var(--brass); transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 0 3px var(--ink); }
.by-small { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: .82rem; color: var(--muted); letter-spacing: .02em; }
.by-name { font-family: Georgia, 'Times New Roman', serif; font-size: 1.2rem; font-variant: small-caps; letter-spacing: .14em; color: #e9b949;
  background: linear-gradient(180deg, #fff0b0, #e9b949 55%, #b47a1c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
@media (max-width: 760px) { .brand-title .bt-main { font-size: 2.6rem; } .brand-title .bt-sub { font-size: .95rem; } }

/* ---------- Chinese Poker (v0.20) ---------- */
.tile-art.chinese .card { margin: 0 -18px; }
.tile-art.chinese .card:nth-child(1) { transform: rotate(-20deg) translateY(14px); }
.tile-art.chinese .card:nth-child(2) { transform: rotate(-10deg) translateY(4px); }
.tile-art.chinese .card:nth-child(3) { transform: none; }
.tile-art.chinese .card:nth-child(4) { transform: rotate(10deg) translateY(4px); }
.tile-art.chinese .card:nth-child(5) { transform: rotate(20deg) translateY(14px); }
.cp-banner { border-color: rgba(233,185,73,.45); }
/* Three games side by side: each tile stacks its card art above the text. */
.tiles .game-tile { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.tiles .tile-art { min-height: 150px; box-shadow: inset 0 -10px 0 var(--rail-2), inset 0 -14px 0 var(--rail-1); }
.tiles .tile-title { font-size: 1.7rem; }
/* phones: three game tiles stacked, so keep each one short */
@media (max-width: 760px) {
  .tiles { gap: .7rem; }
  .tiles .tile-art { min-height: 0; height: 92px; padding: .4rem 1rem 1rem; --cw: 38px; --ch: 53px; overflow: hidden; }
  .tiles .tile-art .card { margin: 0 -4px; }
  .tiles .tile-art.chinese .card { margin: 0 -9px; }
  .tiles .tile-title { font-size: 1.45rem; }
  .tiles .game-tile .tile-body, .tiles .game-tile > div:last-child { padding-top: .7rem; padding-bottom: .9rem; }
}

/* phone number with the country's +code in front */
.phone-field { display: flex; align-items: stretch; border: 1px solid var(--line, rgba(255,255,255,.15)); border-radius: 10px; background: var(--input-bg, rgba(0,0,0,.25)); overflow: hidden; }
.phone-field:focus-within { border-color: var(--gold, #e3b75c); }
.phone-field .phone-cc { display: flex; align-items: center; gap: .35rem; padding: 0 .7rem; font-weight: 700; white-space: nowrap; border-right: 1px solid var(--line, rgba(255,255,255,.15)); background: rgba(255,255,255,.04); font-variant-numeric: tabular-nums; }
.phone-field .phone-cc .flag { width: 1.4rem; height: 1.05rem; margin: 0; }
.phone-field input { flex: 1; min-width: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; margin: 0 !important; box-shadow: none !important; }
.phone-field.off { opacity: .6; }
.phone-field.off .phone-cc { color: #ead9dc; }
.phone-tip:empty { display: none; }
select[data-country-select] { width: 100%; }

/* photo cropper: drag and zoom to choose what shows in the round avatar */
.cropper-bg { position: fixed; inset: 0; z-index: 400; background: rgba(8, 2, 4, .78); display: grid; place-items: center; padding: 16px; }
.cropper { width: min(100%, 380px); padding: 1.1rem 1.1rem 1rem; display: grid; gap: .7rem; }
.cropper h2 { margin: 0; font-size: 1.15rem; }
.crop-stage { position: relative; width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #000; touch-action: none; cursor: grab; outline: none; user-select: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage:focus-visible { box-shadow: 0 0 0 3px var(--gold, #e3b75c); }
.crop-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); border: 2px solid var(--gold, #e3b75c); pointer-events: none; }
.crop-hint { margin: 0; text-align: center; }
.crop-zoom { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; }
.crop-zoom .btn { min-width: 2.6rem; font-size: 1.2rem; line-height: 1; }
.crop-zoom input[type=range] { width: 100%; accent-color: var(--gold, #e3b75c); }
.crop-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* privacy / terms / support links */
.policy-links { display: flex; justify-content: center; flex-wrap: wrap; gap: .3rem .6rem; color: var(--muted); margin: 1.2rem 0 .4rem; }
.policy-links a { color: var(--muted); }
.auth .policy-links { margin-top: .9rem; }
.adult-line { color: var(--text); font-weight: 600; }
.adult-line a { color: var(--brass-2); }

/* game filter (All games / Regular / Pineapple / Chinese): equal columns, never split words */
.seg.games { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.seg.games .seg-btn { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; padding-left: .35rem; padding-right: .35rem; }
/* small phones: the language menu sits above the logo instead of on top of it */
@media (max-width: 420px) {
  .auth-lang { position: static; display: flex; justify-content: flex-end; padding: 12px 14px 0; }
}

/* forgot / reset password */
.auth-h { margin: 0 0 .4rem; font-size: 1.25rem; color: var(--head); }
.auth-done p { margin: 0 0 .8rem; }
.forgot-link { display: block; margin: .8rem auto 0; background: none; border: 0; color: var(--brass-2); font: inherit; font-size: .9rem; text-decoration: underline; cursor: pointer; padding: .3rem; }
.auth form .btn.ghost.wide, .auth .auth-done .btn.wide { margin-top: .5rem; }
.auth .fine a { color: var(--brass-2); }

/* ---------- friends: online button, list, profile ---------- */
.fr-online { position: relative; display: inline-flex; align-items: center; gap: .3rem; height: 2.3rem; padding: 0 .65rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.fr-online svg { width: 20px; height: 20px; }
.fr-online .fr-dot { position: absolute; left: 1.55rem; top: .35rem; }
.fr-online.live { color: var(--text); border-color: color-mix(in srgb, var(--pos) 45%, var(--line)); }
.fr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .45; flex: none; }
.live .fr-dot, .fr-group .fr-dot { background: var(--pos); opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 0 8px color-mix(in srgb, var(--pos) 70%, transparent); }
.online-pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; color: var(--muted); padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); }
.online-pill.live { color: var(--text); }
.fr-group { display: flex; align-items: center; gap: .5rem; font-size: .8rem; letter-spacing: .02em; color: var(--muted); margin: 1.1rem 0 .3rem; font-weight: 700; }
.fr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(120px, 230px) auto; align-items: center; gap: .8rem; width: 100%; text-align: left;
  padding: .7rem .6rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; cursor: pointer; border-radius: 10px; }
.fr-row:hover { background: rgba(255,255,255,.035); }
.fr-av { position: relative; display: inline-block; }
.fr-av .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2px solid var(--panel); margin: 0; }
.fr-av.big .dot { width: 18px; height: 18px; right: 2px; bottom: 2px; border-width: 3px; }
.fr-main { display: grid; min-width: 0; }
.fr-name { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.fr-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-status { font-size: .8rem; color: var(--muted); }
.fr-status.on { color: var(--pos); }
.fr-h2h { display: grid; gap: .3rem; justify-items: end; }
.fr-h2h .wtl { width: 100%; }
.fr-h2h-line { display: flex; gap: .6rem; align-items: baseline; font-size: .82rem; white-space: nowrap; }
.fr-go { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.fr-none { text-align: right; }
.wtl { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); gap: 2px; }
.wtl.big { height: 12px; border-radius: 6px; margin: .4rem 0 .9rem; }
.wtl i { display: block; min-width: 3px; }
.wtl .w { background: var(--pos); } .wtl .t { background: color-mix(in srgb, var(--muted) 55%, transparent); } .wtl .l { background: var(--neg); }
.wtl-txt { color: var(--muted); } .wtl-txt b { color: var(--text); } .wtl-txt b.pos { color: var(--pos); } .wtl-txt b.neg { color: var(--neg); }
.fr-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.fr-panel-head .linkish { font-size: .82rem; }
.fr-open { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.fr-open:hover span { text-decoration: underline; }
.fr-hist-link svg { width: 16px; height: 16px; vertical-align: -3px; }
.back-link { margin: 0 0 .6rem; font-weight: 600; }
.friend-grid { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.friend-side { display: grid; gap: 1rem; }
.fr-hero { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; align-items: center; }
.fr-hero h2 { display: flex; align-items: center; gap: .4rem; margin: 0; font-size: 1.5rem; }
.fr-hero-txt { display: grid; gap: .1rem; min-width: 0; }
.fr-actions { grid-column: 1 / -1; display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.fr-actions .btn.primary { flex: 1 1 auto; }
.fr-record h3, .fr-split h3, .fr-games h3 { margin: 0 0 .6rem; color: var(--head); font-size: 1.05rem; }
.rec-big { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.rec-big .rb b { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rec-big .rb span { font-size: .8rem; color: var(--muted); }
.rec-big .pos b { color: var(--pos); } .rec-big .neg b { color: var(--neg); }
.rec-stats { margin-bottom: .6rem; }
.trend { margin: .6rem 0 0; }
.trend figcaption { display: flex; justify-content: space-between; gap: .6rem; font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.trend svg { width: 100%; height: auto; max-height: 220px; display: block; overflow: visible; }
.trend .zero { stroke: var(--line); stroke-dasharray: 4 4; }
.trend .ax { fill: var(--muted); font-size: 11px; }
.trend .line { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.trend .line.pos, .trend .end.pos { stroke: var(--pos); } .trend .line.neg, .trend .end.neg { stroke: var(--neg); }
.trend .end { fill: var(--panel); stroke-width: 2.5; }
.trend .area.pos { fill: color-mix(in srgb, var(--pos) 12%, transparent); } .trend .area.neg { fill: color-mix(in srgb, var(--neg) 12%, transparent); }
.fv-row { display: grid; grid-template-columns: 7.5rem 4.5rem minmax(40px, 1fr) auto 3rem; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.fv-row.none { grid-template-columns: 7.5rem 1fr; }
.fv-row b { text-align: right; }
.fv-name { font-weight: 600; }
.fv-wtl { font-size: .8rem; white-space: nowrap; }
.cmp { width: 100%; border-collapse: collapse; margin-top: .9rem; font-size: .88rem; font-variant-numeric: tabular-nums; }
.cmp th, .cmp td { padding: .4rem .3rem; border-bottom: 1px solid var(--line); text-align: right; }
.cmp th:first-child, .cmp td:first-child { text-align: left; color: var(--muted); }
.cmp th { color: var(--muted); font-weight: 600; font-size: .8rem; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp td.lead { color: var(--head); font-weight: 800; }
.fr-games .page-head { margin-bottom: .4rem; }
.fh-row { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto auto 1.6rem; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .65rem .4rem;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; cursor: pointer; border-radius: 10px; }
.fh-row:hover { background: rgba(255,255,255,.035); }
.fh-row:disabled { cursor: default; opacity: .8; }
.fh-res { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 10px; font-variant-numeric: tabular-nums; }
.fh-res b { font-size: 1.15rem; line-height: 1; } .fh-res small { font-size: .78rem; font-weight: 700; }
.fh-res.won { background: color-mix(in srgb, var(--pos) 18%, transparent); color: var(--pos); }
.fh-res.lost { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }
.fh-res.tied { background: rgba(255,255,255,.06); color: var(--muted); }
.fh-main { display: grid; min-width: 0; } .fh-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-boards { display: grid; gap: .15rem; justify-items: start; }
.fh-who { font-size: .72rem; color: var(--muted); display: flex; gap: .3rem; align-items: center; max-width: 9rem; overflow: hidden; white-space: nowrap; }
.fh-play { color: var(--brass-2); }
@media (max-width: 1100px) { .friend-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .rail-friends { display: none; }
  .fr-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; padding: .65rem .2rem; }
  .fr-row .fr-h2h, .fr-row .fr-none { grid-column: 2 / 4; grid-row: 2; justify-items: stretch; text-align: left; }
  .fr-row .fr-go { grid-column: 3; grid-row: 1; }
  .fr-h2h-line { justify-content: space-between; }
  .fh-row { grid-template-columns: 3rem minmax(0, 1fr) 1.2rem; gap: .65rem; }
  .fh-row .fh-boards { grid-column: 2 / 4; grid-row: 2; }
  .fh-row .fh-boards.them { grid-row: 3; }
  .fh-row .fh-play { grid-column: 3; grid-row: 1; }
  .fv-row { grid-template-columns: 6.2rem 1fr auto; }
  .fv-row .fv-n { display: none; }
  .fv-row .wtl { grid-column: 1 / -1; grid-row: 2; }
  .fv-row .fv-wtl { grid-column: 2; grid-row: 1; text-align: right; }
  .fr-online { height: 2.1rem; padding: 0 .55rem; }
  .fr-hero h2 { font-size: 1.3rem; }
}
.rail-friends { display: contents; }
@media (max-width: 760px) { .rail-friends { display: none; } }
/* ---------- on-screen extras switches ---------- */
.hud-list { display: grid; gap: .1rem; margin: .4rem 0 .7rem; }
.hud-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; cursor: pointer; }
.switch { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; border: 1px solid var(--line); background: var(--ink); cursor: pointer; padding: 0; transition: background .15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: color-mix(in srgb, var(--pos) 35%, var(--ink)); border-color: var(--pos); }
.switch.on i { transform: translateX(18px); background: #fff; }
.hud-off-handNames .felt:not(.replay-felt) .rhand { display: none; }
.hud-off-rulesBanner .pine-banner { display: none; }
.hud-off-botBadges .felt .tag.bot { display: none; }
.hud-off-reactions .emote-bubble, .hud-off-reactions .react-btn { display: none; }

.fh-sum { display: none; gap: .3rem; flex-wrap: wrap; margin: .15rem 0; }
@media (max-width: 760px) {
  .fh-row .fh-boards { display: none; }
  .fh-sum { display: flex; }
  .fh-row { grid-template-columns: 3rem minmax(0, 1fr) 1.2rem; }
  .fh-row .fh-play { grid-column: 3; grid-row: 1; }
}
/* phones: language lives in Profile & settings (and the log-in screen), so the top bar has room for the page title */
@media (max-width: 560px) { .topbar .lang-pick.compact { display: none; } }

/* hands-together rows: result, date + summary, then both boards on their own line */
.fh-row { grid-template-columns: 3.2rem minmax(0, 1fr) 1.6rem; row-gap: .45rem; }
.fh-row .fh-play { grid-column: 3; grid-row: 1; }
.fh-both { grid-column: 2 / 4; grid-row: 2; display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; }
.fh-both .fh-boards { display: grid; }
.friend-grid { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
.friend-side, .friend-side > * { min-width: 0; }
.friend-side .stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.friend-side .fv-row { grid-template-columns: 6.6rem 4rem minmax(30px, 1fr) auto 2.6rem; }
.friend-side .fv-row.none { grid-template-columns: 6.6rem 1fr; }
@media (max-width: 1100px) { .friend-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .fh-both { display: none; }
  .friend-side .fv-row { grid-template-columns: 6.2rem 1fr auto; }
}

/* ---------- owner dashboard ---------- */
.adm-tabs { margin: .6rem 0 1rem; overflow-x: auto; }
.adm-tabs .seg-btn { white-space: nowrap; padding-left: .7rem; padding-right: .7rem; }
.adm-badge { font-style: normal; display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.2rem; border-radius: .6rem; background: var(--neg); color: #fff; font-size: .72rem; padding: 0 .3rem; }
.adm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1rem; }
.adm-tiles .stat small { display: block; margin-top: .2rem; font-size: .75rem; }
.adm-chart { margin: 0 0 1.1rem; }
.adm-chart figcaption { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.adm-chart figcaption b { color: var(--text); }
.adm-chart svg { width: 100%; height: auto; display: block; }
.adm-chart .bar { fill: var(--brass); }
.adm-chart .bar:hover { fill: var(--brass-2); }
.adm-chart .grid { stroke: var(--line); stroke-width: 1; }
.adm-chart .ax { fill: var(--muted); font-size: 11px; }
.adm-health p { margin: .3rem 0; font-size: .9rem; }
.adm-user { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.adm-user.banned { opacity: .75; }
.adm-u-main { display: grid; gap: .15rem; min-width: 0; }
.adm-u-main .small { overflow-wrap: anywhere; }
.adm-sort { margin: .5rem 0; max-width: 320px; }
.adm-report { padding: .8rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .4rem; }
.adm-report.done { opacity: .7; }
.adm-r-head { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.adm-r-head .muted { flex-basis: 100%; }
.adm-quote { margin: 0; padding: .4rem .7rem; border-left: 3px solid var(--line); color: var(--text); font-size: .9rem; }
.adm-err { padding: .6rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .2rem; }
.adm-err .linkish { text-align: left; }
.adm-stack { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .6rem; margin: .3rem 0 0; max-height: 260px; overflow: auto; }
.owner-link { margin-bottom: .8rem; display: flex; align-items: center; justify-content: center; gap: .4rem; }
.owner-link svg { width: 18px; height: 18px; }
.verify-state { color: var(--muted); }
.verify-state.ok { color: var(--pos); }
@media (max-width: 760px) {
  .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-user { flex-direction: column; align-items: stretch; }
}

.adm-u-name { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.adm-u-name .dot { margin: 0; }
.adm-body h3.mt { margin-top: 1.2rem; }
.adm-chart .ax { font-size: 10px; }
@media (max-width: 760px) {
  .seg.adm-tabs { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .adm-tabs .seg-btn { padding-left: .3rem; padding-right: .3rem; }
}

/* ---------- ratings, rankings, achievements ---------- */
.stats-switch { margin: 0 0 1rem; max-width: 520px; }
.rating-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .8rem; }
.rs-item { display: grid; gap: .1rem; text-align: left; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--ink-2); color: var(--text); font: inherit; cursor: pointer; }
.rs-item span { font-size: .75rem; color: var(--muted); }
.rs-item b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.rs-item b i, .rk-rating i { font-style: normal; color: var(--muted); font-size: .7em; margin-left: .1rem; }
.rs-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }
.streak-chip { font-size: .85rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: color-mix(in srgb, #ff9a3d 18%, transparent); color: #ffb067; }
.streak-chip.warn { opacity: .75; }
.rating-change { margin: -.2rem 0 .7rem; font-size: .9rem; color: var(--muted); }
.rating-tag.up { color: var(--pos); } .rating-tag.down { color: var(--neg); }
.badge-pop { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -150%); z-index: 300; display: flex; gap: .8rem; align-items: center;
  max-width: min(92vw, 420px); padding: .8rem 1.1rem; border-radius: 16px; border: 1px solid var(--brass); background: linear-gradient(135deg, var(--panel-2), var(--panel));
  color: var(--text); font: inherit; text-align: left; box-shadow: 0 18px 40px rgba(0,0,0,.5); cursor: pointer; transition: transform .45s cubic-bezier(.2,1.4,.4,1); }
.badge-pop.in { transform: translate(-50%, 0); }
.badge-pop.out { transform: translate(-50%, -150%); transition-duration: .3s; }
.bp-icon { font-size: 2.2rem; line-height: 1; }
.bp-text { display: grid; } .bp-text small { color: var(--brass-2); font-weight: 700; font-size: .72rem; letter-spacing: .03em; }
.bp-text b { font-size: 1.05rem; } .bp-text span { font-size: .82rem; color: var(--muted); }
.rank-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.my-rating h2 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--head); }
.mr-big { display: flex; align-items: baseline; gap: .6rem; }
.mr-big b { font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rating-chart { width: 100%; height: auto; display: block; margin: .6rem 0; }
.rating-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.rating-chart .ax { fill: var(--muted); font-size: 10px; }
.rating-chart .line { fill: none; stroke: var(--brass); stroke-width: 2.2; stroke-linejoin: round; }
.rating-chart .end { fill: var(--panel); stroke: var(--brass); stroke-width: 2.5; }
.rk-you { font-weight: 700; color: var(--brass-2); margin: .3rem 0; }
.how summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: .6rem; }
.rk-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.rk-filters .seg { flex: 1 1 260px; }
.rk-row { display: grid; grid-template-columns: 2.2rem auto minmax(0, 1fr) auto 3.6rem; align-items: center; gap: .6rem; padding: .5rem .4rem; border-bottom: 1px solid var(--line); border-radius: 8px; }
.rk-row.me { background: color-mix(in srgb, var(--brass) 14%, transparent); }
.rk-n { text-align: right; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rk-row:nth-child(-n+3) .rk-n { color: var(--brass-2); }
.rk-name { display: flex; align-items: center; gap: .35rem; min-width: 0; } .rk-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-rating { text-align: right; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.rk-gap { text-align: center; color: var(--muted); }
.streak-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
.streak-card h2 { margin: 0; }
.sc-flame { font-size: 2.6rem; filter: grayscale(1) opacity(.4); } .sc-flame.on { filter: none; }
.sc-count { text-align: center; } .sc-count b { display: block; font-size: 2rem; font-weight: 800; color: var(--brass-2); } .sc-count span { font-size: .75rem; color: var(--muted); }
.ach-h { color: var(--head); margin: 1.2rem 0 .5rem; font-size: 1rem; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.ach-card { display: flex; gap: .7rem; align-items: center; padding: .75rem .8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); opacity: .78; }
.ach-card.got { opacity: 1; border-color: color-mix(in srgb, var(--brass) 55%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--brass) 12%, var(--panel)), var(--panel)); }
.b-icon { font-size: 1.9rem; width: 2.4rem; text-align: center; flex: none; }
.ach-card:not(.got) .b-icon { filter: grayscale(1) opacity(.55); }
.b-text { display: grid; gap: .15rem; min-width: 0; }
.b-when { color: var(--brass-2); font-size: .72rem; }
.b-prog { display: block; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: .2rem; }
.b-prog i { display: block; height: 100%; background: var(--brass); }
.fr-ratings { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.fr-ratings b { color: var(--text); }
@media (max-width: 900px) { .rank-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .rk-row { grid-template-columns: 1.8rem auto minmax(0, 1fr) 3.4rem; }
  .rk-hands { display: none; }
  .streak-card { grid-template-columns: auto 1fr; }
  .sc-count { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: baseline; justify-content: center; }
  .sc-count b { display: inline; }
}

/* ---------- Hand Review ---------- */
.modal.review { width: min(980px, 96vw); max-height: 92vh; overflow: auto; }
.rv-loading { text-align: center; padding: 2rem 1rem; display: grid; gap: .6rem; justify-items: center; }
.rv-loading .b-prog { width: min(320px, 80%); height: 8px; }
.rv-spin { font-size: 3rem; animation: rvspin 1.4s ease-in-out infinite; }
@keyframes rvspin { 50% { transform: rotateY(180deg); } }
@media (prefers-reduced-motion: reduce) { .rv-spin { animation: none; } }
.rv-summary { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: center; padding: .4rem 0 1rem; border-bottom: 1px solid var(--line); }
.rv-acc { display: grid; place-items: center; width: 6.5rem; height: 6.5rem; border-radius: 50%; border: 4px solid var(--line); text-align: center; }
.rv-acc b { font-size: 1.9rem; line-height: 1; } .rv-acc span { font-size: .75rem; color: var(--muted); margin-top: -.6rem; }
.rv-sum-txt p { margin: 0 0 .3rem; }
.rv-counts { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.rv-chip { font-size: .8rem; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line); }
:root { --rv-best: #5fd39a; --rv-good: #9bd2a5; --rv-inacc: #f2c94c; --rv-mistake: #f2994a; --rv-blunder: #ff5e57; }
.rv-chip.best, .rv-tag.best { color: var(--rv-best); } .rv-chip.good, .rv-tag.good { color: var(--rv-good); }
.rv-chip.inaccuracy, .rv-tag.inaccuracy { color: var(--rv-inacc); } .rv-chip.mistake, .rv-tag.mistake { color: var(--rv-mistake); }
.rv-chip.blunder, .rv-tag.blunder { color: var(--rv-blunder); } .rv-chip.timeout, .rv-tag.timeout { color: var(--muted); }
.rv-moves { display: grid; gap: .35rem; margin: 1rem 0; }
.rv-move { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto 3rem; gap: .6rem; align-items: center; padding: .45rem .6rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--ink-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.rv-move.on { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 10%, var(--ink-2)); }
.rv-move.mistake, .rv-move.blunder { border-left: 4px solid currentColor; }
.rv-move.mistake { color: var(--rv-mistake); } .rv-move.blunder { color: var(--rv-blunder); } .rv-move.inaccuracy { border-left: 4px solid var(--rv-inacc); }
.rv-move > * { color: var(--text); }
.rv-n { color: var(--muted) !important; font-weight: 700; text-align: right; }
.rv-cards { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.rv-tag { font-size: .82rem; white-space: nowrap; font-weight: 600; }
.rv-move .rv-tag.best { color: var(--rv-best); } .rv-move .rv-tag.good { color: var(--rv-good); } .rv-move .rv-tag.inaccuracy { color: var(--rv-inacc); }
.rv-move .rv-tag.mistake { color: var(--rv-mistake); } .rv-move .rv-tag.blunder { color: var(--rv-blunder); } .rv-move .rv-tag.timeout { color: var(--muted); }
.rv-loss { text-align: right; font-weight: 700; color: var(--neg) !important; font-variant-numeric: tabular-nums; }
.rv-detail { border-top: 1px solid var(--line); padding-top: .8rem; }
.rv-q { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .7rem; }
.rv-boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.rv-board { padding: .7rem; border-radius: 12px; background: radial-gradient(circle at 50% 40%, var(--felt-1), var(--felt-2)); border: 2px solid transparent; }
.rv-board.best { border-color: var(--rv-best); } .rv-board.yours.mistake, .rv-board.yours.blunder { border-color: var(--rv-mistake); } .rv-board.yours.blunder { border-color: var(--rv-blunder); }
.rv-board.yours.inaccuracy { border-color: var(--rv-inacc); }
.rv-board.best-same { display: grid; align-content: center; justify-items: center; text-align: center; border-color: var(--rv-best); }
.rv-title { font-weight: 700; margin-bottom: .45rem; display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.rv-row { display: flex; align-items: center; gap: .5rem; margin: .2rem 0; }
.rv-row .rlabel { width: 3.6rem; font-size: .72rem; color: var(--muted); }
.rv-row .cards { display: flex; gap: 3px; }
.card.fresh { outline: 3px solid var(--brass); outline-offset: 1px; }
.rv-disc { display: flex; gap: .3rem; align-items: center; margin-top: .3rem; }
.rv-nav { display: flex; justify-content: space-between; margin: .8rem 0 .3rem; }
.rv-note { margin: .4rem 0 0; }
@media (max-width: 760px) {
  .modal.review { width: 100vw; max-height: 100vh; border-radius: 0; }
  .rv-summary { grid-template-columns: auto 1fr; gap: .8rem; }
  .rv-acc { width: 5rem; height: 5rem; } .rv-acc b { font-size: 1.5rem; }
  .rv-boards { grid-template-columns: 1fr; }
  .rv-move { grid-template-columns: 1.4rem minmax(0, 1fr) auto; }
  .rv-move .rv-loss { display: none; }
}

/* ---------- "Learn to play" lesson ---------- */
.tut-page { max-width: 760px; margin: 0 auto; }
.tut h2 { color: var(--head); margin: .3rem 0 .5rem; }
.tut-top { display: flex; justify-content: space-between; align-items: center; }
.tut-dots { display: flex; gap: .4rem; }
.tut-dots i { width: 28px; height: 5px; border-radius: 3px; background: var(--line); } .tut-dots i.on { background: var(--brass); }
.tut-board { display: grid; gap: .45rem; padding: .8rem; border-radius: 16px; background: radial-gradient(circle at 50% 40%, var(--felt-1), var(--felt-2)); margin: .8rem 0; }
.tut-row { display: grid; grid-template-columns: 4.4rem auto 1fr; align-items: center; gap: .6rem; padding: .35rem .4rem; border-radius: 10px; border: 2px dashed transparent; }
.tut-row[role=button] { cursor: pointer; }
.tut-row.target { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 10%, transparent); animation: tutglow 1.4s ease-in-out infinite; }
@keyframes tutglow { 50% { border-color: color-mix(in srgb, var(--brass) 40%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tut-row.target { animation: none; } .tut-card.pulse { animation: none !important; } }
.tut-rl { display: grid; font-weight: 700; } .tut-rl small { font-weight: 400; color: var(--muted); font-size: .72rem; }
.tut-row .cards { display: flex; gap: 4px; }
.tut-lbl { font-size: .8rem; color: var(--head); }
.tut-board.small .tut-row { grid-template-columns: 3.6rem auto; } .tut-board.small .tut-lbl { grid-column: 2; font-size: .72rem; }
.tut-board.small .card { --cw: 34px; --ch: 48px; }
.tut-hand { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin: .6rem 0; }
.tut-card { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; transition: transform .15s; }
.tut-card.sel { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--brass); }
.tut-card.pulse { animation: tutpulse 1.6s ease-in-out infinite; }
@keyframes tutpulse { 50% { transform: translateY(-4px); } }
.tut-hint { text-align: center; font-size: .95rem; margin: .3rem 0; }
.tut-msg { text-align: center; color: var(--rv-inacc, #f2c94c); font-weight: 600; }
.tut-list { padding-left: 1.2rem; } .tut-list li { margin: .3rem 0; }
.tut-show { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; } .tut-show h3 { margin: .2rem 0 0; font-size: .9rem; color: var(--muted); }
.tut-score { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.tut-score td { padding: .4rem .3rem; border-bottom: 1px solid var(--line); } .tut-score td:last-child { text-align: right; font-weight: 800; }
.tut-score .tot td { font-weight: 800; border-bottom: 0; }
.tut-rule { padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--line); margin: .7rem 0; }
.tut-rule p { margin: .3rem 0 0; } .tut-rule.bad { border-color: color-mix(in srgb, var(--neg) 50%, var(--line)); } .tut-rule.fl { border-color: color-mix(in srgb, var(--brass) 60%, var(--line)); }
.tut .btn.wide { margin-top: .6rem; }
.tut-back { margin-top: .8rem; }
@media (max-width: 760px) {
  .tut-show { grid-template-columns: 1fr; }
  .tut-row { grid-template-columns: 3.6rem auto; } .tut-lbl { grid-column: 2; }
  .tut-row .card { --cw: 44px; --ch: 62px; }
}

/* ---- Daily games, tournaments, watching (v0.29) ---- */
.more-ways { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 0 0 1rem; }
.mw-tile { appearance: none; display: flex; align-items: center; gap: .8rem; text-align: left; padding: .85rem 1rem; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--text); cursor: pointer; font: inherit; position: relative; }
.mw-tile:hover { border-color: var(--brass); }
.mw-tile.hot { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.mw-tile > span:nth-child(2) { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.mw-tile b { font-family: var(--display); font-size: 1.05rem; color: var(--head); }
.mw-ic { font-size: 1.7rem; line-height: 1; }
.mw-tile .badge { margin-left: auto; }
.badge.hot { background: #c0392b; color: #fff; }
.play-switch { margin: 0 0 .8rem; }
.play-switch .seg { max-width: 460px; }
.dg-tabs { margin: .6rem 0 .8rem; }
.dg-list { display: flex; flex-direction: column; gap: .5rem; }
.dg-row { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: .3rem .6rem .3rem .3rem; }
.dg-row.hot { border-color: var(--brass); background: linear-gradient(90deg, rgba(224, 180, 92, .12), var(--panel) 60%); }
.dg-main { appearance: none; flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ops status" "meta status"; gap: .15rem .8rem;
  align-items: center; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: .45rem .5rem; cursor: pointer; border-radius: 9px; }
.dg-main:hover { background: rgba(255, 255, 255, .03); }
.dg-ops { grid-area: ops; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; min-width: 0; }
.dg-op { display: inline-flex; align-items: center; gap: .35rem; }
.dg-meta { grid-area: meta; }
.dg-status { grid-area: status; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.dg-score { font-family: var(--display); font-size: 1.15rem; min-width: 2.6rem; text-align: right; }
.dg-act { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.dg-form .seg { margin-bottom: .3rem; }
.dg-friends { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.dg-friends .chip.on { border-color: var(--brass); background: var(--panel-hi); color: var(--head); }
.dg-side .dg-hand { font-weight: 700; margin: .3rem 0 .5rem; }
.dg-side .row-item > span { display: inline-flex; align-items: center; gap: .4rem; }
.tag.win-tag { background: var(--pos); color: #062414; border-color: var(--pos); }
.tag.live-tag { color: var(--neg); border-color: var(--neg); }
.empty-cta { text-align: center; padding: 1.2rem 0; }
.watch-bar { justify-content: space-between; }
.fr-row-wrap { display: flex; align-items: center; gap: .5rem; }
.fr-row-wrap .fr-row { flex: 1; min-width: 0; }
.fr-watch { flex: none; }

/* tournament bracket */
.tn-status { font-size: .78rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tn-status.signup { color: var(--brass-2); border-color: var(--brass); }
.tn-status.running { color: var(--pos); border-color: var(--pos); }
.tn-champ { display: flex; align-items: center; gap: .6rem; margin: .6rem 0 .2rem; padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--brass);
  background: linear-gradient(90deg, rgba(224, 180, 92, .2), transparent); font-size: 1.6rem; }
.tn-champ span { font-size: .85rem; color: var(--muted); }
.tn-champ b { font-family: var(--display); font-size: 1.25rem; color: var(--head); }
.tn-players { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .7rem 0; }
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 1.2rem; overflow-x: auto; padding-bottom: .4rem; }
.bk-round { display: flex; flex-direction: column; justify-content: space-around; gap: .8rem; }
.bk-round h3 { font-size: .8rem; color: var(--muted); margin: 0 0 .2rem; }
.bk-match { appearance: none; display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--line); color: var(--text); font: inherit; position: relative; }
button.bk-match { cursor: pointer; }
button.bk-match:hover { border-color: var(--brass); }
.bk-match.mine { border-color: var(--brass); }
.bk-match.hot { box-shadow: 0 0 0 2px var(--brass); }
.bk-p { display: flex; align-items: center; gap: .45rem; padding: .4rem .55rem; background: var(--panel); min-height: 38px; }
.bk-p.empty { color: var(--muted); font-size: .85rem; font-style: italic; }
.bk-p.won { background: var(--panel-hi); }
.bk-p.won .bk-name { color: var(--head); font-weight: 700; }
.bk-p.lost { opacity: .55; }
.bk-p.me .bk-name { text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 3px; }
.bk-seed { font-size: .7rem; color: var(--muted); min-width: 1rem; text-align: center; }
.bk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-sc { font-family: var(--display); }
.bk-live { font-size: .72rem; color: var(--pos); padding: .25rem .55rem; background: var(--panel); }
.bk-match .turn-tag { margin: .25rem .55rem; align-self: flex-start; }
@media (max-width: 760px) {
  .more-ways { grid-template-columns: 1fr; gap: .5rem; }
  .mw-tile { padding: .7rem .85rem; }
  .dg-main { grid-template-columns: 1fr; grid-template-areas: "ops" "meta" "status"; }
  .dg-status { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; gap: .3rem; }
  .dg-row { flex-wrap: wrap; }
  .dg-act { width: 100%; padding: 0 .5rem .4rem; justify-content: flex-start; }
  .bracket { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .fr-row-wrap { flex-wrap: wrap; }
  .fr-watch { margin-left: auto; }
}

/* ---- accessibility (v0.30) ---- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 1000; background: var(--brass); color: #1d1606; font-weight: 800; padding: .6rem 1rem; border-radius: 10px; text-decoration: none; transition: top .15s; }
.skip-link:focus { top: calc(10px + env(safe-area-inset-top)); }
[role=button][data-act]:focus-visible, .card[role=button]:focus-visible, .brow[role=button]:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.page-title:focus { outline: none; }
@media (forced-colors: active) {
  .card { forced-color-adjust: none; }
  .btn, .seg-btn, .chip { border: 1px solid ButtonText; }
}
/* Very narrow screens / 400% zoom (WCAG reflow): nothing scrolls sideways */
.panel { min-width: 0; }
.back-bar { min-width: 0; max-width: 100%; }
.back-bar .focus-tabs { min-width: 0; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
@media (max-width: 360px) {
  .data-table { display: block; overflow-x: auto; max-width: 100%; }
  .tut-row { grid-template-columns: 3rem auto; gap: .35rem; } .tut-lbl { grid-column: 2; }
  .tut-board { --cw: 36px; --ch: 50px; }
  .seat.mine { --cw: 44px; --ch: 62px; }
  .opponents .seat { --cw: 32px; --ch: 45px; }
  .hf-player, .hf-date, .hf-quick { min-width: 0; max-width: 100%; }
  .hf-player input, .hf-date input { min-width: 0; width: 100%; }
}
@media (max-width: 360px) {
  .tut-row .card, .tut-board .card { --cw: 34px; --ch: 48px; }
  .tut-board { padding: .5rem; }
  .seat, .placer, .felt, .my-area { min-width: 0; max-width: 100%; }
  .seat.mine .card { --cw: 40px; --ch: 56px; }
  .placer { --cw: 44px; --ch: 62px; padding: .6rem; }
}
@media (max-width: 360px) {
  .brow { grid-template-columns: auto 1fr; row-gap: .1rem; }
  .brow .rlabel { grid-column: 1 / -1; }
  .brow .cards { gap: .2rem; }
  .seat .card, .seat.mine .card { --cw: 40px; --ch: 56px; }
  .opponents .seat .card { --cw: 32px; --ch: 45px; }
}
@media (max-width: 360px) { .brow .cards > .card { flex-shrink: 0; } .brow .rhand { min-width: 0; font-size: .68rem; } }

/* ---- ads (v0.31) ---- */
.ad-box { position: relative; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); padding: 1.3rem .5rem .5rem; text-align: center; }
.ad-box.in-result { margin: .8rem 0 .4rem; }
.ad-tag { position: absolute; top: .3rem; left: .6rem; font-size: .68rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.ad-house { display: block; border-radius: 8px; overflow: hidden; }
.ad-house img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; margin: 0 auto; }
.ad-ph { min-height: 90px; }
.ad-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; }
.ad-float { position: absolute; display: none; }
.ad-inter { position: fixed; inset: 0; z-index: 900; background: rgba(10, 3, 5, .86); display: grid; place-items: center; padding: 16px; }
.ad-inter-box { position: relative; width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: .8rem; }
.ad-inter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.ad-inter .ad-tag { position: static; }
.ad-inter .ad-house img { max-height: 70vh; }
/* owner dashboard */
.adm-card { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; background: var(--ink-2); margin: .6rem 0 1rem; }
.adm-master { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.adm-master h3 { margin: 0; }
.adm-master.on { border-color: var(--pos); }
.adm-h { margin: 1.4rem 0 .5rem; font-size: 1rem; color: var(--head); }
.adm-check { padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .9rem; }
.adm-check li { list-style: none; margin-left: -1.2rem; color: var(--muted); }
.adm-check li.ok { color: var(--text); }
.adm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; }
.adm-grid3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: .2rem .8rem; align-items: end; }
.adm-house, .adm-camp { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.adm-house > img { width: 120px; height: 60px; object-fit: cover; border-radius: 6px; background: #000; flex: none; }
.adm-house > div, .adm-camp > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.adm-house-act { display: flex; gap: .3rem; flex-wrap: wrap; }
.adm-house-preview { display: block; max-width: 100%; max-height: 180px; margin: .6rem 0; border-radius: 8px; }
.adm-form label { display: block; }
.funnel { display: grid; gap: .45rem; margin: .6rem 0 1rem; }
.fn-row { display: grid; grid-template-columns: minmax(9rem, 13rem) 1fr 4rem 6.5rem; align-items: center; gap: .6rem; font-size: .88rem; }
.fn-bar { height: 14px; background: var(--ink-2); border-radius: 7px; overflow: hidden; }
.fn-bar i { display: block; height: 100%; background: var(--brass); border-radius: 7px; }
.fn-row b { text-align: right; }
.adm-camp code { font-size: .8rem; color: var(--brass-2); overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .adm-grid2, .adm-grid3 { grid-template-columns: 1fr; }
  .fn-row { grid-template-columns: 1fr auto; } .fn-row .fn-bar { grid-column: 1 / -1; grid-row: 2; } .fn-row .muted { display: none; }
  .adm-house { flex-wrap: wrap; } .adm-house > img { width: 100%; height: 90px; }
}
.nowrap { white-space: nowrap; }
@media (max-width: 760px) { .wide-only { display: none; } }

/* ---- welcome screen: Chinese Poker first (v0.32) ---- */
.brand-title .bt-main { font-size: clamp(2.2rem, 10.5vw, 3.4rem); white-space: nowrap; }
.byline { margin-top: .7rem; }
.variant-line { list-style: none; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .35rem .9rem; margin: 1.1rem 0 0; padding: .55rem 0 0; border-top: 1px solid color-mix(in srgb, var(--brass) 45%, transparent); width: min(340px, 100%); margin-inline: auto; }
.variant-line li { font-size: .82rem; font-weight: 750; font-stretch: 112%; letter-spacing: .14em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: .9rem; }
.variant-line li + li::before { content: ''; width: 5px; height: 5px; background: var(--brass); transform: rotate(45deg); flex: none; }
.variant-line { flex-wrap: nowrap; gap: .55rem; width: min(360px, 100%); }
.variant-line li { font-size: clamp(.68rem, 3.3vw, .82rem); letter-spacing: .08em; gap: .55rem; white-space: nowrap; }
.next-in { font-size: .9rem; color: var(--muted); margin-right: .2rem; }
.next-in b { color: var(--head); font-variant-numeric: tabular-nums; }
.result-actions { flex-wrap: wrap; gap: .6rem; }
.result-actions .next-in { flex: 1 1 100%; text-align: right; }
@media (max-width: 760px) {
  .result-actions { justify-content: stretch; }
  .result-actions .next-in { text-align: center; }
  .result-actions .btn { flex: 1 1 calc(50% - .6rem); }
  .result-actions .btn.primary { flex-basis: 100%; }
}

/* ---- 30-second tour (v0.35) ---- */
.tour-modal { max-width: 420px; }
.tour-video { display: block; width: 100%; max-height: 62vh; aspect-ratio: 780 / 1688; object-fit: contain; background: #000; border-radius: 12px; margin: .4rem 0 .6rem; }

/* Dealer button on the felt (version 0.36): a small puck that glides to the next player each hand */
.felt > .dealer-chip { position: absolute; z-index: 4; width: 36px; height: 38px; pointer-events: auto; user-select: none; line-height: 0;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.55));
}
.felt > .dealer-chip.leaving { animation: dealerOut .3s ease-in forwards; pointer-events: none; }
.felt > .dealer-chip.arriving { animation: dealerIn .45s .2s cubic-bezier(.2,.9,.3,1.3) backwards; }
@keyframes dealerOut { to { opacity: 0; transform: scale(.6); } }
@keyframes dealerIn { from { opacity: 0; transform: translateY(-14px) scale(1.35); } }
.mt-table .felt > .dealer-chip { width: 28px; height: 29px; }
@media (prefers-reduced-motion: reduce) { .felt > .dealer-chip.leaving, .felt > .dealer-chip.arriving { animation: none; } .felt > .dealer-chip.leaving { display: none; } }

/* Live game scorer (version 0.37) */
.live-page { max-width: 760px; margin: 0 auto; display: grid; gap: 1rem; }
.live-page h3 { margin: 1.1rem 0 .3rem; }
.live-page .field { display: grid; gap: .3rem; margin: .5rem 0; }
.live-page .field > span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.lv-player { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 520px) { .lv-player { grid-template-columns: 1fr; gap: 0; padding-bottom: .4rem; border-bottom: 1px solid var(--line); } }
.lv-n input { max-width: 9rem; }
.live-page .btn.big { width: 100%; margin-top: 1rem; padding: .9rem 1rem; font-size: 1.05rem; }
.lv-row { appearance: none; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .8rem; text-align: left; padding: .75rem .2rem; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer; }
.lv-row > span:first-child { display: grid; gap: .15rem; }
.lv-row-pts { white-space: nowrap; }
.lv-winner { margin: .6rem 0; padding: .7rem 1rem; border-radius: 12px; background: color-mix(in srgb, var(--brass) 22%, transparent); border: 1px solid var(--brass); font-weight: 800; font-size: 1.1rem; }
.lv-board { list-style: none; margin: .8rem 0; padding: 0; display: grid; gap: .35rem; counter-reset: lv; }
.lv-board li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 10px; background: var(--ink); border: 1px solid var(--line); font-size: 1.05rem; counter-increment: lv; }
.lv-board li::before { content: counter(lv); color: var(--muted); font-weight: 700; width: 1.2rem; }
.lv-board li .lv-name { flex: 1; }
.lv-board li.lead { border-color: var(--brass); }
.lv-board li b { font-size: 1.2rem; }
.lv-actions { display: grid; gap: .5rem; margin-top: .4rem; }
.lv-actions .btn.big { margin-top: 0; text-align: center; cursor: pointer; }
.lv-cam[aria-disabled=true] { opacity: .6; pointer-events: none; }
.lv-tip { margin: .5rem 0 0; }
.lv-more { margin-top: .9rem; }
.lv-check { border-color: var(--brass); }
.lv-chand { padding: .7rem 0; border-top: 1px solid var(--line); }
.lv-chand.killed { opacity: .7; }
.lv-chand-head { display: flex; flex-wrap: wrap; align-items: end; gap: .3rem 1rem; }
.lv-chand-head .lv-who { flex: 1 1 220px; margin: 0; }
.lv-crow, .lv-ph-row { display: grid; grid-template-columns: 4.2rem 1fr; align-items: center; gap: .4rem; margin: .3rem 0; }
.lv-ph-row { grid-template-columns: 4.2rem auto 1fr; }
.lv-crow .cards, .lv-ph-row .cards { display: flex; flex-wrap: wrap; gap: .25rem; }
.lv-cbtn { appearance: none; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; line-height: 0; }
.lv-cbtn .card, .lv-pc .card { --cw: 40px; --ch: 56px; }
.lv-cbtn.dup { outline: 3px solid #e5484d; outline-offset: 1px; }
.lv-cbtn.unsure { outline: 2px dashed var(--brass); outline-offset: 1px; }
.lv-q { display: inline-grid; place-items: center; font-weight: 800; font-size: 1.3rem; color: var(--brass); border: 2px dashed var(--brass); }
.lv-problems { margin: .7rem 0; padding-left: 1.2rem; color: #ffb4a8; font-size: .9rem; }
.lv-check-actions { margin-top: .6rem; }
.lv-check-actions label.btn { cursor: pointer; }
.lv-picker { max-width: 640px; }
.lv-suit { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; margin: .35rem 0; }
.lv-pc { appearance: none; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; line-height: 0; }
.lv-pc .card { --cw: min(38px, calc((100vw - 96px) / 13)); --ch: calc(var(--cw) * 1.4); }
.lv-pc .card b { font-size: min(1rem, 3.6vw); } .lv-pc .card i { font-size: min(.9rem, 3.2vw); }
.lv-pc.on { outline: 3px solid var(--brass); outline-offset: 1px; }
.lv-pc.used { opacity: .3; }
.lv-hand { border-top: 1px solid var(--line); padding: .5rem 0; }
.lv-hand summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; }
.lv-hand-pts { font-size: .9rem; }
.lv-ph { padding: .5rem 0 .3rem; }
.lv-ph-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.adm-live .lv-switch { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--ink); margin-bottom: .8rem; }
.adm-live .lv-switch.on { border-color: #3fb27f; }
.adm-live .lv-switch p { margin: .2rem 0 0; }
.adm-live .field { display: grid; gap: .3rem; margin: .5rem 0; max-width: 360px; }
.adm-live .field > span { font-size: .85rem; font-weight: 600; }

/* Password rules on sign-up / new password (version 0.38) */
.pw-rules { list-style: none; margin: -.2rem 0 .6rem; padding: 0; display: grid; gap: .15rem; font-size: .85rem; color: var(--muted); }
.pw-rules li.ok { color: #6fd39b; }
.pw-rules li.bad { color: #ff9b8f; }
.pw-rules .pw-mark { display: inline-block; width: 1.1em; font-weight: 800; }
