.game-table.poker-table {
  --stage-height: clamp(218px, 44vh, 450px);
  --board-card: 83px;
  --hole-card: 78px;
  --poker-avatar: clamp(28px, 4vw, 50px);
  grid-template-columns: minmax(0, 1fr);
}
.game-table > .poker-panel {
  padding: 8px;
  border-color: #4b4e63;
  background: #171b28;
}
.poker-panel .tablehead { margin-bottom: 5px; }
.poker-panel .tablehead h2 { margin: 0; font-size: clamp(.88rem, 2.2vw, 1.18rem); }
.poker-panel .tablehead button { padding: .3rem .55rem; font-size: .78rem; }
.poker-panel .felt {
  min-height: 0;
  padding: 0;
  border: 1px solid #74718a;
  border-radius: 13px;
  background: #171c2b;
}
.poker-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #545470;
  background: #23283a;
}
.poker-banner .notice {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f5e1b8;
  font-size: .8rem;
}
.poker-meta { color: #bcd5c5; white-space: nowrap; font-size: .72rem; }
.poker-stage {
  display: grid;
  grid-template-areas: ". s5 s4 s3 ." "s6 center center center s2" "s7 center center center s1";
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  height: var(--stage-height);
  gap: 3px 7px;
  padding: 4px clamp(7px, 2vw, 24px) 6px;
  background: #181c2b url("/poker-table.svg?v=16") center / 100% 100% no-repeat;
}
.poker-seat-1 { grid-area: s1; }
.poker-seat-2 { grid-area: s2; }
.poker-seat-3 { grid-area: s3; }
.poker-seat-4 { grid-area: s4; }
.poker-seat-5 { grid-area: s5; }
.poker-seat-6 { grid-area: s6; }
.poker-seat-7 { grid-area: s7; }
.poker-felt .seat {
  position: relative;
  display: grid;
  grid-template: "player player" auto "back stack" auto / auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 1px 4px;
  padding: 3px 5px;
  border: 1px solid #787c91;
  border-radius: 8px;
  background: linear-gradient(145deg, #34394f, #1c2333);
  box-shadow: 0 3px 7px #10121b9e;
  color: #fff3df;
}
.poker-felt .seat.turn { border-color: #97ebaa; box-shadow: 0 0 0 1px #97ebaa, 0 0 13px #7ce49c65; }
.poker-stage .seat { width: min(100%, 160px); justify-self: center; }
.poker-felt .seat-identity { grid-area: player; }
.poker-felt .seat strong { font-size: clamp(.64rem, 1.45vw, .9rem); }
.poker-felt .seat-avatar {
  width: var(--poker-avatar);
  height: var(--poker-avatar);
  border: 1px solid #d9ac7d;
  background: #d8a772;
}
.poker-felt .poker-stack {
  grid-area: stack;
  text-align: right;
  color: #ffdfac;
  font-size: clamp(.64rem, 1.4vw, .84rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.poker-felt .poker-dealer, .poker-felt .poker-wager {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: .64rem;
  line-height: 1rem;
  font-weight: 750;
}
.poker-dealer { left: -4px; top: -4px; width: 16px; background: #f6d7a2; color: #211d28; }
.poker-wager { right: -3px; top: -5px; padding: 0 4px; background: #17392f; color: #fbe5bc; border: 1px solid #b89766; }
.poker-felt .seat .mini { grid-area: back; flex-wrap: nowrap; gap: 2px; margin: 0; }
.poker-felt .card, .poker-empty-card {
  min-width: 0;
  min-height: 0;
  height: auto;
  aspect-ratio: 54 / 76;
}
.poker-felt .card { padding: 0; background: #fffcf1; }
.poker-felt .seat .card { width: clamp(13px, 2.6vw, 30px); }
.poker-felt .seat .card-back { width: clamp(12px, 1.8vw, 21px); }
.poker-stage .board {
  grid-area: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, var(--board-card)));
  justify-content: center;
  gap: clamp(2px, .55vw, 7px);
  min-width: 0;
  min-height: 0;
}
.poker-stage .board .card, .poker-empty-card { width: 100%; }
.poker-empty-card {
  display: grid;
  place-items: center;
  border: 1px dashed #b5d3b97d;
  border-radius: 5px;
  background: #102f2d70;
  color: #c6dac27d;
}
.poker-pot {
  grid-column: 1 / -1;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid #c79f6d;
  border-radius: 12px;
  background: #132f2a;
  color: #f5d7a5;
  font-size: .73rem;
  font-variant-numeric: tabular-nums;
}
.poker-pot strong { font-size: clamp(.78rem, 1.7vw, 1rem); color: #fff2d1; }
.poker-chip {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  border: 2px dashed #ffe6b8;
  border-radius: 50%;
  background: #aa7747;
  box-shadow: inset 0 0 0 1px #583e35;
}
.poker-pot .poker-chip { background: #499989; }
.poker-controls {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-top: 1px solid #79768a;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(170deg, #2e3045, #1c2332);
}
.poker-player { display: flex; align-items: center; gap: 5px; min-width: 0; }
.poker-player .seat { max-width: clamp(74px, 16vw, 175px); }
.poker-player .poker-stack { grid-column: 1 / -1; }
.poker-controls .hand { flex-wrap: nowrap; gap: 4px; margin: 0; }
.poker-controls .hand:empty { display: none; }
.poker-controls .hand .card { width: var(--hole-card); }
.poker-betting { display: grid; align-items: center; gap: 6px; min-width: 0; }
.poker-betting.has-raise { grid-template-columns: auto minmax(0, 1fr); }
.poker-betting .actions { flex-wrap: nowrap; min-height: 44px; gap: 5px; margin: 0; overflow-x: auto; scrollbar-width: thin; }
.poker-betting .actions button { flex: none; min-height: 44px; min-width: 48px; font-weight: 750; white-space: nowrap; }
.poker-betting .actions .poker-fold, .poker-betting .actions .poker-call, .poker-betting .actions .poker-check, .poker-betting .actions .poker-raise {
  background: linear-gradient(#ae4953, #742a36 63%, #59222d);
  border-color: #b46c73;
  border-radius: 6px;
  box-shadow: inset 0 1px #f1a99955, 0 2px #151725;
  color: #fff3e1;
}
.poker-betting .actions .poker-fold { background: linear-gradient(#7f3d4b, #522431); }
.poker-betting .actions .poker-raise { border-color: #e0a773; }
.poker-betting .timer, .poker-betting small { white-space: nowrap; }
.poker-raise-tools { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.poker-raise-tools label { display: flex; flex: none; gap: 4px; align-items: center; font-size: .7rem; color: #ebd7b4; }
.poker-raise-tools input { width: clamp(62px, 10vw, 105px); padding: 3px 5px; }
.poker-chip-options { display: flex; align-items: center; gap: 4px; }
.poker-chip-options button {
  --chip-ink: #397f6c;
  display: grid;
  place-content: center;
  place-items: center;
  flex: none;
  width: var(--quick-chip-size, 45px);
  height: var(--quick-chip-size, 45px);
  padding: 0;
  border: 1px solid #f0d7a6;
  border-radius: 50%;
  background: radial-gradient(circle, #fff1d1 0 52%, transparent 54%), repeating-conic-gradient(#f2e0b6 0deg 13deg, var(--chip-ink) 13deg 60deg);
  box-shadow: inset 0 0 0 2px #291f2f44, 0 2px #141521;
  color: #2b2630;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1.05;
  white-space: nowrap;
}
.poker-chip-options button:first-child { --chip-ink: #b67e42; }
.poker-chip-options button:nth-child(3) { --chip-ink: #526b9f; }
.poker-chip-options button[aria-label^="全下"] { --chip-ink: #913949; }
.poker-chip-options button[aria-pressed="true"] { outline: 2px solid #ffdc96; outline-offset: 1px; }
.poker-chip-options small { color: #682d37; font-size: .51rem; }
.poker-next-hand { padding: 6px 10px; border: 1px solid #9b805f; border-radius: 8px; background: #292638; color: #ffdb99; font-weight: 750; }
.poker-table .chat { padding: 7px 10px; }
.poker-table .chat details:not([open]) summary { margin-bottom: 0; }
.poker-playing #toast { top: 10px; bottom: auto; pointer-events: none; }

@media (orientation: landscape) and (max-height: 600px) {
  html.poker-playing .top { display: none; }
  .game-table > .poker-panel { padding: 4px 6px; }
  .game-table.poker-table {
    --stage-height: clamp(150px, calc(100dvh - 174px), 340px);
    --board-card: clamp(43px, 15dvh, 73px);
    --hole-card: clamp(49px, 16dvh, 68px);
    --poker-avatar: clamp(22px, 7.4dvh, 39px);
    --quick-chip-size: clamp(34px, 5.9vw, 43px);
  }
  .poker-betting .actions button { padding: .28rem .4rem; font-size: .85rem; }
  .poker-betting .timer { font-size: .7rem; }
}
@media (orientation: portrait) {
  html:not(.table-immersive) .game-table.poker-table { --stage-height: 228px; --board-card: 59px; --hole-card: 60px; --poker-avatar: 22px; }
  html:not(.table-immersive) .poker-stage { grid-template-areas: "s6 s5 s4 s3 s2" "center center center center center" "s7 s7 . s1 s1"; grid-template-rows: 54px minmax(0, 1fr) 54px; gap: 3px; padding-inline: 4px; }
  html:not(.table-immersive) .poker-controls { grid-template-columns: minmax(0, 1fr); }
  html:not(.table-immersive) .poker-player { justify-content: center; }
  html:not(.table-immersive) .poker-stage .seat { padding: 2px 3px; }
  .table-immersive .game-table.poker-table {
    --stage-height: clamp(150px, calc(100dvw - 174px), 340px);
    --board-card: clamp(43px, 15dvw, 73px);
    --hole-card: clamp(49px, 16dvw, 68px);
    --poker-avatar: clamp(22px, 7.4dvw, 39px);
    --quick-chip-size: clamp(34px, 5.9dvh, 43px);
  }
}
@media (orientation: portrait) and (max-width: 430px) {
  html:not(.table-immersive) .poker-betting.has-raise { grid-template-columns: minmax(0, 1fr); }
  html:not(.table-immersive) .poker-raise-tools { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
