:root {
  --bg: #f7eef3;
  --panel: #fff9fc;
  --ink: #232127;
  --muted: #817784;
  --line: rgba(35, 33, 39, 0.12);
  --felt: #f3b8c9;
  --felt-edge: #b56f83;
  --accent: #b83f62;
  --accent-2: #355f4b;
  --danger: #8d1f35;
  --shadow: 0 18px 50px rgba(68, 37, 49, 0.14);
}

[data-theme="green"] {
  --bg: #eff6f1;
  --panel: #fbfffc;
  --felt: #77b790;
  --felt-edge: #2f6f52;
  --accent: #245f45;
  --accent-2: #9a3151;
}

[data-theme="blue"] {
  --bg: #eef5f8;
  --panel: #fbfdff;
  --felt: #89b9cf;
  --felt-edge: #3b718b;
  --accent: #2b637c;
  --accent-2: #a33e5a;
}

[data-theme="graphite"] {
  --bg: #ecebea;
  --panel: #fafafa;
  --felt: #6f7372;
  --felt-edge: #2f3333;
  --accent: #252828;
  --accent-2: #b94862;
}

[data-theme="burgundy"] {
  --bg: #f4eef0;
  --panel: #fffafb;
  --felt: #9e3d55;
  --felt-edge: #5d2131;
  --accent: #7c253c;
  --accent-2: #2c6b51;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow: hidden;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, border 0.12s ease, background 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(35, 33, 39, 0.25);
}

button.danger {
  color: #fff;
  background: var(--danger);
}

.seat:hover,
.seat.empty:hover {
  transform: translate(-50%, -50%);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.app {
  display: grid;
  grid-template-columns: clamp(244px, 13vw, 292px) minmax(680px, 1fr) clamp(260px, 15vw, 320px);
  grid-template-areas: "left table right";
  height: 100vh;
  overflow: hidden;
}

.left {
  grid-area: left;
}

.right {
  grid-area: right;
}

.table-wrap {
  grid-area: table;
}

.sidebar {
  position: relative;
  height: 100vh;
  padding: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar.right {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.sidebar.right {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar.hidden {
  width: 0;
  padding: 0;
  overflow: visible;
  border: 0;
}

.sidebar.hidden > *:not(.panel-toggle) {
  display: none;
}

.app:has(.left.hidden) {
  grid-template-columns: 0 minmax(760px, 1fr) 320px;
}

.app:has(.right.hidden) {
  grid-template-columns: 292px minmax(760px, 1fr) 0;
}

.app:has(.left.hidden):has(.right.hidden) {
  grid-template-columns: 0 1fr 0;
}

.panel-toggle {
  position: absolute;
  z-index: 20;
  top: 16px;
  right: 14px;
  width: 28px;
  min-height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
}

.right-toggle {
  right: auto;
  left: 14px;
}

.sidebar.hidden .panel-toggle {
  right: -34px;
}

.sidebar.right.hidden .right-toggle {
  left: -34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.mark img {
  width: 120%;
  height: 120%;
  object-fit: contain;
  transform: translateY(4px) scale(1.2);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.brand p,
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.grid2,
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary,
.actions .accent,
.avatar-choice.active,
.theme-choice.active,
.card-theme-choice.active,
.tabs button.active {
  color: #fff;
  background: var(--accent);
}

.invite {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.themes,
.card-themes,
.quick,
.actions,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.avatar-choice {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 98px;
  padding: 8px 6px;
  font-size: 12px;
}

.choice-avatar {
  display: grid;
  place-items: center;
  width: 68px;
  height: 72px;
  border-radius: 8px;
  overflow: visible;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 24%, white), color-mix(in srgb, var(--accent-2) 22%, white));
  font-weight: 800;
}

.choice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.theme-choice,
.card-theme-choice {
  min-height: 34px;
  padding: 0 10px;
}

.card-theme-choice {
  display: grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 7px;
  min-height: 44px;
}

.card-back-preview {
  width: 22px;
  height: 31px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 4px;
  background: var(--card-back);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.table-wrap {
  position: relative;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) auto auto;
  gap: 10px;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 0 20px 18px;
}

.topbar {
  display: grid;
  grid-template-columns: 42px minmax(120px, 1fr) auto 42px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  color: var(--muted);
  gap: 12px;
}

#status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-info {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.table-info span,
.table-info strong {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 900;
}

.table-info strong {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
}

.ghost {
  width: 42px;
  flex: 0 0 auto;
  color: var(--accent);
  background: transparent;
}

.table-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  overflow: visible;
  padding: clamp(76px, 8vh, 120px) clamp(90px, 5.5vw, 180px) clamp(104px, 11vh, 150px);
}

.table-felt {
  position: relative;
  width: min(100%, clamp(980px, 78vw, 1880px));
  height: clamp(390px, 56vh, 760px);
  min-height: 320px;
  border: clamp(10px, 1.6vw, 18px) solid var(--felt-edge);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.22) 0 20%, transparent 48%),
    radial-gradient(ellipse at center, color-mix(in srgb, var(--felt) 80%, white 20%) 0%, var(--felt) 58%, color-mix(in srgb, var(--felt) 74%, black 26%) 100%);
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(255, 255, 255, 0.25), inset 0 -24px 70px rgba(0, 0, 0, 0.18);
}

.community {
  position: absolute;
  left: 50%;
  top: 47%;
  display: grid;
  gap: 14px;
  justify-items: center;
  transform: translate(-50%, -50%);
}

.pot {
  min-width: 126px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  text-align: center;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
}

.pot strong,
.pot small {
  display: block;
}

.pot small {
  margin-top: 2px;
  max-width: min(360px, 52vw);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.board {
  display: grid;
  gap: 10px;
  min-height: 100px;
}

.table-reveal {
  min-height: 58px;
  display: grid;
  place-items: center;
}

.table-reveal:not(.show) {
  display: none;
}

.table-reveal-button {
  min-width: 168px;
  min-height: 58px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 44px rgba(35, 24, 31, 0.34), 0 0 0 8px rgba(255, 255, 255, 0.16);
  font-size: 20px;
  font-weight: 1000;
}

.table-reveal-button.active {
  background: linear-gradient(135deg, #1f7a4d, #35b979);
}

.board-row {
  display: grid;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.board-row.single {
  grid-template-columns: repeat(5, max-content);
}

.board-row.multi {
  grid-template-columns: auto repeat(5, max-content);
}

.board-label {
  min-width: 46px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 900;
}

.card {
  display: grid;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  width: clamp(54px, 5.4vw, 70px);
  height: clamp(76px, 7.4vw, 98px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 20, 20, 0.12);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.card b {
  font-size: 1.55em;
}

.card.back {
  grid-template-rows: 1fr;
  color: transparent;
  background: var(--card-back);
}

.dealt-card {
  opacity: 0;
  transform: translate(-44px, -42px) scale(0.72) rotate(-8deg);
  animation: dealToSeat 360ms ease-out forwards;
}

.pending-card {
  visibility: hidden;
}

.board-back {
  opacity: 0;
  animation: boardDeal 360ms ease-out forwards;
}

.board-front {
  animation: boardFlip 320ms ease-out both;
}

.board-slot-0 { animation-delay: 0ms; }
.board-slot-1 { animation-delay: 130ms; }
.board-slot-2 { animation-delay: 260ms; }
.board-slot-3 { animation-delay: 390ms; }
.board-slot-4 { animation-delay: 520ms; }

[data-card-theme="pacifier"] .card.back {
  background: radial-gradient(circle at 50% 50%, #fff 0 15%, transparent 16%), repeating-linear-gradient(45deg, #eeb6c5 0 9px, #a7d3cf 9px 18px);
}

[data-card-theme="heart"] .card.back {
  background: radial-gradient(circle at 35% 35%, #fff 0 8%, transparent 9%), linear-gradient(135deg, #d94f75, #f6bdcf);
}

[data-card-theme="cat"] .card.back {
  background: radial-gradient(circle at 32% 34%, #fff 0 5%, transparent 6%), radial-gradient(circle at 68% 34%, #fff 0 5%, transparent 6%), linear-gradient(135deg, #2f3035, #7f8890);
}

[data-card-theme="star"] .card.back {
  background: radial-gradient(circle at 50% 50%, #fff7b2 0 9%, transparent 10%), linear-gradient(135deg, #314b7a, #c45b87);
}

.app,
.card-back-preview[data-preview-theme="classic"] {
  --card-back: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.88) 0 13%, transparent 14%),
    repeating-linear-gradient(45deg, var(--accent), var(--accent) 7px, color-mix(in srgb, var(--accent) 70%, white) 7px, color-mix(in srgb, var(--accent) 70%, white) 14px);
}

[data-card-theme="pacifier"] .card.back,
.card-back-preview[data-preview-theme="pacifier"] {
  background: radial-gradient(circle at 50% 50%, #fff 0 14%, #f3a6bc 15% 22%, transparent 23%),
    radial-gradient(circle at 50% 62%, #fff 0 7%, transparent 8%),
    linear-gradient(135deg, #f6c6d6 0 48%, #a9d9d3 49% 100%);
}

[data-card-theme="heart"] .card.back,
.card-back-preview[data-preview-theme="heart"] {
  background: radial-gradient(circle at 38% 35%, #fff 0 8%, transparent 9%),
    radial-gradient(circle at 62% 35%, #fff 0 8%, transparent 9%),
    conic-gradient(from 135deg at 50% 60%, #fff 0 25%, transparent 0 100%),
    linear-gradient(135deg, #c43d64, #f6b8ce);
}

[data-card-theme="cat"] .card.back,
.card-back-preview[data-preview-theme="cat"] {
  background: radial-gradient(circle at 34% 38%, #fff 0 5%, transparent 6%),
    radial-gradient(circle at 66% 38%, #fff 0 5%, transparent 6%),
    linear-gradient(45deg, transparent 0 43%, rgba(255,255,255,0.9) 44% 45%, transparent 46%),
    linear-gradient(-45deg, transparent 0 43%, rgba(255,255,255,0.9) 44% 45%, transparent 46%),
    linear-gradient(135deg, #2f3035, #7f8890);
}

[data-card-theme="star"] .card.back,
.card-back-preview[data-preview-theme="star"] {
  background: radial-gradient(circle at 50% 50%, #fff7b2 0 9%, transparent 10%),
    radial-gradient(circle at 24% 28%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 76% 72%, #fff 0 4%, transparent 5%),
    linear-gradient(135deg, #314b7a, #c45b87);
}

.card.s { color: #11151a; border-color: rgba(17, 21, 26, 0.22); }
.card.h { color: #8d1f35; border-color: rgba(141, 31, 53, 0.26); background: #fff7f8; }
.card.d { color: #d65386; border-color: rgba(214, 83, 134, 0.3); background: #fff5fa; }
.card.c { color: #1f7a4d; border-color: rgba(31, 122, 77, 0.3); background: #f5fff9; }

.seat {
  position: absolute;
  display: grid;
  grid-template-columns: clamp(58px, 4.2vw, 82px) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 6px 9px;
  align-items: center;
  width: clamp(178px, 12vw, 236px);
  min-height: 108px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%);
}

.seat.empty {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  width: 190px;
  min-height: 64px;
  color: rgba(255, 255, 255, 0.9);
  border-style: dashed;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.seat.folded {
  opacity: 0.5;
}

.seat.action {
  outline: 3px solid #fff;
  box-shadow: 0 0 0 5px var(--accent), 0 14px 34px rgba(0, 0, 0, 0.16);
}

.seat.winner {
  outline: 4px solid #fff1a8;
  box-shadow: 0 0 0 6px rgba(245, 197, 67, 0.42), 0 0 34px rgba(245, 197, 67, 0.56), 0 14px 34px rgba(0, 0, 0, 0.16);
  animation: winnerPulse 2.4s ease-in-out 2;
}

.avatar,
.player-portrait {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: clamp(58px, 4.2vw, 82px);
  height: clamp(82px, 5.2vw, 104px);
  border-radius: 8px;
  overflow: visible;
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 22%, white), color-mix(in srgb, var(--accent-2) 20%, white));
  font-weight: 800;
}

.avatar img,
.player-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.avatar.ai,
.player-portrait.ai {
  background: #2d3037;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
}

.player-name span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.solver-toast {
  position: absolute;
  top: 58px;
  right: 28px;
  z-index: 95;
  display: none;
  width: min(360px, calc(100vw - 56px));
  padding: 12px 14px;
  border: 1px solid rgba(143, 32, 61, 0.22);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(58, 25, 37, 0.14);
  background: rgba(255, 250, 252, 0.94);
  color: var(--ink);
  backdrop-filter: blur(14px);
}

.solver-toast.show {
  display: grid;
  gap: 8px;
}

.solver-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.solver-toast-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #8f203d;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
}

.solver-toast-lines {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.solver-toast.done {
  border-color: rgba(17, 133, 87, 0.35);
  background: rgba(238, 249, 243, 0.95);
}

.solver-toast.warn {
  border-color: rgba(213, 156, 38, 0.45);
  background: rgba(255, 247, 223, 0.95);
}

.solver-toast.error {
  border-color: rgba(143, 32, 61, 0.38);
  background: rgba(255, 240, 244, 0.95);
}

.tag {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  color: #fff;
  background: var(--accent);
  font-size: 10px;
}

.mini-hud {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.mini-hud span {
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.74);
}

.mini-hud.muted {
  opacity: 0.62;
}

.stack-badge {
  position: absolute;
  right: -10px;
  bottom: -10px;
  max-width: 112px;
  padding: 4px 8px;
  border-radius: 7px;
  color: #fff;
  background: rgba(35, 33, 39, 0.82);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-cards {
  grid-column: 2;
  display: flex;
  justify-content: flex-start;
  gap: 7px;
  min-height: 58px;
}

.seat-cards .card {
  width: clamp(40px, 2.9vw, 58px);
  height: clamp(56px, 4vw, 78px);
  font-size: clamp(15px, 1vw, 18px);
  border-radius: 7px;
}

.position {
  position: absolute;
  left: 8px;
  top: -12px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  font-size: 11px;
}

.last-action {
  position: absolute;
  right: -10px;
  top: -12px;
  max-width: 120px;
  padding: 4px 8px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-pop {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 120;
  display: grid;
  place-items: center;
  min-width: 150px;
  padding: 14px 22px;
  border: 4px solid rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #087a4d, #22c977 56%, #f7c948);
  box-shadow: 0 22px 58px rgba(22, 138, 84, 0.5), 0 0 0 9px rgba(255, 241, 168, 0.28), 0 0 42px rgba(247, 201, 72, 0.5);
  text-align: center;
  font-weight: 900;
  transform: translate(-50%, -50%);
  animation: floatWin 4.6s ease both;
  pointer-events: none;
}

.win-pop strong {
  font-size: clamp(42px, 4vw, 72px);
  line-height: 1;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.28);
}

.winner-banner {
  position: absolute;
  left: 50%;
  top: 16%;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(720px, 84%);
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  color: #fff;
  background: rgba(35, 24, 31, 0.78);
  box-shadow: 0 18px 44px rgba(26, 14, 20, 0.3);
  transform: translateX(-50%);
  animation: winnerBanner 4.6s ease both;
  pointer-events: none;
}

.winner-banner span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.winner-banner strong {
  color: #fff1a8;
  font-size: clamp(18px, 1.5vw, 26px);
  font-weight: 1000;
}

@keyframes winnerPulse {
  0%, 100% { filter: brightness(1); }
  45% { filter: brightness(1.22); }
}

@keyframes winnerBanner {
  from { opacity: 0; transform: translate(-50%, -18px) scale(0.94); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  24% { transform: translate(-50%, 0) scale(1); }
  82% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -22px) scale(0.98); }
}

@keyframes floatWin {
  from { opacity: 0; transform: translate(-50%, -34%) scale(0.72); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); }
  28% { transform: translate(-50%, -50%) scale(1); }
  86% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -108%) scale(1.08); }
}

@keyframes dealToSeat {
  from {
    opacity: 0;
    transform: translate(-44px, -42px) scale(0.72) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0);
  }
}

@keyframes boardDeal {
  from {
    opacity: 0;
    transform: translateY(-34px) scale(0.76) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes boardFlip {
  from {
    opacity: 0.45;
    transform: rotateY(82deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

.run-it-panel {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 30;
  display: none;
  min-width: 260px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 249, 252, 0.96);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.run-it-panel.show {
  display: grid;
  gap: 10px;
}

.run-it-title {
  text-align: center;
  font-weight: 900;
}

.run-it-equities {
  display: grid;
  gap: 6px;
}

.equity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.equity-row strong {
  color: var(--accent);
  font-size: 16px;
}

.equity-row.all-in {
  border: 1px solid rgba(179, 45, 82, 0.24);
  background: rgba(255, 240, 247, 0.92);
}

.run-it-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.run-it-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.run-it-buttons button.active {
  color: #fff;
  background: var(--accent);
}

.pos0 { left: 50%; top: 104%; }
.pos1 { left: 25%; top: 96%; }
.pos2 { left: 0%; top: 62%; }
.pos3 { left: 13%; top: 12%; }
.pos4 { left: 36%; top: -10%; }
.pos5 { left: 64%; top: -10%; }
.pos6 { left: 87%; top: 12%; }
.pos7 { left: 100%; top: 62%; }
.pos8 { left: 75%; top: 96%; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.stats div {
  display: grid;
  gap: 3px;
}

.stats span {
  color: var(--muted);
  font-size: 11px;
}

.stats strong {
  font-size: 17px;
}

.stats .rebuy {
  grid-template-columns: minmax(120px, 1fr) 96px;
  align-items: end;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 800;
}

.mode-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.action-bar {
  display: grid;
  grid-template-columns: 108px minmax(260px, 1fr) minmax(260px, 0.8fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow);
}

.action-meta {
  display: grid;
  gap: 6px;
}

.amount-readout {
  display: grid;
  place-items: center;
  height: 68px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 28px;
  font-weight: 900;
}

.action-clock {
  min-height: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.action-clock.hot {
  color: var(--danger);
  font-size: 18px;
  animation: clockPulse 0.8s ease-in-out infinite;
}

@keyframes clockPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.72; }
}

.bet-tools {
  display: grid;
  gap: 10px;
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

#betSlider {
  accent-color: var(--accent);
}

.quick button {
  display: grid;
  gap: 2px;
  align-content: center;
  min-width: 74px;
  min-height: 38px;
  font-size: 12px;
  font-weight: 800;
}

.quick button strong {
  color: var(--accent);
  font-size: 13px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.actions button {
  min-height: 58px;
  font-size: 18px;
  font-weight: 900;
}

.actions .inactive-action {
  opacity: 0.34;
}

.actions .danger {
  color: #fff;
  background: var(--danger);
}

.actions .show-ai-cards {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 28px rgba(124, 37, 60, 0.22);
}

.actions .check-fold {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, white);
  background: color-mix(in srgb, var(--accent) 8%, white);
}

.actions .check-fold.active {
  color: #fff;
  background: linear-gradient(135deg, #3a2e38, var(--accent));
  box-shadow: 0 12px 28px rgba(35, 24, 31, 0.24);
}

.learning {
  border-top: 0;
  position: sticky;
  top: -18px;
  z-index: 8;
  padding-top: 18px;
  background: color-mix(in srgb, var(--panel) 96%, white);
}

.study-entry {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
  font-weight: 900;
}

.solver-entry {
  margin-top: 8px;
  background: #8f203d;
}

.advisor-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.advisor-buttons .solver-entry {
  margin-top: 0;
}

.coach-entry {
  background: #3a2e38;
}

.coach-entry.active {
  background: linear-gradient(135deg, var(--accent), #3a2e38);
  box-shadow: 0 12px 26px rgba(143, 32, 61, 0.24);
}

.solver-entry:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.solver-result {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 82%, white);
  font-size: 12px;
  line-height: 1.45;
}

.solver-result strong {
  color: var(--ink);
}

.solver-result.done {
  border-color: rgba(17, 133, 87, 0.35);
  background: #eef9f3;
}

.solver-result.warn {
  border-color: rgba(213, 156, 38, 0.45);
  background: #fff7df;
}

.solver-result.error {
  border-color: rgba(143, 32, 61, 0.38);
  background: #fff0f4;
}

.ai-advice {
  display: none;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(143, 32, 61, 0.28);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, #fff2f5);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ai-advice.show {
  display: grid;
}

.ai-advice.done {
  border-color: rgba(143, 32, 61, 0.42);
  background: #fff4f7;
}

.ai-advice.muted {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 88%, white);
}

.ai-advice strong,
.ai-advice-action {
  color: var(--ink);
}

.ai-advice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-advice-head span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(143, 32, 61, 0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
}

.ai-advice-action {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(143, 32, 61, 0.18);
  font-size: 20px;
  font-weight: 1000;
  text-align: center;
}

.ai-advice-candidates,
.ai-advice-lines {
  display: grid;
  gap: 5px;
}

.ai-advice-candidates div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
}

.ai-advice-candidates b {
  color: var(--accent);
}

.ai-advice-lines span {
  display: block;
}

.lesson-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lesson-card h3 {
  font-size: 15px;
}

.lesson-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.hand-log-panel {
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.hand-history {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
}

.history-hand {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-hand header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
}

.history-hand header b {
  color: var(--accent);
}

.history-board {
  display: flex;
  gap: 5px;
}

.history-board .card {
  width: 30px;
  height: 42px;
  border-radius: 6px;
  font-size: 11px;
}

.history-card-rows {
  display: grid;
  gap: 6px;
}

.history-card-row {
  display: grid;
  gap: 5px;
  padding: 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 62%, white);
  font-size: 11px;
}

.history-card-row > b {
  color: var(--accent);
}

.history-card-row > div {
  display: grid;
  gap: 5px;
}

.history-card-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-card-player em {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-mini-cards {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}

.history-mini-cards .card {
  width: 28px;
  height: 39px;
  border-radius: 6px;
  font-size: 10px;
}

.history-winners {
  color: var(--ink);
  font-size: 12px;
}

.history-winners strong,
.history-nets .up {
  color: #168a54;
}

.history-winners em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.history-advice-list {
  display: grid;
  gap: 6px;
}

.history-advice {
  display: grid;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(143, 32, 61, 0.18);
  border-radius: 7px;
  background: #fff5f8;
  font-size: 11px;
}

.history-advice b,
.history-advice strong {
  color: var(--accent);
}

.history-nets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-nets span {
  padding: 3px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 70%, white);
  font-size: 11px;
  font-weight: 800;
}

.history-nets .down {
  color: #9a3151;
}

.history-actions {
  display: grid;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.history-action {
  display: grid;
  grid-template-columns: 38px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.history-action b,
.history-action strong {
  color: var(--ink);
}

.history-action em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settlement-panel {
  display: none;
}

.settlement-panel.show {
  display: grid;
}

.settlement-summary {
  display: grid;
  gap: 8px;
}

.settlement-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 0.8fr 0.8fr 0.8fr;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}

.settlement-row.header {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 72%, white);
  font-weight: 900;
}

.settlement-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settlement-row .up {
  color: #168a54;
  font-weight: 900;
}

.settlement-row .down {
  color: #9a3151;
  font-weight: 900;
}

.settlement-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(35, 20, 29, 0.28);
  backdrop-filter: blur(8px);
}

.settlement-modal.show {
  display: grid;
}

.settlement-card {
  display: grid;
  gap: 12px;
  width: min(680px, 94vw);
  max-height: min(78vh, 720px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, white);
  box-shadow: 0 28px 80px rgba(30, 18, 26, 0.28);
}

.settlement-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.advice-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(35, 20, 29, 0.22);
  backdrop-filter: blur(8px);
}

.advice-modal.show {
  display: grid;
}

.advice-card {
  display: grid;
  gap: 14px;
  width: min(520px, 94vw);
  padding: 18px;
  border: 1px solid rgba(143, 32, 61, 0.24);
  border-radius: 10px;
  background: rgba(255, 249, 251, 0.98);
  box-shadow: 0 24px 80px rgba(35, 20, 29, 0.28);
}

.advice-card header {
  display: grid;
  gap: 4px;
}

.advice-card header span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.advice-card header strong {
  color: var(--ink);
  font-size: 20px;
}

.advice-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.advice-compare div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.advice-compare span {
  color: var(--muted);
  font-size: 12px;
}

.advice-compare b {
  color: var(--accent);
  font-size: 20px;
}

@media (min-width: 1600px) {
  .app {
    grid-template-columns: clamp(244px, 12vw, 292px) minmax(0, 1fr) clamp(260px, 14vw, 320px);
  }

  .table-wrap {
    padding-inline: clamp(16px, 1.5vw, 34px);
  }

  .table-stage {
    padding-top: clamp(88px, 7vh, 120px);
    padding-bottom: clamp(112px, 10vh, 148px);
  }

  .table-felt {
    width: min(100%, clamp(1320px, 78vw, 2160px));
    height: clamp(480px, 58vh, 820px);
  }
}

@media (max-width: 1220px) {
  .app {
    grid-template-columns: 260px minmax(560px, 1fr);
    grid-template-areas:
      "left table"
      "right table";
  }

  .sidebar.right {
    border-left: 0;
    border-right: 1px solid var(--line);
  }

  .right-toggle {
    left: auto;
    right: -14px;
  }

  .app:has(.right.hidden),
  .app:has(.left.hidden),
  .app:has(.left.hidden):has(.right.hidden) {
    grid-template-columns: 0 1fr;
  }

  .table-wrap {
    padding-inline: 14px;
  }

  .table-stage {
    min-height: clamp(520px, 72vh, 650px);
    padding: 88px 102px 120px;
  }

  .table-felt {
    width: min(100%, 760px);
    height: clamp(310px, 48vh, 390px);
    min-height: 310px;
  }

  .seat {
    width: 154px;
    min-height: 96px;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 5px 7px;
    padding: 6px;
    font-size: 12px;
  }

  .seat.empty {
    width: 142px;
    min-height: 56px;
  }

  .player-portrait,
  .avatar {
    width: 54px;
    height: 72px;
  }

  .seat-cards {
    min-height: 48px;
    gap: 5px;
  }

  .seat-cards .card {
    width: 34px;
    height: 48px;
    font-size: 12px;
  }

  .last-action,
  .stack-badge {
    max-width: 86px;
    font-size: 10px;
    padding: 3px 6px;
  }

  .pos0 { left: 50%; top: 123%; }
  .pos1 { left: 25%; top: 109%; }
  .pos2 { left: -1%; top: 62%; }
  .pos3 { left: 13%; top: 12%; }
  .pos4 { left: 34%; top: -16%; }
  .pos5 { left: 66%; top: -16%; }
  .pos6 { left: 87%; top: 12%; }
  .pos7 { left: 101%; top: 62%; }
  .pos8 { left: 75%; top: 109%; }

  .action-bar {
    grid-template-columns: 96px 1fr;
  }

  .actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app {
    display: block;
  }

  .sidebar {
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar.right {
    border-left: 0;
  }

  .sidebar.hidden {
    display: none;
  }

  .panel-toggle,
  .right-toggle {
    position: sticky;
    top: 8px;
    left: auto;
    right: 0;
    float: right;
  }

  .table-wrap {
    min-height: auto;
    padding: 0 10px 12px;
    grid-template-rows: auto auto auto auto;
  }

  .topbar {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    min-height: 64px;
  }

  .topbar .ghost:last-child {
    grid-column: 3;
    grid-row: 1;
  }

  .table-info {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .solver-toast {
    top: 78px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .table-stage {
    min-height: clamp(560px, 82vh, 680px);
    padding: 82px 76px 116px;
  }

  .table-felt {
    width: min(100%, 440px);
    height: clamp(300px, 48vh, 360px);
    min-height: 300px;
  }

  .seat {
    width: 116px;
    min-height: 84px;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 4px 6px;
    padding: 6px;
    font-size: 12px;
  }

  .seat.empty {
    width: 104px;
    min-height: 44px;
  }

  .avatar,
  .player-portrait {
    width: 42px;
    height: 58px;
  }

  .seat-cards {
    min-height: 48px;
    gap: 5px;
  }

  .seat-cards .card {
    width: 28px;
    height: 40px;
    font-size: 11px;
  }

  .board {
    gap: 6px;
  }

  .card {
    width: 44px;
    height: 62px;
    font-size: 15px;
  }

  .last-action,
  .stack-badge {
    max-width: 82px;
    font-size: 10px;
    padding: 3px 6px;
  }

  .pos0 { left: 50%; top: 124%; }
  .pos1 { left: 24%; top: 109%; }
  .pos2 { left: -3%; top: 62%; }
  .pos3 { left: 12%; top: 12%; }
  .pos4 { left: 32%; top: -16%; }
  .pos5 { left: 68%; top: -16%; }
  .pos6 { left: 88%; top: 12%; }
  .pos7 { left: 103%; top: 62%; }
  .pos8 { left: 76%; top: 109%; }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats .rebuy {
    grid-column: 1 / -1;
  }

  .action-bar {
    grid-template-columns: 1fr;
  }

  .amount-readout {
    height: 58px;
  }

  .actions button {
    min-height: 58px;
  }
}

@media (max-width: 520px) and (orientation: portrait) {
  .avatars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-stage {
    min-height: clamp(540px, 78vh, 620px);
    padding: 74px 64px 108px;
  }

  .table-felt {
    width: min(100%, 320px);
    height: clamp(280px, 44vh, 320px);
    min-height: 280px;
  }

  .seat {
    width: 104px;
    min-height: 78px;
    grid-template-columns: 38px minmax(0, 1fr);
    font-size: 11px;
  }

  .avatar,
  .player-portrait {
    width: 38px;
    height: 52px;
  }

  .seat-cards .card {
    width: 26px;
    height: 38px;
  }

  .community {
    top: 48%;
  }

  .board {
    min-height: 50px;
  }

  .card {
    width: 36px;
    height: 52px;
  }

  .slider-row {
    grid-template-columns: 1fr 86px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .actions button {
    min-height: 54px;
  }
}

@media (min-width: 521px) and (max-width: 1024px) {
  .stats input,
  .stats button,
  .quick button {
    min-height: 36px;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .app {
    display: grid;
    grid-template-columns: 230px 1fr;
    grid-template-areas:
      "left table"
      "right table";
  }

  .sidebar {
    max-height: 50vh;
    padding: 12px;
  }

  .table-wrap {
    min-height: 100vh;
    gap: 8px;
  }

  .table-stage {
    min-height: clamp(360px, 82vh, 460px);
    padding: 58px 76px 78px;
  }

  .table-felt {
    width: min(100%, 560px);
    height: clamp(220px, 46vh, 300px);
    min-height: 220px;
  }

  .seat {
    width: 112px;
    min-height: 76px;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .player-portrait,
  .avatar {
    width: 40px;
    height: 52px;
  }

  .seat-cards .card {
    width: 26px;
    height: 38px;
  }

  .action-bar {
    padding: 10px;
  }

  .actions button {
    min-height: 48px;
  }
}

html,
body {
  height: 100%;
}

@media (min-width: 1025px) and (max-width: 1500px) {
  .pos4 { left: 30%; top: -10%; }
  .pos5 { left: 70%; top: -10%; }
}

@media (max-width: 1220px) and (min-width: 1025px) {
  .pos4 { left: 29%; top: -14%; }
  .pos5 { left: 71%; top: -14%; }
}

@media (min-width: 1221px) and (max-width: 1500px) {
  .seat {
    width: 140px;
    min-height: 90px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 4px 6px;
    padding: 6px;
    font-size: 12px;
  }

  .player-portrait,
  .avatar {
    width: 46px;
    height: 62px;
  }

  .seat-cards {
    min-height: 40px;
    gap: 4px;
  }

  .seat-cards .card {
    width: 30px;
    height: 42px;
    font-size: 11px;
  }

  .mini-hud {
    display: none;
  }

  .last-action,
  .stack-badge {
    max-width: 78px;
    font-size: 9px;
    padding: 3px 6px;
  }

  .pos0 { left: 50%; top: 90%; }
  .pos1 { left: 20%; top: 88%; }
  .pos2 { left: -1%; top: 61%; }
  .pos3 { left: 9%; top: 13%; }
  .pos4 { left: 30%; top: -11%; }
  .pos5 { left: 70%; top: -11%; }
  .pos6 { left: 91%; top: 13%; }
  .pos7 { left: 101%; top: 61%; }
  .pos8 { left: 80%; top: 88%; }
}

@media (max-width: 1220px), (max-height: 520px) and (orientation: landscape) {
  body {
    overflow: hidden;
  }

  .app {
    display: block;
    height: 100dvh;
    overflow: hidden;
  }

  .sidebar,
  .sidebar.right {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(88vw, 320px);
    height: 100dvh;
    max-height: none;
    padding: 14px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: color-mix(in srgb, var(--panel) 96%, white);
    box-shadow: 22px 0 56px rgba(35, 24, 31, 0.18);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(0);
    transition: transform 0.18s ease;
  }

  .sidebar.right {
    right: 0;
    left: auto;
    border-right: 0;
    border-left: 1px solid var(--line);
    box-shadow: -22px 0 56px rgba(35, 24, 31, 0.18);
  }

  .sidebar.hidden {
    display: block;
    width: min(88vw, 320px);
    padding: 14px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    transform: translateX(calc(-100% - 56px));
  }

  .sidebar.right.hidden {
    border-left: 1px solid var(--line);
    transform: translateX(calc(100% + 56px));
  }

  .sidebar.hidden .panel-toggle {
    display: none;
  }

  .table-wrap {
    height: 100dvh;
    min-height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: clamp(4px, 1vh, 8px);
    padding: 0 clamp(6px, 2vw, 12px) max(8px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto 40px;
    grid-template-rows: auto;
    min-height: clamp(42px, 7vh, 56px);
    gap: 6px;
  }

  .topbar .ghost:last-child,
  .table-info {
    grid-column: auto;
    grid-row: auto;
  }

  .table-info {
    justify-content: flex-end;
    overflow-x: auto;
    padding-bottom: 0;
  }

  .table-info span,
  .table-info strong {
    padding: 4px 6px;
    font-size: 10px;
  }

  .solver-toast {
    top: 52px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .table-stage {
    min-height: 0;
    height: 100%;
    padding: clamp(34px, 7vh, 62px) clamp(46px, 11vw, 92px) clamp(48px, 10vh, 84px);
    overflow: visible;
  }

  .table-felt {
    width: min(100%, 680px);
    height: clamp(180px, 36vh, 340px);
    min-height: 0;
    border-width: clamp(7px, 1.7vw, 12px);
  }

  .community {
    top: 48%;
    gap: 8px;
  }

  .pot {
    min-width: 86px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .board {
    gap: 5px;
    min-height: 42px;
  }

  .board-row,
  .board-row.single,
  .board-row.multi {
    gap: 5px;
  }

  .card {
    width: clamp(30px, 8.6vw, 44px);
    height: clamp(42px, 12vw, 62px);
    border-radius: 6px;
    font-size: clamp(12px, 3.4vw, 15px);
  }

  .seat {
    width: clamp(88px, 22vw, 126px);
    min-height: clamp(62px, 13vh, 84px);
    grid-template-columns: clamp(30px, 7vw, 42px) minmax(0, 1fr);
    gap: 3px 5px;
    padding: 4px;
    font-size: 11px;
  }

  .seat.empty {
    width: clamp(76px, 19vw, 110px);
    min-height: 36px;
    font-size: 11px;
  }

  .avatar,
  .player-portrait {
    width: clamp(30px, 7vw, 42px);
    height: clamp(42px, 9vw, 56px);
  }

  .mini-hud {
    display: none;
  }

  .player-name {
    gap: 4px;
    font-size: 11px;
  }

  .seat-cards {
    min-height: 32px;
    gap: 3px;
  }

  .seat-cards .card {
    width: clamp(20px, 5vw, 28px);
    height: clamp(30px, 7vw, 40px);
    border-radius: 5px;
    font-size: 10px;
  }

  .position {
    left: 5px;
    top: -9px;
    padding: 1px 5px;
    font-size: 9px;
  }

  .last-action,
  .stack-badge {
    max-width: 74px;
    padding: 2px 5px;
    font-size: 9px;
  }

  .pos0 { left: 50%; top: 111%; }
  .pos1 { left: 25%; top: 100%; }
  .pos2 { left: -1%; top: 60%; }
  .pos3 { left: 13%; top: 12%; }
  .pos4 { left: 31%; top: -6%; }
  .pos5 { left: 69%; top: -6%; }
  .pos6 { left: 87%; top: 12%; }
  .pos7 { left: 101%; top: 60%; }
  .pos8 { left: 75%; top: 100%; }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }

  .stats span {
    font-size: 10px;
  }

  .stats strong {
    font-size: 14px;
  }

  .stats .rebuy {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .stats input,
  .stats button {
    min-height: 34px;
  }

  .action-bar {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 6px;
    padding: 6px;
  }

  .action-meta {
    gap: 3px;
  }

  .amount-readout {
    height: 44px;
    font-size: 18px;
  }

  .action-clock {
    min-height: 12px;
    font-size: 10px;
  }

  .bet-tools {
    gap: 5px;
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 6px;
  }

  .quick {
    gap: 4px;
    max-height: 32px;
    overflow: hidden;
  }

  .quick button {
    min-width: 48px;
    min-height: 28px;
    padding: 0 5px;
    font-size: 10px;
  }

  .quick button strong {
    font-size: 11px;
  }

  .actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .actions button {
    min-height: 42px;
    font-size: 14px;
  }
}

@media (min-width: 521px) and (max-width: 1220px) {
  .table-stage {
    padding-inline: clamp(54px, 8vw, 88px);
  }

  .table-felt {
    width: min(100%, 700px);
    height: clamp(220px, 36vh, 340px);
  }

  .seat {
    width: clamp(96px, 14vw, 112px);
    min-height: clamp(60px, 8vh, 76px);
    grid-template-columns: clamp(34px, 5vw, 40px) minmax(0, 1fr);
    font-size: 10px;
  }

  .player-portrait,
  .avatar {
    width: clamp(34px, 5vw, 40px);
    height: clamp(44px, 7vw, 54px);
  }

  .seat-cards .card {
    width: clamp(22px, 3.8vw, 27px);
    height: clamp(32px, 5.2vw, 39px);
    font-size: 9px;
  }

  .last-action,
  .stack-badge {
    max-width: 64px;
  }

  .pos0 { left: 50%; top: 94%; }
  .pos1 { left: 15%; top: 84%; }
  .pos2 { left: -1%; top: 58%; }
  .pos3 { left: 7%; top: 16%; }
  .pos4 { left: 30%; top: -7%; }
  .pos5 { left: 70%; top: -7%; }
  .pos6 { left: 93%; top: 16%; }
  .pos7 { left: 101%; top: 58%; }
  .pos8 { left: 85%; top: 84%; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .table-wrap {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 5px;
  }

  .topbar .ghost:last-child,
  .sidebar.right {
    display: none;
  }

  .topbar {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .topbar {
    min-height: 46px;
  }

  .table-info {
    display: none;
  }

  .table-stage {
    min-height: 0;
    padding: clamp(20px, 3.4dvh, 34px) clamp(18px, 6vw, 28px) clamp(40px, 6.6dvh, 60px);
  }

  .table-felt {
    width: clamp(214px, 68vw, 326px);
    height: clamp(300px, 44dvh, 460px);
    border-radius: 48% / 50%;
  }

  .seat {
    width: clamp(82px, 26vw, 104px);
    min-height: clamp(58px, 11vh, 78px);
    grid-template-columns: clamp(28px, 8vw, 38px) minmax(0, 1fr);
  }

  .seat.empty {
    width: clamp(70px, 23vw, 96px);
    min-height: 34px;
  }

  .avatar,
  .player-portrait {
    width: clamp(28px, 8vw, 38px);
    height: clamp(38px, 11vw, 52px);
  }

  .seat-cards .card {
    width: clamp(19px, 6vw, 26px);
    height: clamp(28px, 8.5vw, 38px);
  }

  .board .card {
    width: clamp(32px, 10.6vw, 42px);
    height: clamp(46px, 15vw, 60px);
    font-size: clamp(13px, 3.8vw, 17px);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(24px, 7.4vw, 32px);
    height: clamp(35px, 10.5vw, 46px);
    font-size: clamp(10px, 3vw, 13px);
  }

  .community {
    top: 48%;
  }

  .board-row.single {
    grid-template-columns: repeat(3, max-content);
  }

  .board-row.multi {
    grid-template-columns: auto repeat(3, max-content);
  }

  .pos0 { left: 50%; top: 92%; }
  .pos1 { left: 7%; top: 90%; }
  .pos2 { left: -7%; top: 68%; }
  .pos3 { left: -5%; top: 40%; }
  .pos4 { left: 25%; top: 9%; }
  .pos5 { left: 75%; top: 9%; }
  .pos6 { left: 105%; top: 40%; }
  .pos7 { left: 107%; top: 68%; }
  .pos8 { left: 93%; top: 90%; }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(76px, 0.82fr);
    align-items: end;
    gap: 5px;
    padding: 5px 6px;
  }

  .stats div {
    gap: 1px;
  }

  .stats span {
    font-size: 9px;
  }

  .stats strong {
    font-size: 14px;
  }

  .stats .rebuy {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .stats .rebuy input {
    display: none;
  }

  .stats .rebuy button {
    min-height: 36px;
    padding-inline: 6px;
    font-size: 13px;
  }
}

@media (max-width: 340px) and (orientation: portrait) {
  .table-stage {
    padding: 16px 12px 34px;
  }

  .table-felt {
    width: 190px;
    height: clamp(248px, 42dvh, 316px);
  }

  .seat {
    width: 70px;
    min-height: 54px;
    grid-template-columns: 26px minmax(0, 1fr);
    font-size: 9px;
  }

  .seat.empty {
    width: 64px;
    min-height: 28px;
  }

  .avatar,
  .player-portrait {
    width: 26px;
    height: 34px;
  }

  .seat-cards {
    min-height: 24px;
  }

  .seat-cards .card {
    width: 16px;
    height: 24px;
    font-size: 8px;
  }

  .board .card {
    width: clamp(34px, 5.8vw, 44px);
    height: clamp(46px, 7.6vw, 60px);
    font-size: clamp(12px, 2.1vw, 15px);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(17px, 2.3vw, 21px);
    height: clamp(25px, 3.3vw, 30px);
    font-size: clamp(8px, 1.28vw, 10px);
  }

  .seat.pos0 {
    min-height: 44px;
  }

  .seat.pos0 .stack-badge,
  .seat.pos0 .last-action {
    bottom: -6px;
  }

  .last-action,
  .stack-badge {
    max-width: 54px;
    font-size: 8px;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 58px;
    padding: 4px;
  }

  .stats span {
    font-size: 9px;
  }

  .stats strong {
    font-size: 13px;
  }

  .stats .rebuy {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .stats .rebuy input {
    display: none;
  }

  .action-bar {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 4px;
    padding: 4px;
  }

  .amount-readout {
    height: 36px;
    font-size: 16px;
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 4px;
  }

  .quick {
    display: none;
  }

  .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .actions button {
    min-height: 36px;
    padding-inline: 2px;
    font-size: 11px;
  }

  .pos0 { left: 50%; top: 96%; }
  .pos1 { left: 5%; top: 89%; }
  .pos2 { left: -9%; top: 62%; }
  .pos3 { left: -8%; top: 37%; }
  .pos4 { left: 24%; top: 9%; }
  .pos5 { left: 76%; top: 9%; }
  .pos6 { left: 108%; top: 37%; }
  .pos7 { left: 109%; top: 62%; }
  .pos8 { left: 95%; top: 89%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .table-wrap {
    grid-template-rows: 40px minmax(0, 1fr) auto auto;
    gap: 4px;
    padding: 0 10px 6px;
  }

  .topbar .ghost:last-child,
  .sidebar.right {
    display: none;
  }

  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    min-height: 40px;
  }

  .table-info span:nth-child(n+4) {
    display: none;
  }

  .table-stage {
    padding: 30px clamp(52px, 9vw, 82px) 44px;
  }

  .table-felt {
    width: min(100%, 620px);
    height: clamp(150px, 42vh, 220px);
  }

  .community {
    gap: 5px;
  }

  .card {
    width: clamp(28px, 5vw, 38px);
    height: clamp(38px, 7vw, 52px);
    font-size: 12px;
  }

  .seat {
    width: clamp(74px, 12vw, 92px);
    min-height: 50px;
    grid-template-columns: 26px minmax(0, 1fr);
    font-size: 9px;
  }

  .seat.empty {
    width: clamp(64px, 11vw, 82px);
    min-height: 28px;
  }

  .avatar,
  .player-portrait {
    width: 26px;
    height: 34px;
  }

  .seat-cards {
    min-height: 28px;
  }

  .seat-cards .card {
    width: 16px;
    height: 24px;
    font-size: 8px;
  }

  .board .card {
    width: clamp(34px, 5.8vw, 44px);
    height: clamp(46px, 7.6vw, 60px);
    font-size: clamp(12px, 2.1vw, 15px);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(17px, 2.3vw, 21px);
    height: clamp(25px, 3.3vw, 30px);
    font-size: clamp(8px, 1.28vw, 10px);
  }

  .seat.pos0 {
    min-height: 44px;
  }

  .seat.pos0 .stack-badge,
  .seat.pos0 .last-action {
    bottom: -6px;
  }

  .last-action,
  .stack-badge {
    max-width: 62px;
    font-size: 8px;
  }

  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 6px;
  }

  .stats .rebuy {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr) 56px;
  }

  .stats input,
  .stats button {
    min-height: 30px;
    padding-inline: 6px;
    font-size: 11px;
  }

  .action-bar {
    grid-template-columns: 50px minmax(0, 1fr) minmax(150px, 0.9fr);
    gap: 6px;
    padding: 5px;
  }

  .amount-readout {
    height: 38px;
    font-size: 16px;
  }

  .action-clock {
    display: none;
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .quick {
    max-height: 30px;
  }

  .quick button {
    min-width: 46px;
    min-height: 26px;
  }

  .actions {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions button {
    min-height: 40px;
    font-size: 13px;
  }

  .pos0 { left: 50%; top: 74%; }
  .pos1 { left: 20%; top: 76%; }
  .pos2 { left: 3%; top: 48%; }
  .pos3 { left: 12%; top: 4%; }
  .pos4 { left: 32%; top: -5%; }
  .pos5 { left: 68%; top: -5%; }
  .pos6 { left: 88%; top: 4%; }
  .pos7 { left: 97%; top: 48%; }
  .pos8 { left: 80%; top: 76%; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .seat.pos0 {
    width: clamp(108px, 30vw, 122px);
    grid-template-columns: clamp(28px, 8vw, 36px) minmax(0, 1fr);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(28px, 8vw, 34px);
    height: clamp(40px, 11.5vw, 49px);
    font-size: clamp(11px, 3.2vw, 14px);
  }

  .quick button {
    min-height: 36px;
  }
}

@media (max-width: 520px) and (max-height: 800px) and (orientation: portrait) {
  .seat:not(.pos0) {
    width: clamp(80px, 23vw, 94px);
    min-height: 58px;
    grid-template-columns: clamp(27px, 7.5vw, 34px) minmax(0, 1fr);
  }

  .seat:not(.pos0) .avatar,
  .seat:not(.pos0) .player-portrait {
    width: clamp(27px, 7.5vw, 34px);
    height: clamp(38px, 10vw, 46px);
  }

  .pos1 { left: 10%; top: 94%; }
  .pos2 { left: -6%; top: 64%; }
  .pos7 { left: 106%; top: 64%; }
  .pos8 { left: 90%; top: 94%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .table-wrap {
    grid-template-rows: 36px minmax(0, 1fr) 40px 90px;
    gap: 3px;
    padding: 0 8px 4px;
  }

  .topbar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 36px;
    gap: 5px;
  }

  .topbar .ghost {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .table-info {
    gap: 4px;
  }

  .table-info span,
  .table-info strong {
    padding: 3px 6px;
    font-size: 9px;
  }

  .table-stage {
    padding: 20px clamp(48px, 8vw, 72px) 24px;
  }

  .table-felt {
    width: min(100%, 620px);
    height: clamp(126px, 34vh, 150px);
  }

  .community {
    top: 25%;
    gap: 4px;
  }

  .pot {
    min-width: 78px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .board {
    min-height: 0;
  }

  .board .card {
    width: clamp(36px, 5vw, 42px);
    height: clamp(50px, 6.5vw, 56px);
    font-size: 13px;
  }

  .seat {
    width: clamp(74px, 11vw, 86px);
    min-height: 44px;
    padding: 3px;
  }

  .seat.pos0 {
    width: clamp(110px, 15vw, 122px);
    min-height: 50px;
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .seat.pos0 .seat-cards .card {
    width: 27px;
    height: 39px;
    font-size: 11px;
  }

  .seat.pos0 .avatar,
  .seat.pos0 .player-portrait {
    width: 28px;
    height: 38px;
  }

  .stats {
    min-height: 40px;
    padding: 2px 5px;
  }

  .stats div {
    gap: 0;
  }

  .stats span {
    font-size: 8px;
  }

  .stats strong {
    font-size: 12px;
  }

  .stats input,
  .stats button {
    min-height: 36px;
  }

  .action-bar {
    min-height: 90px;
    padding: 4px;
  }

  .amount-readout {
    height: 42px;
  }

  .bet-tools {
    gap: 4px;
  }

  .quick {
    max-height: 36px;
  }

  .quick button {
    min-height: 36px;
  }

  .actions {
    gap: 4px;
  }

  .actions button {
    min-height: 36px;
  }

  .pos0 { left: 50%; top: 100%; }
  .pos1 { left: 20%; top: 96%; }
  .pos2 { left: 0%; top: 75%; }
  .pos3 { left: 5%; top: 10%; }
  .pos4 { left: 20%; top: -5%; }
  .pos5 { left: 80%; top: -5%; }
  .pos6 { left: 95%; top: 10%; }
  .pos7 { left: 100%; top: 75%; }
  .pos8 { left: 80%; top: 96%; }
}

/* Unified responsive table geometry. Keep this final so device-specific rules stay deterministic. */
@media (min-width: 1221px) and (max-width: 1499px) {
  .seat.pos0 {
    width: 172px;
  }

  .seat.pos0 .seat-cards .card {
    width: 40px;
    height: 56px;
    font-size: 14px;
  }
}

@media (min-width: 521px) and (max-width: 1220px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(148px, 0.9fr);
    align-items: center;
    gap: 6px;
    padding: 5px 7px;
  }

  .stats .rebuy {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .stats input,
  .stats button {
    min-height: 36px;
  }

  .action-bar {
    grid-template-columns: 54px minmax(0, 1fr) minmax(180px, 0.86fr);
    gap: 6px;
    padding: 6px;
  }

  .amount-readout {
    height: 48px;
    font-size: 19px;
  }

  .actions {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .actions button {
    min-height: 42px;
    font-size: 14px;
  }

  .seat.pos0 {
    width: clamp(132px, 19vw, 152px);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(32px, 4.2vw, 40px);
    height: clamp(46px, 5.9vw, 58px);
    font-size: clamp(11px, 1.7vw, 14px);
  }

  .board .card {
    width: clamp(44px, 5.2vw, 58px);
    height: clamp(62px, 7.2vw, 78px);
    font-size: clamp(15px, 2vw, 18px);
  }
}

@media (max-width: 1220px), (max-height: 520px) and (orientation: landscape) {
  .seat.pos0 .last-action {
    top: -9px;
    bottom: auto;
  }

  .seat.pos0 .stack-badge {
    top: auto;
    bottom: -6px;
  }
}

@media (min-width: 521px) and (max-width: 1024px) and (orientation: portrait) {
  .table-stage {
    padding: clamp(52px, 7dvh, 82px) clamp(54px, 8vw, 76px) clamp(64px, 8dvh, 94px);
  }

  .table-felt {
    width: min(74vw, 620px);
    height: clamp(470px, 58dvh, 660px);
    border-radius: 46% / 50%;
  }

  .seat {
    width: clamp(102px, 14vw, 116px);
    min-height: clamp(62px, 7dvh, 72px);
  }

  .seat.pos0 {
    width: clamp(140px, 20vw, 156px);
  }

  .community {
    top: 48%;
  }

  .pos0 { left: 50%; top: 94%; }
  .pos1 { left: 14%; top: 88%; }
  .pos2 { left: 0%; top: 65%; }
  .pos3 { left: 3%; top: 38%; }
  .pos4 { left: 25%; top: 7%; }
  .pos5 { left: 75%; top: 7%; }
  .pos6 { left: 97%; top: 38%; }
  .pos7 { left: 100%; top: 65%; }
  .pos8 { left: 86%; top: 88%; }
}

@media (min-width: 1025px) and (max-width: 1220px) {
  .table-stage {
    padding: 58px clamp(70px, 8vw, 96px) 72px;
  }

  .table-felt {
    width: min(100%, 860px);
    height: clamp(310px, 43dvh, 380px);
  }

  .seat {
    width: 118px;
    min-height: 72px;
  }

  .seat.pos0 {
    width: 154px;
  }

  .pos0 { left: 50%; top: 94%; }
  .pos1 { left: 17%; top: 87%; }
  .pos2 { left: 0%; top: 59%; }
  .pos3 { left: 8%; top: 15%; }
  .pos4 { left: 30%; top: -7%; }
  .pos5 { left: 70%; top: -7%; }
  .pos6 { left: 92%; top: 15%; }
  .pos7 { left: 100%; top: 59%; }
  .pos8 { left: 83%; top: 87%; }
}

@media (min-width: 521px) and (max-width: 1024px) and (min-height: 521px) and (orientation: landscape) {
  .table-stage {
    padding: 50px clamp(62px, 7vw, 78px) 66px;
  }

  .table-felt {
    width: min(100%, 800px);
    height: clamp(300px, 44dvh, 360px);
  }

  .pos0 { left: 50%; top: 94%; }
  .pos1 { left: 17%; top: 87%; }
  .pos2 { left: 0%; top: 59%; }
  .pos3 { left: 8%; top: 15%; }
  .pos4 { left: 30%; top: -7%; }
  .pos5 { left: 70%; top: -7%; }
  .pos6 { left: 92%; top: 15%; }
  .pos7 { left: 100%; top: 59%; }
  .pos8 { left: 83%; top: 87%; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .table-stage {
    padding: clamp(16px, 2.6dvh, 24px) clamp(18px, 5vw, 24px) clamp(30px, 4.5dvh, 42px);
  }

  .table-felt {
    width: clamp(230px, 72vw, 326px);
    height: clamp(340px, 48dvh, 460px);
  }

  .seat:not(.pos0) {
    width: clamp(80px, 23vw, 96px);
    min-height: clamp(56px, 8dvh, 68px);
    grid-template-columns: clamp(27px, 7.4vw, 34px) minmax(0, 1fr);
  }

  .seat:not(.pos0) .avatar,
  .seat:not(.pos0) .player-portrait {
    width: clamp(27px, 7.4vw, 34px);
    height: clamp(38px, 10vw, 46px);
  }

  .seat:not(.pos0) .seat-cards .card {
    width: clamp(19px, 5.4vw, 23px);
    height: clamp(28px, 7.8vw, 34px);
  }

  .seat.pos0 {
    width: clamp(112px, 31vw, 132px);
    min-height: clamp(64px, 9dvh, 76px);
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(30px, 8.5vw, 36px);
    height: clamp(43px, 12vw, 52px);
    font-size: clamp(12px, 3.4vw, 15px);
  }

  .pos0 { left: 50%; top: 93%; }
  .pos1 { left: 9%; top: 89%; }
  .pos2 { left: 0%; top: 66%; }
  .pos3 { left: 0%; top: 39%; }
  .pos4 { left: 25%; top: 8%; }
  .pos5 { left: 75%; top: 8%; }
  .pos6 { left: 100%; top: 39%; }
  .pos7 { left: 100%; top: 66%; }
  .pos8 { left: 91%; top: 89%; }
}

@media (max-width: 340px) and (orientation: portrait) {
  .table-felt {
    width: 230px;
    height: clamp(272px, 48dvh, 330px);
  }

  .seat:not(.pos0) {
    width: 72px;
    min-height: 50px;
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .seat:not(.pos0) .avatar,
  .seat:not(.pos0) .player-portrait {
    width: 24px;
    height: 32px;
  }

  .seat.pos0 {
    width: 102px;
    min-height: 58px;
  }

  .seat.pos0 .seat-cards .card {
    width: 26px;
    height: 38px;
    font-size: 11px;
  }

  .board .card {
    width: 34px;
    height: 48px;
    font-size: 12px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .table-stage {
    padding: 14px clamp(44px, 7vw, 64px) 20px;
  }

  .table-felt {
    width: min(100%, 720px);
    height: clamp(142px, 39dvh, 178px);
  }

  .community {
    top: 27%;
  }

  .seat {
    width: clamp(74px, 10vw, 90px);
    min-height: 46px;
  }

  .seat.pos0 {
    width: clamp(118px, 15vw, 132px);
    min-height: 54px;
  }

  .seat.pos0 .seat-cards .card {
    width: clamp(30px, 4vw, 34px);
    height: clamp(43px, 5.8vw, 48px);
    font-size: 12px;
  }

  .board .card {
    width: clamp(38px, 5vw, 46px);
    height: clamp(52px, 6.7vw, 62px);
    font-size: 14px;
  }

  .pos0 { left: 50%; top: 100%; }
  .pos1 { left: 20%; top: 96%; }
  .pos2 { left: 0%; top: 72%; }
  .pos3 { left: 7%; top: 8%; }
  .pos4 { left: 23%; top: -4%; }
  .pos5 { left: 77%; top: -4%; }
  .pos6 { left: 93%; top: 8%; }
  .pos7 { left: 100%; top: 72%; }
  .pos8 { left: 80%; top: 96%; }

  .actions button {
    min-height: 39px;
  }
}
