/* === Poker Master — Dark Theme === */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-top: #1e2530;
  --bg-bottom: #0f1319;
  --felt-inner: #14532d;
  --felt-mid: #052e16;
  --felt-outer: #021f0e;
  --rim-dark: #2e1e12;
  --rim-hi: rgba(255,255,255,0.15);
  --rim-shadow: rgba(0,0,0,0.6);
  --glass-bg: rgba(15, 23, 42, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg-solid: rgba(15, 23, 42, 0.75);
  --glass-border-solid: rgba(38, 55, 82, 0.8);
  --active-glow: #3b82f6;
  --amber: #f5b928;
  --blue-light: #6eb9ff;
  --gold: #daa520;
  --red: #dc323c;
  --emerald: #50c882;
  --text: #c8d4e4;
  --text-light: #7a8a9e;
  --text-white: #e8ecf0;
  --table-scale: 1.05;
}

html, body {
  font-family: 'Montserrat', 'SF Pro Display', -apple-system, 'PingFang SC', sans-serif;
  background: radial-gradient(circle at center, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

#app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 12px;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
}

/* Immersive fallback when Fullscreen API is unavailable (e.g. iPhone Safari) */
body.app-immersive {
  overflow: hidden;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

body.app-immersive #app {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: none;
  margin: 0;
  padding:
    max(8px, env(safe-area-inset-top, 0))
    max(12px, env(safe-area-inset-right, 0))
    max(8px, env(safe-area-inset-bottom, 0))
    max(12px, env(safe-area-inset-left, 0));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at center, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

.hidden { display: none !important; }

/* Hard-disable legacy rotate UI (cache-safe) */
#landscape-prompt,
#btn-force-landscape,
#btn-force-landscape-header,
#btn-exit-force-landscape {
  display: none !important;
}

/* ── Glass Panel ── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-radius: 14px;
}

.glass-panel-solid {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border-solid);
  border-radius: 10px;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--glass-border-solid);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 14px;
  text-align: center;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
}
.toast.error { border-color: rgba(220,50,60,0.6); color: #fca5a5; }
.toast.success { border-color: rgba(22,163,74,0.6); color: #86efac; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ── Buttons ── */
.btn {
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.btn::after {
  content: '';
  position: absolute;
  top: 3px; left: 4px; right: 4px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
}

.btn-green { background: #16784e; color: #fff; box-shadow: 1px 4px 0 rgba(8,10,14,0.6); }
.btn-green:hover { filter: brightness(1.15); }
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.btn-outline { background: rgba(15,23,42,0.6); color: var(--text); border: 1px solid var(--glass-border-solid); }
.btn-outline:hover { background: rgba(30,41,59,0.7); }

.btn-lg { width: 100%; padding: 14px; font-size: 17px; }

/* ── Input ── */
input, select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(38,55,82,0.8);
  border-radius: 10px;
  background: rgba(15,23,42,0.8);
  color: var(--text-white);
  font-size: 15px;
  outline: none;
}
input:focus, select:focus { border-color: var(--active-glow); }

/* ── Lobby ── */
.lobby-header {
  text-align: center;
  padding: 24px 0 16px;
}
.logo-text {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(to right, #6eb9ff, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 2px;
}
.logo-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: rgba(59,130,246,0.2);
  color: #6eb9ff;
  border: 1px solid rgba(59,130,246,0.3);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 2px;
  vertical-align: middle;
  margin-left: 6px;
}

.lobby-input-row {
  display: flex;
  gap: 8px;
  margin: 0 auto 10px;
  justify-content: flex-start;
  width: 100%;
  max-width: 560px;
}
.lobby-input-row input,
.lobby-input-row select {
  flex: 1;
  min-width: 0;
  max-width: none;
}
.btn-block {
  width: 100%;
  flex: 1 1 auto;
}

.lobby-room-hint {
  max-width: 560px;
  margin: -4px auto 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-light);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(38, 55, 82, 0.55);
  border-radius: 10px;
}
.lobby-room-hint strong {
  color: var(--blue-light);
  font-weight: 700;
}

.lobby-step-panel {
  max-width: 560px;
  margin: 0 auto 12px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.lobby-step-panel.hidden {
  display: none;
}

.lobby-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 600;
}
.lobby-step-indicator .step-dot {
  color: var(--emerald);
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(22, 120, 78, 0.2);
  border: 1px solid rgba(94, 234, 212, 0.25);
}
.lobby-step-indicator .step-dot.muted {
  color: var(--text-light);
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(38, 55, 82, 0.5);
}
.lobby-step-indicator .step-sep {
  width: 24px;
  height: 1px;
  background: rgba(38, 55, 82, 0.8);
}

.lobby-setup-toolbar {
  margin-bottom: 12px;
}
.lobby-room-toolbar {
  margin-bottom: 8px;
}
.lobby-back-btn {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
}
.lobby-setup-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin: 0 0 8px;
  text-align: center;
}
.lobby-starting-chips-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin: -6px 0 10px;
}

.chips-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15,23,42,0.85) 0%, rgba(10,15,30,0.9) 100%);
  border: 2px solid rgba(38, 55, 82, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}
.chips-option {
  min-height: 44px;
  border: 1px solid rgba(38,55,82,0.4);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.35);
  color: var(--text-light);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s;
}
.chips-option:hover {
  color: var(--text-white);
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(59,130,246,0.3);
}
.chips-option.active {
  color: #fff;
  background: linear-gradient(180deg, #b45309 0%, #92400e 100%);
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.chips-custom-row input {
  min-height: 44px;
  text-align: center;
  font-weight: 700;
}

.lobby-btn-row {
  max-width: 560px;
  margin: 12px auto 0;
  display: flex;
  gap: 10px;
}

.lobby-reconnect-section {
  max-width: 560px;
  margin: 16px auto 0;
  padding: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(38, 55, 82, 0.55);
  border-radius: 10px;
}
.lobby-reconnect-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.5;
}
.lobby-reconnect-row {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}
.lobby-reconnect-row input {
  flex: 1;
  min-width: 0;
}
.lobby-reconnect-row .btn {
  flex-shrink: 0;
}

.lobby-create-block {
  max-width: 560px;
  margin: 0 auto 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-count-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15,23,42,0.85) 0%, rgba(10,15,30,0.9) 100%);
  border: 2px solid rgba(38, 55, 82, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}
.count-option {
  min-height: 44px;
  border: 1px solid rgba(38,55,82,0.4);
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.35);
  color: var(--text-light);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  letter-spacing: 0.5px;
}
.count-option:hover {
  color: var(--text-white);
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(59,130,246,0.3);
}
.count-option.active {
  color: #fff;
  background: linear-gradient(180deg, #1d8f5c 0%, #16784e 100%);
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 4px 14px rgba(22, 120, 78, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}
.lobby-room-card {
  padding: 20px;
  margin-top: 16px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.room-id-label {
  font-size: 14px;
  color: var(--amber);
  text-align: center;
  font-weight: 700;
  margin-bottom: 12px;
}

.lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.lobby-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(38,55,82,0.5);
}
.lobby-player-name { font-weight: 600; color: var(--text-white); }
.lobby-player-chips { font-size: 13px; color: var(--emerald); font-weight: 600; }
.ai-badge {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--blue-light); padding: 2px 6px; border-radius: 4px;
}
.host-badge {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--gold); padding: 2px 6px; border-radius: 4px;
}
.replenish-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #7c3aed;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 3px;
  vertical-align: middle;
}

.lobby-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.lobby-actions .btn { flex: 1; }

.lobby-waiting-msg {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  font-style: italic;
  padding: 10px 0;
  margin-bottom: 12px;
}

/* ── Game Header ── */
.game-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
}
.logo-text-sm {
  font-size: 16px;
  font-weight: 900;
  background: linear-gradient(to right, #6eb9ff, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 1px;
}
.logo-badge-sm {
  font-size: 9px;
  font-weight: 700;
  background: rgba(59,130,246,0.2);
  color: #6eb9ff;
  border: 1px solid rgba(59,130,246,0.3);
  padding: 1px 5px;
  border-radius: 12px;
  letter-spacing: 1px;
}
.round-label { font-size: 12px; color: var(--text-light); }
.stage-badge {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #5eead4;
  text-transform: uppercase;
  letter-spacing: 1px;
  transform: translate(8px, 5px);
}

/* ── Game view: table → hero → actions (no overlap) ── */
#view-game.view-game {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: calc(100dvh - 16px);
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow: visible;
}

/* ── Game Area ── */
.game-area {
  width: 100%;
  position: relative;
  overflow: visible;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 4px;
}

.hand-counter {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 30;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: #99f6e4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.table-wrapper {
  position: relative;
  width: 100%;
  min-height: 42vh;
  padding: 32px 0 6px;
  overflow: visible;
}

/* ── Poker Table (竖向椭圆，略缩小留出 hero / 操作区) ── */
.poker-table-outer {
  position: relative;
  width: calc(62% * var(--table-scale));
  max-width: calc(300px * var(--table-scale));
  aspect-ratio: 11 / 18;
  margin: 0 auto;
  border: 10px solid #1a2838;
  border-radius: 50% / 42%;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 3px 8px rgba(255, 255, 255, 0.12),
    inset 0 -6px 14px rgba(0, 0, 0, 0.65);
  margin-top: 1vh;
}

.poker-table-rim {
  position: absolute;
  inset: 0;
  border-radius: 50% / 42%;
  overflow: hidden;
}

.poker-table-felt {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse 70% 55% at 50% 42%, #1a6b5c 0%, #0f4a42 45%, #0a2e2a 75%, #061a18 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Decorative felt rings */
.felt-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.ring-outer {
  inset: 20px;
  border: 1px solid rgba(52, 211, 153, 0.1);
}
.ring-inner {
  inset: 50px;
  border: 1px solid rgba(52, 211, 153, 0.05);
}

/* ── Pot ── */
.pot-display {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  text-align: center;
}
.pot-label {
  font-size: 10px;
  color: #5eead4;
  opacity: 0.65;
  letter-spacing: 1.5px;
  font-weight: 800;
  text-transform: uppercase;
}
.pot-value {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* ── Community Cards ── */
.community-cards {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -80%);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
  z-index: 5;
  justify-content: center;
  align-items: center;
}
.community-slot {
  width: 40px;
  height: 56px;
  border: 2px dashed rgba(52,211,153,0.2);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(52,211,153,0.2);
}

/* ── Action Message ── */
.action-message {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 32, 22, 0.85);
  border: 1px solid rgba(52, 153, 80, 0.2);
  border-radius: 14px;
  padding: 4px 14px;
  color: #b9dcc3;
  font-size: 12px;
  z-index: 5;
  white-space: nowrap;
}

/* ── Dealer Chip ── */
.dealer-chip {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #fef08a 0%, #eab308 70%, #ca8a04 100%);
  box-shadow: 0 3px 5px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  color: #321904;
  z-index: 35;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ── Bet Chips ── */
.bet-chips-container { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.bet-chip {
  position: absolute;
  padding: 2px 6px;
  background: #372805;
  border: 1.5px solid #c39619;
  border-radius: 10px;
  color: #ffeb50;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 1px 2px 0 rgba(0,0,0,0.45);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

/* ── Cards ── */
.card-face {
  width: 40px;
  height: 56px;
  background: #fcfcfc;
  border: 1px solid #d2d2d7;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  padding: 2px 3px;
  flex-shrink: 0;
}
/* Gloss stripe */
.card-face::before {
  content: '';
  position: absolute;
  top: 2px; left: 3px; right: 3px;
  height: 6px;
  background: rgba(255,255,255,0.5);
  border-radius: 3px;
  z-index: 2;
}
.card-face .card-rank { font-size: 13px; z-index: 1; line-height: 1; }
.card-face .card-suit-small { font-size: 10px; z-index: 1; line-height: 1; }
.card-face .card-center-suit {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  z-index: 1;
  line-height: 1;
}
.card-face.red { color: #dc323c; }
.card-face.black { color: #1e293b; }

/* Hero cards (larger) */
.card-face.hero-card {
  width: 50px;
  height: 70px;
}
.card-face.hero-card .card-rank { font-size: 16px; }
.card-face.hero-card .card-suit-small { font-size: 12px; }
.card-face.hero-card .card-center-suit { font-size: 28px; }

/* Face-down card */
.card-face.face-down {
  background: linear-gradient(135deg, #1c1855 0%, #0f1632 100%);
  border: 2px solid #4852c3;
  color: transparent;
  overflow: hidden;
}
.card-face.face-down::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(72,82,195,0.2) 4px, rgba(72,82,195,0.2) 5px),
    repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(72,82,195,0.2) 4px, rgba(72,82,195,0.2) 5px),
    #0f1632;
}

/* Fold overlay */
.fold-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,20,30,0.7);
  border-radius: 7px;
  z-index: 3;
}
.fold-overlay::before, .fold-overlay::after {
  content: '';
  position: absolute;
  width: 55%;
  height: 2px;
  background: #8c949c;
  top: 50%; left: 50%;
}
.fold-overlay::before { transform: translate(-50%, -50%) rotate(45deg); }
.fold-overlay::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ── Seats ── */
.seats-container {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  transform: translate(calc(-50% + var(--seat-ox, 0px)), calc(-50% + var(--seat-oy, 0px)));
  transition: all 0.3s;
  z-index: 20;
}
/* All non-hero seats: vertical col — timer above hand, info below hand */

.seat-info {
  padding: 5px 10px;
  text-align: center;
  min-width: 80px;
  position: relative;
}
.seat-info .model-badge {
  margin-bottom: 2px;
}
.seat-position {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.seat-position.amber { color: var(--amber); }
.seat-position.blue { color: var(--blue-light); }
.seat-position.gray { color: var(--text-light); }
.seat-divider { height: 1px; background: rgba(38,55,82,0.6); margin: 2px 0; }
.seat-chips { font-size: 12px; font-weight: 700; color: var(--emerald); }
.seat-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-white);
}
.seat-hand {
  display: flex;
  gap: 3px;
  position: relative;
}
.seat-hand.folded .card-face { opacity: 0.5; }

/* Dense tables — keep hands / info / chips from overlapping */
.seats-dense-6 .seat .card-face:not(.hero-card) {
  width: 34px;
  height: 48px;
}
.seats-dense-6 .seat-info {
  min-width: 66px;
  max-width: 78px;
  padding: 3px 6px;
}
.seats-dense-6 .model-badge {
  font-size: 9px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seats-dense-6 .seat-chips { font-size: 11px; }

.seats-dense-8 .seat .card-face:not(.hero-card) {
  width: 30px;
  height: 42px;
}
.seats-dense-8 .seat .card-face:not(.hero-card) .card-rank { font-size: 10px; }
.seats-dense-8 .seat .card-face:not(.hero-card) .card-center-suit { font-size: 16px; }
.seats-dense-8 .seat-info {
  min-width: 58px;
  max-width: 70px;
  padding: 2px 5px;
}
.seats-dense-8 .model-badge {
  font-size: 8px;
  padding: 1px 5px;
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seats-dense-8 .seat-position { font-size: 8px; letter-spacing: 0.5px; }
.seats-dense-8 .seat-chips { font-size: 10px; }
.seats-dense-8 .seat-timer-badge { font-size: 9px; padding: 2px 6px; }
.seats-dense-8 .all-in-badge { font-size: 8px; }

/* Active glow */
.seat.is-turn .seat-info {
  border: 2px solid var(--active-glow);
  box-shadow: 0 0 12px rgba(59,130,246,0.4);
}

.seat--top .card-face:not(.hero-card) {
  width: 34px;
  height: 48px;
}
.seat--top .card-face:not(.hero-card) .card-rank { font-size: 11px; }
.seat--top .card-face:not(.hero-card) .card-center-suit { font-size: 18px; }

/* Seat timer badge — countdown on each player's seat */
.seat-timer-badge {
  background: rgba(59, 130, 246, 0.9);
  border: 1.5px solid rgba(96, 165, 250, 0.7);
  color: #eff6ff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  text-align: center;
  letter-spacing: 0.5px;
  animation: timer-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.seat--top .seat-info {
  min-width: 68px;
  padding: 3px 6px;
}

/* All-in badge */
.all-in-badge {
  color: var(--red);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Model Badge ── */
.model-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(38,55,82,0.9);
  text-align: center;
}
.model-badge.human { color: var(--gold); border-color: rgba(218,165,32,0.4); }
.model-badge.ai { color: var(--blue-light); }
.model-badge.ai-takeover { color: var(--amber); border-color: rgba(245,185,40,0.5); }

/* ── Hero Area（紧贴桌缘下方） ── */
.hero-area {
  position: relative;
  flex-shrink: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 2px 12px 2px;
  margin-top: -22px;
  pointer-events: auto;
}
.hero-timer-badge {
  margin-bottom: 0;
  flex-shrink: 0;
}
.hero-hand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 420px;
}
.hero-hand {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.hero-win-badge {
  min-width: 40px;
  padding: 5px 6px;
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.85);
  border: 1px solid rgba(94, 234, 212, 0.5);
  color: #ccfbf1;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}
.hero-win-badge::before {
  content: '胜率';
  display: block;
  font-size: 8px;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 1px;
}
.hero-hand-type-badge {
  max-width: 88px;
  padding: 5px 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  flex-shrink: 0;
  white-space: nowrap;
}

.hero-seat-info {
  min-width: 72px;
  pointer-events: auto;
  flex-shrink: 0;
}
.hero-seat-info.is-turn {
  border: 2px solid var(--active-glow);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

/* ── Hero interactions (voice + props) ── */
.hero-interactions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 420px;
  padding: 2px 4px 0;
}

.hero-info-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.interaction-btn {
  min-height: 30px;
  padding: 3px 7px;
  border-radius: 9px;
  border: 1px solid rgba(38, 55, 82, 0.75);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text-white);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}

.interaction-btn:active {
  transform: scale(0.96);
}

.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(94, 234, 212, 0.45);
  color: #99f6e4;
}

.voice-btn-icon {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 10px;
  flex-shrink: 0;
}

.voice-btn-icon i {
  font-size: 18px;
}

.voice-btn.voice-unavailable {
  opacity: 0.55;
  border-color: rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  cursor: not-allowed;
}

.voice-btn.is-recording {
  background: rgba(185, 28, 28, 0.55);
  border-color: rgba(248, 113, 113, 0.7);
  color: #fecaca;
  animation: voicePulse 0.8s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}

.interaction-presets {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.interaction-props {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.preset-btn {
  min-width: 38px;
  min-height: 26px;
  padding: 2px 4px;
  font-size: 9px;
}

.prop-btn {
  font-size: 17px;
  line-height: 1;
  min-width: 36px;
  min-height: 34px;
  padding: 3px 6px;
}

.interaction-fx-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

.prop-flyer {
  position: absolute;
  left: var(--from-x);
  top: var(--from-y);
  font-size: 28px;
  transform: translate(-50%, -50%);
  animation: propFly 0.75s cubic-bezier(0.22, 0.85, 0.35, 1) forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  z-index: 41;
}

@keyframes propFly {
  to {
    left: var(--to-x);
    top: var(--to-y);
  }
}

.prop-burst {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.2);
  font-size: 36px;
  opacity: 0;
  animation: propBurst 0.55s ease-out 0.65s forwards;
  z-index: 42;
}

@keyframes propBurst {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  35% { transform: translate(-50%, -50%) scale(1.35); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

.fireworks-burst { animation-duration: 0.8s; font-size: 42px; }
.bomb-burst { animation-duration: 0.45s; }

.interaction-toast {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  max-width: min(92%, 360px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: #ccfbf1;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

/* ── Action Zone（文档流底部，不遮挡 Hero 手牌） ── */
.action-zone {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  z-index: 30;
  padding: 4px 8px max(8px, env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(to top, rgba(2, 8, 23, 0.92) 70%, rgba(2, 8, 23, 0));
  border-top: 1px solid rgba(38, 55, 82, 0.35);
  /* Ensure slider-panel is never clipped by viewport */
  overflow: visible;
}

.action-zone--waiting {
  padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0));
}

.action-waiting-hint {
  margin: 0;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.3px;
}

.action-panel {
  padding: 6px 10px;
}

.action-buttons {
  display: flex;
  gap: 4px;
}

.action-btn {
  min-height: 34px;
  flex: 1;
  padding: 6px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: all 0.2s;
}
.action-btn .btn-icon,
.action-btn .btn-label,
.action-btn .btn-sub {
  position: relative;
  z-index: 1;
}
.action-btn.fold::before,
.action-btn.check::before,
.action-btn.call::before,
.action-btn.all-in::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  right: 6px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
.action-btn .btn-icon { font-size: 12px; }
.action-btn .btn-label { font-size: 10px; letter-spacing: 1px; }
.action-btn .btn-sub { font-size: 7px; opacity: 0.6; }

.action-btn.fold {
  background: linear-gradient(to bottom, rgba(127,29,38,0.8), rgba(127,29,38,0.4));
  border: 1px solid rgba(153,27,27,0.4);
  box-shadow: 1px 4px 0 rgba(8,10,14,0.6);
}
.action-btn.check, .action-btn.call {
  background: linear-gradient(to bottom, rgba(22,120,78,0.8), rgba(22,120,78,0.4));
  border: 1px solid rgba(21,128,61,0.4);
  box-shadow: 1px 4px 0 rgba(8,10,14,0.6);
}
.action-btn.raise {
  background: linear-gradient(to bottom, rgba(35,80,170,0.8), rgba(35,80,170,0.4));
  border: 1px solid rgba(30,64,175,0.4);
  box-shadow: 1px 4px 0 rgba(8,10,14,0.6);
}
.action-btn.all-in {
  background: linear-gradient(to bottom, rgba(145,105,28,0.8), rgba(145,105,28,0.4));
  border: 1px solid rgba(161,98,7,0.4);
  box-shadow: 1px 4px 0 rgba(8,10,14,0.6);
}
.action-btn:hover { filter: brightness(1.15); transform: translateY(-2px); }
.action-btn:active { transform: translateY(0); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; transform: none; pointer-events: none; }

/* ── Raise Slider（紧凑细轨） ── */
#slider-panel.action-panel {
  padding: 2px 8px 3px;
}

.raise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1px;
  line-height: 1.1;
}
.raise-label { font-size: 9px; color: var(--text-light); font-weight: 600; }
.raise-value { font-size: 10px; color: var(--active-glow); font-weight: 700; font-family: monospace; }

.raise-slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  outline: none;
  margin: 0;
  padding: 0;
  border: none;
  cursor: pointer;
}
.raise-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: #334155;
}
.raise-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--active-glow);
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(59, 130, 246, 0.55);
}
.raise-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #334155;
  border: none;
}
.raise-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--active-glow);
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(59, 130, 246, 0.55);
}

.raise-presets {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}
.raise-presets .btn {
  min-height: 20px;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: 700;
  flex: 1;
}

/* ── Showdown ── */
.showdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
}

.result-card {
  padding: 16px;
  text-align: center;
  margin: 8px 0;
  border: 2px solid var(--amber);
}
.result-text { font-size: 18px; font-weight: 900; color: var(--amber); }

.showdown-layout {
  margin: 8px 0;
}
.showdown-seats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.showdown-seat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-changes-card {
  padding: 12px 16px;
  margin: 8px 0;
}
.chip-changes-card h3 { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.chip-change-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13px;
}
.chip-change-row .delta-pos { color: var(--emerald); font-weight: 700; }
.chip-change-row .delta-neg { color: #fca5a5; font-weight: 700; }

.showdown-actions { padding: 8px 0; }

.match-over-info {
  padding: 16px;
  text-align: center;
  border: 2px solid var(--gold);
  margin-top: 8px;
}
.match-over-info h3 { color: var(--gold); font-size: 16px; }
.match-over-info .ranking {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 13px;
}

/* ── Score History Overlay ── */
.score-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.score-overlay-panel {
  background: rgba(15,23,42,0.95);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.score-table-wrap {
  overflow-x: auto;
}
.score-overlay-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
}
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.score-table th {
  color: var(--blue-light);
  font-weight: 700;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(38,55,82,0.6);
  text-align: center;
}
.score-table td {
  padding: 5px 4px;
  text-align: center;
  color: var(--text);
}
.score-table td.pos { color: var(--emerald); }
.score-table td.neg { color: #fca5a5; }
.score-close-btn {
  display: block;
  margin: 12px auto 0;
  min-height: 40px;
  padding: 10px 24px;
  background: rgba(50,55,70,0.8);
  border: 1px solid var(--glass-border-solid);
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

/* ── Fullscreen Button ── */
.fullscreen-btn {
  margin-left: auto;
  padding: 6px 10px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(38,55,82,0.8);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.fullscreen-btn:hover { background: rgba(30,41,59,0.8); color: var(--blue-light); }

/* ── Fullscreen Tap Overlay ── */
.fullscreen-tap {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(10, 14, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.fullscreen-tap-inner {
  text-align: center;
  color: var(--text);
  animation: fullscreenPulse 1.5s ease-in-out infinite;
}
.fullscreen-tap-inner i {
  font-size: 36px;
  color: var(--blue-light);
  display: block;
  margin-bottom: 12px;
}
.fullscreen-tap-inner span {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
}
@keyframes fullscreenPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ── Leave Button (in header) ── */
.leave-btn {
  padding: 4px 10px;
  background: rgba(127,29,38,0.4);
  border: 1px solid rgba(153,27,27,0.4);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 4px;
}
.leave-btn:hover { background: rgba(127,29,38,0.7); }

.btn-leave {
  min-height: 40px;
  font-size: 13px;
  margin-bottom: 8px;
}

/* ── Score Button (in header) ── */
.score-btn {
  padding: 4px 10px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(38,55,82,0.8);
  border-radius: 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 4px;
}
.score-btn:hover { background: rgba(15,23,42,0.9); }

/* ── Small screens (400px and below) ── */
@media (max-width: 400px) {
  .poker-table-outer { width: calc(72% * var(--table-scale)); max-width: calc(256px * var(--table-scale)); aspect-ratio: 11 / 19; border-width: 8px; margin-top: 1vh; }
  .table-wrapper { padding-bottom: 8px; min-height: 44vh; }
  .hero-area { margin-top: -20px; }
  .hand-counter { font-size: 11px; padding: 3px 8px; }
  .hero-win-badge { min-width: 38px; font-size: 10px; padding: 4px 6px; }
  .card-face { width: 30px; height: 42px; }
  .card-face .card-rank { font-size: 10px; }
  .card-face .card-center-suit { font-size: 15px; }
  .card-face.hero-card { width: 40px; height: 56px; }
  .card-face.hero-card .card-rank { font-size: 12px; }
  .card-face.hero-card .card-center-suit { font-size: 20px; }
  .seat-info { min-width: 54px; padding: 2px 4px; }
  .pot-value { font-size: 15px; }
  .community-slot { width: 30px; height: 42px; }
  .lobby-input-row { gap: 6px; margin-bottom: 8px; }
  #btn-join, #btn-create { width: 104px; flex-basis: 104px; }
}

@media (min-width: 480px) {
  .poker-table-outer { width: calc(66% * var(--table-scale)); max-width: calc(304px * var(--table-scale)); }
  .card-face { width: 36px; height: 50px; }
  .community-slot { width: 36px; height: 50px; }
  .card-face.hero-card { width: 44px; height: 62px; }
}

@media (min-width: 640px) {
  .poker-table-outer { width: calc(58% * var(--table-scale)); max-width: calc(320px * var(--table-scale)); }
  .action-zone {
    flex-direction: row;
    max-width: 800px;
    left: 50%;
    transform: translateX(-50%);
  }
  #slider-panel { flex: 1; }
  #buttons-panel { flex: 2; }
  #turn-timer-panel { flex: 1; }
}

/* ── Mobile 480px and below ── */
@media (max-width: 480px) {
  #app { padding: 4px 6px; }
  .poker-table-outer { width: calc(62% * var(--table-scale)); max-width: calc(240px * var(--table-scale)); border-width: 10px; border-radius: 200px; margin-top: 4vh; }
  .poker-table-rim { border-radius: 188px; }
  .card-face { width: 32px; height: 44px; }
  .card-face .card-rank { font-size: 11px; }
  .card-face .card-center-suit { font-size: 16px; }
  .card-face.hero-card { width: 42px; height: 58px; }
  .card-face.hero-card .card-rank { font-size: 13px; }
  .card-face.hero-card .card-center-suit { font-size: 22px; }
  .community-slot { width: 32px; height: 44px; }
  .seat-info { min-width: 56px; padding: 2px 5px; }
  .showdown-seat { gap: 6px; }
  .seat-name { font-size: 10px; }
}

/* ── Landscape on phones (short height) — compact vertical table ── */
@media (max-height: 500px) and (orientation: landscape) {
  #app { padding: 2px 6px; min-height: 100vh; min-height: 100dvh; }
  .game-header { padding: 2px 4px; }
  .logo-text-sm { font-size: 13px; }
  .logo-badge-sm { font-size: 7px; padding: 1px 4px; }
  .round-label, .stage-badge { font-size: 13px; }
  .fullscreen-btn { padding: 4px 8px; font-size: 12px; }

  .game-stats-strip {
    padding: 3px 8px;
    border-radius: 10px;
    margin: 2px 0;
  }
  .stat-label { font-size: 8px; }
  .stat-value { font-size: 11px; }

  /* Use horizontal table for landscape phones */
  .poker-table-outer { width: calc(70% * var(--table-scale)); max-width: calc(608px * var(--table-scale)); aspect-ratio: 21 / 10; border-width: 6px; border-radius: 220px; margin-top: 4px; }
  .poker-table-rim { border-radius: 208px; }
  .pot-value { font-size: 17px; }
  .pot-label { font-size: 9px; }
  .pot-display { top: 26%; }
  .community-cards { top: 50%; transform: translate(-50%, -80%); }
  .action-message { bottom: 15%; }

  .card-face { width: 30px; height: 42px; }
  .card-face .card-rank { font-size: 10px; }
  .card-face .card-suit-small { font-size: 8px; }
  .card-face .card-center-suit { font-size: 16px; }
  .card-face.hero-card { width: 40px; height: 56px; }
  .card-face.hero-card .card-rank { font-size: 13px; }
  .card-face.hero-card .card-center-suit { font-size: 22px; }
  .community-slot { width: 30px; height: 42px; }

  .seat-info { min-width: 56px; padding: 2px 5px; font-size: 10px; }
  .seat-position { font-size: 8px; }
  .seat-chips { font-size: 10px; }
  .model-badge { font-size: 8px; padding: 1px 5px; }

  .hero-area { gap: 2px; padding: 2px 0; margin-top: -18px; }
  .hero-hand { gap: 5px; }

  .action-zone { padding: 2px 6px 4px; gap: 2px; }
  .action-panel { padding: 4px 8px; }
  .action-btn { min-height: 30px; padding: 4px 4px; }
  .action-btn .btn-icon { font-size: 11px; }
  .action-btn .btn-label { font-size: 9px; }
  .action-btn .btn-sub { font-size: 6px; }
  .turn-timer-top { font-size: 10px; margin-bottom: 4px; }
  .turn-timer-bar { height: 5px; }
  .raise-presets .btn { min-height: 24px; padding: 3px 6px; font-size: 9px; }
}