#review-dialog {
  width: min(34rem, 92vw);
  max-height: 80vh;
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  color: var(--text-color);
  background: var(--app-bg);
}
#review-dialog::backdrop { background: rgba(0, 0, 0, .65); }
#review-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
#review-dialog form { display: flex; justify-content: flex-end; gap: .5rem; }

:root {
  --app-bg: #14361d;
  --felt-bg: #1c4a28;
  --panel-bg: rgba(12, 33, 18, 0.74);
  --border-subtle: rgba(255, 255, 255, 0.16);
  --text-color: #f3f6f4;
  --text-muted: #b6c8bc;
  --accent-gold: #f5b942;
  --accent-green: #2ea043;
  --accent-blue: #2f81f7;
  --danger-red: #e53935;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at center, var(--felt-bg) 0%, var(--app-bg) 100%);
  color: var(--text-color);
  min-height: 100vh;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

button,
.card,
.player-area,
.info-page,
.history-modal,
.settings-modal,
.winner-overlay,
.quick-remaining-popover {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.game-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1400px;
  min-height: 100vh;
  padding: 8px 14px;
  gap: 7px;
  margin: 0 auto;
  overflow-x: hidden;
}

.game-container > * {
  min-width: 0;
  max-width: 100%;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 5px 10px;
  min-height: 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.home-brand-title {
  display: inline-flex;
  align-items: center;
  font-size: 0.96rem;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 0.4px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 7px;
  background: rgba(245, 185, 66, 0.14);
  border: 1px solid rgba(245, 185, 66, 0.48);
}

.game-variant-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.game-variant-select {
  background: #0f2916;
  color: #fef08a;
  border: 1px solid rgba(245, 185, 66, 0.58);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  line-height: 1.25;
}

.brand-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.4px;
}

.version-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(245, 185, 66, 0.14);
  border: 1px solid rgba(245, 185, 66, 0.42);
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mobile-quick-actions {
  display: none;
  align-items: center;
  gap: 5px;
}

.seat-name-compact {
  display: none;
}

.seat-info-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.badge {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.match-badge {
  background: rgba(15, 38, 22, 0.85);
  border-color: rgba(148, 163, 184, 0.42);
  color: #e2e8f0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-rank-mark {
  display: inline-block;
  font-weight: 900;
  padding: 0 5px;
  margin: 0 2px;
  border-radius: 5px;
  line-height: 1.2;
}

.level-rank-mark.is-active-us {
  color: #fef08a;
  background: rgba(245, 158, 11, 0.34);
  border: 1px solid rgba(250, 204, 21, 0.88);
  box-shadow: 0 0 8px rgba(245, 185, 66, 0.35);
}

.level-rank-mark.is-active-opp {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.34);
  border: 1px solid rgba(248, 113, 113, 0.88);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.32);
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.setup-panel {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

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

.btn-primary {
  background: #2563eb;
  border-color: #3b82f6;
}

.btn-action {
  background: #d97706;
  border-color: #f59e0b;
  padding: 8px 24px;
  font-size: 0.96rem;
}

.btn-secondary {
  background: #374151;
  border-color: #6b7280;
}

.btn-accent {
  background: #059669;
  border-color: #10b981;
}

.btn-retry-subgame {
  background: #0284c7;
  border-color: #38bdf8;
  color: #f8fafc;
}

.btn-retry-subgame:hover:not(:disabled) {
  background: #0369a1;
  border-color: #7dd3fc;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
}

.toast-message {
  position: fixed;
  top: 232px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  color: #fde68a;
  border: 1px solid rgba(245, 185, 66, 0.65);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.toast-message.visible {
  opacity: 1;
}

.toast-message.is-error {
  color: #fecaca;
  border-color: #ef4444;
  background: rgba(127, 29, 29, 0.94);
}

/* 防撑宽精简近期轮次记录条：仅展示「上一轮 + 当前轮」，宽度 100% 锁死绝不撑开页面 */
.round-history-bar {
  background: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 5px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.history-bar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  min-width: 112px;
  max-width: 165px;
}

.history-bar-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fde68a;
  white-space: nowrap;
}

.history-summary {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round-history-list {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  height: 115px;
  min-height: 115px;
  max-height: 115px;
  box-sizing: border-box;
  scrollbar-width: thin;
}

/* 进贡 / 抗贡 / 还贡横幅 */
.tribute-banner {
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.34), rgba(15, 23, 42, 0.78));
  border: 1px solid rgba(245, 185, 66, 0.65);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.tribute-banner-text {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fef08a;
}

.tribute-records-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tribute-record-chip {
  font-size: 0.75rem;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.history-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 6px 4px;
}

.round-card {
  background: rgba(8, 24, 13, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.round-card.is-current {
  border-color: rgba(245, 185, 66, 0.65);
  background: rgba(245, 185, 66, 0.08);
}

.round-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffe08a;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.round-combos {
  display: flex;
  align-items: center;
  gap: 8px;
}

.combo-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 3px 6px;
}

.combo-meta {
  font-size: 0.68rem;
  color: #cbd5e1;
  white-space: nowrap;
}

.combo-cards {
  display: inline-flex;
  align-items: center;
}

.history-mini-card {
  position: relative;
  width: 28px;
  height: 40px;
  background: #ffffff;
  color: #1f2937;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 2px 3px;
  font-weight: 700;
  box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.28);
  margin-left: -14px;
  flex-shrink: 0;
  user-select: none;
}

.history-mini-card:first-child {
  margin-left: 0;
}

.history-mini-card.combo-subgap {
  margin-left: -6px;
}

.mini-card.combo-subgap {
  margin-left: -12px;
}

.mini-card-rank {
  font-size: 0.82rem;
  letter-spacing: -0.4px;
}

.mini-card-rank.is-joker {
  font-size: 0.64rem;
  line-height: 1.02;
}

.history-mini-card .mini-card-rank {
  font-size: 0.64rem;
  letter-spacing: 0;
}

.history-mini-card .mini-card-rank.is-joker {
  font-size: 0.54rem;
  line-height: 1;
}

.history-mini-card .mini-card-corner {
  font-size: 0.64rem;
  line-height: 0.96;
}

.history-mini-card .mini-card-suit-sm {
  font-size: 0.6rem;
}

.history-mini-card.wildcard::after {
  content: "配";
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 0.46rem;
  background: #ef4444;
  color: #fff;
  border-radius: 2px;
  padding: 0 1.5px;
  line-height: 1.2;
}

.grid-table {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-areas:
    ". north ."
    "west center east"
    "south south south";
  grid-template-columns: 185px minmax(0, 1fr) 185px;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.grid-table > * {
  min-width: 0;
}

#player-north {
  grid-area: north;
  justify-self: center;
  min-width: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 14px;
}

.north-info-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 1px;
}

.teammate-card {
  border-color: rgba(46, 160, 67, 0.45);
}

.rival-card {
  border-color: rgba(245, 185, 66, 0.25);
}

.ai-thought-badge {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 3px 6px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  width: 100%;
  max-width: 220px;
  box-sizing: border-box;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ai-thought-badge.is-thinking {
  color: #fde68a;
  border-color: rgba(245, 185, 66, 0.68);
  background: rgba(245, 185, 66, 0.16);
  font-weight: 600;
}

.ai-thought-badge.is-llm {
  border-color: rgba(56, 189, 248, 0.52);
  color: #bae6fd;
}

.combo-tactic-tag {
  font-size: 0.62rem;
  color: #93c5fd;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#player-west {
  grid-area: west;
  align-self: center;
}

#player-east {
  grid-area: east;
  align-self: center;
}

#player-south {
  grid-area: south;
}

.player-area {
  background: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-area.active-turn {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(245, 185, 66, 0.3);
}

.opponent-card {
  text-align: center;
}

.seat-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 22px;
  min-height: 22px;
}

.north-info-col {
  min-width: 0;
  max-width: 220px;
}

.north-info-col .seat-title-row {
  justify-content: flex-start;
}

.south-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  height: 24px;
  min-height: 24px;
}

.seat-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 轮到出牌/操作座位旁的动态按秒读秒计时小图标（固定行高不撑高父容器） */
.turn-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px 0 5px;
  box-sizing: border-box;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  color: #1c1917;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  border: 1px solid #fef08a;
  box-shadow: 0 0 10px rgba(245, 185, 66, 0.52);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  animation: turn-timer-pulse 1.6s ease-in-out infinite;
}

.turn-timer-badge.is-self-timer {
  height: 21px;
  padding: 0 8px 0 6px;
  font-size: 0.78rem;
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.65);
}

.turn-timer-badge.is-long-think {
  color: #ffffff;
  background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.65);
}

.turn-timer-icon {
  width: 12.5px;
  height: 12.5px;
  flex-shrink: 0;
  display: block;
}

.turn-timer-seconds {
  min-width: 2ch;
  text-align: right;
  letter-spacing: 0.2px;
}

@keyframes turn-timer-pulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.09);
  }
}

.seat-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.remaining-count-num {
  display: inline-block;
  line-height: 1;
  vertical-align: baseline;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 4px;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.remaining-count-num.warn-yellow {
  color: #facc15;
  font-weight: 900;
  font-size: 1.06em;
  line-height: 1;
  background: rgba(250, 204, 21, 0.16);
  padding: 1px 5px;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.45);
}

.remaining-count-num.warn-red {
  color: #ff4d4f;
  font-weight: 900;
  font-size: 1.1em;
  line-height: 1;
  background: rgba(239, 68, 68, 0.22);
  padding: 1px 5px;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.48);
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
}

/* AI 对手手牌背面堆叠牌摞 */
.card-back-stack {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  height: 34px;
  padding-left: 10px;
}

#player-north .card-back-stack {
  margin-top: 0;
}

.card-back {
  width: 24px;
  height: 34px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    135deg,
    #1e3a8a 0px,
    #1e3a8a 4px,
    #2563eb 4px,
    #2563eb 8px
  );
  border: 1.5px solid #e2e8f0;
  box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.35);
  margin-left: -17px;
  flex-shrink: 0;
}

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

/* 牌桌中央出牌区 */
.table-center {
  grid-area: center;
  background: rgba(10, 28, 15, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 215px;
}

.table-status {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffe08a;
  background: rgba(0, 0, 0, 0.28);
  padding: 0 12px;
  height: 30px;
  min-height: 30px;
  line-height: 30px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.center-slots {
  flex: 1;
  display: grid;
  grid-template-areas:
    ". north ."
    "west . east"
    ". south .";
  grid-template-columns: 1fr 1.1fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  align-items: center;
}

.slot-north { grid-area: north; }
.slot-west { grid-area: west; }
.slot-east { grid-area: east; }
.slot-south { grid-area: south; }

.play-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 82px;
}

.slot-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* 桌面已打出牌 —— 与我的手牌(.card)完全等大（48×70px），横向层叠露出角标 */
.played-cards {
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  min-height: 70px;
  position: relative;
}

.played-stack-badge {
  margin-left: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(245, 185, 66, 0.18);
  border: 1px solid rgba(245, 185, 66, 0.45);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.pass-tag {
  font-size: 0.82rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 10px;
  border-radius: 999px;
}

.mini-card {
  position: relative;
  width: 48px;
  height: 70px;
  background: #ffffff;
  color: #1f2937;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2px 3.5px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.28);
  margin-left: -27px;
  flex-shrink: 0;
  user-select: none;
}

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

.mini-card.wildcard::after {
  content: "配";
  position: absolute;
  top: 2px;
  left: 16px;
  font-size: 0.5rem;
  background: #ef4444;
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
  line-height: 1.2;
}

.mini-card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 0.98;
  font-size: 0.82rem;
  min-width: 14px;
  text-align: center;
}

.mini-card-suit-sm {
  font-size: 0.74rem;
  line-height: 1;
  margin-top: 1px;
}

.mini-card-center {
  align-self: flex-end;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.88;
}

/* 南家（我）手牌区 —— 堆叠紧凑布局 */
#coach-advice-popover {
  position: absolute;
  z-index: 30;
  bottom: 50%;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(26rem, 96%);
  max-height: 45vh;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  border: 1px solid var(--accent-gold);
  border-radius: 12px;
  color: #f8fafc;
  background: #162337;
  box-shadow: 0 6px 24px #0006;
}

#coach-advice-popover p, #coach-reasons { margin: 0.35rem 0; }
#coach-reasons { padding-inline-start: 1.3rem; }
#coach-advice-popover:not([hidden]) { display: flex; flex-direction: column; }
#coach-advice-popover > [aria-live] { overflow-y: auto; min-height: 0; }
.coach-actions { display: flex; flex-shrink: 0; gap: 0.5rem; }

.south-area {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.south-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.south-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.south-header .seat-meta {
  margin-top: 0;
  margin-left: 4px;
  flex-shrink: 0;
}

.south-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.selected-info {
  font-size: 0.85rem;
  color: #fde68a;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 南家牌区右上角：按住速看当前剩余牌按钮（按下即显、松手即隐） */
.btn-hold-remaining {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.72);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(15, 23, 42, 0.85));
  color: #fef08a;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(254, 240, 138, 0.14);
  transition: transform 0.08s ease, background 0.12s ease, box-shadow 0.12s ease;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn-hold-remaining:hover {
  border-color: #fde047;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.42), rgba(15, 23, 42, 0.92));
}

.btn-hold-remaining.is-holding,
.btn-hold-remaining:active {
  transform: scale(0.96);
  border-color: #fef08a;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0b1c10;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.34), 0 4px 12px rgba(0, 0, 0, 0.45);
}

.hold-rem-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.hold-rem-text {
  white-space: nowrap;
}

/* 按住速看当前剩余牌 —— 浮层面板（纯只读透传 pointer-events: none，整体上移至牌桌中上部，留足底部手牌与按住按钮空间防手指遮挡） */
.quick-remaining-popover {
  position: fixed;
  inset: 0;
  z-index: 1650;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 36px 12px 215px;
  background: rgba(6, 18, 10, 0.56);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.quick-remaining-card {
  width: min(680px, calc(100vw - 20px));
  max-height: calc(100dvh - 255px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(11, 34, 19, 0.98) 0%, rgba(7, 22, 12, 0.98) 100%);
  border: 1.5px solid rgba(250, 204, 21, 0.72);
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.68);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-remaining-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.quick-remaining-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fef08a;
}

.quick-remaining-meta {
  font-size: 0.76rem;
  font-weight: 700;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.48);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.quick-remaining-matrix {
  gap: 6px;
}

.quick-remaining-matrix .rem-zone-row {
  padding: 6px 8px;
  gap: 5px;
}

.quick-remaining-matrix .rem-zone-header {
  padding-bottom: 2px;
}

.quick-remaining-matrix .rem-zone-title {
  font-size: 0.74rem;
}

.quick-remaining-matrix .rem-zone-hint {
  font-size: 0.66rem;
}

.quick-remaining-matrix .rem-row-four-grid {
  gap: 6px;
}

.quick-remaining-matrix .rem-card-cell {
  padding: 6px 6px 5px;
  gap: 3px;
}

.quick-remaining-matrix .rem-graphic-card {
  width: 30px;
  height: 43px;
}

.quick-remaining-matrix .rem-count-big {
  font-size: 1.24rem;
}

.quick-remaining-foot {
  font-size: 0.72rem;
  color: #cbd5e1;
  text-align: center;
  opacity: 0.9;
}

/* 模式 1（默认）：掼蛋经典同点数纵向叠列 + 列间更紧凑层叠 */
.hand-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  padding: 14px 8px 4px;
  min-height: 132px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hand-row.mode-columns {
  gap: 0;
}

.card-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  isolation: isolate;
  width: 48px;
  margin-left: var(--dynamic-col-step, -22px);
  flex-shrink: 0;
  transition: margin 0.14s ease, transform 0.14s ease;
}

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

@media (hover: hover) and (pointer: fine) {
  .card-column:hover {
    z-index: 60;
  }
}

.card-count-pill {
  position: absolute;
  bottom: 2px;
  left: 3px;
  z-index: 30;
  background: rgba(15, 23, 42, 0.88);
  color: #fde68a;
  border: 1px solid rgba(245, 185, 66, 0.65);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0 3.5px;
  line-height: 1.25;
  pointer-events: none;
}

/* 同列紧凑纵向堆叠：上层牌切片 31px，重叠 -4px（净步进 27px），完整露出数字+正下方花色且中心独立可点。
   注意：绝不在选中/悬停时覆盖同列内部纵向 --stack-index 层级，避免上层切片反压下层牌顶边造成残影与截断 */
.hand-row.mode-columns .card {
  position: relative;
  z-index: calc(var(--stack-index, 0) + 1);
  justify-content: flex-start;
  gap: 2px;
}

.hand-row.mode-columns .card:not(:last-of-type) {
  height: 31px;
  margin-top: -4px;
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
  overflow: hidden;
}

.hand-row.mode-columns .card:first-of-type:not(:last-of-type) {
  margin-top: 0;
}

.hand-row.mode-columns .card:last-of-type:not(:first-of-type) {
  margin-top: -4px;
}

.hand-row.mode-columns .card:not(:last-of-type) .card-center-suit {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .hand-row.mode-columns .card:not(.selected):not(.tribute-disabled):hover {
    transform: translateX(3px) translateY(-2px);
  }
}

.hand-row.mode-columns .card.selected {
  transform: translateX(6px) translateY(-4px);
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #f59e0b, 0 5px 12px rgba(245, 158, 11, 0.48);
}

/* 模式 2（可切换）：横向更紧凑叠扇（单张仅露出左侧 19px 竖排数字+花色） */
.hand-row.mode-fan {
  min-height: 96px;
  align-items: center;
  padding: 14px 10px 4px;
}

.hand-row.mode-fan .card {
  position: relative;
  margin-left: var(--dynamic-fan-step, -29px);
  flex-shrink: 0;
}

.hand-row.mode-fan .card:first-child {
  margin-left: 0;
}

@media (hover: hover) and (pointer: fine) {
  .hand-row.mode-fan .card:not(.selected):not(.tribute-disabled):hover {
    transform: translateY(-7px);
  }
}

.hand-row.mode-fan .card.selected {
  transform: translateY(-14px);
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #f59e0b, 0 8px 16px rgba(245, 158, 11, 0.42);
}

/* 单张扑克牌通用样式：花色紧贴在数字正下方（经典真牌角标），保持 1.5px 恒定边框避免选/退选 1px 抖动 */
.card {
  position: relative;
  width: 48px;
  height: 70px;
  box-sizing: border-box;
  background: #ffffff;
  color: #1f2937;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2px 3.5px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
  box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.28);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.card:focus {
  outline: none;
}

.card:focus-visible {
  box-shadow: 0 0 0 2px #38bdf8, -2px 2px 5px rgba(0, 0, 0, 0.28);
}

.card.is-drag-swept {
  box-shadow: 0 0 0 2.5px rgba(56, 189, 248, 0.85), 0 6px 14px rgba(14, 165, 233, 0.45);
}

.card.wildcard::after {
  content: "配";
  position: absolute;
  top: 2px;
  left: 16px;
  font-size: 0.5rem;
  background: #ef4444;
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
  line-height: 1.2;
}

.card.tribute-eligible {
  border-color: #10b981;
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1px #10b981, 0 0 0 2px rgba(16, 185, 129, 0.32), -2px 2px 5px rgba(0, 0, 0, 0.28);
}

.card.tribute-eligible.selected {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #f59e0b, 0 5px 12px rgba(245, 158, 11, 0.52);
}

/* 进贡/还贡不可选牌：使用 100% 不透明哑光石板灰牌面，彻底消除叠牌时下层花色/边框/阴影透出造成的发花现象 */
.card.tribute-disabled {
  opacity: 1;
  background: #cfd8e3;
  border-color: #94a3b8;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: -1px 1px 3px rgba(15, 23, 42, 0.24);
}

.card.tribute-disabled .card-rank,
.card.tribute-disabled .card-suit-inline,
.card.tribute-disabled .card-center-suit {
  color: #64748b;
  opacity: 0.82;
}

.card.tribute-disabled.suit-heart .card-rank,
.card.tribute-disabled.suit-heart .card-suit-inline,
.card.tribute-disabled.suit-heart .card-center-suit,
.card.tribute-disabled.suit-diamond .card-rank,
.card.tribute-disabled.suit-diamond .card-suit-inline,
.card.tribute-disabled.suit-diamond .card-center-suit,
.card.tribute-disabled.red-joker .card-rank,
.card.tribute-disabled.red-joker .card-suit-inline,
.card.tribute-disabled.red-joker .card-center-suit {
  color: #8c6268;
}

.card.tribute-disabled.wildcard::after {
  background: #7c8ba1;
  color: #e2e8f0;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 0.98;
  min-width: 14px;
  text-align: center;
}

.card-rank {
  font-size: 0.82rem;
  letter-spacing: -0.4px;
}

.card-rank.is-joker {
  font-size: 0.64rem;
  line-height: 1.02;
}

.card-suit-inline {
  font-size: 0.74rem;
  line-height: 1;
  margin-top: 1px;
}

.card-center-suit {
  align-self: flex-end;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.88;
}

.suit-heart,
.suit-diamond,
.red-joker {
  color: #dc2626;
}

.suit-club {
  color: #15803d;
}

.suit-spade,
.suit-joker {
  color: #111827;
}

.action-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 7px 14px;
  background: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.action-row-primary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  gap: 12px;
}

#btn-pass,
#btn-clear,
#btn-suggest,
#btn-play,
#btn-tribute,
#btn-return-tribute {
  width: 100%;
  min-width: 0;
}

.winner-overlay,
.history-modal,
.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 18px;
  z-index: 2000;
}

.winner-card {
  background: #122b18;
  border: 2px solid var(--accent-gold);
  border-radius: 16px;
  padding: 24px 32px;
  text-align: center;
  max-width: min(640px, 94vw);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.winner-card h2 {
  margin: 0 0 10px;
  color: #fef08a;
  font-size: 1.45rem;
}

.winner-card p {
  margin: 6px 0;
  line-height: 1.5;
  color: #e2e8f0;
}

.winner-my-rank-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px auto 10px;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.32), rgba(234, 88, 12, 0.28));
  border: 1.5px solid #facc15;
  color: #fef9c3;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.32);
}

.winner-rank-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.winner-rank-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #cbd5e1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.winner-rank-place {
  opacity: 0.92;
  white-space: nowrap;
}

.winner-rank-who {
  font-weight: 700;
  color: #f8fafc;
}

.winner-rank-pill.rank-1 {
  background: rgba(245, 185, 66, 0.18);
  border-color: rgba(245, 185, 66, 0.65);
  color: #fef08a;
}

.winner-rank-pill.is-my-rank {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.34), rgba(16, 185, 129, 0.34));
  border: 2px solid #fde047;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(253, 224, 71, 0.28), 0 8px 20px rgba(0, 0, 0, 0.38);
  transform: scale(1.02);
}

.winner-rank-pill.is-my-rank .winner-rank-place,
.winner-rank-pill.is-my-rank .winner-rank-who {
  color: #fef9c3;
  font-weight: 800;
}

.winner-my-rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #facc15;
  color: #142619;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

.winner-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

/* 全部轮次记录弹窗 */
.history-modal-card {
  background: #0f2916;
  border: 1.5px solid rgba(245, 185, 66, 0.58);
  border-radius: 14px;
  width: min(1060px, 94vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.history-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 24, 13, 0.85);
}

.history-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #fde68a;
}

.history-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-modal-body .round-card {
  width: 100%;
}

.history-modal-body .round-combos {
  flex-wrap: wrap;
  row-gap: 6px;
}

/* 对局与模型配置弹窗（桌面端与手机端统一入口） */
.settings-modal-card {
  background: #0f2916;
  border: 1.5px solid rgba(245, 185, 66, 0.58);
  border-radius: 14px;
  width: min(490px, 94vw);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 24, 13, 0.88);
  flex-shrink: 0;
}

.settings-modal-header h2 {
  margin: 0;
  font-size: 1rem;
  color: #fde68a;
}

.settings-modal-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  user-select: text;
}

.settings-group-card {
  background: rgba(8, 24, 13, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

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

.settings-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fef08a;
}

.settings-status-pill {
  font-size: 0.7rem;
  padding: 1.5px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #a7f3d0;
  font-weight: 700;
  white-space: nowrap;
}

.cfg-custom-llm-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(15, 41, 22, 0.78);
  border: 1px dashed rgba(245, 185, 66, 0.45);
}

.cfg-key-hint {
  font-size: 0.72rem;
  color: #6ee7b7;
  font-weight: 600;
  margin-left: 4px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-field select,
.settings-field input {
  width: 100%;
  background: #0b2011;
  color: var(--text-color);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.88rem;
  user-select: text;
  -webkit-user-select: text;
}

.settings-field input:focus,
.settings-field select:focus {
  outline: 1.5px solid rgba(245, 185, 66, 0.75);
  border-color: rgba(245, 185, 66, 0.75);
}

.settings-apply-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.settings-inline-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-inline-buttons.settings-table-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-inline-buttons .btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.settings-actions .btn {
  width: 100%;
  padding: 9px 14px;
}

/* =========================================================================
   独立可上下滑动全屏「信息页」样式（桌面端与手机竖屏端自适应）
   ========================================================================= */
.info-page {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: radial-gradient(circle at top, #173f22 0%, #0b2011 100%);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.info-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(8, 24, 13, 0.94);
  border-bottom: 1px solid rgba(245, 185, 66, 0.45);
  flex-shrink: 0;
}

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

.info-page-header h2 {
  margin: 0;
  font-size: 1.12rem;
  color: #fde68a;
}

.info-page-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.info-page-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.info-section {
  background: rgba(12, 33, 18, 0.84);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-section-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #fef08a;
}

.info-section-meta {
  font-size: 0.78rem;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}

.info-section-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* 一、剩余牌数量 4×4 空间记忆定位盘（四排分区 + 恒定四列坐标 + 4+4 分段圆点 + 盖牌自测） */
.info-rem-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-rem-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.rem-legend-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  white-space: nowrap;
}

.rem-legend-pill.is-level {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.14);
  color: #bae6fd;
}

.rem-legend-pill.is-pivot {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
}

.rem-legend-pill.is-bomb {
  border-color: rgba(245, 185, 66, 0.65);
  background: rgba(245, 185, 66, 0.15);
  color: #fde68a;
}

.rem-legend-pill.is-void {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
  color: #94a3b8;
}

.info-remaining-matrix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rem-zone-row {
  border-radius: 11px;
  padding: 8px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rem-zone-row.zone-trump_core {
  border-left: 4px solid #f87171;
  background: linear-gradient(90deg, rgba(185, 28, 28, 0.16), rgba(15, 23, 42, 0.34));
}

.rem-zone-row.zone-high_court {
  border-left: 4px solid #fbbf24;
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.14), rgba(15, 23, 42, 0.34));
}

.rem-zone-row.zone-mid_pivot {
  border-left: 4px solid #34d399;
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.14), rgba(15, 23, 42, 0.34));
}

.rem-zone-row.zone-low_tail {
  border-left: 4px solid #60a5fa;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.14), rgba(15, 23, 42, 0.34));
}

.rem-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.rem-zone-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.2px;
}

.rem-zone-hint {
  font-size: 0.7rem;
  color: rgba(226, 232, 240, 0.72);
}

/* 无论桌面宽屏还是手机竖屏，严格固定 4 列一排，确保 16 格空间坐标永久恒定 */
.rem-row-four-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.rem-card-cell {
  position: relative;
  appearance: none;
  font-family: inherit;
  text-align: left;
  color: inherit;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 10px;
  padding: 9px 10px 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

button.rem-card-cell {
  cursor: pointer;
}

button.rem-card-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(253, 224, 71, 0.72);
}

.rem-card-cell.is-wild {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(248, 113, 113, 0.62);
}

.rem-card-cell.is-level-slot {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.rem-card-cell.is-pivot-slot:not(.is-zero) {
  border-color: rgba(52, 211, 153, 0.5);
}

.rem-card-cell.is-bomb-alert {
  border-color: rgba(245, 185, 66, 0.85);
  box-shadow: inset 0 0 0 1px rgba(245, 185, 66, 0.28);
}

.rem-card-cell.is-zero {
  opacity: 0.38;
  background: rgba(2, 6, 23, 0.46);
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.32);
}

.rem-card-cell.is-quiz-masked {
  background: rgba(30, 41, 59, 0.74);
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.55);
}

.rem-card-cell.is-quiz-peeked {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.35);
}

.rem-landmark-tag {
  position: absolute;
  top: -7px;
  right: 6px;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.15;
  padding: 1px 5px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  white-space: nowrap;
  z-index: 2;
}

.rem-landmark-tag.is-level-tag {
  background: #0369a1;
  border-color: #38bdf8;
  color: #f0f9ff;
}

.rem-landmark-tag.is-pivot-tag {
  background: #065f46;
  border-color: #34d399;
  color: #ecfdf5;
}

.rem-cell-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.rem-card-visual-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-readonly-card {
  cursor: default;
  pointer-events: none;
}

.rem-graphic-card {
  width: 38px;
  height: 54px;
  padding: 2px 3px;
  border-radius: 5px;
  position: relative;
  box-shadow: -1px 2px 5px rgba(0, 0, 0, 0.35);
}

.rem-graphic-card .card-rank {
  font-size: 0.8rem;
}

.rem-graphic-card .card-rank.is-joker {
  font-size: 0.6rem;
}

.rem-graphic-card .card-suit-inline {
  font-size: 0.64rem;
}

.rem-graphic-card.is-multi-suit .card-suit-inline {
  font-size: 0.48rem;
  letter-spacing: -0.5px;
  color: #475569;
}

.rem-graphic-card .card-center-suit {
  font-size: 0.9rem;
}

.rem-graphic-card.is-multi-suit .card-center-suit {
  font-size: 0.6rem;
  letter-spacing: -0.5px;
  color: #dc2626;
  opacity: 0.8;
}

.rem-stat-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.rem-count-prominent {
  display: flex;
  align-items: baseline;
  gap: 2px;
  line-height: 1;
}

.rem-count-big {
  font-size: 1.52rem;
  font-weight: 900;
  color: #fde047;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.rem-card-cell.is-wild .rem-count-big {
  color: #fca5a5;
}

.rem-card-cell.is-level-slot .rem-count-big {
  color: #7dd3fc;
}

.rem-card-cell.is-zero .rem-count-big {
  color: #94a3b8;
  text-shadow: none;
}

.rem-card-cell.is-quiz-masked .rem-count-big {
  color: #cbd5e1;
  text-shadow: none;
}

.rem-count-total-sm {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.68);
  white-space: nowrap;
}

.rem-sub-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.rem-card-cell.is-bomb-alert .rem-sub-label {
  color: #fde68a;
  font-weight: 700;
}

.rem-card-cell.is-quiz-masked .rem-sub-label {
  color: #93c5fd;
  font-weight: 600;
}

/* 4+4 分段圆点条：利用视觉直觉数量感（Subitizing <=4）一眼识别可成炸与余量密度 */
.rem-pip-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 8px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rem-pip-group {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
}

.rem-pip-sep {
  width: 1px;
  height: 7px;
  background: rgba(255, 255, 255, 0.25);
}

.rem-pip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.rem-pip-dot.is-lit {
  background: #38bdf8;
  border-color: #7dd3fc;
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.45);
}

.rem-pip-dot.is-lit.is-bomb-lit {
  background: #fbbf24;
  border-color: #fde68a;
  box-shadow: 0 0 5px rgba(251, 191, 36, 0.6);
}

.rem-card-cell.is-wild .rem-pip-dot.is-lit {
  background: #f87171;
  border-color: #fecaca;
  box-shadow: 0 0 5px rgba(248, 113, 113, 0.55);
}

.rem-pip-bar.is-masked .rem-pip-dot {
  background: rgba(148, 163, 184, 0.16);
  border-style: dashed;
}

/* 二、AI 每家最可能手牌推演卡片（支持同点叠列 / 紧凑叠扇切换） */
.info-ai-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-layout-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.btn-switch-pill {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.info-layout-switch.is-compact .btn-switch-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
}

.btn-switch-pill.is-active {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.info-ai-hands-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-infer-card {
  background: rgba(9, 25, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-infer-card.is-teammate {
  border-color: rgba(56, 189, 248, 0.45);
}

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

.ai-infer-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-infer-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: #f8fafc;
}

.ai-infer-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #a7f3d0;
}

.ai-infer-status.is-insufficient {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

.ai-insufficient-box {
  background: rgba(127, 29, 29, 0.28);
  border: 1px dashed rgba(248, 113, 113, 0.55);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-insufficient-label {
  font-size: 0.96rem;
  font-weight: 800;
  color: #fca5a5;
}

.ai-insufficient-desc {
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.info-ai-hand-row {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 8px 6px;
  min-height: 98px;
  justify-content: flex-start;
  overflow-x: auto;
}

.info-ai-hand-row.mode-fan {
  min-height: 76px;
  padding: 8px 10px;
}

.info-ai-hand-row .card-column {
  width: 42px;
  margin-left: var(--dynamic-col-step, -18px);
}

.info-ai-hand-row .card-column:first-child {
  margin-left: 0;
}

.info-ai-hand-row .info-readonly-card {
  width: 42px;
  height: 60px;
  padding: 2px 3px;
  border-radius: 5px;
}

.info-ai-hand-row.mode-columns .info-readonly-card:not(:last-of-type) {
  height: 27px;
  margin-top: -4px;
}

.info-ai-hand-row.mode-fan .info-readonly-card {
  margin-left: var(--dynamic-fan-step, -24px);
}

.info-ai-hand-row.mode-fan .info-readonly-card:first-child {
  margin-left: 0;
}

.ai-infer-reasons {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #d1fae5;
  line-height: 1.42;
}

/* 三、信息页内的每轮出牌列表 */
.info-rounds-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-rounds-list .round-card {
  width: 100%;
}

.info-rounds-list .round-combos {
  flex-wrap: wrap;
  row-gap: 6px;
}

/* =========================================================================
   手机竖屏专属版面重构（<= 768px）：一屏容纳三家AI + 牌桌四槽 + 完整手牌 + 底部大触控按钮
   ========================================================================= */
@media (max-width: 768px) {
  html,
  body {
    height: 100dvh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .game-container {
    min-height: 100dvh;
    height: 100dvh;
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 5px;
    justify-content: space-between;
  }

  /* 1. 顶部精简状态栏：单行横向排布「玩法下拉 + 第几局比分与庄级 + 右侧快捷按钮」 */
  .top-bar {
    padding: 4px 6px;
    gap: 4px;
    border-radius: 8px;
    flex-wrap: nowrap;
    align-items: center;
    min-height: 34px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .game-variant-select {
    padding: 2px 4px;
    font-size: 0.72rem;
    border-radius: 6px;
  }

  .brand h1 {
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .home-brand-title {
    font-size: 0.74rem;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.15px;
  }

  .version-tag {
    display: inline-flex;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 999px;
  }

  .brand-badges {
    gap: 3px;
    min-width: 0;
  }

  .badge {
    font-size: 0.65rem;
    padding: 1.5px 5px;
    white-space: nowrap;
  }

  .level-rank-mark {
    padding: 0 3px;
    margin: 0 0.5px;
  }

  .setup-panel {
    display: none;
  }

  .mobile-quick-actions {
    display: flex;
    flex-shrink: 0;
    align-self: center;
    gap: 3px;
  }

  .mobile-quick-actions .btn-xs {
    padding: 3px 5.5px;
    font-size: 0.68rem;
  }

  .toast-message {
    top: 96px;
    max-width: 92vw;
    font-size: 0.78rem;
    padding: 5px 12px;
    white-space: normal;
    text-align: center;
  }

  /* 2. 近期轮次精简栏压缩为高信息密度单行条 */
  .round-history-bar {
    padding: 3px 6px;
    gap: 6px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .history-bar-left {
    min-width: 68px;
    max-width: 86px;
    gap: 1px;
  }

  .history-bar-title {
    font-size: 0.7rem;
  }

  .history-summary {
    font-size: 0.62rem;
  }

  .round-history-list {
    height: 71px;
    min-height: 71px;
    max-height: 71px;
    gap: 5px;
    padding-bottom: 1px;
    box-sizing: border-box;
  }

  .history-empty {
    font-size: 0.68rem;
    padding: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .round-card {
    padding: 2px 5px;
    gap: 2px;
    border-radius: 6px;
  }

  .round-card-title {
    font-size: 0.62rem;
    gap: 4px;
  }

  .combo-group {
    padding: 1.5px 4px;
    gap: 1px;
  }

  .combo-meta {
    font-size: 0.58rem;
  }

  .combo-tactic-tag {
    display: none;
  }

  .history-mini-card {
    width: 21px;
    height: 29px;
    margin-left: -11px;
    padding: 1px 2px;
  }

  .history-mini-card.combo-subgap {
    margin-left: -5px;
  }

  .history-mini-card .mini-card-corner {
    font-size: 0.54rem;
  }

  .history-mini-card .mini-card-suit-sm {
    font-size: 0.48rem;
  }

  #btn-open-all-rounds {
    padding: 3px 7px;
    font-size: 0.68rem;
  }

  /* 进贡条压缩 */
  .tribute-banner {
    padding: 4px 8px;
    gap: 4px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .tribute-banner-text {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .tribute-record-chip {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  /* 3. 主牌桌竖屏三段式网格：
        第1行：西家(左) · 北家对家(中) · 东家(右) 并排三列紧凑对手状态栏
        第2行：全宽中央四方出牌桌面（100% 手机宽度给打出的牌）
        第3行：全宽南家我的手牌区 */
  .grid-table {
    grid-template-areas:
      "west north east"
      "center center center"
      "south south south";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(128px, 1fr) auto;
    gap: 5px;
    min-height: 0;
  }

  .seat-name-full {
    display: none;
  }

  .seat-name-compact {
    display: inline;
  }

  #player-north,
  #player-west,
  #player-east {
    min-width: 0;
    width: 100%;
    align-self: stretch;
    justify-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 4px 5px;
    border-radius: 8px;
  }

  .north-info-col {
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
  }

  .north-info-col .seat-title-row {
    justify-content: center;
  }

  .seat-title-row {
    gap: 3px;
    flex-wrap: nowrap;
    height: 18px;
    min-height: 18px;
  }

  .opponent-card .seat-title {
    font-size: 0.72rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  .opponent-card .turn-timer-badge {
    height: 16px;
    font-size: 0.62rem;
    padding: 0 5px 0 3.5px;
    gap: 2px;
  }

  .opponent-card .turn-timer-icon {
    width: 10px;
    height: 10px;
  }

  .opponent-card .seat-meta {
    font-size: 0.66rem;
    line-height: 15px;
    height: 15px;
    min-height: 15px;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .card-back-stack {
    display: none;
  }

  /* 在手机竖屏正式出牌阶段，进贡已完成提示自动收起，省出宝贵纵向空间给牌桌与手牌 */
  .tribute-banner.is-settled {
    display: none;
  }

  .ai-thought-badge {
    margin-top: 2px;
    font-size: 0.6rem;
    line-height: 1.22;
    padding: 2px 4px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* 4. 中央桌面全宽紧凑四方位出牌槽 */
  .table-center {
    min-height: 128px;
    padding: 6px 8px;
    gap: 4px;
    border-radius: 10px;
    justify-content: space-between;
  }

  .table-status {
    font-size: 0.73rem;
    padding: 0 8px;
    height: 23px;
    min-height: 23px;
    line-height: 23px;
    border-radius: 6px;
  }

  .center-slots {
    grid-template-areas:
      "north north"
      "west east"
      "south south";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 3px 6px;
  }

  .play-slot {
    min-height: 64px;
    gap: 1px;
  }

  .slot-label {
    font-size: 0.62rem;
  }

  .played-cards {
    min-height: 60px;
  }

  /* 手机竖屏已打出牌：与我的手牌(.card 42×60px)完全等大 */
  .mini-card {
    width: 42px;
    height: 60px;
    margin-left: -24px;
    padding: 2px 3px;
    border-radius: 5px;
  }

  .mini-card.combo-subgap {
    margin-left: -10px;
  }

  .mini-card-corner {
    font-size: 0.76rem;
    min-width: 12px;
  }

  .mini-card-rank {
    font-size: 0.76rem;
  }

  .mini-card-rank.is-joker {
    font-size: 0.58rem;
  }

  .mini-card-suit-sm {
    font-size: 0.66rem;
  }

  .mini-card-center {
    font-size: 0.9rem;
  }

  .played-stack-badge {
    margin-left: 4px;
    font-size: 0.62rem;
    padding: 1px 5px;
  }

  .pass-tag {
    font-size: 0.7rem;
    padding: 1.5px 8px;
  }

  /* 5. 南家我的手牌区 —— 竖屏拇指触控友好 + 动态等比紧缩 */
  .south-area {
    padding: 6px 6px 7px;
    gap: 3px;
    border-radius: 10px;
  }

  .south-header {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .south-title-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    height: 20px;
    min-height: 20px;
  }

  .south-header .seat-title {
    font-size: 0.78rem;
  }

  .south-header .turn-timer-badge.is-self-timer {
    height: 18px;
    font-size: 0.68rem;
    padding: 0 6px 0 4px;
    gap: 2.5px;
  }

  .south-header .turn-timer-icon {
    width: 11px;
    height: 11px;
  }

  .south-header .seat-meta {
    font-size: 0.7rem;
    line-height: 16px;
    height: 16px;
    min-height: 16px;
    margin-top: 0;
    margin-left: 3px;
  }

  .south-header-right {
    gap: 5px;
  }

  .selected-info {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .btn-hold-remaining {
    padding: 3px 8px;
    font-size: 0.68rem;
    gap: 3.5px;
  }

  .hold-rem-icon {
    width: 11.5px;
    height: 11.5px;
  }

  .quick-remaining-popover {
    align-items: flex-start;
    padding: 32px 6px 225px;
  }

  .quick-remaining-card {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 260px);
    padding: 7px 8px 6px;
    gap: 4px;
    border-radius: 12px;
  }

  .quick-remaining-title {
    font-size: 0.76rem;
  }

  .quick-remaining-meta {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .quick-remaining-matrix {
    gap: 3px;
  }

  .quick-remaining-matrix .rem-zone-row {
    padding: 3px 5px;
    gap: 2.5px;
  }

  .quick-remaining-matrix .rem-zone-hint {
    display: none;
  }

  .quick-remaining-matrix .rem-row-four-grid {
    gap: 4px;
  }

  .quick-remaining-matrix .rem-card-cell {
    padding: 4px 4px 3px;
    gap: 1.5px;
  }

  .quick-remaining-matrix .rem-graphic-card {
    width: 22px;
    height: 31px;
  }

  .quick-remaining-matrix .rem-count-big {
    font-size: 0.98rem;
  }

  .quick-remaining-foot {
    font-size: 0.62rem;
  }

  .settings-inline-buttons.settings-table-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-inline-buttons.settings-table-buttons #btn-settings-open-table-modal {
    grid-column: 1 / -1;
  }

  .hand-row {
    min-height: 112px;
    padding: 10px 4px 2px;
  }

  .card-column {
    width: 42px;
    margin-left: var(--dynamic-col-step, -16px);
  }

  .card {
    width: 42px;
    height: 60px;
    padding: 2px 3px;
    border-radius: 5px;
  }

  .card-rank {
    font-size: 0.76rem;
  }

  .card-rank.is-joker {
    font-size: 0.58rem;
  }

  .card-suit-inline {
    font-size: 0.66rem;
  }

  .card-center-suit {
    font-size: 0.9rem;
  }

  .hand-row.mode-columns .card:not(:last-of-type) {
    height: 27px;
    margin-top: -4px;
  }

  .hand-row.mode-columns .card.selected {
    transform: translateX(4px) translateY(-4px);
  }

  .hand-row.mode-fan {
    min-height: 82px;
    padding: 12px 6px 2px;
  }

  .hand-row.mode-fan .card {
    margin-left: var(--dynamic-fan-step, -26px);
  }

  .hand-row.mode-fan .card.selected {
    transform: translateY(-11px);
  }

  /* 6. 底部单行四按钮操作栏：过牌 · 清空选牌 · AI建议 · 出牌 */
  .action-bar {
    flex-direction: row;
    align-items: center;
    padding: 5px 6px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .action-row-primary {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    gap: 5px;
  }

  #btn-pass,
  #btn-clear,
  #btn-suggest,
  #btn-play,
  #btn-tribute,
  #btn-return-tribute {
    min-width: 0;
  }

  .action-row-primary .btn {
    flex: 1 1 0;
    min-height: 38px;
    padding: 7px 4px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .action-row-primary .btn-action {
    flex: 1.18 1 0;
    font-size: 0.88rem;
  }

  /* 弹窗适配手机小屏 */
  .winner-card {
    padding: 18px 16px;
    width: 94vw;
  }

  .winner-card h2 {
    font-size: 1.15rem;
  }

  .winner-card p {
    font-size: 0.84rem;
  }

  .winner-my-rank-banner {
    font-size: 0.82rem;
    padding: 5px 12px;
  }

  .winner-rank-list {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .winner-rank-pill {
    font-size: 0.8rem;
    padding: 7px 11px;
  }

  .winner-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }

  .winner-actions .btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  .winner-actions .btn:only-child,
  .winner-actions #btn-restart-match-overlay:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .history-modal-card {
    width: 95vw;
    max-height: 86dvh;
  }

  .history-modal-header {
    padding: 10px 12px;
  }

  .history-modal-header h2 {
    font-size: 0.92rem;
  }

  .history-modal-body {
    padding: 10px 10px;
  }

  .info-page-header {
    padding: 9px 12px;
  }

  .info-page-header h2 {
    font-size: 0.98rem;
  }

  .info-page-subtitle {
    font-size: 0.68rem;
  }

  .info-page-scroll {
    padding: 10px 10px calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }

  .info-section {
    padding: 10px 11px;
    gap: 8px;
  }

  .info-section-head h3 {
    font-size: 0.9rem;
  }

  /* 手机竖屏同样严格保持 4 张一排（4×4 空间坐标不跨端折行移位） */
  .rem-zone-row {
    padding: 7px 7px 8px;
    gap: 6px;
  }

  .rem-zone-title {
    font-size: 0.72rem;
  }

  .rem-zone-hint {
    font-size: 0.62rem;
  }

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

  .rem-card-cell {
    padding: 7px 5px 5px;
    gap: 4px;
    border-radius: 8px;
  }

  .rem-landmark-tag {
    top: -6px;
    right: 3px;
    font-size: 0.52rem;
    padding: 0.5px 3.5px;
  }

  .rem-cell-main {
    gap: 3px;
  }

  .rem-graphic-card {
    width: 28px;
    height: 41px;
    padding: 1px 2px;
    border-radius: 4px;
  }

  .rem-graphic-card .card-rank {
    font-size: 0.66rem;
  }

  .rem-graphic-card .card-rank.is-joker {
    font-size: 0.5rem;
  }

  .rem-graphic-card .card-suit-inline {
    font-size: 0.52rem;
  }

  .rem-graphic-card.is-multi-suit .card-suit-inline {
    font-size: 0.42rem;
  }

  .rem-graphic-card .card-center-suit {
    font-size: 0.72rem;
  }

  .rem-graphic-card.is-multi-suit .card-center-suit {
    font-size: 0.48rem;
  }

  .rem-count-big {
    font-size: 1.18rem;
  }

  .rem-count-total-sm {
    font-size: 0.56rem;
  }

  .rem-sub-label {
    font-size: 0.56rem;
  }

  .rem-pip-bar {
    gap: 2.5px;
    padding-top: 2px;
  }

  .rem-pip-group {
    gap: 1.5px;
  }

  .rem-pip-dot {
    width: 4.5px;
    height: 4.5px;
  }

  .ai-infer-card {
    padding: 10px 10px;
  }

  .info-ai-hand-row .card-column {
    width: 38px;
  }

  .info-ai-hand-row .info-readonly-card {
    width: 38px;
    height: 54px;
  }

  .info-ai-hand-row.mode-columns .info-readonly-card:not(:last-of-type) {
    height: 24px;
    margin-top: -4px;
  }
}

/* 超窄屏手机（如 iPhone SE / 360px 宽屏）进一步微调 */
@media (max-width: 390px) {
  .selected-info {
    max-width: 96px;
  }

  .card-column {
    width: 38px;
  }

  .card,
  .mini-card {
    width: 38px;
    height: 55px;
    padding: 1.5px 2.5px;
  }

  .mini-card {
    margin-left: -22px;
  }

  .mini-card.combo-subgap {
    margin-left: -9px;
  }

  .card-rank,
  .mini-card-rank {
    font-size: 0.72rem;
  }

  .card-suit-inline,
  .mini-card-suit-sm {
    font-size: 0.62rem;
  }

  .hand-row.mode-columns .card:not(:last-of-type) {
    height: 25px;
  }
}

/* =========================================================================
   v3.1.0 用户登录页、弹窗注册、图形验证码、记住我 & 6位牌桌码联机样式
   ========================================================================= */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background: radial-gradient(circle at 50% 30%, #205730 0%, #0f2b17 65%, #08180d 100%);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: rgba(10, 29, 16, 0.92);
  border: 1px solid rgba(245, 185, 66, 0.42);
  border-radius: 16px;
  padding: 24px 22px 22px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.52);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.auth-brand-badge {
  align-self: center;
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(245, 185, 66, 0.16);
  border: 1px solid rgba(245, 185, 66, 0.45);
  border-radius: 999px;
  padding: 3px 11px;
}

.auth-title {
  margin: 2px 0 0;
  font-size: 1.38rem;
  font-weight: 800;
  color: #f8fafc;
}

.auth-subtitle {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #d7e8dc;
}

.auth-field input,
.join-code-input-row input {
  width: 100%;
  background: rgba(6, 19, 10, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9px;
  padding: 9px 12px;
  color: #f8fafc;
  font-size: 0.92rem;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.auth-field input:focus,
.join-code-input-row input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(245, 185, 66, 0.22);
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-row input {
  flex: 1 1 auto;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.captcha-img-btn {
  flex-shrink: 0;
  width: 128px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(245, 185, 66, 0.42);
  border-radius: 8px;
  background: #0f241d;
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.captcha-img-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.auth-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.remember-me-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #dbe7df;
  cursor: pointer;
}

.remember-me-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2ea043;
  cursor: pointer;
}

.auth-link-btn {
  background: none;
  border: none;
  color: #fde047;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}

.auth-error-msg {
  background: rgba(229, 57, 53, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: #fecaca;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.auth-submit-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.auth-submit-btn {
  flex: 1 1 100%;
  width: 100%;
  min-height: 42px;
  font-size: 0.95rem;
  font-weight: 800;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(3, 12, 7, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal-card {
  width: 100%;
  max-width: 420px;
  background: #0e2817;
  border: 1px solid rgba(245, 185, 66, 0.48);
  border-radius: 15px;
  padding: 18px 20px 20px;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.62);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #fde68a;
}

/* 顶栏牌桌码徽章与用户胶囊 */
.table-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: rgba(245, 185, 66, 0.15);
  border: 1px solid rgba(245, 185, 66, 0.52);
  color: #fef08a;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
}

.table-code-badge:hover {
  background: rgba(245, 185, 66, 0.26);
}

.table-code-prefix {
  font-size: 0.7rem;
  opacity: 0.88;
}

.table-code-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fde047;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(46, 160, 67, 0.2);
  border: 1px solid rgba(110, 231, 183, 0.38);
  color: #d1fae5;
  font-size: 0.75rem;
  font-weight: 700;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-table-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(5, 18, 10, 0.72);
  border: 1px dashed rgba(245, 185, 66, 0.55);
  border-radius: 10px;
  padding: 10px 14px;
}

.modal-table-code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fde047;
  -webkit-user-select: text;
  user-select: text;
}

.join-code-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.join-code-input-row input {
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 2px;
  font-weight: 800;
}

.join-table-preview {
  background: rgba(8, 25, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.79rem;
  line-height: 1.45;
  color: #dbeafe;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 768px) {
  .auth-card {
    padding: 18px 16px;
    gap: 13px;
  }

  .auth-title {
    font-size: 1.2rem;
  }

  .table-code-prefix {
    display: none;
  }

  .table-code-badge {
    padding: 1.5px 5px;
    font-size: 0.64rem;
  }
}

/* =========================================================================
   v3.3.0 其它玩家区点击防遮挡弹手牌浮层 & 音效开关样式
   ========================================================================= */
.is-peekable-seat {
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, background-color 0.18s ease;
}

.is-peekable-seat:hover {
  border-color: rgba(245, 185, 66, 0.58);
}

.is-peekable-seat:active {
  transform: scale(0.985);
}

.is-peekable-seat.is-peek-active {
  border-color: #fde047;
  box-shadow: 0 0 0 2px rgba(253, 224, 71, 0.48), 0 6px 18px rgba(0, 0, 0, 0.36);
  background: rgba(22, 68, 38, 0.88);
}

/* 首页点击其它玩家区弹出的实时手牌浮层（需高于复盘页 2350 以支持复盘点击任一家放大看明牌） */
.seat-hand-popover {
  position: fixed;
  z-index: 2520;
  left: 12px;
  top: 196px;
  max-width: calc(100vw - 16px);
  pointer-events: auto;
  animation: seatPeekPopIn 0.14s cubic-bezier(0.2, 0.85, 0.32, 1);
}

@keyframes seatPeekPopIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.seat-hand-popover-card {
  background: rgba(9, 28, 15, 0.97);
  border: 1.5px solid rgba(245, 185, 66, 0.68);
  border-radius: 14px;
  padding: 10px 12px 9px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seat-hand-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 6px;
}

.seat-hand-popover-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.seat-hand-popover-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fef08a;
}

.seat-hand-popover-meta {
  font-size: 0.74rem;
  font-weight: 700;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 999px;
  padding: 1px 7px;
}

.seat-hand-popover-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.seat-hand-layout-switch .btn-switch-pill {
  padding: 2px 8px;
  font-size: 0.7rem;
}

.seat-hand-popover-body {
  min-height: 76px;
  max-height: min(46vh, 300px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 2px 6px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.seat-peek-hand-row {
  width: 100%;
  justify-content: center;
  padding-top: 2px;
  padding-bottom: 4px;
}

.seat-hand-empty {
  width: 100%;
  text-align: center;
  padding: 18px 10px;
  color: #cbd5e1;
  font-size: 0.82rem;
}

.seat-hand-popover-foot {
  font-size: 0.68rem;
  color: rgba(226, 232, 240, 0.74);
  text-align: center;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 5px;
}

#btn-sound-toggle.is-muted {
  opacity: 0.78;
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.settings-sound-speed-field {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  gap: 6px;
}

.settings-sound-speed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sound-speed-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  background: rgba(6, 18, 10, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  padding: 4px;
}

.sound-speed-segmented.is-muted {
  opacity: 0.58;
}

.sound-speed-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  text-align: center;
  user-select: none;
}

.sound-speed-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.sound-speed-btn.is-active {
  background: linear-gradient(180deg, rgba(245, 185, 66, 0.34), rgba(217, 119, 6, 0.32));
  border-color: rgba(251, 191, 36, 0.78);
  color: #fef08a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

/* 设置页 — 用户反馈与开发组回复区 */
.feedback-group-card {
  border-color: rgba(52, 211, 153, 0.34);
}

.feedback-textarea {
  width: 100%;
  resize: vertical;
  min-height: 68px;
  max-height: 160px;
  background: #0b2011;
  color: var(--text-color);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}

.feedback-textarea:focus {
  outline: 1.5px solid rgba(245, 185, 66, 0.75);
  border-color: rgba(245, 185, 66, 0.75);
}

.feedback-submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.feedback-char-counter {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.feedback-submit-btn {
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.feedback-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback-history-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

.feedback-history-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
}

.feedback-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.feedback-item-card {
  background: rgba(6, 18, 10, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: text;
  -webkit-user-select: text;
}

.feedback-item-user {
  font-size: 0.82rem;
  color: #f1f5f9;
  line-height: 1.42;
  word-break: break-word;
}

.feedback-item-meta {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-left: 6px;
}

.feedback-item-reply {
  background: rgba(16, 185, 129, 0.13);
  border-left: 3px solid #34d399;
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 0.81rem;
  line-height: 1.45;
  color: #d1fae5;
  word-break: break-word;
}

.feedback-reply-sender {
  font-weight: 700;
  color: #fde68a;
  margin-right: 4px;
}

.settings-status-pill.is-quota-full {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(251, 191, 36, 0.7);
  color: #fde68a;
}

.feedback-item-card.is-just-submitted {
  border-color: rgba(52, 211, 153, 0.72);
  background: rgba(10, 34, 21, 0.92);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.28);
}

/* ================= 全屏「最近10局打牌式逐手复盘回放」页面 ================= */
.replay-page {
  position: fixed;
  inset: 0;
  z-index: 2350;
  background: radial-gradient(circle at center, #14361d 0%, #091d0f 100%);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.replay-page.hidden,
.replay-empty-state.hidden,
.replay-picker-wrap.hidden,
.replay-stage-wrap.hidden,
.replay-game-select.hidden {
  display: none !important;
}

.replay-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(7, 22, 11, 0.96);
  border-bottom: 1px solid rgba(245, 185, 66, 0.42);
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.replay-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.replay-title-wrap h2 {
  margin: 0;
  font-size: 1.02rem;
  color: #fef08a;
  white-space: nowrap;
}

.replay-page-subtitle {
  font-size: 0.76rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-header-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.replay-game-select {
  max-width: min(380px, 46vw);
  min-width: 110px;
  background: #0b2011;
  color: #f8fafc;
  border: 1px solid rgba(245, 185, 66, 0.55);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.replay-exit-btn {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  border: 1px solid rgba(254, 202, 202, 0.65);
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
}

.replay-exit-btn:hover {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

.replay-exit-btn-lg {
  min-width: 180px;
  font-weight: 800;
}

/* 选局列表面板（点击复盘首先展示） */
.replay-picker-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

.replay-picker-panel {
  width: min(760px, 100%);
  background: rgba(8, 25, 13, 0.9);
  border: 1px solid rgba(245, 185, 66, 0.45);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.replay-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.replay-picker-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: #fef08a;
}

.replay-picker-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.replay-picker-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.replay-picker-item {
  width: 100%;
  text-align: left;
  background: rgba(15, 45, 24, 0.85);
  border: 1.5px solid rgba(245, 185, 66, 0.32);
  border-radius: 11px;
  padding: 11px 14px;
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}

.replay-picker-item:hover,
.replay-picker-item.is-current {
  border-color: #fbbf24;
  background: rgba(22, 62, 34, 0.95);
}

.replay-picker-item-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1 1 auto;
}

.replay-picker-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.replay-picker-index {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0b2011;
  background: #fbbf24;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

.replay-picker-item-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fef9c3;
}

.replay-picker-retry-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  color: #e0f2fe;
  background: rgba(2, 132, 199, 0.32);
  border: 1px solid rgba(56, 189, 248, 0.65);
}

.replay-picker-outcome {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.replay-picker-outcome.is-win {
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.28);
  border: 1px solid rgba(74, 222, 128, 0.55);
}

.replay-picker-outcome.is-loss {
  color: #fecaca;
  background: rgba(220, 38, 38, 0.24);
  border: 1px solid rgba(248, 113, 113, 0.5);
}

.replay-picker-outcome.is-live {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.55);
}

.replay-picker-outcome.is-partial {
  color: #fde68a;
  background: rgba(217, 119, 6, 0.24);
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.replay-picker-item-sub {
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.38;
}

.replay-picker-enter-cta {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde047;
  background: rgba(245, 185, 66, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.52);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-empty-state {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.replay-empty-card {
  max-width: 460px;
  background: rgba(8, 25, 13, 0.88);
  border: 1px solid rgba(245, 185, 66, 0.45);
  border-radius: 14px;
  padding: 22px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.replay-empty-card h3 {
  margin: 0;
  color: #fef08a;
  font-size: 1.05rem;
}

.replay-empty-card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.replay-stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 10px 8px;
  gap: 6px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

/* 顶部双行定高局况 + 常驻 AI 战术思路面板（高度 100% 锁死，绝不随 AI 思路有无产生 1px 抖动） */
.replay-hud-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(8, 27, 14, 0.92) 0%, rgba(6, 20, 10, 0.88) 100%);
  border: 1px solid rgba(245, 185, 66, 0.32);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.replay-status-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  overflow: hidden;
  flex-shrink: 0;
}

.replay-status-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.replay-step-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.48);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.replay-step-desc {
  font-size: 0.83rem;
  font-weight: 700;
  color: #f8fafc;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-thought-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(245, 185, 66, 0.13);
  border-left: 3px solid #fbbf24;
  border-top: 1px solid rgba(251, 191, 36, 0.22);
  border-right: 1px solid rgba(251, 191, 36, 0.22);
  border-bottom: 1px solid rgba(251, 191, 36, 0.22);
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.replay-thought-bar.is-idle {
  background: rgba(15, 38, 22, 0.58);
  border-left-color: rgba(148, 163, 184, 0.45);
  border-top-color: rgba(255, 255, 255, 0.08);
  border-right-color: rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.replay-thought-bar.has-thought {
  cursor: pointer;
}

.replay-thought-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #1c1917;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  padding: 1.5px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
}

.replay-thought-bar.is-idle .replay-thought-tag {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.2);
}

.replay-thought-note {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: #fef08a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.replay-thought-bar.is-idle .replay-thought-note {
  color: rgba(203, 213, 225, 0.78);
  font-weight: 500;
}

.replay-thought-more-btn {
  appearance: none;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(245, 185, 66, 0.2);
  color: #fef08a;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-thought-more-btn.hidden,
.replay-thought-popover.hidden {
  display: none !important;
}

/* 长 AI 思路点击展开的绝对定位浮层（完全脱离文档流，绝不挤压牌桌） */
.replay-thought-popover {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% + 4px);
  z-index: 45;
  background: rgba(8, 26, 14, 0.98);
  border: 1.5px solid rgba(251, 191, 36, 0.75);
  border-radius: 10px;
  padding: 9px 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.replay-thought-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.replay-thought-popover-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde047;
}

.replay-thought-popover-body {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #f8fafc;
  word-break: break-word;
}

/* 桌面端复盘四方标准牌桌网格：定高北家 + [西家 | 宽敞中央出牌台 | 东家] + 定高南家手牌，彻底锁死纵向轨道 */
.replay-board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(196px, 24%) minmax(0, 1fr) minmax(196px, 24%);
  grid-template-rows: 78px minmax(176px, 1fr) 104px;
  grid-template-areas:
    "north north north"
    "west center east"
    "south south south";
  gap: 7px;
  overflow: hidden;
}

.replay-seat-north {
  grid-area: north;
  width: min(640px, 100%);
  justify-self: center;
}

.replay-seat-west {
  grid-area: west;
  align-self: center;
  height: 92px;
}

.replay-seat-east {
  grid-area: east;
  align-self: center;
  height: 92px;
}

.replay-seat-south {
  grid-area: south;
  height: 104px;
  background: linear-gradient(180deg, rgba(10, 32, 17, 0.88) 0%, rgba(7, 23, 12, 0.92) 100%);
  border-color: rgba(245, 185, 66, 0.34);
}

.replay-table-center {
  grid-area: center;
  background: radial-gradient(ellipse at center, rgba(24, 68, 36, 0.78) 0%, rgba(10, 34, 18, 0.88) 100%);
  border: 1.5px solid rgba(245, 185, 66, 0.36);
  border-radius: 14px;
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.28);
}

.replay-center-status-row {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  flex-shrink: 0;
}

.replay-center-lead-pill {
  display: inline-block;
  max-width: 100%;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 999px;
  padding: 1.5px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-center-slots {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.replay-table-center .play-slot {
  min-height: 76px;
  padding: 3px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.play-slot.is-actor-slot {
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.32);
  background: rgba(245, 185, 66, 0.11);
}

.replay-seat-box {
  background: rgba(8, 25, 13, 0.82);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.replay-seat-north,
.replay-seat-west,
.replay-seat-east {
  cursor: pointer;
}

.replay-seat-north:hover,
.replay-seat-west:hover,
.replay-seat-east:hover {
  border-color: rgba(251, 191, 36, 0.55);
}

.replay-seat-box.teammate-card {
  border-color: rgba(56, 189, 248, 0.32);
}

.replay-seat-box.active-turn {
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.34);
}

.replay-seat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  height: 20px;
  min-height: 20px;
  max-height: 20px;
  flex-shrink: 0;
}

.replay-seat-role-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-seat-role-tag.is-teammate {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.replay-seat-role-tag.is-rival {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.replay-seat-role-tag.is-self {
  color: #1c1917;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
}

.replay-seat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-seat-peek-hint {
  font-size: 0.69rem;
  color: rgba(186, 230, 253, 0.8);
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-seat-count {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.replay-seat-count.is-warn-yellow {
  color: #fde047;
}

.replay-seat-count.is-warn-red {
  color: #f87171;
}

/* 三位 AI 陪练单行恒定高度自适应叠牌（绝不折行撑高座位框） */
.replay-mini-hand {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  overflow: hidden;
  padding: 0 2px;
}

.replay-opponent-mini-card {
  margin-left: var(--replay-opp-step, -12px) !important;
  flex-shrink: 0;
}

.replay-opponent-mini-card:first-child {
  margin-left: 0 !important;
}

/* 南家（我的手牌）单行恒定高度自适应叠扇（无论 27 张还是 0 张高度锁死） */
.replay-south-hand {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 72px;
  min-height: 72px;
  max-height: 72px;
  overflow: hidden;
  padding: 0 4px;
}

.replay-south-card {
  margin-left: var(--replay-south-step, -20px) !important;
  flex-shrink: 0;
}

.replay-south-card:first-child {
  margin-left: 0 !important;
}

.replay-hand-finished-tag {
  font-size: 0.73rem;
  font-weight: 700;
  color: #6ee7b7;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.36);
  white-space: nowrap;
}

.replay-transport-bar {
  background: rgba(7, 22, 11, 0.96);
  border: 1px solid rgba(245, 185, 66, 0.44);
  border-radius: 10px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.replay-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-progress-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fde68a;
  min-width: 58px;
  text-align: center;
}

.replay-step-slider {
  flex: 1 1 auto;
  accent-color: #f59e0b;
  cursor: pointer;
}

.replay-sub-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-transport-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.replay-step-main-btn {
  flex: 1 1 0;
  max-width: 220px;
  min-height: 38px;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 7px 12px;
  white-space: nowrap;
}

.replay-step-main-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.replay-auto-btn {
  min-height: 38px;
  padding: 6px 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.replay-transport-buttons .replay-exit-btn {
  min-height: 38px;
  padding: 6px 12px;
}

@media (max-width: 768px) {
  .seat-hand-popover-card {
    padding: 9px 10px 8px;
    gap: 6px;
  }

  .seat-hand-popover-title {
    font-size: 0.81rem;
  }

  .seat-hand-popover-meta {
    font-size: 0.7rem;
  }

  .seat-hand-popover-foot {
    font-size: 0.64rem;
  }

  .replay-page-header {
    padding: 6px 8px;
    gap: 5px;
  }

  .replay-title-wrap h2 {
    font-size: 0.9rem;
  }

  .replay-page-subtitle {
    display: none;
  }

  .replay-game-select {
    max-width: 36vw;
    min-width: 84px;
    font-size: 0.72rem;
    padding: 4px 5px;
  }

  .replay-picker-wrap {
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .replay-picker-panel {
    padding: 11px 11px;
    gap: 9px;
  }

  .replay-picker-item {
    padding: 10px 10px;
    gap: 8px;
  }

  .replay-picker-item-title {
    font-size: 0.82rem;
  }

  .replay-picker-enter-cta {
    font-size: 0.74rem;
    padding: 5px 8px;
  }

  .replay-stage-wrap {
    padding: 4px 6px 6px;
    gap: 5px;
  }

  .replay-hud-panel {
    padding: 5px 7px;
    gap: 4px;
  }

  .replay-status-strip {
    height: 21px;
    min-height: 21px;
    max-height: 21px;
    gap: 5px;
  }

  .replay-status-badges .match-badge,
  .replay-step-pill {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .replay-step-desc {
    font-size: 0.72rem;
  }

  .replay-thought-bar {
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    padding: 0 6px;
    gap: 5px;
  }

  .replay-thought-tag {
    font-size: 0.62rem;
    padding: 1px 4px;
  }

  .replay-thought-note {
    font-size: 0.7rem;
  }

  /* 手机竖屏复盘牌桌：与主牌桌一致的三列顶栏 [上家 | 对家 | 下家] + 中央全宽出牌台 + 底部南家手牌，全部定高零跳动 */
  .replay-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 66px minmax(150px, 1fr) 88px;
    grid-template-areas:
      "west north east"
      "center center center"
      "south south south";
    gap: 4px;
  }

  .replay-seat-north,
  .replay-seat-west,
  .replay-seat-east {
    width: 100%;
    height: 66px;
    align-self: stretch;
    justify-self: stretch;
    padding: 4px 5px;
    gap: 2px;
  }

  .replay-seat-south {
    height: 88px;
    padding: 4px 7px;
    gap: 2px;
  }

  .replay-seat-head {
    height: 17px;
    min-height: 17px;
    max-height: 17px;
    gap: 3px;
  }

  .replay-seat-role-tag {
    font-size: 0.58rem;
    padding: 0.5px 3.5px;
  }

  .replay-seat-north .replay-seat-title,
  .replay-seat-west .replay-seat-title,
  .replay-seat-east .replay-seat-title {
    display: none;
  }

  .replay-seat-south .replay-seat-title {
    font-size: 0.72rem;
  }

  .replay-seat-peek-hint {
    font-size: 0.61rem;
  }

  .replay-seat-count {
    font-size: 0.65rem;
  }

  .replay-mini-hand {
    height: 39px;
    min-height: 39px;
    max-height: 39px;
    padding: 0 1px;
  }

  .replay-south-hand {
    height: 62px;
    min-height: 62px;
    max-height: 62px;
    padding: 0 2px;
  }

  .replay-table-center {
    padding: 5px 6px;
    gap: 3px;
    border-radius: 10px;
  }

  .replay-center-status-row {
    height: 19px;
    min-height: 19px;
    max-height: 19px;
  }

  .replay-center-lead-pill {
    font-size: 0.66rem;
    padding: 1px 8px;
  }

  .replay-table-center .play-slot {
    min-height: 62px;
    padding: 2px 3px;
  }

  .replay-transport-bar {
    padding: 5px 7px calc(5px + env(safe-area-inset-bottom, 0px));
    gap: 5px;
  }

  .replay-transport-buttons {
    gap: 5px;
  }

  .replay-step-main-btn {
    min-height: 36px;
    font-size: 0.78rem;
    padding: 6px 6px;
  }

  .replay-auto-btn,
  .replay-transport-buttons .replay-exit-btn {
    min-height: 36px;
    font-size: 0.74rem;
    padding: 5px 8px;
  }
}

/* ============================================================================
   v3.6.3 实时服务器网络连接状态与出牌确认反馈（零布局跳动）
   ============================================================================ */

.net-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.net-status-badge:hover {
  filter: brightness(1.08);
}

.net-status-badge:active {
  transform: scale(0.96);
}

.net-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
  box-shadow: 0 0 6px currentColor;
}

.net-status-badge.is-online {
  background: rgba(6, 78, 59, 0.72);
  border-color: rgba(52, 211, 153, 0.65);
  color: #a7f3d0;
}

.net-status-badge.is-online .net-status-dot {
  background: #34d399;
}

.net-status-badge.is-slow {
  background: rgba(120, 53, 15, 0.78);
  border-color: rgba(251, 191, 36, 0.72);
  color: #fde68a;
}

.net-status-badge.is-slow .net-status-dot {
  background: #fbbf24;
  animation: netDotPulse 1.3s ease-in-out infinite;
}

.net-status-badge.is-syncing {
  background: rgba(30, 58, 138, 0.82);
  border-color: rgba(96, 165, 250, 0.82);
  color: #dbeafe;
}

.net-status-badge.is-syncing .net-status-dot {
  background: #60a5fa;
  animation: netDotPulse 0.7s ease-in-out infinite;
}

.net-status-badge.is-connecting,
.net-status-badge.is-reconnecting {
  background: rgba(124, 45, 18, 0.85);
  border-color: rgba(251, 146, 60, 0.85);
  color: #fed7aa;
}

.net-status-badge.is-connecting .net-status-dot,
.net-status-badge.is-reconnecting .net-status-dot {
  background: #fb923c;
  animation: netDotPulse 0.8s ease-in-out infinite;
}

.net-status-badge.is-offline {
  background: rgba(127, 29, 29, 0.92);
  border-color: rgba(248, 113, 113, 0.92);
  color: #fecaca;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.net-status-badge.is-offline .net-status-dot {
  background: #f87171;
  animation: netDotPulse 0.9s ease-in-out infinite;
}

@keyframes netDotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.42;
    transform: scale(0.82);
  }
}

/* 顶部悬浮网络/出牌等待诊断条（fixed 定位，绝不挤压牌桌引发上下抖动） */
.net-warning-banner {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1950;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(94vw, 620px);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.95);
  border: 1px solid rgba(252, 165, 165, 0.85);
  color: #fef2f2;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(6px);
}

.net-warning-banner.is-syncing-warn {
  background: rgba(30, 58, 138, 0.94);
  border-color: rgba(147, 197, 253, 0.85);
  color: #eff6ff;
}

.net-warning-banner.is-reconnecting-warn {
  background: rgba(124, 45, 18, 0.95);
  border-color: rgba(253, 186, 116, 0.88);
  color: #fff7ed;
}

.net-warning-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: netDotPulse 0.85s ease-in-out infinite;
}

.net-warning-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.net-warning-btn {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.net-warning-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* 按钮在等待服务器确认或断线补发时的即时视觉反馈 */
.btn.is-action-pending {
  position: relative;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.75);
  filter: saturate(1.08);
}

.settings-status-pill.is-net-online {
  background: rgba(6, 78, 59, 0.65);
  border-color: rgba(52, 211, 153, 0.65);
  color: #a7f3d0;
}

.settings-status-pill.is-net-warn {
  background: rgba(120, 53, 15, 0.72);
  border-color: rgba(251, 191, 36, 0.75);
  color: #fde68a;
}

.settings-status-pill.is-net-offline {
  background: rgba(127, 29, 29, 0.82);
  border-color: rgba(248, 113, 113, 0.85);
  color: #fecaca;
}

@media (max-width: 768px) {
  .home-brand-title {
    display: none;
  }

  .net-status-badge {
    padding: 1.5px 6px;
    gap: 4px;
    font-size: 0.64rem;
  }

  .net-status-dot {
    width: 6px;
    height: 6px;
  }

  .net-warning-banner {
    top: 42px;
    max-width: 96vw;
    padding: 5px 9px;
    gap: 6px;
    font-size: 0.73rem;
  }

  .net-warning-btn {
    padding: 2px 7px;
    font-size: 0.68rem;
  }
}

/* ============================================================================
   v3.7.0 服务端发牌配额栏与激励视频广告解锁弹窗样式
   ============================================================================ */

.settings-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(6, 38, 22, 0.58);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.cfg-quota-status-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: #d1fae5;
}

.ad-unlock-panel {
  max-width: 440px;
}

.ad-unlock-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px 6px;
}

.ad-unlock-reason {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #e2e8f0;
}

.ad-video-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(6, 78, 59, 0.78));
  border: 1px solid rgba(251, 191, 36, 0.58);
}

.ad-video-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.65);
  color: #fde68a;
}

.ad-countdown-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
}

.ad-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.ad-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #fbbf24);
  transition: width 0.25s linear;
}

.ad-unlock-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}





