:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --bg: #111714;
  --panel: #19211c;
  --line: #36443b;
  --text: #f4f2e8;
  --muted: #adb9ae;
  --gold: #e6c182;
  --gold-light: #f4d7a1;
  --dark: #1c221b;
  --subtle: #4f6759;
  --red: #a63539;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 26% 8%, #202d24, transparent 55%), var(--bg); }
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
button:disabled { opacity: .46; cursor: default; }
h1, h2, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell {
  max-width: 1220px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 max(32px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(32px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
.masthead {
  padding-top: env(safe-area-inset-top);
  min-height: calc(76px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: .10em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #9e845c; color: var(--gold); border-radius: 9px; font: 22px Georgia, serif; }
.mast-meta { color: var(--gold); font: 13px Georgia, serif; letter-spacing: .22em; }
.footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); border-top: 1px solid var(--line); padding: 16px 0; font-size: 13px; }

.lobby { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(320px, 1fr); flex: 1; align-items: center; gap: clamp(20px, 4vw, 64px); padding: 40px 0; }
.lobby-hero {
  min-width: 0;
  min-height: clamp(390px, 48vw, 570px);
  isolation: isolate;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 80%, #284b3b, #18261e 68%);
  border: 1px solid #3a4d40;
  border-radius: 24px;
}
.hero-copy { position: relative; padding: clamp(24px, 4vw, 56px); z-index: 2; }
.overline { font-size: 14px; letter-spacing: .16em; color: var(--gold); font-weight: 650; }
.hero-copy h1 { margin-top: 14px; font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif; font-size: clamp(48px, 7vw, 96px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.hero-art { position: absolute; inset: 31% 0 0; }
.hero-felt {
  position: absolute;
  top: 20%; left: 3%;
  width: 115%; height: 120%;
  transform: rotate(-18deg);
  border: 15px solid #1b231d;
  border-radius: 50%;
  background: repeating-linear-gradient(125deg, #ffffff06 0 1px, transparent 1px 4px), radial-gradient(ellipse at 50% 30%, #30634a, #1b3b2a 78%);
  box-shadow: 0 0 0 1px #a1885a, inset 0 0 0 1px #af996d, inset 0 0 0 13px #1e3429;
}
.art-card {
  position: absolute;
  top: 32%; left: 39%;
  width: clamp(67px, 14vw, 172px);
  aspect-ratio: .70;
  background: linear-gradient(125deg, #fffdf4, #e2d8ba);
  border: 1px solid #fff8dd;
  border-radius: 8%;
  box-shadow: 6px 13px 22px #0b1a1299;
  color: #183225;
  font-family: Georgia, serif;
  padding: 9% 0 0;
}
.art-card span { position: absolute; top: 5%; left: 11%; font-size: clamp(21px, 4vw, 47px); }
.art-card strong { position: absolute; inset: 21% 0 0; display: grid; place-items: center; font-size: clamp(39px, 9vw, 105px); font-weight: 400; }
.art-first { transform: rotate(-24deg) translateX(-18%); }
.art-second { transform: rotate(12deg) translate(44%, 2%); color: var(--red); }
.art-chip { position: absolute; width: clamp(24px, 6vw, 65px); aspect-ratio: 1; border-radius: 50%; border: 5px dashed #e5d7ac; box-shadow: 3px 6px 0 #14271e, 4px 10px 12px #102219aa; transform: skewY(-9deg) scaleY(.69); }
.art-chip::after { content: ""; position: absolute; inset: 13%; border: 1px solid #f2e5bba6; border-radius: 50%; }
.chip-dark { left: 21%; top: 68%; background: #243a36; }
.chip-gold { left: 27%; top: 78%; background: #9c6942; }

.lobby-panel { padding: clamp(22px, 3.4vw, 42px); border: 1px solid var(--line); border-radius: 21px; background: var(--panel); box-shadow: 0 20px 45px #080e0b39; }
.lobby-heading h2, dialog h2 { font-size: clamp(25px, 3vw, 34px); line-height: 1.24; letter-spacing: .02em; }
.lobby-heading p, dialog p { font-size: 15px; line-height: 1.55; margin-top: 9px; color: var(--muted); }
form label { display: block; font-size: 14px; color: var(--muted); margin: 23px 0 7px; }
.lobby-panel input, dialog input {
  width: 100%; min-width: 0; min-height: 50px; padding: 0 13px;
  color: var(--text); background: #121915; border: 1px solid #435448;
  border-radius: 9px; font-size: 16px;
}
input::placeholder { color: #a1afa3; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px; min-height: 44px;
  padding: 8px 14px; text-align: center; font-size: 15px; font-weight: 650;
  background: transparent; color: var(--text); cursor: pointer;
}
.primary { background: var(--gold); color: var(--dark); border-color: var(--gold); }
.outline { background: #18241d; border-color: #667b6b; }
.quiet { border-color: #405448; background: #202c24; color: var(--text); }
@media (hover: hover) {
  .primary:hover:not(:disabled) { background: var(--gold-light); }
  .outline:hover:not(:disabled), .quiet:hover:not(:disabled) { background: #2b4033; }
}
.create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.create-button { width: 100%; min-height: 49px; }
.join-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 13px; color: var(--muted); font-size: 14px; }
.join-divider::before, .join-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#room-input, .room-code { text-transform: uppercase; letter-spacing: .09em; }
.notice { color: #f1bdac; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.notice:not(:empty) { margin-top: 10px; }
.room-tools { display: flex; gap: 7px; align-items: center; }
.room-code { color: var(--gold-light); font-variant-numeric: tabular-nums; }

.game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, .47fr); gap: clamp(15px, 3vw, 36px); align-items: center; padding: 26px 0; flex: 1; }
.table { position: relative; min-width: 0; height: clamp(350px, 44vw, 506px); isolation: isolate; }
.table-rim { position: absolute; inset: 11% 2% 5%; border-radius: 44% / 46%; border: 1px solid #a28455; background: #212d25; padding: clamp(8px, 1.4vw, 19px); box-shadow: 0 16px 42px #080d0a99; }
.felt { width: 100%; height: 100%; border-radius: inherit; border: 1px solid #6e876e; background: repeating-linear-gradient(135deg, #fff06c06 0 1px, transparent 1px 4px), radial-gradient(ellipse at 55% 35%, #315f49, #213e30 73%); box-shadow: inset 0 0 25px #0a241b70; }
.felt::before { content: ""; display: block; position: absolute; inset: 10% 8%; border: 1px solid #cfba7a3f; border-radius: inherit; }
.board { position: absolute; top: 51%; left: 50%; transform: translate(-50%, -50%); width: min(61%, 405px); text-align: center; }
.board-top { display: flex; gap: 10px; align-items: center; justify-content: center; color: #dae5d6; font-size: 14px; }
.table-deck { width: 12px; height: 17px; border: 1px solid #c6a974; border-radius: 2px; transform: rotate(-13deg); box-shadow: 2px 2px #112b20; background: repeating-linear-gradient(135deg, #426653 0 1px, #254734 1px 3px); }
#hand-number { color: #c2cfbd; font-size: 13px; }
.community { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 12px auto; }
.card {
  display: block; min-width: 0; aspect-ratio: .71; position: relative; overflow: hidden;
  border: 1px solid #efe6cc; border-radius: 7%; background: linear-gradient(130deg, #fffdf3, #e9dfc3);
  color: #172923; box-shadow: 0 3px 6px #0a251c70; font-family: Georgia, serif;
}
.card.red { color: var(--red); }
.card .rank { position: absolute; top: 2%; left: 9%; font-size: clamp(15px, 2.6vw, 29px); line-height: 1; font-weight: 700; }
.card .pip { position: absolute; inset: 21% 0 0; display: grid; place-items: center; font-size: clamp(24px, 4.4vw, 47px); line-height: 1; }
.card.empty { border: 1px dashed #bbd3bf65; background: #122b213d; box-shadow: none; }
.card.back { border: 1px solid #a98d5c; background: repeating-linear-gradient(135deg, #527765 0 2px, #1d4133 2px 5px); }
.card-cover { position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(135deg, #527765 0 2px, #1d4133 2px 5px); box-shadow: inset 0 0 0 1px #bd9e65; }
.pot { display: inline-flex; gap: 7px; padding: 5px 11px; align-items: center; border-radius: 50px; border: 1px solid #8ca49365; background: #10271d; color: #d1ded0; font-size: 14px; }
.pot strong { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.pot-chip { width: 13px; height: 13px; border: 2px dashed #eddab2; background: #8d6646; border-radius: 50%; }

.opponents { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; width: clamp(86px, 19%, 136px); min-width: 0; transform: translateX(-50%); }
.seat-1 { top: 44%; left: 10%; }
.seat-2 { top: 11%; left: 26%; }
.seat-3 { top: 2%; left: 50%; }
.seat-4 { top: 11%; left: 74%; }
.seat-5 { top: 44%; left: 90%; }
.seat-box { position: relative; text-align: center; padding: 6px 6px 5px; border-radius: 9px; border: 1px solid #52705e; background: #15221a; box-shadow: 0 5px 12px #1225179e; }
.seat.empty-seat .seat-box { color: #a8b9a9; border-style: dashed; background: #18261db0; box-shadow: none; font-size: 12px; }
.empty-seat .seat-name { font-weight: 400; }
.seat.active .seat-box { border-color: var(--gold); box-shadow: 0 0 0 2px #c7ad7352; }
.seat.folded .seat-box { opacity: .72; }
.seat.awarded .seat-box { border-color: var(--gold); box-shadow: 0 0 12px #dfae5b6e; }
.seat-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.seat-stack { display: block; color: #c3d0c5; font-size: 12px; margin-top: 2px; }
.seat-role { position: absolute; top: -9px; right: -4px; min-width: 18px; padding: 0 4px; border-radius: 8px; line-height: 16px; color: #19221b; background: var(--gold-light); font-size: 10px; font-weight: 800; }
.seat-presence { position: absolute; top: -9px; left: -4px; border-radius: 7px; padding: 0 5px; line-height: 16px; background: #6b4838; color: #ffe8dc; font-size: 11px; }
.seat.offline .seat-stack { color: #a3afa4; }
.seat-detail { margin-top: 3px; text-align: center; color: #f4dfaf; font-size: 12px; }
.seat-cards { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.seat-cards .card { width: 23px; }
.seat-cards .rank { font-size: 11px; }
.seat-cards .pip { font-size: 15px; }

.console { min-width: 0; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 17px; }
.console-head { display: flex; align-items: center; gap: 12px; }
.self-cards { width: 95px; flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.self-cards .rank { font-size: 18px; }
.self-cards .pip { font-size: 27px; }
.self-cards.folded { opacity: .55; }
.self-info { min-width: 0; flex: 1; }
.self-name { display: flex; align-items: center; gap: 5px; }
.self-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
#self-role { white-space: nowrap; color: var(--gold); font-size: 12px; }
.self-stack { margin-top: 3px; font-size: 13px; color: var(--muted); }
.self-stack strong { color: var(--gold-light); font-size: 18px; font-variant-numeric: tabular-nums; }
.self-rank { margin-top: 5px; line-height: 1.35; color: var(--muted); font-size: 13px; }
.self-rank strong { color: var(--gold-light); }
.clock { color: var(--gold-light); border: 1px solid #70694c; border-radius: 50%; width: 45px; height: 45px; display: flex; flex-direction: column; justify-content: center; align-items: center; flex: none; font-variant-numeric: tabular-nums; line-height: 1; font-size: 18px; }
.clock small { font-size: 10px; margin-top: 2px; color: var(--muted); }
.clock.urgent { color: #fac0ac; border-color: #bd735e; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.game-status { min-width: 0; color: #d5dfd4; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.game-status.mine { color: var(--gold-light); font-weight: 700; }
.guide-button { flex: none; padding-inline: 9px; font-size: 13px; }
.status-tools { display: flex; gap: 5px; flex: none; }
#sound-button[aria-pressed="true"] { color: var(--gold-light); border-color: #7c704f; }
#sound-button[aria-pressed="false"] { color: var(--muted); }
.setting-line { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.setting-line .button { padding-inline: 9px; font-size: 13px; }
.between, .actions { display: flex; gap: 7px; }
.between .button, .actions .button { flex: 1; min-width: 0; padding-left: 6px; padding-right: 6px; }
#fold-button { color: #ffcec1; border-color: #825953; background: #352825; }
.bet-editor { display: grid; gap: 5px; margin-bottom: 8px; }
.bet-line { display: grid; grid-template-columns: auto minmax(0, 1fr) 70px; align-items: center; gap: 7px; }
.bet-line label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bet-line input { accent-color: var(--gold); min-width: 0; width: 100%; margin: 0; min-height: 44px; }
#bet-amount { appearance: textfield; padding: 5px; border: 1px solid #5a6e5e; border-radius: 7px; background: #111914; color: var(--gold-light); font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
#bet-amount::-webkit-inner-spin-button, #bet-amount::-webkit-outer-spin-button { appearance: none; margin: 0; }
#bet-amount[aria-invalid="true"] { border-color: #bc8073; }
.bet-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.bet-presets .button { min-width: 0; padding-inline: 4px; font-size: 13px; }
.bet-error { color: #f1bdac; font-size: 13px; line-height: 1.4; }
.result { color: var(--text); font-size: 14px; line-height: 1.4; margin: 0 0 11px; padding: 9px 11px; border-radius: 8px; background: #293326; border: 1px solid #596753; overflow-wrap: anywhere; }
.result-title { display: block; font-size: 16px; color: var(--gold-light); margin-bottom: 3px; }
.result-win { background: linear-gradient(125deg, #463b24, #302e22); border-color: #9f7d44; }
.result-loss { background: #342a27; border-color: #805d55; }
.result-loss .result-title { color: #f5c1b3; }
.result p + p { margin-top: 4px; }
.table-motion { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.motion-marker { position: fixed; left: 0; top: 0; display: block; }
.motion-chip { width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px dashed #f6dfab; border-radius: 50%; background: #b08049; box-shadow: 0 2px 4px #0c1711a8; }
.motion-muck { width: 17px; height: 24px; margin: -12px 0 0 -8px; border: 1px solid #c3a269; border-radius: 3px; background: repeating-linear-gradient(135deg, #527765 0 2px, #1d4133 2px 5px); }

dialog { width: min(440px, calc(100% - 30px)); max-height: min(83dvh, 760px); border: 1px solid #54695a; border-radius: 16px; background: var(--panel); color: var(--text); padding: clamp(15px, 4vw, 23px); }
dialog::backdrop { background: #080d0bbd; }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: 7px; justify-content: end; margin-top: 13px; }
.outcome-stage {
  --radiance: #f1bd69;
  --brilliance: #ffebae;
  --halo: #825526;
  --field: #101914;
  --trace: #ffcf794a;
  --stroke: #ad7d47;
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--field);
  color: var(--brilliance);
  isolation: isolate;
  overscroll-behavior: contain;
}
.outcome-stage[open] { display: grid; place-items: center; animation: stage-entry .34s ease-out both; }
body:has(.outcome-stage[open]) { overflow: hidden; }
.outcome-stage::backdrop { background: #080b09; }
.outcome-loss {
  --radiance: #d5836f;
  --brilliance: #f2c0b6;
  --halo: #6d2f2c;
  --field: #150f13;
  --trace: #bb504555;
  --stroke: #93514a;
}
.outcome-split {
  --radiance: #8bcac2;
  --brilliance: #d3f4ea;
  --halo: #386961;
  --field: #121b1c;
  --trace: #94e2d233;
  --stroke: #659f97;
}
.outcome-art, .outcome-rays, .outcome-sparks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.outcome-art {
  z-index: -1;
  background:
    linear-gradient(172deg, transparent 25%, var(--trace) 25.15%, transparent 25.45% 76%, var(--trace) 76.15%, transparent 76.5%),
    radial-gradient(ellipse at 50% 43%, var(--halo), transparent 58%);
}
.outcome-rays {
  background: repeating-conic-gradient(from -17deg at 50% 45%, transparent 0 23deg, var(--trace) 26deg 29deg, transparent 31deg 45deg);
  -webkit-mask-image: radial-gradient(ellipse, black, transparent 73%);
  mask-image: radial-gradient(ellipse, black, transparent 73%);
  animation: outcome-rays 1.1s cubic-bezier(.19,.72,.22,1) both;
}
.outcome-ring {
  position: absolute;
  top: 47%;
  left: 50%;
  width: min(57vw, 61vh);
  aspect-ratio: 1;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  box-shadow: 0 0 6vw var(--trace), inset 0 0 6vw var(--trace);
  animation: outcome-ring 1.05s cubic-bezier(.12,.54,.21,1) both;
}
.outcome-sparks i {
  position: absolute;
  top: 47%;
  left: 50%;
  width: 5px;
  height: 14px;
  background: var(--radiance);
  box-shadow: 0 0 13px var(--radiance);
  animation: outcome-spark 1.25s cubic-bezier(.11,.61,.29,1) both;
}
.outcome-sparks i:nth-child(1) { --x: -37vw; --y: -18vh; --angle: -53deg; }
.outcome-sparks i:nth-child(2) { --x: 29vw; --y: -23vh; --angle: 28deg; animation-delay: .055s; }
.outcome-sparks i:nth-child(3) { --x: -30vw; --y: 18vh; --angle: 30deg; animation-delay: .13s; }
.outcome-sparks i:nth-child(4) { --x: 38vw; --y: 15vh; --angle: -50deg; animation-delay: .1s; }
.outcome-sparks i:nth-child(5) { --x: -18vw; --y: -29vh; --angle: -25deg; animation-delay: .19s; }
.outcome-sparks i:nth-child(6) { --x: 16vw; --y: -29vh; --angle: 18deg; animation-delay: .15s; }
.outcome-sparks i:nth-child(7) { --x: -42vw; --y: 4vh; --angle: -70deg; animation-delay: .1s; }
.outcome-sparks i:nth-child(8) { --x: 42vw; --y: -2vh; --angle: 72deg; animation-delay: .21s; }
.outcome-loss .outcome-rays { opacity: .7; }
.outcome-loss .outcome-sparks i { animation-name: outcome-ember; }
.outcome-content { width: min(590px, 100%); display: grid; justify-items: center; align-content: center; text-align: center; }
.outcome-insignia {
  width: clamp(48px, 9vmin, 90px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--radiance);
  box-shadow: 0 0 28px var(--trace), inset 0 0 28px var(--trace);
  color: var(--brilliance);
  font: clamp(32px, 7vmin, 70px) Georgia, serif;
  transform: rotate(45deg);
  animation: outcome-insignia .69s cubic-bezier(.16,.67,.22,1) both;
}
.outcome-insignia span { transform: rotate(-45deg); }
.outcome-hand { color: var(--brilliance); margin: clamp(19px, 5vh, 42px) 0 1px; font-size: 14px; letter-spacing: .12em; }
.outcome-stage h2 {
  font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  font-size: clamp(58px, min(19vw, 21dvh), 152px);
  line-height: 1.06;
  letter-spacing: .18em;
  padding-left: .18em;
  text-shadow: 0 2px var(--stroke), 0 0 28px var(--trace), 0 12px 18px #000a;
  animation: outcome-title .78s cubic-bezier(.12,.7,.18,1) both;
}
.outcome-loss h2 { animation-name: outcome-title-loss; }
.outcome-stage .outcome-detail { color: #f4f0e6; font-size: clamp(15px, 3.8vw, 19px); line-height: 1.35; margin-top: 8px; overflow-wrap: anywhere; }
.outcome-return { min-width: 142px; margin-top: clamp(14px, 5vh, 36px); color: var(--brilliance); border: 1px solid var(--stroke); background: #151a16c7; }
.outcome-return:hover { background: var(--halo); }
@keyframes stage-entry { from { opacity: .35; } to { opacity: 1; } }
@keyframes outcome-rays { from { opacity: .12; transform: scale(.49) rotate(-12deg); } to { opacity: 1; transform: scale(1.32) rotate(4deg); } }
@keyframes outcome-ring {
  0% { opacity: .0; transform: translate(-50%, -50%) scale(.35); }
  34% { opacity: 1; }
  100% { opacity: .38; transform: translate(-50%, -50%) scale(1.18); }
}
@keyframes outcome-spark {
  0% { opacity: 0; transform: translate(0, 0) rotate(var(--angle)) scale(.2); }
  23% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--angle)) scale(.55); }
}
@keyframes outcome-ember {
  0% { opacity: 0; transform: translate(0, -15vh) rotate(var(--angle)) scale(.35); }
  35% { opacity: .8; }
  100% { opacity: 0; transform: translate(var(--x), 36vh) rotate(115deg) scale(.65); }
}
@keyframes outcome-insignia {
  from { opacity: .1; transform: rotate(12deg) scale(.3); }
  55% { opacity: 1; transform: rotate(49deg) scale(1.25); }
  to { transform: rotate(45deg) scale(1); }
}
@keyframes outcome-title {
  0% { opacity: .06; transform: scale(1.65) translateY(-12px); }
  62% { opacity: 1; transform: scale(.94); }
  100% { transform: scale(1); }
}
@keyframes outcome-title-loss {
  0% { opacity: .15; transform: translateY(-26px) scale(1.32); }
  44% { opacity: 1; transform: translateY(4px) rotate(-2deg); }
  64% { transform: translateY(-3px) rotate(1.2deg); }
  100% { transform: translateY(0) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .outcome-stage[open], .outcome-stage * { animation: none !important; }
  .outcome-ring { transform: translate(-50%, -50%); }
  .outcome-sparks { display: none; }
}
@media (orientation: landscape) and (max-height: 460px) {
  .outcome-hand { margin-top: 19px; }
  .outcome-return { margin-top: 13px; }
}
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-fields small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.offline-list { list-style: none; padding: 0; margin: 12px 0 0; }
.offline-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.offline-row .button { flex: none; }
.offline-empty { color: var(--muted); padding: 8px 0; }
.hand-guide { width: min(500px, calc(100% - 30px)); }
.guide-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; position: sticky; top: 0; background: var(--panel); z-index: 2; padding-bottom: 9px; }
.guide-heading p { margin-top: 3px; }
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 9px 0; }
.rank-explainer strong { display: block; color: var(--gold-light); font-size: 15px; line-height: 1.35; }
.rank-explainer span { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }
.rank-example { display: flex; gap: 3px; }
.rank-example .card { width: clamp(18px, 5vw, 26px); }
.rank-example .rank { font-size: 10px; }
.rank-example .pip { font-size: 13px; }

@media (max-width: 760px) and (orientation: portrait) {
  .shell { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .masthead { min-height: calc(59px + env(safe-area-inset-top)); }
  .brand { font-size: 15px; gap: 7px; letter-spacing: .04em; }
  .brand-mark { width: 30px; height: 30px; font-size: 19px; }
  .mast-meta { font-size: 11px; letter-spacing: .12em; }
  .room-tools { gap: 4px; }
  .room-tools .button { font-size: 13px; padding-inline: 7px; }
  .lobby { grid-template-columns: 1fr; align-content: start; gap: 13px; padding: 13px 0 17px; }
  .lobby-hero { min-height: clamp(158px, 42vw, 290px); border-radius: 16px; }
  .hero-copy { padding: 23px 18px; }
  .hero-copy h1 { font-size: clamp(36px, 10vw, 65px); }
  .overline { font-size: 12px; }
  .hero-art { inset: 0 0 0 39%; }
  .hero-felt { top: 19%; left: -18%; width: 155%; height: 115%; border-width: 9px; }
  .art-card { top: 27%; }
  .lobby-panel { padding: 18px; border-radius: 16px; }
  form label { margin-top: 16px; }
  .join-divider { margin-top: 17px; }
  .footer { padding: 10px 0; }
  .game { grid-template-columns: 1fr; align-content: start; gap: 8px; padding: 9px 0 12px; }
  .table { height: clamp(274px, 78vw, 440px); }
  .table-rim { inset: 8% 0% 3%; border-radius: 43% / 37%; }
  .seat { width: clamp(64px, 23%, 105px); }
  .seat-1 { top: auto; bottom: 0; left: 19%; height: 104px; }
  .seat-2 { top: 10%; left: 16%; }
  .seat-3 { top: 1%; left: 50%; }
  .seat-4 { top: 10%; left: 84%; }
  .seat-5 { top: auto; bottom: 0; left: 81%; height: 104px; }
  .seat-cards .card { width: 21px; }
  .board { width: 72%; top: 55%; }
  .community { gap: 4px; margin: 7px auto; }
  .console { padding: 12px; border-radius: 13px; }
  .self-cards { width: 76px; }
  .self-cards .rank { font-size: 16px; }
  .self-cards .pip { font-size: 22px; }
}

@media (orientation: landscape) and (max-height: 570px) {
  .shell { padding-inline: max(11px, env(safe-area-inset-left)) max(11px, env(safe-area-inset-right)); }
  .masthead { min-height: calc(48px + env(safe-area-inset-top)); }
  .brand { font-size: 15px; }
  .brand-mark { width: 28px; height: 28px; font-size: 18px; }
  .room-tools .button { min-height: 44px; }
  .lobby { grid-template-columns: minmax(0, 1fr) minmax(258px, .97fr); gap: 13px; padding: 9px 0; }
  .lobby-hero { min-height: 248px; border-radius: 14px; }
  .hero-copy { padding: 19px; }
  .hero-copy h1 { font-size: clamp(37px, 7vw, 68px); }
  .art-card { width: clamp(60px, 11vw, 95px); }
  .lobby-panel { padding: 13px; }
  .lobby-panel h2 { font-size: 22px; }
  .lobby-heading p { margin-top: 3px; font-size: 13px; }
  form label { margin-top: 9px; }
  .lobby-panel input, .create-button { min-height: 44px; }
  .create-row { margin-top: 6px; }
  .join-divider { margin: 9px 0 4px; }
  .footer { padding: 5px 0; font-size: 12px; }
  .game { grid-template-columns: minmax(0, 1fr) minmax(226px, .62fr); gap: 9px; padding: 7px 0; }
  .table { height: clamp(205px, calc(100dvh - 98px), 420px); }
  .console { padding: 9px; }
  .console-head { gap: 7px; }
  .self-cards { width: 66px; }
  .self-cards .rank { font-size: 14px; }
  .self-cards .pip { font-size: 19px; }
  .status-row { margin: 4px 0; }
  .table-rim { inset: 6% 0% 1%; }
  .board { width: min(57%, 275px); top: 59%; }
  .community { gap: 4px; margin: 6px auto; }
  .seat { width: clamp(60px, 20%, 103px); }
  .seat-box { padding: 4px; }
  .seat-stack { margin-top: 1px; line-height: 1.15; }
  .seat-detail { margin-top: 2px; }
  .seat-1 { left: 10%; }
  .seat-2 { left: 26%; }
  .seat-4 { left: 74%; }
  .seat-5 { left: 90%; }
  .seat-cards .card { width: 19px; }
  .seat-cards .pip { font-size: 12px; }
  .actions .button, .between .button { font-size: 13px; }
}

@media (max-width: 355px) and (orientation: portrait) {
  .room-tools .button { padding-inline: 5px; }
  .brand { font-size: 14px; }
  .brand-mark { width: 25px; }
}

@media (orientation: landscape) and (max-height: 350px) {
  .game { padding-block: 4px; }
  .game:not([hidden]) + .footer { display: none; }
  .board { top: 70%; }
  .seat-3 { top: 0; }
  .seat-3 .seat-detail { line-height: 1.15; }
  .seat-3 .seat-cards { margin-top: 3px; }
  .bet-editor { gap: 4px; margin-bottom: 6px; }
  .bet-line input, .bet-presets .button { min-height: 38px; }
}
