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

:root {
  --bg-deep: #0a1628;
  --bg-panel: rgba(12, 28, 52, 0.92);
  --bg-panel-light: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --gold: #ffc947;
  --gold-dark: #e6a800;
  --gem: #5ecbff;
  --text-muted: #8fa3bf;
  --accent: #ff9f1c;
  --green: #2ecc71;
  --radius: 14px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(46, 90, 160, 0.35), transparent),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(255, 159, 28, 0.12), transparent),
    linear-gradient(135deg, #071018 0%, #0f2744 45%, #091525 100%);
  color: #fff;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.page {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.page.active { display: flex; flex-direction: column; }

/* ========== 登录页 ========== */
.page-login.active {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-layout {
  display: flex;
  align-items: stretch;
  gap: 48px;
  max-width: 920px;
  width: 100%;
}

.login-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
}

.brand-logo {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 24px rgba(255, 201, 71, 0.3));
}

.login-brand h1 {
  font-size: 2.4rem;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #fff, #ffc947);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 28px;
}

.brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-features li {
  padding: 10px 16px;
  background: var(--bg-panel-light);
  border-radius: 10px;
  border-left: 3px solid var(--gold);
  color: #c8d6e8;
  font-size: 0.95rem;
}

.login-card {
  width: 360px;
  flex-shrink: 0;
  padding: 36px 32px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.login-card h2 {
  font-size: 1.35rem;
  margin-bottom: 24px;
  text-align: center;
}

.login-error {
  margin: -8px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.login-error.hidden {
  display: none;
}

.login-error.is-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(74, 222, 128, 0.4);
  color: #86efac;
}

input {
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus { border-color: var(--gold); }

.btn {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.12s, filter 0.12s;
  font-weight: 600;
}

.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; margin-bottom: 10px; }
.btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #1a1200;
}
.btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #dce6f2;
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid var(--border);
}
.btn.small {
  padding: 6px 14px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.btn-match-lg {
  padding: 14px 36px;
  font-size: 1.05rem;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(255, 159, 28, 0.35);
}
.hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; text-align: center; }

/* ========== 横屏大厅 ========== */
.page-lobby.active {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lobby-header {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-logo { font-size: 28px; }

.lobby-brand strong { font-size: 1.05rem; display: block; }
.lobby-version {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.lobby-header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.lobby-header-actions { display: flex; gap: 8px; }

.lobby-body {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: clamp(200px, 18vw, 280px) minmax(0, 1fr) clamp(180px, 16vw, 260px);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(8px, 1.2vw, 16px);
  padding: clamp(8px, 1.2vw, 16px);
  min-height: 0;
  overflow: hidden;
}

.lobby-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  height: auto;
}

.lobby-body > .lobby-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lobby-profile {
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 1.5vw, 18px);
  gap: clamp(10px, 1.2vh, 14px);
  min-height: 0;
  overflow: hidden;
  flex: 1 1 0;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3d6cb9, #1e3a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: bold;
  border: 2px solid rgba(255, 201, 71, 0.5);
  flex-shrink: 0;
}

.profile-main h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.profile-level {
  color: var(--gold);
  font-size: 0.85rem;
  margin: 0;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.profile-vip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a1200;
  background: linear-gradient(135deg, #ffd700, #ff9f1a);
  border: 1px solid rgba(255, 215, 0, 0.45);
  box-shadow: 0 0 10px rgba(255, 180, 40, 0.25);
}

.profile-vip.hidden {
  display: none;
}

.profile-wallet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.wallet-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-panel-light);
  border-radius: 10px;
}

.wallet-label { font-size: 12px; color: var(--text-muted); }
.wallet-value { font-size: 1.05rem; font-weight: 700; }
.wallet-value.gold { color: var(--gold); }
.wallet-value.gem { color: var(--gem); }
.wallet-value.points { color: #38bdf8; }

.stats-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.stats-tab {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.stats-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
}
.stats-points-note {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: #38bdf8;
  margin-bottom: 8px;
}
.leaderboard-list {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 14px;
}
.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.leaderboard-list em {
  color: #38bdf8;
  font-style: normal;
}

.profile-notice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0;
  min-height: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.profile-notice .section-label {
  flex-shrink: 0;
}

.profile-notice .announce-box {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.stats-modal-box {
  width: min(480px, 94vw);
  min-width: 0;
  max-width: 94vw;
  max-height: min(560px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(16px, 3vh, 28px);
  text-align: left;
}

.stats-modal-box h3 {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: clamp(10px, 2vh, 16px);
  font-size: clamp(1rem, 2.5vh, 1.25rem);
}

.stats-total {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  flex-wrap: nowrap;
  padding: clamp(10px, 2vh, 14px);
  margin-bottom: clamp(10px, 2vh, 16px);
  background: var(--bg-panel-light);
  border-radius: 12px;
}

.stats-total-item {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

.stats-total-item strong {
  display: block;
  font-size: clamp(1.1rem, 3vh, 1.4rem);
  margin-bottom: 4px;
}

.stats-total-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.stats-game-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 240px;
  overflow-y: auto;
}

.stats-section-label {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stats-record-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
  max-height: none;
  margin-bottom: clamp(12px, 2vh, 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.stats-record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-panel-light);
  border-radius: 10px;
  font-size: 13px;
}

.stats-record-label em {
  font-style: normal;
  font-weight: 700;
}

.stats-record-amount.win { color: #6ee7a8; }
.stats-record-amount.loss { color: #ff8a8a; }
.stats-record-amount.draw { color: var(--text-muted); }

.stats-record-label {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.stats-record-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.stats-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 12px;
  font-size: 13px;
}

.stats-game-row {
  display: grid;
  grid-template-columns: 1fr repeat(3, 56px);
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-panel-light);
  border-radius: 10px;
}

.stats-game-name {
  font-weight: 600;
  font-size: 14px;
}

.stats-game-num {
  text-align: center;
  font-size: 13px;
}

.stats-game-num em {
  display: block;
  font-style: normal;
  font-size: 16px;
  font-weight: 700;
}

.stats-game-num small {
  color: var(--text-muted);
  font-size: 10px;
}

.stats-modal-box .btn {
  flex-shrink: 0;
  width: 100%;
}

.feature-modal-box {
  width: min(420px, 94vw);
  max-height: min(520px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(20px, 4vh, 32px);
  overflow: hidden;
}

.feature-modal-box.feature-modal-box--shop {
  --shop-w: clamp(240px, 68vmin, 360px);
  --shop-pad-x: clamp(10px, 3vmin, 18px);
  --shop-pad-y: clamp(8px, 2.2vmin, 16px);
  --shop-gap: clamp(6px, 1.8vmin, 10px);
  --shop-item-pad: clamp(6px, 1.6vmin, 12px);
  --shop-font: clamp(11px, 2.8vmin, 14px);
  --shop-font-sm: clamp(10px, 2.4vmin, 12px);
  --shop-title: clamp(0.92rem, 3.2vmin, 1.1rem);
  --shop-icon: clamp(1.4rem, 5vmin, 2rem);
  --shop-btn-pad-y: clamp(6px, 1.8vmin, 10px);
  --shop-btn-font: clamp(11px, 2.6vmin, 13px);
  --shop-section-gap: clamp(8px, 2.2vmin, 14px);
  --shop-body-max: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - clamp(16px, 4vmin, 28px)));

  width: min(var(--shop-w), 92vw);
  max-width: 100%;
  max-height: var(--shop-body-max);
  padding: var(--shop-pad-y) var(--shop-pad-x) calc(var(--shop-pad-y) - 2px);
  box-sizing: border-box;
}

.feature-modal-box.feature-modal-box--shop .feature-modal-icon {
  font-size: var(--shop-icon);
  margin-bottom: clamp(2px, 1vmin, 6px);
}

.feature-modal-box.feature-modal-box--shop h3 {
  font-size: var(--shop-title);
  margin-bottom: clamp(6px, 1.6vmin, 10px);
}

.feature-modal-box.feature-modal-box--shop .feature-modal-body {
  padding-right: 2px;
  padding-bottom: clamp(4px, 1.2vmin, 8px);
  margin-bottom: clamp(8px, 2vmin, 12px);
  font-size: var(--shop-font);
  line-height: 1.5;
}

.feature-modal-box.feature-modal-box--shop #btn-close-feature {
  flex-shrink: 0;
  width: 100%;
  margin-top: clamp(2px, 0.8vmin, 4px);
  padding: var(--shop-btn-pad-y) clamp(10px, 2.8vmin, 14px);
  font-size: var(--shop-btn-font);
}

.feature-modal-icon {
  font-size: clamp(2rem, 6vh, 2.75rem);
  line-height: 1;
  margin-bottom: 12px;
}

.feature-modal-box h3 {
  font-size: clamp(1.05rem, 2.5vh, 1.3rem);
  margin-bottom: 14px;
}

.feature-modal-body {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  text-align: left;
  color: #c5d4e8;
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 18px;
}

.feature-soon {
  text-align: center;
  color: var(--text-muted);
  padding: 8px 4px 4px;
}

.feature-help-block + .feature-help-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.feature-help-block h4 {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 6px;
}

.feature-help-block p {
  font-size: 13px;
  color: var(--text-muted);
}

.feature-settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-panel-light);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.feature-settings-row span {
  font-size: 14px;
}

.feature-settings-row em {
  font-size: 12px;
  color: var(--text-muted);
  font-style: normal;
}

.lobby-games {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
}

/* 游戏大类首页 */
.games-home {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 2vw, 24px);
  min-height: 0;
}

.games-home-head {
  flex-shrink: 0;
  margin-bottom: clamp(10px, 1.5vh, 18px);
}

.games-home-head h2 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.games-home-head p {
  font-size: 13px;
  color: var(--text-muted);
}

.games-grid {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(10px, 1.5vw, 16px);
  align-items: stretch;
  min-height: 0;
}

.game-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.2vh, 12px);
  height: 100%;
  min-height: clamp(110px, 20vh, 260px);
  padding: clamp(16px, 2.5vh, 28px) clamp(12px, 1.5vw, 16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  text-align: center;
}

.game-category:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 201, 71, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.game-category-icon {
  font-size: clamp(2.2rem, 4.5vh, 3.2rem);
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.game-category h3 {
  font-size: clamp(1rem, 2vh, 1.15rem);
  color: #fff;
}

.game-category p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 100%;
}

.game-category-meta {
  font-size: 11px;
  color: #6d849c;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

/* 场次页 */
.game-room {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(14px, 2vw, 24px);
  min-height: 0;
  overflow-y: auto;
}

.btn-back {
  align-self: flex-start;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.btn-back:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.games-tabs {
  display: none;
}

.game-tab {
  display: none;
}

.game-detail {
  display: none;
}

.game-detail-head {
  display: flex;
  align-items: center;
  gap: 20px;
}

.game-detail-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 201, 71, 0.2), rgba(255, 159, 28, 0.08));
  border: 1px solid rgba(255, 201, 71, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  flex-shrink: 0;
}

.game-detail-head h3 { font-size: 1.5rem; margin-bottom: 6px; }
.game-detail-head p { color: var(--text-muted); font-size: 0.9rem; }
.game-detail-meta { margin-top: 4px; font-size: 0.8rem !important; color: #6d849c !important; }

.section-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.section-label.hidden,
.hidden { display: none !important; }

.room-chips,
.difficulty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: #dce6f2;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.chip::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.chip:focus,
.chip:focus-visible,
.chip:active {
  outline: none;
  box-shadow: none;
  background: transparent;
}

.chip:hover:not(.disabled) {
  border-color: rgba(255, 201, 71, 0.4);
  color: #fff;
}

.chip:active:not(.disabled) {
  transform: none;
  background: transparent;
  border-color: rgba(255, 201, 71, 0.4);
}

.chip.active {
  border-color: var(--gold);
  background: transparent;
  color: var(--gold);
}

.chip.active:hover:not(.disabled),
.chip.active:focus,
.chip.active:focus-visible,
.chip.active:active:not(.disabled) {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
}

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

.chip small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.match-bar {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.match-info { display: flex; flex-direction: column; gap: 4px; }
.match-info span:first-child { font-size: 1rem; font-weight: 600; }
.match-hint { font-size: 12px; color: var(--text-muted); }
.match-hint.is-warn { color: #e85d4a; font-weight: 600; }
.btn-match-lg.is-points-low {
  opacity: 0.72;
  filter: saturate(0.85);
}

.lobby-side {
  flex: 1 1 0;
  padding: clamp(12px, 1.5vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.lobby-side .section-label {
  flex-shrink: 0;
}

.quick-grid {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(72px, 1fr));
  gap: clamp(8px, 1vw, 12px);
  min-height: 0;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 72px;
  padding: 14px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel-light);
  color: #dce6f2;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.quick-btn span { font-size: 1.4rem; }
.quick-btn small { font-size: 11px; color: var(--text-muted); }
.quick-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }

.announce-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announce-item {
  padding: 12px;
  background: var(--bg-panel-light);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.announce-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 159, 28, 0.2);
  color: var(--accent);
  margin-bottom: 6px;
}

.announce-item p { font-size: 12px; color: #b8c8da; line-height: 1.5; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vh, 24px);
  overflow-y: auto;
  z-index: 200;
}

.overlay.hidden { display: none; }

.overlay-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: clamp(20px, 4vh, 32px);
  border-radius: 16px;
  text-align: center;
  min-width: min(280px, 92vw);
  max-width: 94vw;
  margin: auto;
  flex-shrink: 0;
}

.th-result-box {
  max-width: min(420px, 96vw);
  text-align: left;
}

.th-result-box > #btn-back-lobby-texas {
  display: block;
  margin: 8px auto 0;
  min-width: min(220px, 72%);
}

#th-result-modal.overlay {
  align-items: flex-end;
  justify-content: center;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0.35) 38%,
    rgba(0, 0, 0, 0.82) 100%
  );
}

#th-result-modal .overlay-box {
  width: min(480px, 100%);
  margin: 0;
  border-radius: 16px 16px 0 0;
  max-height: min(62vh, 520px);
  overflow-y: auto;
}

.th-seat.is-revealed .th-seat-cards .th-poker-card {
  box-shadow: 0 0 0 1px rgba(255, 215, 100, 0.45);
}

.th-result-box h3 {
  text-align: center;
  margin-bottom: 10px;
}

.th-result-box > #th-result-text {
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 10px;
}

.th-result-detail {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.th-result-detail.hidden {
  display: none;
}

.th-result-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.th-result-row:last-child {
  border-bottom: none;
}

.th-result-row.is-winner {
  color: #ffd700;
}

.th-result-row > span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.th-result-row .th-poker-card,
.th-result-row .th-card-back {
  width: clamp(24px, 7vmin, 34px);
  height: clamp(33px, 9.5vmin, 46px);
  font-size: 0.65rem;
}

.surrender-modal-box {
  width: min(380px, 94vw);
  text-align: left;
}

.surrender-modal-box h3 {
  text-align: center;
  margin-bottom: 14px;
}

.surrender-settlement {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
}

.surrender-settle-title {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.surrender-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.surrender-score-row:last-of-type {
  border-bottom: none;
}

.surrender-score-row strong {
  font-size: 15px;
  white-space: nowrap;
}

.surrender-score-row.win strong {
  color: #6ee7a0;
}

.surrender-score-row.loss strong {
  color: #fca5a5;
}

.surrender-score-row.is-me {
  background: rgba(255, 201, 71, 0.08);
  margin: 0 -8px;
  padding: 7px 8px;
  border-radius: 8px;
}

.surrender-spring,
.surrender-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.surrender-hint {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 10px;
}

.surrender-hint.subtle {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 18px;
}

.surrender-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.surrender-actions .btn {
  min-width: 120px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-game.active {
  padding: 10px 14px 12px;
  gap: 8px;
  position: relative;
  min-height: 0;
}

.game-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.game-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.turn-timer {
  font-size: 12px;
  color: #dce6f2;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.turn-timer.urgent {
  color: #ff8a8a;
  background: rgba(255, 80, 80, 0.2);
  animation: timer-pulse 0.8s ease-in-out infinite;
}

@keyframes timer-pulse {
  50% { opacity: 0.65; }
}

.game-phase-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(255, 201, 71, 0.15);
  border: 1px solid rgba(255, 201, 71, 0.35);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

.autoplay-badge {
  position: absolute;
  right: clamp(12px, 2.5vw, 22px);
  bottom: clamp(10px, 2vh, 18px);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(96, 165, 250, 0.55);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 600;
  color: #93c5fd;
  cursor: pointer;
  pointer-events: auto;
  animation: autoplay-pulse 1.6s ease-in-out infinite;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.autoplay-badge:hover {
  transform: translateY(-1px);
  border-color: rgba(147, 197, 253, 0.85);
  background: rgba(30, 41, 59, 0.92);
}

.autoplay-badge:active {
  transform: scale(0.98);
}

.autoplay-badge.hidden {
  display: none;
}

@keyframes autoplay-pulse {
  50% { opacity: 0.72; }
}

.player-zone.is-autoplay .my-hand {
  opacity: 0.82;
}

.player-zone.is-autoplay .game-action-dock {
  pointer-events: none;
  opacity: 0.45;
}

.game-multiple-badge {
  justify-self: end;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: #dce6f2;
}

.ddz-table {
  flex: 1;
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) minmax(calc(var(--btn-row-h, 44px) + var(--action-gap, 16px) + var(--card-h, 56px) + var(--hand-lift, 18px) + var(--hand-pad-b, 12px) + 20px), auto);
  --card-w: 40px;
  --card-h: 56px;
  --hand-lift: 20px;
  --hand-pad-b: 16px;
  --action-gap: clamp(12px, 2.5vh, 24px);
  --btn-row-h: 44px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 40%, rgba(46, 125, 50, 0.45), transparent),
    radial-gradient(ellipse at center, #1b5e20 0%, #0d3d0d 100%);
  border-radius: 16px;
  padding: 10px 14px 14px;
  border: 3px solid #2e7d32;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.25);
  overflow-x: hidden;
  overflow-y: hidden;
}

.ddz-top-bar {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: clamp(6px, 1.5vw, 12px);
  width: 100%;
  padding-bottom: 6px;
  z-index: 4;
}

.ddz-top-bar .opponent-panel {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(150px, 30vw);
}

.ddz-top-center {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.landlord-cards {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.landlord-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.bottom-cards {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  min-height: 56px;
}

.ddz-mid {
  grid-row: 2;
  grid-column: 1;
  z-index: 1;
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  min-height: 0;
  width: 100%;
  padding: 0 6px;
}

.ddz-mid-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.ddz-mid .seat-play-left,
.ddz-mid .seat-play-right {
  flex: 0 1 auto;
  width: auto;
  max-width: min(320px, 46%);
  margin-top: 0;
}

.opp-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.opp-timer-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
  background: conic-gradient(var(--gold) var(--timer-pct, 100%), rgba(255, 255, 255, 0.15) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}

.opp-timer-ring.active {
  opacity: 1;
}

.opp-timer-ring.urgent {
  background: conic-gradient(#ff6b6b var(--timer-pct, 100%), rgba(255, 255, 255, 0.15) 0);
}

.opp-timer-text {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000;
  pointer-events: none;
}

.opp-timer-text.urgent {
  color: #ffd0d0;
}

.opp-timer-text.hidden {
  display: none;
}

.seat-play-zone {
  position: relative;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.seat-play-zone.has-cards {
  min-height: calc(var(--card-h, 56px) + 18px);
  width: auto;
  min-width: 0;
}

.seat-play-left,
.seat-play-right {
  align-self: stretch;
  max-width: min(320px, 100%);
}

.seat-play-left.is-lead,
.seat-play-right.is-lead,
.seat-play-left.is-turn,
.seat-play-right.is-turn,
.seat-play-left.is-turn.urgent,
.seat-play-right.is-turn.urgent {
  background: transparent;
  border: none;
  box-shadow: none;
}

.seat-play-self {
  width: auto;
  max-width: min(420px, 96vw);
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.seat-play-self.is-empty {
  display: none;
}

.seat-play-self .seat-play-content {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.seat-play-self .seat-play-label {
  flex-shrink: 0;
  font-size: 10px;
}

.seat-play-zone.is-turn {
  background: transparent;
  border: none;
  box-shadow: none;
}

.seat-play-zone.is-turn.urgent {
  background: transparent;
  border: none;
  box-shadow: none;
}

.seat-countdown {
  display: none !important;
}

.seat-play-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 0;
  justify-content: center;
}

.seat-play-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  line-height: 1.2;
}

.seat-play-label em {
  font-style: normal;
  color: var(--gold);
}

.ddz-mid .seat-play-left .seat-play-content,
.ddz-mid .seat-play-left .seat-play-cards {
  align-items: flex-start;
}

.ddz-mid .seat-play-left .seat-play-cards.folded-cards {
  justify-content: flex-start;
}

.ddz-mid .seat-play-right .seat-play-content,
.ddz-mid .seat-play-right .seat-play-cards {
  align-items: flex-end;
}

.ddz-mid .seat-play-right .seat-play-cards.folded-cards {
  justify-content: flex-end;
}

.seat-play-cards {
  max-width: 100%;
  overflow: visible;
}

.seat-play-cards .card {
  overflow: visible;
}

.seat-play-pass {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.turn-flow-item {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid transparent;
}

.turn-flow-item.active {
  color: var(--gold);
  font-weight: 700;
  background: rgba(255, 201, 71, 0.15);
  border-color: rgba(255, 201, 71, 0.45);
}

.turn-flow-item small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 1px;
}

.turn-flow-arrow {
  color: rgba(255, 255, 255, 0.25);
  font-size: 12px;
}

.center-hint strong {
  color: var(--gold);
  font-weight: 600;
}

.opponent-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 140px;
}

.opponent-panel.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 201, 71, 0.35);
}

.opponent-panel.is-landlord .opp-avatar {
  background: linear-gradient(135deg, #ffc947, #e6a800);
  color: #1a1200;
}

.opp-right { flex-direction: row-reverse; text-align: right; }
.opp-right .opp-info { align-items: flex-end; }

.opp-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.opp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.opp-role {
  font-size: 11px;
  color: var(--text-muted);
}

.opp-name {
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
}

.opponent-panel .card-count {
  font-size: 11px;
  color: var(--gold);
}

.ddz-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  max-width: min(360px, 94vw);
  pointer-events: none;
}

.ddz-center:not(:has(.center-hint:not(:empty))):not(:has(.turn-flow:not(:empty))) {
  display: none;
}

.center-hint:empty {
  display: none;
}

.turn-flow:empty {
  display: none;
}

.center-hint.hidden {
  display: none;
}

.center-hint.visible {
  display: block;
}

.center-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  line-height: 1.45;
  width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: game-hint-in 0.2s ease-out;
}

.center-hint.is-notice {
  color: #e8f4ff;
  border-color: rgba(120, 190, 255, 0.35);
  background: rgba(18, 42, 72, 0.82);
}

.center-hint.is-warn {
  color: #ffe8b8;
  border-color: rgba(255, 201, 71, 0.55);
  background: rgba(56, 36, 8, 0.88);
  box-shadow: 0 0 16px rgba(255, 201, 71, 0.18);
}

@keyframes game-hint-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.turn-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ddz-bottom {
  grid-row: 3;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  min-height: 0;
  padding: 2px 4px 8px;
  overflow: visible;
  position: relative;
}

.ddz-bottom .seat-play-self {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 4px);
  flex-shrink: 0;
  pointer-events: none;
  z-index: 5;
}

.player-zone {
  width: 100%;
  display: grid;
  grid-template-rows: minmax(var(--btn-row-h), auto) calc(var(--card-h) + var(--hand-lift, 18px) + var(--hand-pad-b, 12px));
  gap: var(--action-gap);
  align-items: stretch;
  justify-items: center;
  isolation: isolate;
  overflow: visible;
}

.player-zone:not(:has(.actions:not(.hidden))) {
  grid-template-rows: calc(var(--card-h) + var(--hand-lift, 18px) + var(--hand-pad-b, 12px));
  gap: 0;
}

.player-zone .game-action-dock {
  grid-row: 1;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  z-index: 20;
  flex-shrink: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: max(var(--btn-row-h), clamp(42px, 7vh, 50px));
  overflow: visible;
}

.player-zone .game-action-dock:not(:has(.game-action-row:not(.hidden))) {
  display: none;
}

.player-zone:not(:has(.game-action-row:not(.hidden))) .my-hand {
  grid-row: 1;
}

.player-zone .my-hand {
  grid-row: 2;
  width: 100%;
  height: calc(var(--card-h) + var(--hand-lift, 18px) + var(--hand-pad-b, 12px));
  min-height: calc(var(--card-h) + var(--hand-lift, 18px) + var(--hand-pad-b, 12px));
  overflow: visible;
  flex-shrink: 0;
  padding: var(--hand-lift, 20px) 6px var(--hand-pad-b, 16px);
  box-sizing: border-box;
}

.game-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 16px);
  flex-wrap: nowrap;
}

.game-action-row.hidden {
  display: none;
}

.action-hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 0);
  z-index: 40;
  max-width: min(92vw, 360px);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.action-hint.hidden {
  display: block;
  opacity: 0;
  visibility: hidden;
}

.action-hint.visible {
  opacity: 1;
  visibility: visible;
  animation: action-hint-in 0.2s ease-out forwards;
}

@keyframes action-hint-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.action-hint.is-notice {
  color: #e8f4ff;
  border: 1px solid rgba(120, 190, 255, 0.35);
  background: rgba(18, 42, 72, 0.92);
}

.action-hint.is-warn {
  color: #ffe8b8;
  border: 1px solid rgba(255, 201, 71, 0.55);
  background: rgba(56, 36, 8, 0.94);
  box-shadow: 0 0 16px rgba(255, 201, 71, 0.22);
}

.my-turn-timer {
  position: relative;
  width: clamp(42px, 7vh, 50px);
  height: clamp(42px, 7vh, 50px);
  flex-shrink: 0;
}

.my-turn-timer.hidden {
  display: none;
}

.my-turn-timer-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
  background: conic-gradient(var(--gold) var(--timer-pct, 100%), rgba(255, 255, 255, 0.15) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
}

.my-turn-timer-ring.active {
  opacity: 1;
}

.my-turn-timer-ring.urgent {
  background: conic-gradient(#ff6b6b var(--timer-pct, 100%), rgba(255, 255, 255, 0.15) 0);
}

.my-turn-timer::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(8, 12, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  z-index: 0;
}

.my-turn-timer-text {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 2.4vh, 18px);
  font-weight: 800;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.95), 0 1px 3px #000;
}

.my-turn-timer.urgent .my-turn-timer-text {
  color: #ffd0d0;
}

.my-hand {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
  padding: 0 6px;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

.my-hand .hand-row {
  max-width: 100%;
  margin: 0 auto;
  height: var(--card-h);
  align-items: flex-end;
}

/* 手牌 & 出牌区共用：叠牌 + 左上角点数花色 */
.folded-cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: nowrap;
  max-width: 100%;
}

.folded-cards .card {
  flex: 0 0 auto;
  width: var(--card-w, 40px);
  height: var(--card-h, 56px);
  margin-left: calc(-1 * var(--card-overlap, 14px));
  position: relative;
  overflow: hidden;
  font-size: 13px;
}

.folded-cards .card.card-corner-layout {
  display: block;
  padding: 0;
}

.folded-cards .card .card-corner {
  position: absolute;
  top: 2px;
  left: 3px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  gap: 0;
  pointer-events: none;
  user-select: none;
}

.folded-cards .card .card-rank {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.3px;
}

.folded-cards .card .card-suit {
  font-size: 10px;
  line-height: 1;
  margin-top: 1px;
}

.folded-cards .card .card-rank:only-child {
  font-size: 12px;
}

.folded-cards .card:first-child {
  margin-left: 0;
}

.my-hand .card.selectable {
  transform: translateY(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.my-hand .card.selectable:not(.selected):hover {
  transform: translateY(0);
  z-index: 6;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(255, 201, 71, 0.55);
}

.my-hand .card.selected {
  transform: translateY(-16px);
  z-index: 10;
  position: relative;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.4),
    0 0 0 3px #ffc947,
    0 0 12px rgba(255, 201, 71, 0.55);
  filter: brightness(1.08) saturate(1.12);
  background: linear-gradient(180deg, #fffef0 0%, #ffe9a8 100%);
  border-color: rgba(255, 180, 0, 0.85);
}

.my-hand .card.selected:hover {
  transform: translateY(-16px);
}

.card.card-back {
  background: linear-gradient(145deg, #1976d2, #0d47a1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: transparent;
  cursor: default;
}

.game-action-dock {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.call-waiting {
  font-size: 14px;
  color: #dce6f2;
  padding: 8px 16px;
}

.call-waiting.hidden { display: none; }

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.actions.hidden { display: none; }

.actions .btn {
  min-width: clamp(64px, 12vw, 88px);
  padding: clamp(7px, 1.2vh, 10px) clamp(14px, 3vw, 22px);
  font-size: clamp(13px, 1.8vh, 15px);
  min-height: var(--btn-row-h);
}

.card {
  width: 44px;
  height: 60px;
  background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: default;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  user-select: none;
  transition: transform 0.15s;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.bottom-cards .card {
  width: 40px;
  height: 56px;
  cursor: default;
}

.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-4px); }

.card.selected { transform: translateY(-12px); box-shadow: 0 0 0 2px var(--gold); }
.card.red { color: #e53935; }
.card.black { color: #212121; }

.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #071018;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.rotate-hint.hidden { display: none; }
.rotate-hint p { font-size: 1.1rem; color: var(--text-muted); }

@media (max-width: 1100px) {
  .games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-category {
    min-height: clamp(96px, 18vh, 200px);
  }
}

@media (max-width: 900px) {
  .lobby-body {
    grid-template-columns: minmax(160px, 22vw) minmax(0, 1fr) minmax(140px, 20vw);
    gap: 8px;
    padding: 8px;
  }

  .lobby-profile {
    padding: 12px;
    gap: 10px;
  }

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

  .game-category {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    height: auto;
    min-height: 88px;
    padding: 16px 20px;
    text-align: left;
    gap: 16px;
  }

  .game-category-icon { font-size: 2.4rem; }
  .game-category p { max-width: none; }

  .quick-grid {
    grid-template-rows: repeat(2, minmax(64px, 1fr));
  }

  .login-layout {
    flex-direction: column;
    max-width: 400px;
  }

  .login-brand { display: none; }
  .login-card { width: 100%; }
}

@media (max-width: 640px) {
  .lobby-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow-y: auto;
  }

  .lobby-profile {
    max-height: 42vh;
  }

  .profile-notice {
    flex: 1 1 auto;
    min-height: 80px;
  }

  .lobby-side {
    flex: 0 0 auto;
  }

  .quick-grid {
    grid-template-rows: repeat(2, minmax(56px, auto));
  }
}

@media (max-height: 720px) {
  .lobby-header { height: 48px; }
  .lobby-body { padding: 8px; gap: 8px; }
  .lobby-profile {
    padding: 10px;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .profile-avatar { width: 52px; height: 52px; font-size: 1.2rem; }
  .wallet-item { padding: 8px 10px; }
  .profile-notice { padding-top: 8px; }
  .game-category { min-height: clamp(80px, 15vh, 160px); }
  .games-home { padding: 12px 16px; }
  .quick-grid { grid-template-rows: repeat(2, minmax(56px, 1fr)); }

  .overlay { align-items: flex-start; padding: 10px; }
  .feature-modal-box.feature-modal-box--shop {
    --shop-body-max: calc(100dvh - 20px);
  }
  .stats-modal-box {
    max-height: calc(100dvh - 20px);
    padding: 14px 16px;
  }
  .stats-total-item strong { font-size: 1.1rem; }
  .stats-record-row { padding: 10px 12px; font-size: 12px; }
}

@media (max-height: 500px) {
  .lobby-header { height: 44px; }
  .lobby-body { padding: 6px; gap: 6px; }
  .lobby-profile { padding: 8px; gap: 6px; }
  .profile-notice .announce-box { min-height: 0; }
  .game-detail { padding: 14px 18px; }
  .profile-avatar { width: 44px; height: 44px; font-size: 1rem; }
  .game-category { min-height: 72px; padding: 12px; }

  .stats-modal-box {
    max-height: calc(100dvh - 12px);
    padding: 12px 14px;
  }
  .stats-modal-box h3 { margin-bottom: 8px; }
  .stats-total { padding: 8px; margin-bottom: 8px; }
  .stats-record-list { margin-bottom: 10px; gap: 6px; }
  .stats-record-row { padding: 8px 10px; }

  .page-game.active { padding: 6px 10px; gap: 6px; }
  .game-header { padding: 6px 10px; }
  .ddz-table {
    padding: 6px 8px 10px;
    grid-template-rows: auto minmax(0, 1fr) minmax(calc(var(--btn-row-h) + var(--action-gap) + var(--card-h) + var(--hand-lift) + var(--hand-pad-b) + 16px), auto);
  }
  .player-zone { --action-gap: clamp(10px, 2vh, 18px); }
  .ddz-top-bar .opponent-panel { max-width: min(120px, 28vw); padding: 6px 8px; }
  .ddz-mid .seat-play-left,
  .ddz-mid .seat-play-right { max-width: min(260px, 48%); }
  .opp-avatar { width: 28px; height: 28px; font-size: 13px; }
  .my-hand .folded-cards .card {
    width: var(--card-w, 36px);
    height: var(--card-h, 50px);
  }
  .folded-cards .card .card-rank { font-size: 10px; }
  .folded-cards .card .card-suit { font-size: 9px; }
  .actions .btn { min-width: 64px; padding: 8px 14px; }
}

@media (max-width: 600px) {
  .card { width: 36px; height: 52px; font-size: 11px; }
}

/* 维护模式 / 商城 / 大厅通知 */
.maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(8, 12, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.maintenance-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  text-align: center;
}

.maintenance-box h2 { color: var(--gold); margin-bottom: 12px; }
.maintenance-box p { color: var(--text-muted); line-height: 1.6; }

.lobby-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  background: rgba(20, 30, 48, 0.95);
  border: 1px solid var(--gold);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  max-width: min(90vw, 480px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
  line-height: 1.5;
}
.lobby-toast.is-error {
  border-color: #f87171;
  background: rgba(48, 20, 24, 0.96);
  color: #fecaca;
}
.lobby-toast.is-warn {
  border-color: #fbbf24;
  background: rgba(40, 32, 16, 0.96);
  color: #fde68a;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 4px;
}

.shop-section--compact {
  margin-top: 10px;
  padding-top: 10px;
}

.shop-section--compact:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.shop-section--compact .shop-grid {
  margin-bottom: 0;
}

.feature-modal-box--shop .shop-grid {
  gap: var(--shop-gap, 8px);
  margin: clamp(4px, 1.2vmin, 8px) 0 2px;
}

.feature-modal-box--shop .shop-item {
  padding: var(--shop-item-pad, 8px);
  border-radius: clamp(6px, 1.6vmin, 10px);
  min-width: 0;
}

.feature-modal-box--shop .shop-item strong {
  font-size: var(--shop-font);
  margin-bottom: clamp(2px, 0.6vmin, 4px);
  line-height: 1.3;
  word-break: break-word;
}

.feature-modal-box--shop .shop-item small {
  font-size: var(--shop-font-sm);
}

.feature-modal-box--shop .shop-item .btn {
  margin-top: clamp(4px, 1.2vmin, 8px);
  padding: var(--shop-btn-pad-y) clamp(6px, 1.6vmin, 10px);
  font-size: var(--shop-btn-font);
}

.feature-modal-box--shop .shop-section {
  margin-top: var(--shop-section-gap);
  padding-top: var(--shop-section-gap);
}

.feature-modal-box--shop .shop-section--compact {
  margin-top: clamp(6px, 1.6vmin, 10px);
  padding-top: clamp(6px, 1.6vmin, 10px);
}

.feature-modal-box--shop .shop-section h4 {
  font-size: var(--shop-font);
  margin-bottom: clamp(4px, 1.2vmin, 8px);
}

.feature-modal-box--shop .shop-exchange-hint {
  margin: clamp(-4px, -0.8vmin, -2px) 0 clamp(6px, 1.6vmin, 10px);
  font-size: var(--shop-font-sm);
}

.feature-modal-box--shop .promo-row input {
  padding: clamp(7px, 2vmin, 10px) clamp(8px, 2.2vmin, 12px);
  font-size: var(--shop-font);
}

.feature-modal-box--shop .promo-row--stack {
  gap: clamp(4px, 1.2vmin, 8px);
}

.feature-modal-box--shop .shop-scroll-hint {
  font-size: var(--shop-font-sm);
  margin-top: clamp(6px, 1.6vmin, 10px);
}

/* 商城弹窗：横屏矮屏进一步收紧 */
@media (orientation: landscape) and (max-height: 430px) {
  .feature-modal-box.feature-modal-box--shop {
    --shop-w: clamp(220px, 58vmin, 300px);
    --shop-pad-x: clamp(8px, 2.4vmin, 12px);
    --shop-pad-y: clamp(6px, 1.8vmin, 10px);
    --shop-body-max: calc(100dvh - 10px);
  }

  .overlay:has(.feature-modal-box--shop) {
    align-items: flex-start;
    padding: 6px;
  }
}

/* 商城弹窗：大屏略放宽 */
@media (min-width: 768px) {
  .feature-modal-box.feature-modal-box--shop {
    --shop-w: clamp(280px, 36vw, 400px);
  }
}

/* 商城弹窗：极窄竖屏 */
@media (max-width: 360px) {
  .feature-modal-box.feature-modal-box--shop {
    --shop-w: min(92vw, 280px);
    --shop-gap: 6px;
  }
}

.shop-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.shop-item strong { display: block; color: var(--gold); margin-bottom: 4px; }
.shop-item small { color: var(--text-muted); }
.shop-item .btn { margin-top: 8px; width: 100%; }

.shop-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.shop-section h4 { font-size: 14px; margin-bottom: 10px; color: #c5d4e8; }

.shop-scroll-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.85;
}

.feature-modal-box--shop .shop-scroll-hint {
  display: block;
}

.feature-modal-box--shop .feature-modal-body[data-scrolled] .shop-scroll-hint {
  display: none;
}

.promo-row, .daily-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.promo-row--stack {
  flex-direction: column;
  align-items: stretch;
}

.promo-row--stack .btn {
  width: 100%;
}

.promo-row input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  box-sizing: border-box;
}

.shop-exchange-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.feature-modal-box--shop .promo-row:not(.promo-row--stack) {
  flex-wrap: wrap;
}

.feature-modal-box--shop .promo-row:not(.promo-row--stack) .btn {
  flex: 0 1 auto;
  max-width: 100%;
}

.friend-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.friend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  font-size: 14px;
}

.feature-msg { font-size: 13px; color: var(--text-muted); margin-top: 8px; text-align: center; }
.feature-msg.success { color: #6ee7a0; }
.feature-msg.error { color: #f87171; }

/* 血战麻将 - 四方四正牌桌（自适应） */
.page-game-mj.active {
  --mj-tile-w: clamp(24px, 4.6vmin, 36px);
  --mj-tile-h: clamp(32px, 6.4vmin, 48px);
  --mj-tile-sm-w: clamp(17px, 3.1vmin, 24px);
  --mj-tile-sm-h: clamp(24px, 4.4vmin, 32px);
  --mj-tag-fs: clamp(9px, 2.2vmin, 12px);
  --mj-gap: clamp(3px, 0.8vmin, 6px);
  padding: clamp(4px, 1vmin, 10px);
  gap: var(--mj-gap);
  position: relative;
  min-height: 0;
}

.page-game-mj .game-header {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.page-game-mj .game-header > .btn {
  white-space: nowrap;
  writing-mode: horizontal-tb;
  align-self: center;
  justify-self: start;
  width: max-content;
  height: auto;
  flex-shrink: 0;
}

.page-game-mj .game-phase-badge,
.page-game-mj .game-multiple-badge {
  font-size: clamp(10px, 2.4vmin, 12px);
  white-space: nowrap;
  padding: 3px 8px;
  line-height: 1.2;
}

.page-game-mj .game-header-center {
  min-width: 0;
}

.mj-board {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  --mj-edge: clamp(2px, 0.8vmin, 8px);
  --mj-side-w: clamp(48px, 14vw, 110px);
  --mj-bottom-h: clamp(96px, 36vh, 200px);
  --mj-center-w: clamp(96px, 34vw, 240px);
  --mj-center-h: clamp(64px, 18vh, 130px);
  padding: var(--mj-edge);
  background:
    radial-gradient(ellipse at center, rgba(0, 80, 40, 0.35) 0%, rgba(0, 40, 20, 0.15) 55%, transparent 70%),
    rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: clamp(10px, 2vmin, 14px);
}

.mj-zone {
  min-height: 0;
  min-width: 0;
}

.mj-zone-center {
  position: absolute;
  left: 50%;
  top: calc(50% - var(--mj-bottom-h) * 0.12);
  transform: translate(-50%, -50%);
  width: var(--mj-center-w);
  min-height: var(--mj-center-h);
  max-height: calc(100% - var(--mj-bottom-h) - 12%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: clamp(6px, 1.4vmin, 10px);
}

.mj-zone-top {
  position: absolute;
  top: var(--mj-edge);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - var(--mj-side-w) * 2 - 12px), 420px);
  max-height: 16%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
}

.mj-zone-left {
  position: absolute;
  left: var(--mj-edge);
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  max-width: min(calc(50% - var(--mj-center-w) / 2 - 10px), var(--mj-side-max-w, 120px));
  max-height: calc(100% - var(--mj-bottom-h) - 8%);
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  overflow: visible;
}

.mj-zone-right {
  position: absolute;
  right: var(--mj-edge);
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  max-width: min(calc(50% - var(--mj-center-w) / 2 - 10px), var(--mj-side-max-w, 120px));
  max-height: calc(100% - var(--mj-bottom-h) - 8%);
  z-index: 2;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  overflow: visible;
}

.mj-zone-bottom {
  position: absolute;
  left: var(--mj-edge);
  right: var(--mj-edge);
  bottom: var(--mj-edge);
  height: var(--mj-bottom-h);
  max-height: 42%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(4px, 1vmin, 6px);
}

.mj-bottom-spacer {
  flex: 1 1 auto;
  min-height: clamp(8px, 2vh, 20px);
  width: 100%;
}

.mj-discards-self {
  width: 100%;
  min-height: 0;
  max-height: calc(var(--mj-tile-sm-h) + 6px);
  padding: 0;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 2px;
  flex-wrap: nowrap;
  justify-content: center;
  scrollbar-width: none;
  z-index: 1;
}

.mj-discards-self::-webkit-scrollbar {
  display: none;
}

.mj-zone-bottom .mj-hand-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 3;
  overflow: visible;
}

.mj-hand-gap {
  flex: 0 0 clamp(6px, 1.2vmin, 10px);
  width: clamp(6px, 1.2vmin, 10px);
  align-self: flex-end;
  height: var(--mj-hand-tile-h, var(--mj-tile-h));
  margin-bottom: 2px;
}

.mj-hand-gap.hidden {
  display: none;
}

.mj-hand-drawn {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
  padding: 2px 0;
  padding-top: calc(var(--mj-hand-lift, 12px) + 2px);
  padding-bottom: 2px;
  min-height: calc(var(--mj-hand-tile-h, var(--mj-tile-h)) + var(--mj-hand-lift, 12px) + 6px);
}

.mj-hand-drawn.hidden {
  display: none;
}

.mj-hand-drawn .mj-tile {
  min-width: var(--mj-hand-tile-w, var(--mj-tile-w));
  width: var(--mj-hand-tile-w, var(--mj-tile-w));
  height: var(--mj-hand-tile-h, var(--mj-tile-h));
  font-size: var(--mj-hand-tile-fs, clamp(9px, 2.2vmin, 12px));
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.mj-zone-bottom .mj-hand-row .mj-hand {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  box-sizing: border-box;
  padding: 2px 4px;
  padding-top: calc(var(--mj-hand-lift, 12px) + 2px);
  padding-bottom: 2px;
  min-height: calc(var(--mj-hand-tile-h, var(--mj-tile-h)) + var(--mj-hand-lift, 12px) + 6px);
  align-items: flex-end;
  position: relative;
  z-index: 3;
  overflow-x: visible;
  overflow-y: visible;
}

.mj-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.6vmin, 12px);
  flex-wrap: wrap;
  width: 100%;
  flex-shrink: 0;
}

.mj-player-tag-self {
  margin: 0;
}

.mj-player-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--mj-tag-fs);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
}

.mj-seat-timer {
  position: absolute;
  inset: -4px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.mj-seat-timer.active {
  opacity: 1;
}

.mj-timer-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: conic-gradient(var(--gold) var(--timer-pct, 100%), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}

.mj-seat-timer.urgent .mj-timer-ring {
  background: conic-gradient(#ff6b6b var(--timer-pct, 100%), rgba(255, 255, 255, 0.12) 0);
}

.mj-timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.95), 0 1px 2px #000;
}

.mj-seat-timer.urgent .mj-timer-text {
  color: #ffd0d0;
}

.mj-player-tag-side .mj-seat-timer {
  inset: -3px;
}

.mj-player-tag.is-timer-active {
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

.mj-player-tag.is-autoplay::after {
  content: '🤖';
  font-size: 10px;
  margin-left: 2px;
}

.mj-player-tag-side {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  flex-direction: column;
  gap: 3px;
  padding: clamp(4px, 1vmin, 8px) 3px;
  letter-spacing: 1px;
  max-height: 100%;
  flex-shrink: 0;
}

.mj-seat-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mj-seat-badge {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.18);
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.mj-seat-count {
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}

.mj-meld {
  display: inline-flex;
  gap: 1px;
  margin-right: 4px;
  padding: 1px 2px;
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.2);
  flex-shrink: 0;
}

.mj-zone.is-hu .mj-player-tag {
  border-color: rgba(255, 215, 0, 0.45);
  color: var(--gold);
}

.mj-discards-h {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 2px;
  max-width: min(100%, 72vw);
  min-height: 0;
}

.mj-discards-v {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-end;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.mj-discards-v::-webkit-scrollbar { display: none; }

/* 左右家出牌：横排朝牌桌中心，避免贴边被裁切 */
.mj-zone-left .mj-discards-v,
.mj-zone-right .mj-discards-v {
  flex: 1 1 auto;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

.mj-zone-left .mj-discards-v {
  justify-content: flex-end;
}

.mj-zone-right .mj-discards-v {
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.mj-zone-left .mj-player-tag-side,
.mj-zone-right .mj-player-tag-side {
  flex-shrink: 0;
}

.mj-center-hint {
  margin: 0;
  font-size: clamp(10px, 2.4vmin, 12px);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}

.mj-last-discard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mj-last-discard-label {
  font-size: 11px;
  color: var(--text-muted);
}

.mj-bottom-bar .mj-action-row {
  width: auto;
  flex-shrink: 0;
}

.mj-action-row {
  display: flex;
  justify-content: center;
  gap: clamp(4px, 1.2vmin, 8px);
  flex-wrap: wrap;
  width: 100%;
}

.mj-action-row .btn {
  padding: clamp(6px, 1.4vmin, 10px) clamp(10px, 2.4vmin, 16px);
  font-size: clamp(11px, 2.6vmin, 14px);
}

.mj-hand {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(2px, 0.6vmin, 4px);
  padding: 2px 4px;
  padding-top: calc(var(--mj-hand-lift, 12px) + 2px);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  min-height: calc(var(--mj-hand-tile-h, var(--mj-tile-h)) + var(--mj-hand-lift, 12px) + 6px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mj-hand::-webkit-scrollbar { display: none; }

.mj-tile {
  flex-shrink: 0;
  min-width: var(--mj-hand-tile-w, var(--mj-tile-w));
  width: var(--mj-hand-tile-w, var(--mj-tile-w));
  height: var(--mj-hand-tile-h, var(--mj-tile-h));
  padding: 1px 2px;
  background: linear-gradient(180deg, #fffef8 0%, #f2ead8 100%);
  border: 1px solid #9a8468;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 2.2vmin, 12px);
  font-weight: 700;
  color: #2c1810;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  user-select: none;
  touch-action: manipulation;
}

.mj-discards-h .mj-tile,
.mj-discards-v .mj-tile,
.mj-last-discard .mj-tile {
  min-width: var(--mj-tile-sm-w);
  width: var(--mj-tile-sm-w);
  height: var(--mj-tile-sm-h);
  font-size: clamp(8px, 1.8vmin, 10px);
}

.mj-tile.small {
  min-width: var(--mj-tile-sm-w);
  width: var(--mj-tile-sm-w);
  height: var(--mj-tile-sm-h);
  font-size: clamp(8px, 1.8vmin, 10px);
  border-radius: 4px;
}

.mj-tile.wan { color: #c62828; }
.mj-tile.tong { color: #1565c0; }
.mj-tile.tiao { color: #2e7d32; }
.mj-tile.feng,
.mj-tile.jian,
.mj-tile.east,
.mj-tile.south,
.mj-tile.west,
.mj-tile.north { color: #5d4037; }

.mj-tile.selectable { cursor: pointer; }
.mj-tile.selectable:hover { transform: translateY(-4px); }
.mj-tile.selected {
  position: relative;
  z-index: 2;
  transform: translateY(calc(-1 * var(--mj-hand-lift, 12px)));
  box-shadow: 0 0 0 2px var(--gold), 0 4px 8px rgba(0, 0, 0, 0.35);
}

.mj-zone.is-active .mj-player-tag {
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.35);
}

.mj-hand .mj-tile {
  font-size: var(--mj-hand-tile-fs, clamp(9px, 2.2vmin, 12px));
}

@media (max-width: 767px) {
  .page-game-mj.active {
    --mj-tile-w: clamp(20px, 4.8vw, 32px);
    --mj-tile-h: clamp(28px, 6.6vw, 42px);
    --mj-tile-sm-w: clamp(14px, 3.2vw, 20px);
    --mj-tile-sm-h: clamp(20px, 4.6vw, 28px);
  }

  .page-game-mj .game-header {
    padding: 6px 10px;
    gap: 6px;
  }

  .page-game-mj .game-phase-badge,
  .page-game-mj .game-multiple-badge {
    padding: 2px 6px;
    font-size: 10px;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  .mj-board {
    --mj-side-w: clamp(38px, 10vw, 60px);
    --mj-bottom-h: clamp(112px, 36vh, 190px);
    --mj-center-w: min(72vw, 220px);
    --mj-center-h: clamp(56px, 14vh, 100px);
  }

  .mj-zone-top {
    max-height: 13%;
    width: min(calc(100% - var(--mj-side-w) * 2 - 8px), 320px);
  }

  .mj-zone-left,
  .mj-zone-right {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: calc(50% - var(--mj-center-w) / 2 - 8px);
    top: calc(46% - var(--mj-bottom-h) * 0.08);
  }

  .mj-zone-left {
    flex-direction: column;
    justify-content: flex-start;
  }

  .mj-zone-right {
    flex-direction: column;
    justify-content: flex-end;
  }

  .mj-zone-left .mj-discards-v {
    order: 1;
  }

  .mj-zone-left .mj-player-tag {
    order: 0;
  }

  .mj-zone-right .mj-discards-v {
    order: 1;
  }

  .mj-zone-right .mj-player-tag {
    order: 2;
  }

  .mj-player-tag-side {
    writing-mode: horizontal-tb;
    flex-direction: row;
    letter-spacing: 0;
    padding: 2px 5px;
  }

  .mj-discards-v {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    max-height: none;
  }

  .mj-zone-left .mj-discards-v {
    justify-content: flex-end;
  }

  .mj-zone-right .mj-discards-v {
    justify-content: flex-start;
  }
}

@media (max-width: 767px) and (orientation: landscape) {
  .page-game-mj.active {
    padding: 2px 6px;
    gap: 4px;
  }

  .mj-board {
    --mj-bottom-h: clamp(104px, 44vh, 168px);
    --mj-center-w: clamp(72px, 22vw, 150px);
    --mj-center-h: clamp(48px, 12vh, 82px);
  }

  .mj-zone-top {
    max-height: 15%;
    width: min(calc(100% - var(--mj-center-w) - 24px), 420px);
  }

  .mj-zone-left,
  .mj-zone-right {
    max-width: min(calc(50% - var(--mj-center-w) / 2 - 8px), var(--mj-side-max-w, 150px));
    max-height: calc(100% - var(--mj-bottom-h) - 10%);
  }

  .mj-zone-left .mj-discards-v,
  .mj-zone-right .mj-discards-v {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .mj-bottom-bar {
    gap: 8px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .mj-board {
    --mj-side-w: clamp(72px, 12vw, 100px);
    --mj-bottom-h: clamp(120px, 30vh, 180px);
    --mj-center-w: clamp(120px, 30vw, 220px);
  }
}

@media (min-width: 1025px) {
  .mj-board {
    --mj-side-w: clamp(88px, 10vw, 120px);
    --mj-bottom-h: clamp(130px, 28vh, 200px);
    --mj-center-w: clamp(140px, 24vw, 260px);
    max-width: 960px;
    margin: 0 auto;
  }
}

/* ===== 德州扑克（全屏自适应） ===== */
.page-game-texas.active {
  --th-card-w: clamp(32px, 9vmin, 52px);
  --th-card-h: clamp(44px, 12.5vmin, 72px);
  --th-gap: clamp(4px, 1.2vmin, 10px);
  --th-pad: clamp(6px, 1.5vmin, 12px);
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: 1fr;
  width: 100%;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  max-height: 100dvh;
  max-height: 100svh;
  min-height: 0;
  overflow: hidden;
  padding: var(--th-pad);
  gap: var(--th-gap);
  box-sizing: border-box;
  background: #0a1218;
}

.page-game-texas.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 42%, rgba(26, 77, 46, 0.18) 0%, transparent 70%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.35) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.page-game-texas.active > * {
  position: relative;
  z-index: 1;
}

.page-game-texas .game-header {
  grid-row: 1;
  flex-shrink: 0;
  z-index: 10;
  grid-template-columns: auto 1fr auto;
  padding: clamp(6px, 1.4vmin, 10px) clamp(10px, 2vmin, 14px);
  width: 100%;
}

.page-game-texas .game-phase-badge,
.page-game-texas .game-multiple-badge {
  font-size: clamp(10px, 2.4vmin, 12px);
  white-space: nowrap;
  padding: 3px 8px;
}

.page-game-texas .game-header-center {
  min-width: 0;
}

.th-table {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: visible;
  width: 100%;
  padding: clamp(32px, 7vmin, 48px) clamp(8px, 2vmin, 14px);
  box-sizing: border-box;
}

.th-felt {
  position: relative;
  width: var(--th-felt-w, min(88vw, 420px));
  height: var(--th-felt-h, min(34vh, 280px));
  min-width: 240px;
  min-height: 180px;
  max-width: 100%;
  flex-shrink: 1;
  margin: 0 auto;
}

/* 平顶六边形牌桌（缩小居中，外圈留给座位） */
.th-hex-rail,
.th-hex-surface {
  position: absolute;
  clip-path: polygon(16% 6%, 84% 6%, 100% 50%, 84% 94%, 16% 94%, 0% 50%);
  pointer-events: none;
}

.th-hex-rail {
  inset: 18% 8%;
  background: linear-gradient(180deg, #9a6530 0%, #6b4423 45%, #4a2f18 100%);
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.5));
  transform: scale(1.02);
  transform-origin: center;
}

.th-hex-surface {
  inset: 20% 10%;
  clip-path: polygon(16% 6%, 84% 6%, 100% 50%, 84% 94%, 16% 94%, 0% 50%);
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 255, 255, 0.08) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 50%, #3a8f55 0%, #256b3c 38%, #1a4d2c 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.28);
}

.th-felt::before,
.th-felt::after {
  display: none;
}

.th-seats {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.th-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: clamp(42px, 11vmin, 64px);
  max-width: clamp(58px, 14vmin, 76px);
  padding: clamp(2px, 0.6vmin, 5px);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  transition: box-shadow 0.2s;
  z-index: 3;
}

.th-seat.is-active {
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.7), 0 0 12px rgba(255, 215, 0, 0.35);
  background: rgba(0, 0, 0, 0.45);
}

.th-seat.is-folded {
  opacity: 0.55;
}

.th-seat-empty {
  opacity: 0.35;
  border-style: dashed;
}

.th-avatar-empty {
  opacity: 0.5;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.th-card-back-dim {
  opacity: 0.35;
}

.th-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vmin, 8px);
  width: min(58%, 220px);
  pointer-events: none;
}

.th-seat .th-avatar {
  width: clamp(24px, 6vmin, 32px);
  height: clamp(24px, 6vmin, 32px);
  font-size: clamp(0.7rem, 2vmin, 0.9rem);
}

.th-seat .th-dealer-badge {
  width: 12px;
  height: 12px;
  font-size: 0.5rem;
}

.th-seat-cards {
  display: flex;
  gap: clamp(2px, 0.5vmin, 4px);
}

.th-seat .th-poker-card,
.th-seat .th-card-back {
  width: calc(var(--th-card-w) * 0.45);
  height: calc(var(--th-card-h) * 0.45);
  font-size: clamp(0.48rem, 1.4vmin, 0.62rem);
}

.th-seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  text-align: center;
}

.th-seat-name {
  font-weight: 600;
  color: #fff;
  font-size: clamp(0.62rem, 1.8vmin, 0.74rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.th-seat-chips,
.th-seat-bet {
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.58rem, 1.6vmin, 0.68rem);
  white-space: nowrap;
}

.th-seat-bet {
  color: #ffd700;
}

.th-opponent {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--th-gap);
  padding: clamp(6px, 1.4vmin, 10px) clamp(8px, 2vmin, 14px);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.th-opponent.is-active {
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.55);
}

.th-player-card {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vmin, 10px);
  min-width: 0;
}

.th-avatar {
  position: relative;
  width: clamp(30px, 7vmin, 40px);
  height: clamp(30px, 7vmin, 40px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.9rem, 2.8vmin, 1.2rem);
  flex-shrink: 0;
}

.th-dealer-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd700;
  color: #1a1208;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.th-player-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: clamp(0.72rem, 2.2vmin, 0.85rem);
  min-width: 0;
}

.th-player-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.th-player-chips,
.th-player-bet {
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.68rem, 2vmin, 0.8rem);
  white-space: nowrap;
}

.th-hole-back {
  display: flex;
  gap: clamp(4px, 1vmin, 6px);
  flex-shrink: 0;
}

.th-card-back,
.th-poker-card {
  width: var(--th-card-w);
  height: var(--th-card-h);
  border-radius: clamp(5px, 1vmin, 8px);
  flex-shrink: 0;
}

.th-card-back {
  display: inline-block;
  background: linear-gradient(135deg, #8b0000, #4a0000);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.th-community {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(4px, 1vmin, 8px);
  justify-content: center;
  max-width: 100%;
}

.th-center-hint {
  margin: 0;
  font-size: clamp(0.75rem, 2.2vmin, 0.85rem);
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  line-height: 1.3;
}

.th-player-dock {
  grid-row: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  overflow: visible;
  width: 100%;
}

.th-my-cards {
  display: flex;
  gap: clamp(6px, 1.5vmin, 10px);
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: min(520px, 100%);
  margin-left: auto;
  margin-right: auto;
  min-height: 0;
  flex-shrink: 0;
  margin-bottom: clamp(4px, 1vmin, 8px);
}

.th-poker-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-weight: 700;
  font-size: clamp(0.75rem, 2.8vmin, 1.05rem);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.th-poker-card.is-red {
  color: #c0392b;
}

.th-poker-card.is-black {
  color: #1a1a2e;
}

.th-player-dock.is-active .th-my-bar {
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.7), 0 0 12px rgba(255, 215, 0, 0.35);
}

.th-my-bar {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: clamp(6px, 1.4vmin, 10px) clamp(8px, 2vmin, 12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.th-my-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: center;
  font-size: clamp(0.72rem, 2.2vmin, 0.85rem);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: clamp(4px, 1vmin, 8px);
  width: 100%;
}

.th-hand-rank {
  color: #ffd700;
  font-weight: 600;
}

.th-my-bar #th-action-hint {
  width: 100%;
  text-align: center;
  margin-bottom: 4px;
}

.th-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(4px, 1vmin, 8px);
  width: 100%;
  max-width: min(520px, 100%);
}

.th-actions .btn {
  min-width: 0;
  padding: clamp(6px, 1.4vmin, 8px) clamp(4px, 1vmin, 8px);
  font-size: clamp(0.72rem, 2.2vmin, 0.88rem);
  white-space: nowrap;
}

.th-actions .btn.warn {
  background: linear-gradient(180deg, #e67e22, #d35400);
  color: #fff;
}

.th-raise-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(6px, 1.5vmin, 10px);
  justify-content: center;
  margin-top: clamp(4px, 1vmin, 8px);
  width: 100%;
  max-width: min(520px, 100%);
}

.th-raise-panel input[type="range"] {
  flex: 1;
  min-width: 100px;
  max-width: 200px;
}

.th-raise-panel #th-raise-amount {
  min-width: 56px;
  text-align: center;
  color: #ffd700;
  font-weight: 600;
  font-size: clamp(0.8rem, 2.4vmin, 0.95rem);
}

.page-game-texas .turn-timer {
  font-size: clamp(10px, 2.4vmin, 12px);
}

@media (max-width: 520px) {
  .th-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .th-actions .btn:nth-child(4),
  .th-actions .btn:nth-child(5) {
    grid-column: span 1;
  }
}

/* 横屏 / 矮屏：牌桌区纵向撑满，手牌始终在按钮正上方 */
@media (orientation: landscape), (max-height: 520px) {
  .page-game-texas.active {
    --th-pad: clamp(4px, 1vmin, 8px);
    --th-gap: clamp(3px, 0.8vmin, 6px);
  }

  .page-game-texas .game-header {
    padding: 4px 10px;
  }

  .th-table {
    justify-content: stretch;
  }

  .th-felt {
    width: min(98%, 720px);
  }

  .th-center-hint {
    font-size: clamp(0.68rem, 1.8vmin, 0.78rem);
  }

  .th-my-cards {
    margin-bottom: 4px;
    max-width: min(600px, 100%);
  }

  .th-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: min(600px, 100%);
  }
}

@media (max-height: 640px) and (orientation: portrait) {
  .page-game-texas.active {
    --th-card-w: clamp(28px, 8vmin, 42px);
    --th-card-h: clamp(38px, 11vmin, 58px);
  }
}

@media (max-height: 400px) and (orientation: landscape) {
  .page-game-texas.active {
    --th-card-w: clamp(22px, 6.5vh, 34px);
    --th-card-h: clamp(30px, 9vh, 46px);
  }

  .th-seat {
    min-width: clamp(48px, 12vmin, 68px);
    max-width: clamp(64px, 16vmin, 84px);
  }

  .th-center-hint {
    font-size: 0.7rem;
  }

  .th-actions .btn {
    padding: 4px 3px;
    font-size: 0.65rem;
  }
}
