@charset "UTF-8";

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --bg: #101715;
  --panel: #19221e;
  --surface: #222d27;
  --line: #344139;
  --ink: #f4f5ec;
  --sub: #b4c1b5;
  --lime: #cbef77;
  --lime-hover: #dbfc98;
  --red: #ffb3a5;
  --amber: #f8d994;
  --radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }
main { flex: 1; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
a { color: inherit; }
p, h1, h2, h3, ol, ul { margin: 0; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.number { font-variant-numeric: tabular-nums; }
.positive { color: var(--lime); }
.negative { color: var(--red); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.eyebrow { display: flex; gap: 9px; align-items: center; color: var(--lime); font-size: .72rem; font-weight: 750; letter-spacing: .16em; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.site-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 90px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: .04em; line-height: 1.15; }
.brand small { display: block; color: var(--sub); font-size: .64rem; font-weight: 500; letter-spacing: .18em; margin-top: 5px; }
.brand-mark { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 13px; background: var(--lime); color: #162112; font-family: Georgia, serif; font-size: 1.8rem; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.connection { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .76rem; color: var(--amber); }
.connection.is-online { color: var(--lime); }
.site-footer { padding: 24px 0 22px; margin-top: 44px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 9px; color: var(--sub); font-size: .75rem; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 12px; padding: 8px 15px; color: var(--ink); background: var(--surface); font-weight: 650; line-height: 1.25; text-align: center; text-decoration: none; }
.button:not(:disabled):hover { background: #2d3a31; }
.button.primary { color: #172111; background: var(--lime); }
.button.primary:not(:disabled):hover { background: var(--lime-hover); }
.button.quiet { background: transparent; border-color: var(--line); }
.button.outline { border-color: #597544; color: var(--lime); background: #202b21; }
.button.danger { color: var(--red); }
.button.small { font-size: .84rem; padding-inline: 11px; }
.button.square { width: 44px; padding: 0; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; margin-top: 22px; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 520px; padding: clamp(26px, 4.5vw, 68px); border: 1px solid #3d6250; border-radius: 28px; background: radial-gradient(ellipse at 96% 95%, #2d6148, transparent 63%), linear-gradient(128deg, #1b3026 8%, #173d2d 100%); }
.hero::after { position: absolute; z-index: -1; inset: 0; content: ""; opacity: .45; background: repeating-linear-gradient(138deg, transparent 0 9px, #97c1a209 9px 10px); }
.hero-copy { position: relative; z-index: 2; }
.hero h1 { margin: 20px 0 18px; font-size: clamp(2.6rem, 5.25vw, 4.7rem); letter-spacing: -.055em; line-height: 1.12; }
.hero h1 span { color: var(--lime); }
.hero-desc { color: #d0dfd3; font-size: .95rem; line-height: 1.85; }
.hero-meta { position: absolute; z-index: 2; left: clamp(26px, 4.5vw, 68px); bottom: 35px; display: flex; gap: 7px; flex-wrap: wrap; }
.hero-meta span { padding: 6px 10px; border: 1px solid #8ba99568; border-radius: 999px; background: #152e23d9; font-size: .73rem; color: #d8e8d7; white-space: nowrap; }
.hero-art { position: absolute; width: 276px; height: 223px; right: 4%; bottom: 11%; transform: rotate(-5deg); pointer-events: none; }
.orbit { position: absolute; inset: 1% -5%; border: 1px solid #b0d5b843; border-radius: 50%; transform: rotate(-31deg); }
.orbit-inner { inset: 10% 5%; border-style: dashed; }
.art-card { position: absolute; display: flex; flex-direction: column; justify-content: space-between; width: 102px; height: 144px; padding: 8px 10px; border-radius: 11px; border: 1px solid #eff0dc; box-shadow: 0 12px 18px #10251b70; background: #f5f0da; color: #24342b; font: 700 1.04rem/1 Georgia, serif; }
.art-card b { align-self: center; position: absolute; top: 50%; transform: translateY(-50%); font-size: 3.2rem; }
.art-card span:last-child:not(:first-child) { transform: rotate(180deg); }
.art-left { color: #9a3f34; left: 35px; top: 52px; transform: rotate(-24deg); }
.art-right { right: 23px; top: 43px; transform: rotate(20deg); background: #e1ebca; }
.art-center { left: 94px; top: 28px; transform: rotate(-2deg); background: #f3f2dc; }

.entry { align-self: stretch; min-width: 0; padding: clamp(22px, 3.2vw, 40px); border-radius: 28px; }
.entry-heading h2 { margin-top: 9px; font-size: 1.9rem; letter-spacing: -.035em; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #111914; margin: 22px 0; }
.segments button { min-height: 44px; border: none; border-radius: 9px; background: transparent; color: var(--sub); font-weight: 650; font-size: .87rem; }
.segments button[aria-pressed="true"] { background: #344137; color: var(--ink); }
.field { display: block; margin: 0 0 17px; padding: 0; border: 0; min-width: 0; color: var(--sub); font-size: .86rem; font-weight: 650; }
.field legend { padding: 0; }
.field > input { display: block; width: 100%; height: 49px; padding: 0 13px; margin-top: 8px; border: 1px solid var(--line); border-radius: 11px; background: #111a15; color: var(--ink); font-size: 1rem; }
.field > input::placeholder { color: #94a297; }
#join-code, .room-code { letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
#join-code { text-transform: uppercase; }
.rule-fields { padding: 10px 11px 11px; border: 1px solid var(--line); border-radius: 13px; background: #152019; }
.rule-fields legend { color: var(--lime); padding: 0 5px; }
.rule-fields .field { margin: 0; }
.rule-fields .field > input { height: 44px; margin-top: 4px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.rule-rounds { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 126px); align-items: center; gap: 8px; }
.rule-fields .rule-rounds > input { margin: 0; }
.entry-rule-hint { margin: 5px 0 0; font-size: .72rem; line-height: 1.5; font-weight: 450; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 10px 0 4px; }
.rule-toggle { display: flex; align-items: center; min-height: 44px; gap: 7px; cursor: pointer; color: var(--ink); }
.rule-toggle input { accent-color: var(--lime); width: 18px; height: 18px; margin: 0; }
.entry-submit { width: 100%; min-height: 50px; margin-top: 3px; justify-content: space-between; padding-inline: 15px; }
.entry-note { margin-top: 14px; text-align: center; color: var(--sub); font-size: .73rem; }
.form-error { color: var(--red); font-size: .82rem; margin: 0 0 12px; }
.noscript { padding: 16px; margin-top: 10px; }

.in-room {
  --table-inset: max(24px, env(safe-area-inset-left), env(safe-area-inset-right));
  --gold: #f2d088;
  --table-line: #6b5b426b;
  background: radial-gradient(ellipse at 50% 31%, #302923, #1a1b18 71%);
}
.in-room > .site-header, .in-room > .site-footer { display: none; }
.in-room > main { width: min(1320px, calc(100% - var(--table-inset) * 2)); }
#room { padding-block: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-bottom)); }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--table-line); padding-bottom: 9px; }
.room-heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
.room-suit { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 1px solid #8a7148; border-radius: 12px; color: var(--gold); background: #302921; font: 1.65rem Georgia, serif; }
.room-title { min-width: 0; }
.room-top h1 { font-size: clamp(1.02rem, 2.2vw, 1.42rem); line-height: 1.12; }
.room-meta { margin-top: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 3px 9px; color: #cfc5b6; font-size: .75rem; line-height: 1.3; }
.room-meta > span { white-space: nowrap; }
.room-meta > span + span { border-left: 1px solid #8f7a5a; padding-left: 9px; }
.room-meta b { color: var(--gold); letter-spacing: .06em; }
.table-menu-button { border-color: #826b48; color: var(--gold); background: #2d2921; flex: none; }
.table-menu-button .icon { width: 23px; height: 23px; }
.rotate-hint { display: none; }
.result-panel { min-width: 0; padding: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: .99rem; }
.panel-title .icon { color: var(--lime); }
.stack { display: grid; gap: 8px; list-style: none; padding: 0; }
.stack-item { display: flex; align-items: center; min-width: 0; gap: 9px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.stack-item:last-child { border-bottom: none; }
.stack-person { min-width: 0; flex: 1; }
.ellipsize { min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { display: block; color: var(--sub); font-size: .75rem; margin-top: 3px; }
.activity { display: grid; list-style: none; padding: 0; gap: 9px; color: var(--sub); font-size: .8rem; line-height: 1.6; max-height: 180px; overflow-y: auto; }
.activity li { padding-left: 11px; border-left: 2px solid #59734d; overflow-wrap: anywhere; }

.felt { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 48% 23%, #285b42, #193c2c 65%, #183226 100%); border: 1px solid #53715c; border-radius: 27px; box-shadow: inset 0 0 0 5px #132c215c; padding: 19px; }
.felt::before { content: ""; position: absolute; z-index: -1; pointer-events: none; inset: 10px; border: 1px solid #acc8b02d; border-radius: 19px; background: repeating-linear-gradient(134deg, transparent 0 8px, #c1e7c60a 8px 9px); }
.table-scene { position: relative; isolation: isolate; height: clamp(430px, calc(100svh - 150px), 620px); }
.table-oval {
  position: absolute; z-index: -1; inset: 6% 2% 5%; border-radius: 50%; border: clamp(7px, 1.2vw, 16px) solid #25261f;
  background: radial-gradient(ellipse at 51% 57%, #117b55, #0d6045 63%, #084936 100%);
  box-shadow: 0 13px 23px #100a09a8, 0 0 0 1px #bd9b6577, inset 0 0 0 1px #182c21, inset 0 9px 28px #071b18aa;
}
.table-oval::before, .table-oval::after { content: ""; position: absolute; pointer-events: none; border-radius: inherit; }
.table-oval::before { inset: 2.5%; border: 1px solid #d7c99547; background: repeating-linear-gradient(132deg, transparent 0 4px, #ebeed709 4px 5px); }
.table-oval::after { inset: 10% 11%; border: 1px solid #83c9a23b; box-shadow: 0 0 0 4px #10463235; }
.lobby-scene { height: auto; min-height: clamp(295px, calc(100svh - 155px), 530px); display: grid; place-items: center; }
.lobby { display: grid; justify-items: center; text-align: center; gap: 9px; padding: 24px 20px; }
.lobby-mark, .trophy-mark { display: grid; place-items: center; width: 51px; height: 51px; border: 1px solid #c2a975a6; border-radius: 16px; background: #172e22; color: var(--gold); }
.lobby-mark { font: 2.15rem Georgia, serif; }
.trophy-mark .icon { width: 25px; height: 25px; }
.lobby h2 { font-size: clamp(1.35rem, 4vw, 2.1rem); }
.lobby > p:not(.table-kicker) { color: #e4e9dc; font-size: .86rem; line-height: 1.5; }
.lobby .button { min-width: 148px; }
.lobby-kpis { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 3px 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; color: #f1eddb; background: #153f2e; border: 1px solid #a7b29477; border-radius: 999px; white-space: nowrap; padding: 4px 9px; font-size: .72rem; }

.table-seat {
  --card-w: clamp(20px, 2.65vw, 37px);
  --chip-w: clamp(26px, 3vw, 38px);
  position: absolute; min-width: 0; width: clamp(124px, 14.7vw, 190px);
  padding: 6px 8px 7px; border: 1px solid #b7ae785e; border-radius: 12px;
  background: linear-gradient(158deg, #27342fed, #162a22f4); color: #f7f2e7;
  box-shadow: 0 4px 12px #07171268;
}
.table-seat.is-active { outline: 2px solid #f4d27e; outline-offset: 2px; border-color: #e1bc71; box-shadow: 0 0 18px #eac77666, 0 4px 12px #07171268; }
.table-seat.is-folded { background: #242e29e8; border-color: #a1a7a070; }
.seat-west { left: 13%; top: 47%; transform: translateX(-50%); }
.seat-east { left: 87%; top: 47%; transform: translateX(-50%); }
.seat-northwest { left: 26%; top: 2%; transform: translateX(-50%); }
.seat-north { left: 50%; top: 0; transform: translateX(-50%); }
.seat-northeast { left: 74%; top: 2%; transform: translateX(-50%); }
.self-seat {
  --card-w: clamp(43px, 5.4vw, 73px);
  --chip-w: clamp(34px, 4vw, 51px);
  width: clamp(246px, 30vw, 380px); left: 50%; bottom: 2%; transform: translateX(-50%);
  padding: 8px 12px 10px; background: linear-gradient(138deg, #274235fa, #182a23fb);
}
.seat-identity { display: flex; align-items: center; gap: 4px; min-width: 0; margin-bottom: 5px; line-height: 1.2; }
.seat-name { flex: 1; font-size: .81rem; }
.seat-score { flex: none; white-space: nowrap; font-size: .79rem; font-weight: 700; }
.seat-score > span:last-child { color: #c6d1c2; font-size: .67em; }
.seat-first { flex: none; border-radius: 3px; padding: 2px 4px; color: #271d10; background: #dbbd82; font-size: .64rem; font-weight: 750; white-space: nowrap; }
.self-seat .seat-name { font-size: .95rem; }
.self-seat .seat-score { font-size: .9rem; }
.seat-hand { position: relative; display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) auto; column-gap: 4px; }
.self-seat .seat-hand { grid-template-columns: var(--chip-w) minmax(0, 1fr) var(--chip-w); }
.self-seat .seat-cards { grid-column: 2; }
.seat-cards { position: relative; display: flex; align-items: center; gap: 2px; width: max-content; max-width: 100%; justify-self: center; }
.self-seat .seat-cards { gap: 4px; }
.seat-wager { justify-self: end; margin-top: 1px; }
.seat-badges { position: absolute; right: 0; bottom: -3px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 2px; width: max-content; max-width: 100%; pointer-events: none; }
.seat-badges:empty { display: none; }
.seat-tag { max-width: 100%; white-space: nowrap; padding: 1px 3px; border: 1px solid #b6c1b981; border-radius: 4px; color: #eeeee5; background: #1a2e26; font-size: .60rem; font-weight: 750; }
.seen-tag { background: #352812; color: #ffe3a4; border-color: #cea359; }
.offline-tag { color: #e4ded8; background: #3b3733; }
.self-seat .seat-badges { bottom: 0; flex-direction: column; align-items: flex-end; }
.self-seat .seat-tag { padding: 2px 3px; font-size: .67rem; }
.fold-stamp { position: absolute; z-index: 1; top: 54%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); border: 1px solid #e0e4de; border-radius: 4px; padding: 1px 5px; background: #313935ed; color: #f3f3eb; font-size: clamp(.63rem, 2.2vw, 1rem); font-weight: 850; letter-spacing: .08em; white-space: nowrap; box-shadow: 0 2px 6px #070c0a99; }
.is-folded .card { filter: grayscale(.78) brightness(.76); }
.card { position: relative; flex: 0 0 auto; width: var(--card-w); aspect-ratio: 5 / 7; border-radius: clamp(3px, .55vw, 8px); border: 1px solid #fbf0d9; background: linear-gradient(145deg, #fff9e9, #e9dcc1); color: #212e25; box-shadow: 0 2px 4px #0715109c; font: 750 .72rem/1 Georgia, serif; }
.card.red { color: #a22a38; }
.card-rank { position: absolute; z-index: 1; top: 2px; left: 2px; }
.card-rank small { display: block; font-size: .75em; }
.card b { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-w) * .62); }
.card:not(.back) b { padding-top: 12%; }
.card.back { background: repeating-linear-gradient(45deg, #6e2e31 0 3px, #803b40 3px 6px); border-color: #ddc7a8; color: #f2d4a9; }
.card.back::before { content: ""; position: absolute; inset: 9%; border: 1px solid #f2d4a97d; border-radius: 19%; background: repeating-linear-gradient(-45deg, transparent 0 3px, #b861633f 3px 4px); }
.self-seat .card { font-size: clamp(.8rem, 1.7vw, 1.31rem); }
.self-seat .card-rank { top: 6%; left: 8%; }
.chip { display: inline-grid; place-items: center; flex: none; width: var(--chip-w); aspect-ratio: 1; border: 2px dashed #f4e1bc; border-radius: 50%; outline: 1px solid #cfb084; outline-offset: -1px; color: #fff6df; background: radial-gradient(circle, #793638 55%, #c17b6a 56% 62%, #7a3938 63%); box-shadow: 0 2px 2px #101d16b3; font-size: clamp(.65rem, 1.6vw, .83rem); font-weight: 800; line-height: 1; }
.base-chip { --chip-w: clamp(28px, 4vw, 44px); background: radial-gradient(circle, #285c51 55%, #7fa990 56% 63%, #296b57 64%); }
.chip-small-text { font-size: .56rem; }

.table-center { position: absolute; top: 47%; left: 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 6px; min-width: 0; width: min(245px, 40%); text-align: center; }
.table-kicker { font-size: .63rem; font-weight: 800; letter-spacing: .22em; color: #e6ce96; white-space: nowrap; }
.pot-main { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1vw, 12px); font-size: clamp(.72rem, 1.5vw, 1rem); font-weight: 750; color: #f6ebcf; }
.pot-main strong { font-size: clamp(1.85rem, 4.25vw, 3.45rem); line-height: .94; color: #fff3d4; }
.pot-main strong.long-pot { font-size: clamp(1.22rem, 2.8vw, 2rem); }
.pot-details { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: clamp(.62rem, 1.4vw, .83rem); white-space: nowrap; color: #e6f0e0; }
.pot-details span + span { border-left: 1px solid #d6e5c16d; padding-left: 6px; }
.turn-line { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.turn-label { font-size: .8rem; font-weight: 700; color: #edf3e8; min-width: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.turn-label.is-mine { color: #ffe4a5; }
.timer { min-width: 42px; flex: none; text-align: center; padding: 3px 5px; background: #173e30; border: 1px solid #918b5f; border-radius: 6px; font-size: .74rem; font-weight: 750; line-height: 1.1; }
.timer.urgent { color: var(--amber); }
.spectating-label { position: absolute; bottom: 12%; left: 17%; transform: rotate(-10deg); max-width: calc(100% - 16px); padding: 5px 12px; border: 1px solid #b9bab0; border-radius: 5px; background: #2f3333; color: #f7f1dc; font-size: .81rem; font-weight: 800; box-shadow: 0 3px 9px #1017148c; }

.table-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; margin-top: 9px; }
.table-footer.has-controls { grid-template-columns: minmax(0, 1fr) minmax(264px, 510px) minmax(0, 1fr); }
.table-notice { color: #e2d8c4; display: flex; align-items: center; gap: 3px 10px; flex-wrap: wrap; font-size: .76rem; }
.table-notice .connection { font-size: .71rem; }
.table-exit { justify-self: end; white-space: nowrap; border-color: #7b6a53; color: #f0dfc6; }
.table-exit .icon { width: 16px; height: 16px; }
.controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.controls .button { padding-inline: 3px; font-size: .83rem; background: #302b24; border-color: #887251; }
.controls .button span { white-space: nowrap; }
.button.table-gold { color: #2c2014; border-color: #e6c179; background: linear-gradient(#efda9f, #ceaa63); }
.button.table-gold:not(:disabled):hover { background: #ffe5a7; }
.round-result { max-width: 600px; margin: 8px auto 0; background: #192e24; padding: 12px; border: 1px solid #a8a2738c; border-radius: 13px; }
.round-result h2 { margin-bottom: 5px; font-size: 1.08rem; overflow-wrap: anywhere; }
.round-result p, .result-hero .detail, .rank-table td:last-child, #dialog-content p { overflow-wrap: anywhere; }
.round-result .next-line { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.results-layout { max-width: 920px; margin: 14px auto 0; }
.result-hero { padding: 27px 23px; display: grid; justify-items: start; gap: 9px; }
.result-hero .eyebrow, .result-panel .panel-title .icon, .rank-table .first .rank-number { color: var(--gold); }
.result-hero h2 { font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 1.2; overflow-wrap: anywhere; }
.result-hero .detail { color: #d1e0d3; font-size: .87rem; }
.result-panel { margin-top: 13px; }
.rank-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
.rank-table th, .rank-table td { padding: 11px 6px; border-bottom: 1px solid var(--line); }
.rank-table thead { color: var(--sub); font-size: .76rem; }
.rank-table tbody tr:last-child td { border-bottom: none; }
.rank-table th:first-child { width: 47px; }
.rank-table th:last-child, .rank-table td:last-child { text-align: right; width: 76px; }
.rank-table .rank-number { color: var(--sub); font-weight: 750; }
.rank-table .name-cell { overflow-wrap: anywhere; }
.self-label { font-size: .72rem; color: var(--lime); margin-left: 4px; white-space: nowrap; }
.round-summary { border-bottom: 1px solid var(--line); padding: 6px 0; }
.round-summary:last-child { border-bottom: 0; }
.round-summary summary { min-height: 44px; padding: 11px 0; cursor: pointer; overflow-wrap: anywhere; font-size: .86rem; }
.round-summary ul { list-style: none; padding: 0 0 8px 9px; }
.round-summary li { display: flex; gap: 8px; justify-content: space-between; padding: 4px 0; font-size: .81rem; }
.round-summary li span:first-child { overflow-wrap: anywhere; }

dialog { width: min(440px, calc(100vw - 30px)); max-height: min(85vh, 680px); overflow: auto; padding: 19px; background: var(--panel); border: 1px solid #576659; border-radius: 19px; color: var(--ink); box-shadow: 0 14px 70px #0008; }
dialog::backdrop { background: #050a08bf; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.dialog-head h2 { font-size: 1.18rem; }
#room-menu { position: fixed; inset: max(12px, env(safe-area-inset-top)) max(var(--table-inset), calc((100% - 1320px) / 2)) auto auto; margin: 0; width: min(390px, calc(100% - var(--table-inset) * 2)); max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); padding: 15px; border-color: #8d7956; background: #202a24; }
#room-menu::backdrop { background: #100d0b91; }
.menu-head { margin-bottom: 9px; }
.menu-head .eyebrow { color: var(--gold); margin-bottom: 3px; }
.segments.menu-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 13px; }
.menu-tabs button { padding-inline: 2px; font-size: .79rem; }
.menu-pane { display: grid; gap: 9px; }
.menu-note { font-size: .79rem; color: #cbd5ca; line-height: 1.5; }
.menu-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 7px; }
.menu-copy .field { margin: 0; }
.menu-copy .field input { height: 44px; margin-top: 4px; }
.menu-section { margin-top: 5px; padding-top: 11px; border-top: 1px solid var(--line); }
.menu-section .panel-title { margin-bottom: 6px; }
.menu-section .stack { gap: 0; }
.menu-rank { margin-top: 3px; }
.history-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.room-rules { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .84rem; }
.room-rules th, .room-rules td { padding-block: 8px; border-bottom: 1px solid var(--line); }
.room-rules tr:last-child > * { border-bottom: 0; }
.room-rules th { width: 44%; color: var(--sub); text-align: left; font-weight: 550; }
.room-rules td { text-align: right; overflow-wrap: anywhere; }
.menu-footer { display: flex; justify-content: flex-start; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
#dialog-content p { color: var(--sub); line-height: 1.65; margin-bottom: 13px; }
#dialog-content .button { min-width: 80px; }
.dialog-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.rules-list { padding-left: 22px; color: var(--sub); display: grid; gap: 10px; line-height: 1.65; font-size: .86rem; }
.rules-list strong { color: var(--ink); }
.opponents { display: grid; gap: 8px; }
.opponents .button { justify-content: space-between; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 28px); padding: 11px 15px; border: 1px solid #8ca776; border-radius: 12px; background: #25382b; color: var(--ink); box-shadow: 0 5px 24px #0007; font-size: .85rem; overflow-wrap: anywhere; }

@media (max-width: 940px) {
  .shell { width: calc(100% - 40px); }
  .hero { min-height: 485px; padding: 28px; }
  .hero-meta { left: 28px; bottom: 25px; }
  .hero-art { right: -5px; bottom: 32px; transform: scale(.8) rotate(-5deg); transform-origin: bottom right; }
}

@media (max-width: 740px) {
  .shell { width: calc(100% - 28px); }
  .site-header { min-height: 65px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .home-layout { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .home-layout { margin-top: 4px; }
  .hero { min-height: 284px; padding: 21px; border-radius: 22px; }
  .hero h1 { font-size: clamp(2.3rem, 9.4vw, 3.15rem); margin: 13px 0 11px; }
  .hero-desc { font-size: .81rem; max-width: 67%; line-height: 1.6; }
  .hero-meta { left: 21px; bottom: 15px; padding-right: 10px; gap: 4px; }
  .hero-meta span { font-size: .67rem; padding: 4px 6px; }
  .hero-art { right: 4px; bottom: 28px; transform: scale(.63) rotate(-5deg); }
  .wide-only { display: none; }
  .entry { border-radius: 22px; }
  .entry-heading h2 { font-size: 1.48rem; }
  .segments { margin: 15px 0; }
  .felt { padding: 12px; border-radius: 20px; }
  .felt::before { inset: 6px; border-radius: 15px; }
  .site-footer { margin-top: 23px; padding: 14px 0; }
}

@media (max-width: 480px) {
  .hero-desc { max-width: 57%; }
  .hero-art { right: 0; bottom: 37px; transform: scale(.51) rotate(-5deg); }
}

@media (max-width: 355px) {
  .shell { width: calc(100% - 20px); }
  .hero { padding-inline: 15px; }
  .hero-meta { left: 15px; }
  .hero-art { right: -4px; transform: scale(.45) rotate(-5deg); }
  .entry { padding: 16px; }
}

@media (min-width: 800px) and (orientation: landscape) {
  .seat-northwest, .seat-northeast { top: 14%; }
}

@media (min-width: 600px) and (max-height: 550px) and (orientation: landscape) {
  .in-room { --table-inset: max(12px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  #room { padding-block: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-bottom)); }
  .room-top { margin-bottom: 5px; padding-bottom: 4px; }
  .table-scene { height: max(256px, calc(100svh - 126px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  .lobby-scene { height: auto; min-height: max(235px, calc(100svh - 122px)); }
  .lobby { padding-block: 10px; gap: 5px; }
  .lobby-mark { width: 37px; height: 37px; font-size: 1.7rem; }
  .table-seat { --card-w: 22px; --chip-w: 24px; padding-block: 4px 5px; }
  .self-seat { --card-w: 38px; --chip-w: 32px; }
  .table-center { top: 46%; gap: 3px; }
  .pot-main strong:not(.long-pot) { font-size: 2rem; }
  .table-footer { margin-top: 5px; gap: 5px; }
  .table-footer.has-controls { grid-template-columns: minmax(0, 1fr) minmax(255px, 3.2fr) minmax(94px, 1fr); }
  .table-notice { font-size: .72rem; }
  .table-exit { padding-inline: 5px; }
}

@media (max-width: 599px), (max-width: 900px) and (orientation: portrait) {
  .in-room { --table-inset: max(12px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .room-top { margin-bottom: 7px; padding-bottom: 7px; }
  .room-heading { gap: 7px; }
  .room-suit { width: 33px; height: 33px; border-radius: 10px; font-size: 1.35rem; }
  .room-meta { gap: 3px 5px; font-size: .68rem; }
  .room-meta > span + span { padding-left: 5px; }
  .rotate-hint { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 4px 0 8px; color: #e1d2b4; font-size: .72rem; }
  .rotate-hint .icon { width: 14px; height: 14px; }
  .table-scene { display: grid; justify-items: center; height: auto; gap: 12px; padding: 12px 7px; }
  .table-oval { inset: 1% 0 0; border-width: 5px; border-radius: 43% / 22%; }
  .table-oval::after { inset: 8% 6%; }
  .lobby-scene { min-height: 310px; }
  .opponents-ring { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; width: min(100%, 525px); }
  .opponent-seat { --card-w: clamp(15px, 4.55vw, 29px); --chip-w: clamp(20px, 5.25vw, 29px); position: relative; inset: auto; transform: none; grid-column: span 2; width: 100%; padding: 4px 3px 5px; border-radius: 7px; }
  .opponents-ring[data-count="1"] .opponent-seat { grid-column: 2 / span 4; justify-self: center; max-width: 173px; }
  .opponents-ring:is([data-count="2"], [data-count="4"]) .opponent-seat { grid-column: span 3; }
  .opponents-ring[data-count="5"] .opponent-seat:nth-child(4) { grid-column: 2 / span 2; }
  .opponent-seat .seat-identity { gap: 2px; margin-bottom: 4px; }
  .opponent-seat .seat-name, .opponent-seat .seat-score { font-size: .68rem; }
  .opponent-seat .seat-first { padding: 1px 2px; font-size: .56rem; }
  .opponent-seat .seat-cards { gap: 1px; }
  .opponent-seat .seat-hand { column-gap: 1px; }
  .opponent-seat .seat-tag { font-size: .54rem; padding-inline: 2px; }
  .opponent-seat .card { font-size: clamp(.46rem, 1.8vw, .69rem); }
  .opponent-seat .card-rank { top: 1px; left: 1px; }
  .table-center, .self-seat { position: relative; inset: auto; transform: none; }
  .table-center { gap: 4px; width: min(236px, 100%); }
  .table-center .pot-main strong:not(.long-pot) { font-size: 2.25rem; }
  .self-seat { --card-w: clamp(40px, 12vw, 60px); --chip-w: 34px; width: min(100%, 290px); padding: 6px 8px 8px; }
  .spectating-label { position: relative; inset: auto; justify-self: end; margin-inline-end: 8px; font-size: .73rem; }
  .table-footer.has-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .table-footer .controls { grid-column: 1 / -1; grid-row: 1; }
  .table-notice { font-size: .73rem; }
  .result-hero { padding: 18px 14px; }
}
