:root {
  color-scheme: dark;
  --bg: #0c121a;
  --panel: #121c27;
  --panel-deep: #0f1822;
  --line: #273745;
  --text: #edf4f4;
  --muted: #a0b2be;
  --accent: #71f0c4;
  --gold: #f9d38e;
  --red: #ffb3b8;
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
*, *::before, *::after { box-sizing: border-box; }
html, body, .table-panel, .table-scroll, .table-stage, .feed, dialog, .money-scroll {
  touch-action: manipulation;
}
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 38% 0, #14302e 0, transparent 45%), var(--bg); min-height: 100dvh; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
h2, p { margin: 0; }
.topbar { border-bottom: 1px solid #304236; background: #0c161be8; }
.top-inner, .workspace { width: min(1440px, 100%); margin: auto; padding-inline: clamp(16px, 3vw, 48px); }
.top-inner { min-height: 76px; display: flex; align-items: center; gap: clamp(10px, 2vw, 26px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent); color: #112720; font-size: 28px; line-height: 1; }
.brand strong { display: block; font-size: 18px; font-weight: 800; letter-spacing: .09em; white-space: nowrap; }
.brand strong span { color: var(--accent); }
.brand small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .12em; margin-top: 1px; }
.header-blinds { display: grid; gap: 2px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-deep); white-space: nowrap; }
.header-blinds span { color: var(--muted); font-size: 13px; }
.header-blinds strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.header-controls { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; }
.workspace { padding-block: clamp(12px, 2vw, 28px); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(225px, 27%); gap: 16px; align-items: stretch; }
.workspace-grid.history-collapsed { grid-template-columns: minmax(0, 1fr); }
.table-panel, .side-panel { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); min-width: 0; }
.table-panel { overflow: hidden; display: flex; flex-direction: column; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #121d27; }
.table-scroll { overflow-x: auto; }
.hand-status { font-size: 14px; color: var(--text); font-weight: 700; white-space: nowrap; }
.hand-status::before { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; margin-right: 8px; vertical-align: 2px; }
.streets { display: flex; gap: 3px; }
.street { padding: 5px 8px; border-radius: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.street.current { background: #244139; color: #a5ffe0; font-weight: 750; }
.street.complete { color: #c4d4db; }
.table-stage { min-height: 418px; height: clamp(430px, 48vh, 560px); position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 50% 48%, #142c31 0, #111b27 62%); }
.table-stage.dense { min-width: 525px; min-height: 520px; }
.felt { position: absolute; inset: 14% 9%; border-radius: 48% / 48%; border: 8px solid #234143; outline: 1px solid #446766; background: repeating-linear-gradient(127deg, #fff0 0 4px, #a8f6ce05 4px 5px), radial-gradient(ellipse at 46% 35%, #1d6b54, #114232 75%); box-shadow: inset 0 0 48px #082a23a8, 0 15px 34px #050a12ae; }
.felt::before { content: ''; position: absolute; inset: 10px; border-radius: inherit; border: 1px solid #b3ffd23d; }
.felt::after { content: '♠'; position: absolute; inset: 0; display: grid; place-items: center; color: #d2ffe00e; font-size: clamp(150px, 24vw, 300px); line-height: 1; }
.table-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; width: max-content; max-width: 46%; }
.chip { display: inline-grid; place-items: center; width: 32px; aspect-ratio: 1; border-radius: 50%; border: 3px dashed #adffdb; box-shadow: 0 0 0 2px #80f5c5; background: #1b7757; color: #e2fff3; font-size: 15px; }
.pot-label { margin-top: 10px; color: #b6e9d3; font-size: 14px; font-weight: 750; letter-spacing: .12em; }
.pot-value { display: block; font-size: clamp(30px, 5vw, 53px); font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1.15; }
.pot-note { margin-top: 5px; color: #b6e9d3; font-size: 13px; }
.seats { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; top: var(--y); left: var(--x); transform: translate(-50%, -50%); pointer-events: auto; width: clamp(94px, 15%, 138px); display: grid; text-align: left; border: 1px solid #42606b; border-radius: 12px; background: #172835; color: var(--text); box-shadow: 0 5px 14px #050e15a8; }
.dense .seat { width: clamp(94px, 17%, 138px); }
.seat.inactive { opacity: .66; }
.seat.current { z-index: 2; border-color: #fff2bf; color: #342403; background: #ffdb83; box-shadow: 0 0 0 3px #ffdc8380, 0 0 24px #ffd47980; }
.seat.editing { opacity: 1; z-index: 4; }
.seat > button { min-height: 30px; width: 100%; padding: 3px 7px; border: 0; background: transparent; color: inherit; text-align: left; border-radius: 10px; }
.seat > button:hover { background: #ffffff17; }
.seat.current > button:hover { background: #47290815; }
.seat-top { display: flex; align-items: center; gap: 4px; min-width: 0; }
.avatar { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: #304c59; color: #baf3e2; }
.seat.current .avatar { color: #fff1cd; background: #56401d; }
.seat-name { font-size: 14px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-pencil { margin-left: auto; font-size: 14px; color: #b8d6de; }
.seat.current .seat-pencil { color: #56401d; }
.seat-bottom { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.seat-editor { padding: 5px; display: grid; gap: 3px; }
.seat-editor input { min-width: 0; width: 100%; min-height: 34px; border-radius: 6px; border: 1px solid #6a9b8c; padding-inline: 5px; font-size: 16px; background: #0e1b24; color: var(--text); }
.seat-editor > div { display: flex; justify-content: space-between; gap: 3px; }
.seat-editor button { flex: 1; min-height: 32px; border: 1px solid #43616f; border-radius: 6px; background: #1e303d; color: var(--text); font-weight: 800; }
.seat-editor button[type="submit"] { background: var(--accent); color: #102a22; }
.stack { font-weight: 800; font-variant-numeric: tabular-nums; font-size: clamp(14px, 1.6vw, 18px); }
.roles { display: flex; gap: 2px; }
.role { font-size: 10px; font-weight: 800; border-radius: 4px; padding: 1px 3px; background: #31495b; color: #d4eafa; }
.role.btn { background: var(--gold); color: #372811; }
.wager { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px; border: 1px solid #6a9b8c; border-radius: 20px; color: #c6fae8; background: #102c26; padding: 2px 6px; white-space: nowrap; font-size: 12px; font-weight: 750; }
.wager .play-icon { font-size: 13px; }
.turn-badge { position: absolute; left: 50%; bottom: calc(100% - 1px); transform: translateX(-50%); white-space: nowrap; background: #ffe6a6; color: #342403; border-radius: 6px 6px 0 0; padding: 1px 7px; font-size: 12px; font-weight: 850; }
.round-transition { position: absolute; z-index: 5; inset: 0; background: #07131ade; display: grid; place-items: center; pointer-events: auto; animation: round-reveal 1.25s ease both; }
.round-transition[hidden] { display: none; }
.round-transition > div { display: grid; gap: 6px; padding: 18px 30px; text-align: center; border: 1px solid #71f0c4a6; background: #16392f; border-radius: 17px; box-shadow: 0 10px 30px #0009; }
.round-transition strong { font-size: clamp(26px, 5vw, 45px); color: var(--accent); }
.round-transition span { font-size: 15px; color: #d4ffe9; }
@keyframes round-reveal { 0%, 100% { opacity: 0; } 15%, 83% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .round-transition { animation: none; } }
.action-bar { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 14px 16px; min-height: 82px; border-top: 1px solid var(--line); background: #111a24; }
.action-bar.has-turn { border-top-color: #ac8539; background: #282217; }
.has-turn .action-context b { color: #ffdf9a; }
.action-context { display: grid; gap: 3px; min-width: 0; }
.action-context b { font-size: 17px; overflow-wrap: anywhere; }
.action-context small { color: var(--muted); font-size: 14px; }
.buttons { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.button, .icon-button { min-height: 44px; padding: 7px 13px; border-radius: 9px; border: 1px solid #3a5060; background: #1e303d; color: var(--text); font-weight: 750; white-space: nowrap; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { filter: brightness(1.14); }
.play-button, .feed-row .feed-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.play-icon { display: inline-grid; place-items: center; flex: none; width: 1.15em; height: 1.15em; font-size: 17px; line-height: 1; }
.play-icon.is-check, .play-icon.is-fold { border: 1px solid currentColor; border-radius: .22em; font-weight: 850; }
.play-icon.is-check { border-radius: 50%; }
.play-icon.is-fold { transform: rotate(-8deg); }
.play-icon.is-chip { --chip-face: #168368; --chip-rim: #c0ffe5; --chip-edge: #50b999; }
.play-icon.is-raise, .play-icon.is-prize { --chip-face: #996313; --chip-rim: #ffe9ad; --chip-edge: #d9a752; }
.play-icon.is-allin { --chip-face: #a13e47; --chip-rim: #ffe0e3; --chip-edge: #e28c95; }
.play-icon.is-tip { --chip-face: #634fa3; --chip-rim: #ece0ff; --chip-edge: #b8a4ec; }
.is-chip i { width: .96em; height: .96em; display: block; border: max(1px, .11em) dashed var(--chip-rim); border-radius: 50%; background: radial-gradient(circle, var(--chip-rim) 15%, transparent 18%), var(--chip-face); }
.is-raise i, .is-tip i, .is-prize i { transform: translateY(-.12em); box-shadow: 0 .20em 0 -.03em var(--chip-edge); }
.is-allin i { transform: translateY(-.19em); box-shadow: 0 .21em 0 -.03em var(--chip-edge), 0 .37em 0 -.04em var(--chip-face); }
.feed-action .play-icon { font-size: 13px; }
.ghost { background: #19262f; }
.buy-entry { color: var(--accent); border-color: #5cbe9d; background: #1d3c34; }
.primary { background: var(--accent); color: #102a22; border-color: var(--accent); }
.warning { color: var(--gold); border-color: #746043; }
.danger { color: var(--red); }
.side-panel { display: flex; flex-direction: column; min-height: 410px; }
.side-panel[hidden] { display: none; }
.side-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 17px 14px 12px; }
.side-head h2 { font-size: 17px; }
.side-head span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tabs { margin: 0 12px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 9px; background: #0d151e; }
.tabs button { border: 0; border-radius: 7px; background: transparent; color: var(--muted); min-height: 44px; padding: 4px; white-space: nowrap; }
.tabs button[aria-pressed="true"] { color: #d4ffe9; background: #253b42; font-weight: 750; }
.feed { flex: 1; min-height: 0; max-height: 460px; overflow-y: auto; padding: 14px; scrollbar-color: #42606a transparent; }
.feed ol { list-style: none; margin: 0; padding: 0; }
.feed li, .history-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.feed li:first-child { padding-top: 0; }
.feed li:last-child, .history-item:last-child { border-bottom: 0; }
.feed-row { display: flex; justify-content: space-between; gap: 5px; align-items: baseline; font-size: 14px; }
.feed-row b { overflow-wrap: anywhere; }
.feed-row span { color: var(--accent); text-align: right; white-space: nowrap; }
.feed small, .feed p { color: var(--muted); font-size: 14px; }
.feed p { line-height: 1.55; }
.tip-history { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tip-history h3 { margin: 0 0 8px; font-size: 14px; color: #e2d6ff; }
.tip-history ol { margin-bottom: 8px; }
.empty-state { padding: 16px 4px; }
.empty-state .empty-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #203941; color: var(--accent); font-size: 22px; margin-bottom: 13px; }
.empty-state b { display: block; margin-bottom: 5px; }
.history-item summary { cursor: pointer; min-height: 35px; }
.history-item ol { padding-top: 8px; }
dialog { color: var(--text); background: #172430; width: min(580px, calc(100% - 28px)); max-height: 90dvh; border: 1px solid #47616d; border-radius: 19px; padding: 0; box-shadow: 0 22px 90px #000b; }
dialog::backdrop { background: #050a12c9; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.dialog-head h2 { font-size: 21px; }
.icon-button { min-width: 44px; font-size: 22px; padding: 0; }
#dialog-body { padding: 18px; }
#dialog-body p { line-height: 1.55; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 12px; }
.tip-fields .field:last-child { grid-column: 1 / -1; }
.tip-preview { display: flex; gap: 8px; }
.tip-preview > div { flex: 1; min-width: 0; border: 1px solid var(--line); padding: 8px; border-radius: 8px; }
.tip-preview small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.tip-preview strong { color: #e2d6ff; font-size: 21px; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 5px; min-width: 0; font-size: 14px; color: #d1dfe5; }
.buy-field { margin-top: 12px; }
.field input, .field select, .field textarea { padding: 8px 10px; min-height: 46px; min-width: 0; border: 1px solid #43616f; color: var(--text); background: #0e1b24; border-radius: 8px; font: inherit; font-size: 16px; }
.field textarea { width: 100%; resize: vertical; }
.setup-reuse, .setup-roster { margin-top: 10px; }
.setup-roster { overflow-wrap: anywhere; }
.deal-setting { display: flex; align-items: center; gap: 9px; padding: 9px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; }
.deal-setting input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--accent); }
.deal-setting small { display: block; color: var(--muted); margin-top: 2px; font-size: 13px; }
.field select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #a0b2be 50%), linear-gradient(135deg, #a0b2be 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 10px 0; }
legend { font-weight: 750; }
.winner { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; padding: 4px 10px; margin: 2px; background: #253944; border-radius: 7px; overflow-wrap: anywhere; }
.winner input { width: 18px; height: 18px; accent-color: var(--accent); }
.money-scroll { overflow-x: auto; margin-top: 10px; }
.money-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.money-table th, .money-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.money-table th:first-child, .money-table td:first-child { width: 27%; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.money-table th { color: var(--muted); font-size: 13px; }
.settlement-payments { margin-top: 10px; color: var(--muted); }
.settlement-payments summary { padding-block: 8px; cursor: pointer; color: var(--text); }
.settlement-payments ul { padding-inline-start: 24px; margin-block: 5px; overflow-wrap: anywhere; }
.positive { color: var(--accent); }
.negative { color: var(--red); }
.hand-guide { list-style: none; margin: 10px 0 0; padding: 0; }
.hand-guide li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name probability cards"; align-items: center; gap: 8px 18px; padding-block: 7px; border-bottom: 1px solid var(--line); }
.hand-guide li:last-child { border-bottom: 0; }
.hand-name { grid-area: name; font-size: 15px; }
.hand-probability { grid-area: probability; justify-self: end; color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; }
.example-cards { grid-area: cards; display: flex; gap: 4px; }
.example-card { display: inline-grid; grid-template-rows: auto auto; place-content: center; place-items: center; gap: 1px; width: 34px; height: 40px; border: 1px solid #b8ccc3; border-radius: 5px; background: #f4faf6; color: #192c34; font-size: 15px; line-height: 1; }
.example-card.red-suit { color: #9c263a; }
.toast { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: calc(100% - 24px); background: #29434e; border: 1px solid #678a96; color: var(--text); border-radius: 9px; padding: 10px 15px; box-shadow: 0 5px 20px #0009; }
@media (max-width: 930px) {
  .action-bar { align-items: flex-start; flex-direction: column; gap: 9px; }
  .action-bar .buttons { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .top-inner { flex-wrap: wrap; justify-content: space-between; padding-block: 10px; }
  .header-controls { width: 100%; flex-wrap: wrap; margin-inline-start: 0; }
}
@media (max-width: 500px) {
  .hand-guide li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name probability" "cards cards"; }
}
@media (max-width: 745px), (max-width: 950px) and (orientation: portrait) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .side-panel { min-height: 235px; }
  .feed { max-height: 270px; }
  .table-stage { height: clamp(390px, 54vh, 560px); }
}
@media (max-width: 475px) {
  .top-inner { min-height: 64px; padding-inline: 10px; }
  .brand { gap: 6px; }
  .brand strong { font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; font-size: 21px; }
  .header-controls { gap: 5px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .header-controls .button { padding-inline: 2px; font-size: 13px; }
  .header-controls .button[data-action="settings"] span { display: none; }
  .workspace { padding-inline: 10px; }
  .street { font-size: 12px; }
  .table-toolbar { padding-inline: 7px; }
  .street { padding-inline: 4px; }
  .seat { width: 84px; }
  .seat > button { padding-inline: 4px; }
  .seat-name { font-size: 13px; }
  .avatar { flex-basis: 18px; height: 18px; }
  .felt { inset-inline: 7%; }
  .action-bar { padding: 10px; }
  .button { padding-inline: 9px; }
}
