/* 德州陪练 · 界面样式（令牌见 tokens.css） */

/* ---------- 基础 ---------- */
html, body { height: 100%; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

#app { height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 进场：一次编排的入场，之后页面静止 */
.enter { animation: enter var(--dur-long) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 44px; padding: 0 var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-paper-3);
  color: var(--color-ink);
  font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color var(--dur-short) var(--ease-out), transform 100ms var(--ease-out), border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.btn:hover { background: var(--color-paper-4); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-primary:hover { background: var(--color-focus); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px) scale(0.99); }
.btn-outline { background: transparent; border-color: var(--color-accent); color: var(--color-accent); }
.btn-outline:hover { background: oklch(80% 0.13 85 / 0.12); }
.btn-ghost { background: transparent; color: var(--color-muted); border-color: var(--color-rule); }
.btn-ghost:hover { background: var(--color-paper-2); color: var(--color-ink); }
.btn-danger { background: transparent; border-color: var(--color-rule); color: var(--color-bad); }
.btn-danger:hover { background: oklch(66% 0.18 25 / 0.12); }
.btn-lg { min-height: 52px; padding: 0 var(--space-lg); font-size: var(--text-md); }
.btn-xl { min-height: 58px; padding: 0 var(--space-lg); font-size: var(--text-md); border-radius: var(--radius-lg); width: 100%; }
.btn-sm { min-height: 34px; padding: 0 var(--space-sm); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-md); color: var(--color-muted); }
.btn-icon:hover { color: var(--color-ink); background: var(--color-paper-2); }
.btn-icon svg { width: 22px; height: 22px; }
.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
kbd { font-family: var(--font-display); font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.55; }

/* 分段选择 */
.seg { display: inline-flex; align-items: center; background: var(--color-paper-2); border-radius: var(--radius-md); padding: 3px; gap: 2px; }
.seg button { min-height: 36px; min-width: 44px; padding: 0 var(--space-sm); border-radius: var(--radius-sm); color: var(--color-muted); font-weight: 600; transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.seg button[aria-pressed="true"] { background: var(--color-paper-4); color: var(--color-ink); }
.seg button:hover { color: var(--color-ink); }
.seg-sm { padding: 2px; }
.seg-sm button { min-height: 32px; min-width: 34px; padding: 0 8px; font-size: var(--text-sm); }
.seg-label { padding: 0 6px 0 10px; font-size: var(--text-sm); color: var(--color-muted); }

/* 开关 */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: 44px; width: 100%; text-align: left; }
.switch-label { display: flex; flex-direction: column; gap: 2px; }
.switch-label small { color: var(--color-muted); font-size: var(--text-sm); }
.switch-track { flex: none; width: 46px; height: 28px; border-radius: var(--radius-pill); background: var(--color-paper-4); position: relative; transition: background-color var(--dur-short) var(--ease-out); }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--color-ink); transition: transform var(--dur-short) var(--ease-out); }
.switch[aria-checked="true"] .switch-track { background: var(--color-accent); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(18px); background: var(--color-accent-ink); }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px 0 10px;
  border-radius: var(--radius-pill); border: 1px solid var(--color-rule); color: var(--color-muted);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  transition: border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.chip-toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-neutral); transition: background-color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.chip-toggle:hover { background: var(--color-paper-2); color: var(--color-ink); }
.chip-toggle[aria-checked="true"] { border-color: var(--color-accent); color: var(--color-ink); }
.chip-toggle[aria-checked="true"] .dot { background: var(--color-accent); box-shadow: 0 0 0 3px oklch(80% 0.13 85 / 0.2); }

/* ---------- 大厅 ---------- */
#lobby { overflow-y: auto; overflow-x: hidden; padding-inline: max(var(--space-md), env(safe-area-inset-left), env(safe-area-inset-right)); }
.lobby-inner { width: 100%; max-width: 60rem; margin-inline: auto; padding-block: var(--space-sm) var(--space-2xl); display: flex; flex-direction: column; gap: var(--space-xl); }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: 48px; }
.wordmark { display: flex; align-items: baseline; gap: var(--space-xs); min-width: 0; }
.wordmark-cn { font-size: var(--text-md); font-weight: 800; letter-spacing: 0.04em; white-space: nowrap; }
.wordmark-en { font-family: var(--font-display); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-accent); white-space: nowrap; }
.level-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px 0 8px; border-radius: var(--radius-pill); border: 1px solid var(--color-rule); color: var(--color-muted); font-size: var(--text-sm); white-space: nowrap; flex: none; transition: border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
@media (max-width: 22.5rem) { .wordmark-en { display: none; } }
.level-pill:hover { border-color: var(--color-accent); color: var(--color-ink); }
.level-pill-no { font-family: var(--font-display); font-weight: 700; color: var(--color-ink); letter-spacing: 0.02em; }

.hero { display: grid; gap: var(--space-lg); grid-template-areas: "text" "stage" "cta"; }
.hero-text { grid-area: text; display: flex; flex-direction: column; gap: var(--space-sm); }
.headline { margin: 0; font-size: clamp(1.8rem, 8.6vw, 3.4rem); line-height: 1.14; font-weight: 800; letter-spacing: 0.01em; text-wrap: balance; }
.lede { margin: 0; color: var(--color-muted); font-size: var(--text-base); line-height: 1.65; max-width: 26em; }

.stage { grid-area: stage; position: relative; height: 188px; }
@media (max-width: 60rem) {
  /* 手机上让绒布一直延伸到屏幕边缘，并在那里裁掉，不产生横向滚动 */
  .stage { margin-inline: calc(-1 * max(var(--space-md), env(safe-area-inset-left), env(safe-area-inset-right))); overflow: hidden; }
}
.stage-felt {
  position: absolute; left: -22%; right: -22%; top: 26px; bottom: 0; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 32%, var(--color-felt) 0%, var(--color-felt-deep) 82%);
  box-shadow: 0 0 0 8px var(--color-rail), 0 0 0 9px var(--color-rail-edge), 0 18px 40px oklch(8% 0.03 160 / 0.6), inset 0 0 40px oklch(20% 0.05 160 / 0.5);
}
.stage-felt::after { content: ""; position: absolute; inset: 16% 22%; border-radius: 50%; border: 1px solid oklch(60% 0.08 160 / 0.25); }
.stage-cards { position: absolute; left: 50%; top: 16px; width: 0; height: 0; }
.stage-cards .card { position: absolute; left: 0; top: 0; width: 78px; transform-origin: 50% 100%; box-shadow: 0 14px 28px oklch(8% 0.03 160 / 0.55), 0 2px 4px oklch(10% 0 0 / 0.4); }
.stage-cards .card:nth-child(1) { transform: translate(-84px, 12px) rotate(-14deg); }
.stage-cards .card:nth-child(2) { transform: translate(-30px, 0) rotate(5deg); }
.stage-btn {
  position: absolute; left: calc(50% + 76px); top: 112px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-card); color: var(--color-card-ink); font-family: var(--font-display); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px oklch(10% 0 0 / 0.5);
}
.stage-chip { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2px dashed var(--chip-edge); box-shadow: inset 0 0 0 2px oklch(100% 0 0 / 0.25), 0 2px 3px oklch(10% 0 0 / 0.5); }
.stage-chip-a { left: calc(50% - 150px); top: 104px; background: var(--chip-25); }
.stage-chip-b { left: calc(50% - 136px); top: 97px; background: var(--chip-100); }

.hero-cta { grid-area: cta; display: flex; flex-direction: column; gap: var(--space-md); }
.bank-row { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2xs); }
@media (min-width: 40rem) { .bank-row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: var(--space-md); } }
.bank-label { color: var(--color-muted); font-size: var(--text-sm); margin: 0 0 2px; }
.bank-amount { font-size: clamp(2.5rem, 10vw, 3.6rem); font-weight: 700; line-height: 1; margin: 0; }
.bank-last { margin: 0; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.5; max-width: 15em; }
.bank-last strong { color: var(--color-ink); font-weight: 600; }
.table-setup { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.start-note { color: var(--color-muted); font-size: var(--text-sm); margin: 0; }

.today { display: flex; flex-direction: column; gap: var(--space-sm); padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); }
.today-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
.today-head h2 { margin: 0; font-size: var(--text-md); font-weight: 700; }
.today-signin { color: var(--color-good); font-size: var(--text-sm); }
.missions { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xs); }
.mission { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text reward" "bar progress"; gap: 6px var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); background: var(--color-paper-2); }
.mission-text { grid-area: text; font-size: var(--text-sm); font-weight: 600; }
.mission-reward { grid-area: reward; font-weight: 700; color: var(--color-accent); font-size: var(--text-sm); white-space: nowrap; }
.mission .bar { grid-area: bar; height: 4px; }
.mission-progress { grid-area: progress; font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
.mission.done { opacity: 0.6; }
.mission.done .mission-reward { color: var(--color-good); }

.progress { display: flex; flex-direction: column; gap: var(--space-xs); padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); }
.level-row { display: flex; justify-content: space-between; gap: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.level-row strong { color: var(--color-ink); }
.bar { height: 6px; background: var(--color-paper-3); border-radius: var(--radius-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--color-accent); border-radius: var(--radius-pill); transition: transform var(--dur-long) var(--ease-out); transform-origin: left; }

.lobby-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); }

@media (min-width: 60rem) {
  .lobby-inner { padding-block: var(--space-md) var(--space-2xl); gap: var(--space-2xl); }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "text stage" "cta stage"; column-gap: var(--space-2xl); row-gap: var(--space-xl); align-items: center; }
  .headline { font-size: clamp(2.6rem, 4vw, 3.4rem); }
  .stage { height: 320px; }
  .stage-felt { left: -4%; right: -4%; top: 40px; }
  .stage-cards { top: 28px; }
  .stage-cards .card { width: 118px; }
  .stage-cards .card:nth-child(1) { transform: translate(-126px, 18px) rotate(-14deg); }
  .stage-cards .card:nth-child(2) { transform: translate(-44px, 0) rotate(5deg); }
  .stage-btn { left: calc(50% + 112px); top: 200px; width: 32px; height: 32px; font-size: 15px; }
  .stage-chip { width: 28px; height: 28px; }
  .stage-chip-a { left: calc(50% - 210px); top: 180px; }
  .stage-chip-b { left: calc(50% - 192px); top: 170px; }
  .lobby-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .today, .progress { max-width: 36rem; }
}

/* ---------- 牌桌 ---------- */
#table { background: var(--color-paper); }
.topbar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-xs);
  padding: var(--space-2xs) max(var(--space-xs), env(safe-area-inset-left)) var(--space-2xs) max(var(--space-xs), env(safe-area-inset-right));
  min-height: 48px;
}
.topbar-right { display: flex; gap: 2px; }
.flow { min-width: 0; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-md); }
.flow:hover { background: var(--color-paper-2); }
.flow-line { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; font-size: var(--text-sm); }
.flow-street { flex: none; font-size: var(--text-xs); font-weight: 700; color: var(--color-accent); border: 1px solid var(--color-accent); border-radius: var(--radius-sm); padding: 0 6px; line-height: 1.5; }
.flow-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 40rem) { .flow-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; } }
.flow-why { font-size: var(--text-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow.open .flow-text, .flow.open .flow-why { white-space: normal; display: block; }

.table-wrap { position: relative; flex: 1; min-height: 0; margin: 0 auto; width: 100%; max-width: 1100px; }
.felt {
  position: absolute; inset: 36px 42px;
  border-radius: 50% / 50%;
  background: radial-gradient(ellipse at 50% 38%, var(--color-felt) 0%, var(--color-felt-deep) 85%);
  box-shadow: 0 0 0 10px var(--color-rail), 0 0 0 11px var(--color-rail-edge), 0 20px 50px oklch(8% 0.03 160 / 0.55), inset 0 0 44px oklch(20% 0.05 160 / 0.5);
}
.felt::after { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1px solid oklch(60% 0.08 160 / 0.25); }
@media (min-width: 40rem) { .felt { inset: 44px 62px; } }

.board-area { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); z-index: var(--z-base); }
.tracker { display: flex; gap: 3px; list-style: none; margin: 0; padding: 0; }
.tracker li { font-size: 10px; letter-spacing: 0.04em; color: oklch(75% 0.04 160 / 0.6); padding: 1px 6px; border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; transition: color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out); }
.tracker li.done { color: oklch(85% 0.05 160 / 0.75); }
.tracker li.done::before { content: "✓ "; }
.tracker li.current { color: var(--color-accent); border-color: var(--color-accent); }
.board { display: flex; gap: clamp(3px, 1vw, 6px); min-height: calc(var(--card-w) * 1.4); }
.board .card { width: var(--card-w); }
.pot { display: flex; align-items: center; gap: var(--space-xs); padding: 2px 10px; border-radius: var(--radius-pill); background: oklch(20% 0.04 160 / 0.55); color: var(--color-ink); font-size: var(--text-xs); white-space: nowrap; }
.pot .num { font-size: var(--text-md); font-weight: 700; }

/* 座位 */
.seat {
  position: absolute; width: clamp(86px, 22vw, 120px); transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: var(--z-raised);
  transition: opacity var(--dur-short) var(--ease-out);
}
.seat-cards { display: flex; height: calc(var(--seat-card-w) * 1.4); }
.seat-cards .card { width: var(--seat-card-w); }
.seat-cards .card + .card { margin-left: -6px; }
.seat-box {
  width: 100%; padding: 6px 7px 5px; border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--color-paper-3), var(--color-paper-2));
  border: 1.5px solid oklch(100% 0 0 / 0.08);
  box-shadow: 0 6px 16px oklch(8% 0.03 160 / 0.35);
  line-height: 1.15; position: relative;
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.seat-main { display: flex; align-items: center; gap: 7px; min-width: 0; }
.avatar {
  flex: none; position: relative; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--color-ink);
  background: var(--avatar-bg, var(--color-paper-4));
}
.seat.hero .avatar { background: var(--color-accent); color: var(--color-accent-ink); }
.ring { position: absolute; left: -4px; top: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); pointer-events: none; opacity: 0; transition: opacity var(--dur-short) var(--ease-out); }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: oklch(100% 0 0 / 0.14); }
.ring .fill { stroke: var(--color-accent); stroke-dasharray: 100; stroke-dashoffset: 0; stroke-linecap: round; }
.seat.thinking .ring { opacity: 1; }
.seat.thinking .ring .fill { animation: ring-drain var(--think-ms, 2000ms) linear forwards; }
@keyframes ring-drain { to { stroke-dashoffset: 100; } }
.seat-text { min-width: 0; display: flex; flex-direction: column; }
.seat-name { font-size: var(--text-xs); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-chips { font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.seat-status { font-size: 10px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-muted); min-height: 13px; }
.seat-status.act { color: var(--color-accent); }
.seat-status.need { color: var(--color-warn); }
.seat-status.ok { color: var(--color-good); }
.seat-status.fold { color: var(--color-neutral); }
.seat-status.allin { color: var(--color-accent); }
.seat-pos {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; line-height: 1;
  padding: 2px 6px; border-radius: var(--radius-pill); background: var(--color-paper-4); color: var(--color-muted); white-space: nowrap;
}
.seat-pos.is-btn { background: var(--color-card); color: var(--color-card-ink); }
.seat-pos.is-blind { background: var(--color-paper-4); color: var(--color-ink); }
.seat.active .seat-box { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent), 0 6px 16px oklch(8% 0.03 160 / 0.35); }
.seat.hero { transform: translate(-50%, -88%); }
.seat.folded { opacity: 0.45; }
.seat.out { opacity: 0.3; }
.seat.winner .seat-box { border-color: var(--color-accent); background: linear-gradient(180deg, oklch(80% 0.13 85 / 0.24), oklch(80% 0.13 85 / 0.1)); }

/* 下注筹码 */
.bet { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; z-index: var(--z-base); font-size: var(--text-xs); font-weight: 700; color: var(--color-ink); white-space: nowrap; text-shadow: 0 1px 2px oklch(10% 0 0 / 0.6); }
.chip { width: 16px; height: 16px; border-radius: 50%; background: var(--chip-color, var(--chip-25)); border: 2px dashed var(--chip-edge); box-shadow: inset 0 0 0 2px oklch(100% 0 0 / 0.2), 0 1px 0 oklch(10% 0 0 / 0.5); }
.chip-stack { position: relative; width: 16px; height: 16px; }
.chip-stack .chip { position: absolute; left: 0; }
.dealer-btn {
  position: absolute; width: 22px; height: 22px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--color-card); color: var(--color-card-ink); font-family: var(--font-display); font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px oklch(10% 0 0 / 0.5); z-index: var(--z-base);
  transition: left var(--dur-long) var(--ease-out), top var(--dur-long) var(--ease-out);
}

/* 牌 */
.card {
  position: relative; aspect-ratio: 5 / 7; width: var(--card-w); flex: none; border-radius: 8%;
  background: linear-gradient(160deg, var(--color-card) 0%, var(--color-card-shade) 100%);
  color: var(--color-card-ink); box-shadow: 0 1px 2px oklch(10% 0 0 / 0.45);
  user-select: none; container-type: inline-size;
}
/* 牌面内容放在 face 里：内边距和字号都按牌自身宽度算，放进任何容器都一样 */
.card .face {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 6cqw 8cqw;
  font-family: var(--font-display); font-weight: 700; line-height: 1;
}
.card .rank { font-size: 42cqw; letter-spacing: -0.04em; }
.card .suit-sm { font-size: 30cqw; margin-top: -2cqw; }
.card .suit-big { position: absolute; right: 8cqw; bottom: 4cqw; font-size: 52cqw; line-height: 1; opacity: 0.9; }
.card.red { color: var(--color-card-red); }
.four-color .card.diamond { color: var(--color-card-blue); }
.four-color .card.club { color: var(--color-card-green); }
.card.back {
  background: repeating-linear-gradient(45deg, var(--color-card-back) 0 4px, var(--color-card-back-2) 4px 8px);
  border: 3px solid var(--color-card); box-shadow: 0 1px 2px oklch(10% 0 0 / 0.45);
}
.card.back > * { display: none; }
.card.dim { opacity: 0.4; }
.card.mine { box-shadow: 0 0 0 2px oklch(80% 0.13 85 / 0.7), 0 1px 2px oklch(10% 0 0 / 0.45); }
.card.best { box-shadow: 0 0 0 2px var(--color-accent), 0 0 12px oklch(80% 0.13 85 / 0.5); }

/* 底部：手牌与动作 */
.bottom {
  position: relative;
  flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: var(--space-xs) var(--space-md);
  padding: var(--space-xs) max(var(--space-md), env(safe-area-inset-left)) max(var(--space-sm), env(safe-area-inset-bottom)) max(var(--space-md), env(safe-area-inset-right));
  background: var(--color-paper-2); border-top: 1px solid var(--color-rule);
}
.hero-cards { grid-row: 1 / 3; display: flex; gap: 6px; align-self: center; }
.hero-cards .card { width: var(--hero-card-w); box-shadow: 0 6px 14px oklch(8% 0.03 160 / 0.5); }
.hero-cards .card + .card { margin-left: -10px; transform: rotate(4deg); }
.hero-cards .card:first-child { transform: rotate(-4deg); }
.hero-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.readout { display: flex; align-items: baseline; gap: var(--space-xs); flex-wrap: wrap; }
.readout-title { font-weight: 700; font-size: var(--text-md); }
.readout-sub { color: var(--color-muted); font-size: var(--text-sm); }
.coach-chip {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--color-accent); color: var(--color-accent);
  font-size: var(--text-sm); font-weight: 600; min-height: 28px; animation: fade var(--dur-short) var(--ease-out);
  transition: background-color var(--dur-short) var(--ease-out);
}
.coach-chip:hover { background: oklch(80% 0.13 85 / 0.12); }
.coach-chip .icon { width: 14px; height: 14px; }

.actions { grid-column: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); align-items: start; }
.action { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.action .btn { width: 100%; min-height: 50px; padding: 0 var(--space-xs); flex-direction: column; gap: 1px; line-height: 1.15; }
.action .btn .lbl { display: inline-flex; align-items: center; gap: 6px; }
.action .btn kbd { display: none; }
.action .btn small { font-size: var(--text-xs); font-weight: 600; opacity: 0.85; }
.action-hint { font-size: 11px; line-height: 1.3; color: var(--color-muted); min-height: 0; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.waiting-note { grid-column: 2; color: var(--color-muted); font-size: var(--text-sm); min-height: 48px; display: flex; align-items: center; }
@media (max-width: 40rem) {
  .bottom { grid-template-rows: auto auto; }
  .hero-cards { grid-row: 1; }
  .actions, .waiting-note { grid-column: 1 / -1; }
  .waiting-note { min-height: 36px; }
  .action .btn { min-height: 52px; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 60rem) { .action .btn kbd { display: inline-block; } }

/* 加注面板 */
.raise-panel {
  position: absolute; left: var(--space-md); right: var(--space-md); bottom: calc(100% + 4px); z-index: var(--z-dropdown);
  display: grid; gap: var(--space-xs);
  padding: var(--space-sm); border-radius: var(--radius-lg); background: var(--color-paper-3);
  box-shadow: 0 -6px 24px oklch(10% 0.02 160 / 0.45);
  animation: sheet-in var(--dur-short) var(--ease-out);
}
.raise-head { display: flex; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; }
.raise-amount { font-size: var(--text-lg); font-weight: 700; }
.raise-note { margin-left: auto; font-size: var(--text-xs); color: var(--color-muted); }
.raise-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.raise-presets .btn { flex: 1 1 3.5rem; min-height: 34px; font-size: var(--text-sm); padding: 0 6px; border-radius: var(--radius-sm); }
.raise-slider { width: 100%; accent-color: var(--color-accent); height: 32px; margin: 0; }
.raise-actions { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-xs); }
.raise-stepper { display: inline-flex; gap: 4px; }
.raise-stepper .btn { width: 44px; padding: 0; }

/* ---------- 浮层：抽屉、弹层、提示 ---------- */
.scrim { position: fixed; inset: 0; background: oklch(10% 0.02 160 / 0.6); z-index: var(--z-modal); display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: fade var(--dur-short) var(--ease-out); }
.scrim.center { align-items: center; padding: var(--space-md); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 40rem; max-height: min(88vh, 88dvh); overflow-y: auto;
  background: var(--color-paper-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md) max(var(--space-md), env(safe-area-inset-left)) max(var(--space-lg), env(safe-area-inset-bottom)) max(var(--space-md), env(safe-area-inset-right));
  animation: sheet-in var(--dur-long) var(--ease-out);
  display: flex; flex-direction: column; gap: var(--space-md);
}
.scrim.center .sheet { border-radius: var(--radius-lg); padding-bottom: var(--space-md); animation: pop-in var(--dur-long) var(--ease-out); max-width: 32rem; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.96); opacity: 0; } }
@media (min-width: 40rem) {
  .scrim { align-items: center; padding: var(--space-md); }
  .sheet { border-radius: var(--radius-lg); padding-bottom: var(--space-lg); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.sheet-head h2 { margin: 0; font-size: var(--text-md); font-weight: 700; }
.sheet h3 { margin: var(--space-sm) 0 var(--space-xs); font-size: var(--text-base); color: var(--color-accent); font-weight: 700; }
.sheet p { margin: 0 0 var(--space-xs); color: var(--color-muted); }
.sheet p strong { color: var(--color-ink); }
.sheet ul, .sheet ol { margin: 0 0 var(--space-sm); padding-left: 1.2em; color: var(--color-muted); }
.sheet li { margin-bottom: var(--space-2xs); }
.sheet li strong { color: var(--color-ink); }
.checklist { counter-reset: step; list-style: none; padding-left: 0 !important; display: grid; gap: var(--space-xs); }
.checklist li { position: relative; padding-left: 2rem; min-height: 1.6rem; }
.checklist li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0.1rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--color-paper-4); color: var(--color-ink); font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); display: flex; align-items: center; justify-content: center; }
.diagram { display: flex; justify-content: center; margin: var(--space-xs) 0 var(--space-sm); }
.diagram svg { width: 100%; max-width: 440px; height: auto; }

/* 发牌员记录抽屉 */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 24rem); background: var(--color-paper-2); border-left: 1px solid var(--color-rule); z-index: var(--z-modal); display: flex; flex-direction: column; animation: drawer-in var(--dur-long) var(--ease-out); padding-top: env(safe-area-inset-top, 0px); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.drawer-head h2 { margin: 0; font-size: var(--text-base); }
.log { flex: 1; overflow-y: auto; padding: var(--space-sm) var(--space-md) max(var(--space-md), env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 3px; font-size: var(--text-sm); }
.log-line { color: var(--color-muted); padding-left: 10px; position: relative; }
.log-line::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 4px; height: 4px; border-radius: 50%; background: var(--color-neutral); }
.log-line.deal { color: var(--color-ink); }
.log-line.deal::before { background: var(--color-good); }
.log-line.pot { color: var(--color-accent); }
.log-line.pot::before { background: var(--color-accent); }
.log-line.end { color: var(--color-ink); font-weight: 700; margin-top: var(--space-xs); padding-left: 0; }
.log-line.end::before { display: none; }
.log-line.note::before { background: var(--color-warn); }

/* 结果层 */
.result { display: flex; flex-direction: column; gap: var(--space-sm); }
.result-title { font-size: var(--text-xl); font-weight: 800; margin: 0; line-height: 1.1; }
.result-title.win { color: var(--color-accent); }
.result-sub { color: var(--color-muted); margin: 0; }
.result-board { display: flex; gap: 4px; align-items: center; }
.result-board .card, .reveal .card { width: 34px; box-shadow: none; }
.result-board .card.best, .reveal .card.best { box-shadow: 0 0 0 2px var(--color-accent); }
.result-board-label { font-size: var(--text-xs); color: var(--color-muted); margin-right: 4px; }
.reveals { display: grid; gap: 4px; }
.reveal { display: grid; grid-template-columns: 5rem auto minmax(0, 1fr); align-items: center; gap: var(--space-sm); padding: 4px 8px; border-radius: var(--radius-md); font-size: var(--text-sm); }
.reveal.win { background: oklch(80% 0.13 85 / 0.12); }
.reveal-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal-cards { display: flex; gap: 3px; }
.reveal-hand { color: var(--color-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reveal.win .reveal-hand { color: var(--color-ink); }
.result-lines { display: grid; gap: var(--space-2xs); font-size: var(--text-sm); }
.result-lines .row { display: flex; justify-content: space-between; gap: var(--space-sm); }
.result-lines .row span:last-child { font-weight: 700; }
.review { display: grid; gap: 2px; font-size: var(--text-sm); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-md); background: var(--color-paper-3); }
.review-title { font-weight: 700; }
.review-line { color: var(--color-muted); }
.review-line.diff::before { content: "· "; color: var(--color-warn); }
.fair-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); font-size: var(--text-xs); color: var(--color-muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--text-xs); word-break: break-all; color: var(--color-ink); }
.mono.small { color: var(--color-muted); }
.deck-group { display: flex; flex-direction: column; gap: 4px; }
.deck-label { font-size: var(--text-xs); color: var(--color-muted); }
.mini-cards.wrap { flex-wrap: wrap; }
.result-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.countdown { color: var(--color-muted); font-size: var(--text-sm); }
.achv-pop { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-accent); border-radius: var(--radius-md); }
.achv-pop strong { color: var(--color-accent); }
.achv-pop small { color: var(--color-muted); display: block; }

/* 发牌员提问 */
.quiz-bar {
  position: absolute; left: 50%; bottom: var(--space-2xs); transform: translateX(-50%); z-index: var(--z-dropdown);
  width: min(92%, 30rem); background: var(--color-paper-2); border: 1px solid var(--color-accent); border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md); display: flex; flex-direction: column; gap: var(--space-xs); animation: pop-in var(--dur-short) var(--ease-out);
  box-shadow: 0 10px 30px oklch(8% 0.03 160 / 0.5);
}
.quiz-tag { font-size: var(--text-xs); font-weight: 700; color: var(--color-accent); letter-spacing: 0.06em; }
.quiz-prompt { margin: 0; font-weight: 600; }
.quiz-options { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.quiz-options .btn { flex: 1 1 auto; min-height: 38px; font-size: var(--text-sm); }
.quiz-feedback { margin: 0; font-size: var(--text-sm); color: var(--color-muted); }
.quiz-feedback.ok { color: var(--color-good); }
.quiz-feedback.bad { color: var(--color-bad); }
.seat.pick { cursor: pointer; }
.seat.pick .seat-box { border-style: dashed; border-color: var(--color-accent); }
.seat.pick:hover .seat-box { background: var(--color-paper-3); }
.quiz-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); font-size: var(--text-xs); color: var(--color-muted); }

/* 提示条 */
.toast-wrap { position: fixed; left: 50%; bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-xs); align-items: center; pointer-events: none; width: min(92%, 26rem); }
.toast { background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; animation: toast-in var(--dur-long) var(--ease-out); pointer-events: auto; text-align: center; }
.toast.gold { background: var(--color-accent); color: var(--color-accent-ink); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: var(--z-dropdown); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-md); background: oklch(20% 0.04 160 / 0.9); color: var(--color-ink); font-size: var(--text-sm); white-space: nowrap; animation: fade var(--dur-short) var(--ease-out); pointer-events: none; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }

/* 规则速查 */
.rank-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.rank-table td { padding: 6px 4px; border-bottom: 1px solid var(--color-rule); vertical-align: middle; }
.rank-table td:first-child { color: var(--color-ink); font-weight: 700; white-space: nowrap; }
.rank-table td:last-child { color: var(--color-muted); }
.mini-cards { display: flex; gap: 3px; }
.mini-cards .card { width: 24px; box-shadow: none; }
.mini-cards .card .suit-big { display: none; }
.mini-cards .card .rank { font-size: 46cqw; }
.mini-cards .card .suit-sm { font-size: 36cqw; }
.flow-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.flow-table th, .flow-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--color-rule); vertical-align: top; }
.flow-table th { color: var(--color-ink); font-weight: 700; white-space: nowrap; }
.flow-table td { color: var(--color-muted); }
.faq dt { font-weight: 700; margin-top: var(--space-sm); }
.faq dd { margin: var(--space-2xs) 0 0; color: var(--color-muted); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .btn { flex: none; }

/* 成就与统计 */
.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--space-xs); }
.achv { padding: var(--space-sm); border-radius: var(--radius-md); background: var(--color-paper-3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.achv.locked { opacity: 0.55; }
.achv strong { font-size: var(--text-sm); }
.achv small { color: var(--color-muted); font-size: var(--text-xs); line-height: 1.35; }
.achv .reward { color: var(--color-accent); font-weight: 700; font-size: var(--text-xs); margin-top: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: var(--space-sm); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--color-muted); font-size: var(--text-xs); }
.stat .num { font-size: var(--text-lg); font-weight: 700; }
.settings-list { display: flex; flex-direction: column; }
.settings-list .switch, .settings-list .setting-row { padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; min-height: 44px; }
.setting-row > span { display: flex; flex-direction: column; }
.setting-row small { color: var(--color-muted); font-size: var(--text-sm); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; position: relative; }
.swatch[aria-pressed="true"] { border-color: var(--color-accent); }
.swatch:disabled { opacity: 0.35; cursor: not-allowed; }
.swatch.green { background: oklch(39% 0.085 160); }
.swatch.blue { background: oklch(40% 0.08 240); }
.swatch.red { background: oklch(40% 0.1 25); }
.swatch.purple { background: oklch(38% 0.09 300); }
.swatch.classic { background: repeating-linear-gradient(45deg, oklch(42% 0.1 25) 0 3px, oklch(30% 0.09 25) 3px 6px); }
.swatch.ocean { background: repeating-linear-gradient(45deg, oklch(45% 0.1 240) 0 3px, oklch(32% 0.09 240) 3px 6px); }
.swatch.forest { background: repeating-linear-gradient(45deg, oklch(45% 0.1 150) 0 3px, oklch(32% 0.09 150) 3px 6px); }
.danger-zone { display: flex; flex-direction: column; gap: var(--space-xs); padding-top: var(--space-sm); }
.danger-zone small { color: var(--color-muted); }

/* 飞行筹码 */
.fly { position: absolute; z-index: var(--z-dropdown); pointer-events: none; display: flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: 700; color: var(--color-accent); transform: translate(-50%, -50%); }

/* ---------- 宽屏调整 ---------- */
@media (min-width: 60rem) {
  .bottom { grid-template-columns: auto minmax(0, 1fr); max-width: 1100px; width: 100%; margin: 0 auto; border-top: 0; background: transparent; padding-bottom: max(var(--space-md), env(safe-area-inset-bottom)); }
  .actions { max-width: 36rem; }
  .raise-panel { left: auto; width: min(44rem, calc(100% - 2 * var(--space-md))); }
  .seat { width: 126px; }
  .flow-line { font-size: var(--text-base); }
  .flow-why { font-size: var(--text-sm); }
  .tracker li { font-size: 11px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .bottom { padding-block: 4px 6px; }
  .hero-cards .card { width: clamp(44px, 9vh, 72px); }
  .action .btn { min-height: 40px; }
  .action-hint { display: none; }
  .felt { inset: 30px 40px; }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 120ms !important; animation-iteration-count: 1 !important; transition-duration: 100ms !important; }
  .enter { animation: none; }
  .seat.thinking .ring .fill { animation: none; stroke-dashoffset: 0; }
}
