@charset "UTF-8";

:root {
  --bg: #061718;
  --bg-2: #0a2224;
  --panel: rgb(13 41 43 / 92%);
  --panel-solid: #0e2b2d;
  --line: rgb(255 255 255 / 10%);
  --line-strong: rgb(255 255 255 / 18%);
  --text: #eef4f0;
  --muted: #a6bcb5;
  --faint: #7f978f;
  --gold: #e8b863;
  --gold-deep: #c8933c;
  --teal: #34c3a2;
  --teal-deep: #1f8f77;
  --red: #e35d61;
  --felt: #11695a;
  --felt-deep: #0a3f37;
  --rail: #241a12;
  --card: #f7f2e6;
  --ink: #1b2331;
  --card-red: #c22b3b;
  --card-blue: #2463c9;
  --card-green: #18804a;
  --radius: 14px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #0d3133 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; 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: 50; background: var(--panel-solid); color: var(--gold); padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }

/* 顶栏 */
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: rgb(6 23 24 / 80%); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: .3px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(145deg, var(--felt), var(--felt-deep)); color: var(--card); font-size: 17px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%); }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.home-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.home-link:hover { color: var(--text); }
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.lang-switch button { background: transparent; border: 0; padding: 5px 10px; min-height: 34px; color: var(--muted); font-size: 13px; font-weight: 650; }
.lang-switch button[aria-pressed="true"] { background: rgb(255 255 255 / 10%); color: var(--text); }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--text); }

.screen { width: min(1200px, 100%); margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)); }

/* 大厅 */
.lobby { padding-top: clamp(28px, 7vh, 72px); padding-bottom: 48px; }
.lobby-hero { text-align: center; max-width: 640px; margin: 0 auto; }
.hero-cards { display: flex; justify-content: center; margin-bottom: 18px; --cw: 54px; }
.hero-cards .card { box-shadow: 0 10px 24px rgb(0 0 0 / 45%); }
.hero-cards .card:first-child { transform: rotate(-9deg) translateX(8px); }
.hero-cards .card:last-child { transform: rotate(8deg) translate(-8px, 4px); }
.kicker { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 4px; }
.lobby h1 { font-size: clamp(36px, 7vw, 60px); line-height: 1.15; margin-top: 10px; letter-spacing: -1px; }
.lobby-text { color: var(--muted); margin-top: 14px; font-size: 16px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.mode-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 22px 22px 24px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(160deg, rgb(255 255 255 / 6%), rgb(255 255 255 / 2%)); transition: transform .18s, border-color .18s, background-color .18s; }
.mode-card:hover { transform: translateY(-3px); border-color: rgb(232 184 99 / 45%); }
.mode-card.primary { background: linear-gradient(155deg, #145c50, #0c3a34); border-color: rgb(52 195 162 / 35%); }
.mode-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--card); color: var(--ink); font-size: 22px; box-shadow: 0 6px 18px rgb(0 0 0 / 25%); }
#go-host .mode-icon, #go-join .mode-icon { color: var(--card-red); }
.mode-title { font-size: 19px; font-weight: 750; margin-top: 6px; }
.mode-text { color: var(--muted); font-size: 14px; }
.lobby-links { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 28px; color: var(--faint); }
.text-btn { background: none; border: 0; color: var(--gold); padding: 8px 4px; font-weight: 600; }
.text-btn:hover { text-decoration: underline; }
.lobby-note { text-align: center; color: var(--faint); font-size: 12px; margin-top: 18px; }

/* 通用按钮 */
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 13px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgb(255 255 255 / 4%); font-size: 13px; font-weight: 600; color: var(--text); }
.chip-btn:hover { background: rgb(255 255 255 / 9%); }
.chip-btn.toggle[aria-pressed="true"] { border-color: rgb(52 195 162 / 60%); background: rgb(52 195 162 / 16%); }
.chip-btn.danger { color: #ffb4b4; border-color: rgb(227 93 97 / 40%); }
.act { min-height: 48px; padding: 8px 18px; border-radius: 12px; border: 0; font-weight: 750; font-size: 15px; color: #081716; background: var(--teal); box-shadow: 0 4px 14px rgb(0 0 0 / 25%); transition: filter .15s, transform .1s; }
.act:hover { filter: brightness(1.08); }
.act:active { transform: translateY(1px); }
.act:disabled { opacity: .45; cursor: not-allowed; }
.act.fold { background: #33403f; color: #f2d4d4; }
.act.raise { background: linear-gradient(180deg, #f0c574, var(--gold-deep)); }
.act.ghost { background: transparent; color: var(--muted); box-shadow: none; border: 1px solid var(--line-strong); }

/* 牌桌页 */
.table-screen { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: calc(100dvh - 56px); padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); gap: 8px; width: min(1400px, 100%); }
.table-bar { grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-strip { grid-row: 2; }
.table-layout { grid-row: 3; }
.action-bar { grid-row: 4; }
.table-info { color: var(--muted); font-size: 13px; text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.table-info strong { color: var(--text); font-weight: 650; }
.table-tools { display: flex; gap: 8px; }
.room-strip { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / 3%); font-size: 13px; }
.room-label { color: var(--muted); }
.room-code { font: 700 18px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 3px; color: var(--gold); }
.room-status { color: var(--muted); }
.table-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; }
.table-layout.with-panel { grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }

.stage { container-type: size; position: relative; min-height: 0; height: 100%; display: grid; place-items: center; padding: 58px 86px 62px; }
.felt {
  --ratio: 1.9;
  position: relative;
  width: min(100%, calc(100cqh * var(--ratio)));
  aspect-ratio: var(--ratio);
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 42%, #1b8a73 0%, var(--felt) 40%, var(--felt-deep) 100%);
  box-shadow: 0 0 0 10px var(--rail), 0 0 0 12px rgb(232 184 99 / 45%), 0 0 0 14px #120c08, 0 24px 60px rgb(0 0 0 / 55%), inset 0 0 70px rgb(0 0 0 / 40%);
}
.felt-mark { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 22%; color: rgb(255 255 255 / 7%); font-weight: 800; letter-spacing: 6px; font-size: clamp(11px, 1.6cqw, 18px); pointer-events: none; }
.center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; }
.pot { min-height: 26px; padding: 3px 14px; border-radius: 999px; background: rgb(0 0 0 / 28%); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pot:empty { visibility: hidden; }
.pot .side { color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 12px; }
.board { display: flex; gap: clamp(4px, .8cqw, 9px); --cw: clamp(34px, 5.4cqw, 64px); }
.result-line { min-height: 22px; max-width: 80%; text-align: center; color: var(--gold); font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px rgb(0 0 0 / 60%); }

@container (orientation: portrait) {
  .felt { --ratio: .64; width: min(100%, calc(100cqh * var(--ratio))); }
  .felt-mark { padding-top: 0; padding-bottom: 60%; }
  .board { --cw: clamp(30px, 10.5cqw, 52px); }
}
@media (max-width: 700px) {
  .stage { padding: 52px 40px 64px; }
}

/* 牌 */
.card { position: relative; flex: none; width: var(--cw, 48px); height: calc(var(--cw, 48px) * 1.4); border-radius: calc(var(--cw, 48px) * .11); background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / 35%), inset 0 0 0 1px rgb(0 0 0 / 8%); font-weight: 800; line-height: 1; user-select: none; }
.card .rank { position: absolute; top: 7%; left: 9%; font-size: calc(var(--cw, 48px) * .36); letter-spacing: -1px; }
.card .pip { position: absolute; top: 33%; left: 10%; font-size: calc(var(--cw, 48px) * .26); }
.card .suit { position: absolute; right: 8%; bottom: 5%; font-size: calc(var(--cw, 48px) * .52); }
.card.red { color: var(--card-red); }
.four .card.s2 { color: var(--card-blue); }
.four .card.s3 { color: var(--card-green); }
.card.back { background: repeating-linear-gradient(45deg, #1a7a66 0 4px, #126150 4px 8px); box-shadow: 0 2px 6px rgb(0 0 0 / 35%), inset 0 0 0 2px #f2ead6, inset 0 0 0 4px #126150; }
.card.slot { background: rgb(255 255 255 / 5%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%); }
.card.deal { animation: deal .32s cubic-bezier(.2, .7, .3, 1); }
.card.best { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgb(232 184 99 / 70%); transform: translateY(-4px); }
.card.dim { filter: brightness(.55) saturate(.7); }
@keyframes deal { from { transform: translateY(-14px) rotate(-6deg) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* 座位 */
.seats { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); width: clamp(100px, 14cqw, 150px); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: auto; transition: opacity .3s; }
.seat.empty { opacity: .45; }
.seat .hole { display: flex; justify-content: center; --cw: clamp(26px, 3.4cqw, 38px); margin-bottom: -14px; z-index: 1; }
.seat .hole .card + .card { margin-left: calc(var(--cw) * -.32); transform: rotate(6deg); }
.seat .hole .card:first-child { transform: rotate(-5deg); }
.seat.me .hole { --cw: clamp(40px, 5.6cqw, 62px); margin-bottom: -10px; }
.seat.me .hole .card + .card { margin-left: 4px; transform: none; }
.seat.me .hole .card:first-child { transform: none; }
.seat .plate { position: relative; width: 100%; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 12px; background: rgb(7 25 26 / 92%); box-shadow: 0 4px 14px rgb(0 0 0 / 40%), inset 0 0 0 1px var(--line-strong); z-index: 2; }
.seat .avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #0b1a19; background: hsl(var(--hue, 170) 55% 62%); }
.seat .who { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.seat .name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .stack { font-size: 12.5px; color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 650; }
.seat .meta { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .tag { min-height: 20px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: rgb(0 0 0 / 45%); color: var(--text); white-space: nowrap; max-width: 140%; overflow: hidden; text-overflow: ellipsis; }
.seat .tag:empty { visibility: hidden; }
.seat .tag.win { background: var(--gold); color: #1d1406; }
.seat .tag.fold { color: var(--faint); }
.seat .tag.allin { background: var(--red); color: #fff; }
.seat .timer { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 3px; border-radius: 3px; background: rgb(255 255 255 / 12%); overflow: hidden; }
.seat .timer span { display: block; height: 100%; width: 100%; background: var(--teal); transform-origin: left; }
.seat.acting .plate { box-shadow: 0 0 0 2px var(--teal), 0 0 18px rgb(52 195 162 / 45%); }
.seat.folded .plate, .seat.out .plate { opacity: .55; }
.seat.winner .plate { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgb(232 184 99 / 55%); }
.seat .badge { position: absolute; top: -9px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / 40%); }
.seat .badge.blind { background: #9fb7b0; }
.seat .offline { color: var(--red); }
.bet { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; border-radius: 999px; background: rgb(0 0 0 / 35%); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; transition: left .35s, top .35s, opacity .35s; pointer-events: none; }
.bet::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, var(--gold) 0 34%, #fff6df 36% 50%, var(--gold-deep) 52%); box-shadow: 0 1px 2px rgb(0 0 0 / 50%); }

/* 右侧：练习助手和记录 */
.side-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }
.side-panel:not(:has(> :not([hidden]))) { display: none; }
.helper, .feed { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; }
.helper h2, .feed h2 { font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .5px; margin-bottom: 8px; }
.helper dl { margin: 0; display: grid; gap: 8px; }
.helper dt { font-size: 11.5px; color: var(--faint); }
.helper dd { margin: 0; font-size: 14px; font-weight: 600; }
.helper .meter { height: 6px; border-radius: 6px; background: rgb(255 255 255 / 10%); margin-top: 5px; overflow: hidden; position: relative; }
.helper .meter span { position: absolute; inset: 0 auto 0 0; background: var(--teal); border-radius: 6px; }
.helper .meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); }
.helper .advice { font-size: 13px; color: var(--text); background: rgb(255 255 255 / 5%); border-radius: 10px; padding: 8px 10px; }
.feed ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); max-height: 46vh; overflow: auto; }
.feed li.street { color: var(--gold); font-weight: 650; margin-top: 4px; }
.feed li.win { color: var(--text); font-weight: 650; }
@media (max-width: 1099px) {
  .table-layout.with-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 6px; }
  .side-panel { max-height: 34vh; gap: 6px; }
  .helper { padding: 8px 12px; }
  .helper h2, .feed h2 { display: none; }
  .helper dl { grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; align-items: baseline; }
  .helper dt { font-size: 11px; }
  .helper dd { font-size: 12.5px; }
  .helper dd.advice { grid-column: 1 / -1; font-size: 12px; padding: 5px 8px; }
  .helper dd.fine { display: none; }
  .feed { padding: 8px 12px; }
  .feed ol { max-height: 22vh; }
}

/* 操作区 */
.action-bar { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 64px; }
.status-line { color: var(--muted); font-size: 14px; text-align: center; min-height: 22px; }
.status-line strong { color: var(--teal); }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(560px, 100%); }
.raise-panel { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 9; width: min(560px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 -12px 40px rgb(0 0 0 / 50%); }
.actions.covered { visibility: hidden; }
.kbd { font-size: 11px; font-weight: 600; opacity: .6; margin-left: 6px; }
@media (hover: none) { .kbd { display: none; } }
.presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.presets button { min-height: 36px; border-radius: 9px; border: 1px solid var(--line-strong); background: rgb(255 255 255 / 5%); font-size: 12.5px; font-weight: 650; padding: 4px; }
.presets button:hover { background: rgb(255 255 255 / 10%); }
.raise-row { display: flex; gap: 10px; align-items: center; }
.raise-row input[type="range"] { flex: 1; accent-color: var(--gold); min-height: 32px; }
.raise-row input[type="number"] { width: 110px; min-height: 40px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgb(0 0 0 / 25%); font-weight: 700; font-variant-numeric: tabular-nums; }
.raise-confirm { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.extra-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.extra-actions:empty { display: none; }

/* 覆盖层：房间大厅、补码、结束 */
.table-screen { position: relative; }
.overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px; background: rgb(4 14 15 / 55%); backdrop-filter: blur(3px); }
.overlay-card { width: min(460px, 100%); max-height: 100%; overflow: auto; border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--line-strong); padding: 22px; box-shadow: 0 20px 60px rgb(0 0 0 / 50%); display: flex; flex-direction: column; gap: 14px; }
.overlay-card h2 { font-size: 20px; }
.overlay-card p { color: var(--muted); font-size: 14px; }
.overlay-card .big-code { font: 800 34px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 6px; color: var(--gold); text-align: center; padding: 6px 0; }
.overlay-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.overlay-card .row > * { flex: 1; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.roster li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgb(255 255 255 / 4%); font-size: 14px; }
.roster li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster li small { color: var(--faint); }
.roster li button { min-height: 30px; padding: 2px 10px; font-size: 12px; }
.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
.standings th, .standings td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.standings td:last-child, .standings th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* 对话框 */
dialog { border: 1px solid var(--line-strong); border-radius: 18px; padding: 0; background: var(--panel-solid); color: var(--text); width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px rgb(0 0 0 / 60%); }
dialog.wide { width: min(640px, calc(100% - 24px)); }
dialog::backdrop { background: rgb(3 10 11 / 70%); backdrop-filter: blur(3px); }
.dialog-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dialog-form h2 { font-size: 20px; }
.dialog-form h3 { font-size: 15px; color: var(--gold); margin-top: 4px; }
.dialog-form p { color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0; }
.field input:not([type]), .field input[type="text"], .field input[name="name"], .field input[name="code"], .field select { min-height: 42px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgb(0 0 0 / 25%); }
.field select option { background: var(--panel-solid); }
.code-input { font: 700 20px/1 ui-monospace, "SF Mono", Menlo, monospace !important; letter-spacing: 4px; text-transform: uppercase; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--gold); min-height: 32px; }
.range-row output { min-width: 22px; font-weight: 750; text-align: right; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; }
.segmented label { position: relative; text-align: center; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 6px; font-size: 13.5px; font-weight: 650; color: var(--muted); }
.segmented input:checked + span { background: rgb(232 184 99 / 18%); color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -2px; }
.stack-options { display: flex; flex-direction: column; gap: 6px; }
.stack-options label, .check { display: flex; align-items: center; gap: 9px; font-size: 14px; min-height: 32px; }
.stack-options input, .check input { accent-color: var(--gold); width: 18px; height: 18px; }
.fine { font-size: 12.5px !important; color: var(--faint) !important; }
.form-error { color: #ffb0ae !important; font-size: 13px !important; }
.form-error:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.ranking { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ranking li { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.ranking .cards { display: flex; gap: 3px; --cw: 26px; }
.ranking strong { display: block; }
.ranking small { color: var(--faint); }
.terms { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }

/* 记录页 */
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head h1 { font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgb(255 255 255 / 3%); }
.stat span { display: block; font-size: 12px; color: var(--faint); }
.stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat strong.up { color: var(--teal); }
.stat strong.down { color: var(--red); }
.hint { color: var(--faint); font-size: 12.5px; margin-top: 10px; }
.history-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; }
.history-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgb(255 255 255 / 3%); }
.history-list button[aria-current="true"] { border-color: rgb(232 184 99 / 55%); background: rgb(232 184 99 / 8%); }
.history-list .h-title { font-weight: 650; font-size: 14px; }
.history-list .h-sub { grid-column: 1 / -1; font-size: 12px; color: var(--faint); }
.history-list .h-net { font-weight: 750; font-variant-numeric: tabular-nums; }
.history-list .h-net.up { color: var(--teal); }
.history-list .h-net.down { color: var(--red); }
.history-list .cards { display: inline-flex; gap: 2px; --cw: 20px; vertical-align: middle; margin-left: 6px; }
.history-detail { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgb(255 255 255 / 3%); min-height: 200px; }
.history-detail pre { margin: 0; white-space: pre-wrap; font: 13px/1.7 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); }
.history-detail .empty { color: var(--faint); }
.history-actions { display: flex; gap: 10px; margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 60; padding: 10px 16px; border-radius: 12px; background: var(--card); color: var(--ink); font-weight: 650; font-size: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / 40%); transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .mode-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-layout { grid-template-columns: minmax(0, 1fr); }
  .history-list { max-height: 34vh; }
}
@media (max-width: 560px) {
  .home-link { display: none; }
  .table-info { font-size: 12px; }
  .act { min-height: 50px; padding: 8px 10px; font-size: 14.5px; }
  .presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seat .meta { display: none; }
  .seat .avatar { width: 24px; height: 24px; font-size: 12px; }
  .seat .plate { padding: 5px 6px; gap: 5px; }
  .seat .name, .seat .stack { font-size: 11.5px; }
  .field-row { grid-template-columns: 1fr; }
  .ranking li { grid-template-columns: 1fr; }
}
/* 矮屏（手机横放）：顶栏和操作区压扁，练习助手放到牌桌右边 */
@media (max-height: 560px) and (orientation: landscape) {
  .topbar { height: 42px; }
  .brand-mark { width: 26px; height: 26px; font-size: 15px; }
  .table-screen { height: calc(100dvh - 42px); padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 4px; }
  .chip-btn { min-height: 32px; padding: 3px 10px; }
  .room-strip { padding: 3px 10px; }
  .table-layout.with-panel { grid-template-columns: minmax(0, 1fr) 250px; grid-template-rows: minmax(0, 1fr); gap: 8px; }
  .side-panel { max-height: none; }
  .helper dd.advice { font-size: 11.5px; }
  .stage { padding: 30px 64px 34px; }
  .seat { width: clamp(84px, 13cqw, 130px); }
  .seat .hole { --cw: clamp(22px, 3cqw, 32px); }
  .seat.me .hole { --cw: clamp(30px, 4.6cqw, 48px); }
  .seat .meta { display: none; }
  .action-bar { min-height: 0; gap: 4px; flex-direction: row; justify-content: center; }
  .status-line { display: none; }
  .actions { width: min(520px, 100%); gap: 8px; }
  .act { min-height: 40px; padding: 6px 10px; font-size: 14px; }
  .raise-panel { gap: 6px; padding: 8px; }
  .presets button { min-height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
