:root {
  --bg-obsidian: #060907;
  --panel-dark: rgba(11, 16, 13, 0.9);
  --gold: #d9b25f;
  --gold-bright: #f8dfa0;
  --crimson: #dc2626;
  --text: #f3f1e8;
  --muted: #a6b4aa;
  --border-gold: rgba(217, 178, 95, 0.36);
  --tile-w: clamp(46px, 5.4vw, 72px);
  --tile-h: calc(var(--tile-w) * 1.40);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at center, #113a26 0%, #071b11 60%, #040806 100%);
  user-select: none;
}

.hidden { display: none !important; }

/* ================= 通用按钮 ================= */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; padding: 13px 18px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-primary {
  background: linear-gradient(135deg, #e5be6a, #b88930);
  color: #1a1102;
  box-shadow: 0 4px 16px rgba(217, 178, 95, 0.32);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: #fff;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.42);
}
.btn-outline {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid rgba(217, 178, 95, 0.34);
}
.btn-ghost {
  background: transparent;
  color: var(--gold-bright);
}

/* ================= 大厅视图 ================= */
.lobby-view {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.lobby-card {
  width: 100%;
  max-width: 455px;
  background: rgba(9, 15, 12, 0.93);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 26px 24px 20px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(12px);
}

.lobby-brand {
  text-align: center;
  margin-bottom: 20px;
}

.brand-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(217, 178, 95, 0.14);
  border: 1px solid rgba(217, 178, 95, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.lobby-brand h1 {
  font-size: 26px;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: #fffdf5;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  font-size: 15px;
  outline: none;
}
.form-group input:focus { border-color: var(--gold); }

.code-input {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 800;
  text-align: center;
  font-size: 18px !important;
}

.lobby-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 12px;
}
.tab-btn {
  padding: 9px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active {
  background: rgba(217, 178, 95, 0.22);
  color: var(--gold-bright);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
#panelJoin .btn + .btn { margin-top: 10px; }

.settings-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.toggle-row strong { display: block; font-size: 13px; color: #fff; }
.toggle-row span { display: block; font-size: 11px; color: var(--muted); }
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  flex-shrink: 0;
}
.select-sm {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(217, 178, 95, 0.3);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
}

.lobby-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}
.lobby-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= 登录门禁与纯娱乐免责声明 ================= */
.auth-card {
  max-width: 420px;
}
.auth-error {
  margin: -4px 0 12px;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: #fecaca;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.disclaimer-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(217, 178, 95, 0.08);
  border: 1px solid rgba(217, 178, 95, 0.25);
  font-size: 11.5px;
  line-height: 1.5;
  color: #d6dfd8;
  cursor: pointer;
}
.disclaimer-check input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  flex-shrink: 0;
}
.disclaimer-check strong {
  color: var(--gold-bright);
}
.disclaimer-bar {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(217, 178, 95, 0.2);
  font-size: 11px;
  line-height: 1.48;
  color: #b4c2b8;
}
.disclaimer-bar strong {
  color: var(--gold-bright);
}
.auth-footer-note {
  text-align: center;
}

/* ================= 局域网大厅与扫码 ================= */
.lan-lobby-panel {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(217, 178, 95, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
}
.lan-lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.lan-head-actions {
  display: flex;
  gap: 6px;
}
.btn-mini {
  background: rgba(217, 178, 95, 0.16);
  border: 1px solid rgba(217, 178, 95, 0.35);
  color: var(--gold-bright);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.btn-mini:hover { background: rgba(217, 178, 95, 0.28); }
.lan-addr-line {
  font-size: 11px;
  color: #86efac;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.24);
  border-radius: 7px;
  padding: 5px 8px;
  margin-bottom: 8px;
  word-break: break-all;
}
.lan-room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 126px;
  overflow-y: auto;
}
.lan-empty {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}
.lan-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
}
.lan-room-meta strong {
  color: var(--gold-bright);
  letter-spacing: 1px;
  margin-right: 6px;
}
.lan-room-meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.wait-lan-grid {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(217, 178, 95, 0.22);
  border-radius: 12px;
  padding: 12px;
}
.wait-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--gold-bright);
  font-weight: 700;
}
.qr-img {
  width: 108px;
  height: 108px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  display: block;
}
.qr-img.qr-lg {
  width: 196px;
  height: 196px;
  padding: 6px;
}
.wait-lan-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wait-lan-right .invite-row { margin-bottom: 0; }
.lan-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.lan-select-row select { flex: 1; min-width: 0; }
.lan-hint-mini {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.lan-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lan-modal-tip { font-size: 13px; color: #e2e8f0; }
.lan-modal-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.conn-badge { font-size: 12px; color: var(--muted); }
.conn-badge.ok { color: #4ade80; }
.conn-badge.err { color: #f87171; }

/* ================= 舞台外壳：手机竖屏自动转 90° 全屏横屏 ================= */
.stage-shell {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-obsidian);
}

.stage-shell.force-landscape {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 100vh;
  height: 100vw;
  width: 100dvh;
  height: 100dvw;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}

/* 舞台内所有弹窗、抽屉、Toast 改用 absolute 相对 stage-shell 定位，自动跟随横屏正向展示 */
.stage-shell .modal-backdrop,
.stage-shell .chat-drawer,
.stage-shell .toast {
  position: absolute;
}

.mobile-only {
  display: none;
}

/* ================= 3D 牌桌主界面（莲花广麻版面） ================= */
.table-view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #1b5938 0%, #113c26 62%, #071a11 100%);
}

.loading-3d-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(8, 16, 12, 0.82);
  border: 1px solid rgba(217, 178, 95, 0.45);
  color: #f8dfa0;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.table-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* 顶部黑金极简横栏（同莲花广麻） */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(6, 9, 7, 0.94) 0%, rgba(6, 9, 7, 0.72) 100%);
  border-bottom: 1px solid rgba(217, 178, 95, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 30;
}

.top-left, .top-center, .top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mini {
  font-size: 14px;
  font-weight: 700;
  color: #e6ddc3;
  letter-spacing: 0.5px;
}

.room-pill {
  background: rgba(217, 178, 95, 0.14);
  border: 1px solid rgba(217, 178, 95, 0.42);
  color: var(--gold-bright);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.room-pill:hover { background: rgba(217, 178, 95, 0.25); }

.round-status-pill {
  background: rgba(14, 20, 17, 0.85);
  border: 1px solid rgba(217, 178, 95, 0.35);
  color: #e9dfbf;
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.round-status-pill.follow-alert {
  border-color: #f87171;
  background: rgba(127, 29, 29, 0.72);
  color: #fef08a;
}

.timer-pill {
  background: rgba(234, 179, 8, 0.24);
  border: 1.5px solid #facc15;
  color: #fef08a;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timer-pill.urgent {
  background: rgba(220, 38, 38, 0.85);
  border-color: #fde047;
  color: #fff;
  animation: pulseTimer 0.7s infinite alternate;
}
@keyframes pulseTimer {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.seat-timer-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #facc15;
  color: #fef08a;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}
.seat-timer-badge.urgent {
  background: #dc2626;
  border-color: #fde047;
  color: #fff;
}

.action-choice-info {
  flex: 1;
  min-width: 0;
}
.action-choice-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.icon-btn {
  background: rgba(18, 26, 22, 0.78);
  border: 1px solid rgba(217, 178, 95, 0.3);
  color: #ebe4cf;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.icon-btn:hover { border-color: var(--gold); color: #fff; }
.icon-btn.danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }

/* 实时事件横幅 */
.live-banner {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: linear-gradient(135deg, rgba(160, 22, 22, 0.95), rgba(92, 16, 16, 0.95));
  border: 1px solid var(--gold);
  color: #fef9c3;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

/* ================= 莲花广麻风格：4 个方框头像座卡 ================= */
.avatar-seat-card {
  position: absolute;
  z-index: 25;
  width: 86px;
  padding: 6px 6px 7px;
  background: rgba(8, 12, 10, 0.86);
  border: 1.5px solid rgba(217, 178, 95, 0.34);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.avatar-seat-card.active-turn {
  border-color: #fde047;
  box-shadow: 0 0 0 2px rgba(253, 224, 71, 0.35), 0 0 22px rgba(234, 179, 8, 0.65);
}

.avatar-seat-card.offline {
  opacity: 0.55;
  border-style: dashed;
}

/* 复刻莲花广麻四位卡片位置（避开右家副露区） */
.seat-pos-top {
  top: 48px;
  left: 20%;
}
.seat-pos-left {
  left: 24px;
  top: 34%;
}
.seat-pos-right {
  right: 24px;
  top: 34%;
}
.seat-pos-self {
  position: relative;
  flex-shrink: 0;
  width: 86px;
}

.seat-avatar-box {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(240, 224, 182, 0.72);
  background: #f3e8c8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seat-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dealer-seal {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ef4444, #991b1b);
  border: 1.5px solid #fde68a;
  color: #fffdf5;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.wind-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.68);
  padding: 1px 4px;
  border-radius: 4px;
}

.seat-name {
  font-size: 12px;
  font-weight: 700;
  color: #f4efe0;
  max-width: 76px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.seat-score {
  font-size: 12px;
  font-weight: 800;
  color: #f0d78c;
  line-height: 1.1;
}
.seat-score.pos { color: #4ade80; }
.seat-score.neg { color: #f87171; }

.score-float {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  pointer-events: none;
  animation: floatUp 2s ease forwards;
  z-index: 40;
  white-space: nowrap;
}
.score-float.pos { background: #16a34a; color: #fff; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.6); }
.score-float.neg { background: #dc2626; color: #fff; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.6); }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.85); }
  18% { opacity: 1; transform: translate(-50%, -4px) scale(1.1); }
  80% { opacity: 1; transform: translate(-50%, -18px); }
  100% { opacity: 0; transform: translate(-50%, -32px); }
}

.chat-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fffdf5;
  color: #1c1917;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 50;
}

/* ================= 底部前景区：本家大号手牌 + 右侧悬浮操作 ================= */
.bottom-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 18px 10px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.bottom-dock > * {
  pointer-events: auto;
}

.ting-bar {
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(8, 15, 12, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #bae6fd;
}

/* 牌面正上方出牌倒计时条 */
.hand-timer-bar {
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(9, 16, 13, 0.9);
  border: 1.5px solid rgba(217, 178, 95, 0.72);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  color: #f4efe0;
}
.hand-timer-bar.my-turn {
  border-color: #fde047;
  background: rgba(24, 34, 16, 0.92);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.35), 0 6px 18px rgba(0, 0, 0, 0.55);
}
.hand-timer-clock {
  font-size: 16px;
  font-weight: 900;
  color: #fde047;
  font-variant-numeric: tabular-nums;
}
.hand-timer-bar.urgent {
  background: rgba(153, 27, 27, 0.94);
  border-color: #fde047;
  color: #fff;
  animation: pulseTimer 0.65s infinite alternate;
}
.hand-timer-bar.urgent .hand-timer-clock {
  color: #fff;
}

.floating-actions {
  width: 100%;
  max-width: 1180px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-height: 36px;
  pointer-events: none;
}

.floating-actions > * {
  pointer-events: auto;
}

/* 莲花广麻风格：暗金圆角操作胶囊按钮 */
.act-btn {
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  color: #f9ebc0;
  background: rgba(16, 22, 18, 0.9);
  border: 1.5px solid rgba(217, 178, 95, 0.72);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  transition: transform 0.1s, filter 0.15s;
}
.act-btn:hover { filter: brightness(1.12); }
.act-btn:active { transform: scale(0.95); }

.act-btn.discard-btn {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #7dd3fc;
  color: #fff;
}
.act-btn.peng-btn {
  background: linear-gradient(135deg, #059669, #065f46);
  border-color: #6ee7b7;
  color: #fff;
}
.act-btn.gang-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border-color: #c4b5fd;
  color: #fff;
}
.act-btn.pass-btn {
  background: rgba(20, 28, 24, 0.82);
  border-color: rgba(255, 255, 255, 0.25);
  color: #cbd5e1;
}
.act-btn.hu-btn {
  background: linear-gradient(135deg, #dc2626, #881313);
  border: 1.5px solid #fde047;
  color: #fef9c3;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.65);
}
.act-btn.hu-btn.muted-hu {
  background: rgba(88, 18, 18, 0.62);
  border: 1px dashed rgba(253, 224, 71, 0.45);
  color: rgba(254, 249, 195, 0.76);
  box-shadow: none;
  font-size: 12px;
  padding: 6px 13px;
}

.robgang-callout {
  background: rgba(153, 27, 27, 0.92);
  border: 1px solid #fde047;
  color: #fef9c3;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.bottom-row {
  width: 100%;
  max-width: 1240px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
}

.my-hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2.5px;
  padding-top: 18px;
}

/* ================= 实体 3D 前景麻将牌（自然纯白玉瓷质感 + 翡翠绿顶边） ================= */
.tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 4px 5px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdfd 75%, #edf1f0 100%);
  border: 1px solid #d4dcd9;
  border-top: 4px solid #2ea644;
  border-bottom: 6px solid #bcc7c3;
  border-radius: 8px;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px #ffffff,
    inset 0 -2px 3px rgba(130, 145, 140, 0.2);
  overflow: hidden;
  flex-shrink: 0;
}

.tile-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.16));
}

.tile-art-vector {
  padding: 1px;
  filter: none;
}

.red-wild-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  color: #fffbeb;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  padding: 2px 3.5px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.tile.is-red {
  background: linear-gradient(180deg, #fffef6 0%, #fef4d0 72%, #f1d98c 100%);
  border-color: #eab308;
  border-top: 4px solid #d97706;
  border-bottom: 6px solid #b45309;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.55),
    0 0 12px rgba(234, 179, 8, 0.35),
    inset 0 1px 1px #ffffff;
}

.tile.hand-tile {
  width: var(--tile-w);
  height: var(--tile-h);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile.hand-tile:hover {
  transform: translateY(-9px);
}

.tile.hand-tile.selected {
  transform: translateY(-18px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.65), 0 0 0 2.5px #fde047;
  z-index: 12;
}

.tile.hand-tile.just-drawn {
  margin-left: 16px;
}

.settle-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= 碰 / 杠 / 抢杠 中央居中操作选择弹窗 ================= */
.action-choice-popup {
  position: absolute;
  left: 50%;
  bottom: calc(var(--tile-h) + 92px);
  transform: translateX(-50%);
  z-index: 42;
  width: min(92vw, 440px);
  animation: popChoice 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes popChoice {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.action-choice-card {
  background: rgba(9, 17, 13, 0.94);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 14px 18px 16px;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.72),
    0 0 24px rgba(217, 178, 95, 0.28);
  backdrop-filter: blur(10px);
}

.action-choice-card.is-robgang {
  border-color: #ef4444;
  background: rgba(34, 10, 10, 0.96);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.78),
    0 0 28px rgba(239, 68, 68, 0.48);
}

.action-choice-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.action-choice-tile-wrap {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.action-choice-tile-wrap .tile {
  width: 48px;
  height: 67px;
  padding: 4px 3px;
  border-top-width: 3px;
  border-bottom-width: 4px;
}

.action-choice-title {
  font-size: 16px;
  font-weight: 800;
  color: #fffdf5;
  margin-bottom: 4px;
}

.action-choice-desc {
  font-size: 12px;
  color: #cbd5cf;
  line-height: 1.4;
}

.action-choice-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.choice-btn {
  flex: 1;
  min-width: 96px;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42);
  transition: transform 0.1s, filter 0.15s;
}
.choice-btn:hover { filter: brightness(1.08); }
.choice-btn:active { transform: scale(0.95); }

.choice-btn.peng {
  background: linear-gradient(135deg, #10b981, #047857);
  border: 1.5px solid #6ee7b7;
}
.choice-btn.gang {
  background: linear-gradient(135deg, #8b5cf6, #5b21b6);
  border: 1.5px solid #ddd6fe;
}
.choice-btn.hu {
  background: linear-gradient(135deg, #ef4444, #991b1b);
  border: 1.5px solid #fde047;
  color: #fef9c3;
}
.choice-btn.pass {
  flex: 0.7;
  min-width: 78px;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
}

/* ================= 等待开局浮层 ================= */
.waiting-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 7, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 38;
  padding: 14px;
}

.waiting-box {
  width: 100%;
  max-width: 560px;
  background: rgba(9, 16, 13, 0.96);
  border: 1.5px solid var(--border-gold);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.waiting-box h2 { font-size: 20px; margin-bottom: 6px; color: var(--gold-bright); }
.waiting-tip { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.invite-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.invite-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.wait-seat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.wait-seat-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(217, 178, 95, 0.24);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.wait-seat-item.empty { color: var(--muted); border-style: dashed; }

.host-wait-controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

/* ================= 弹窗 ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 14px;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  background: #0c1410;
  border: 1.5px solid var(--border-gold);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.75);
}
.modal-lg { max-width: 740px; }
.modal-sm { max-width: 400px; }

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(217, 178, 95, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-header h2 { font-size: 18px; color: var(--gold-bright); }
.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(217, 178, 95, 0.2);
  color: var(--gold-bright);
  font-weight: 700;
}
.close-x {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(217, 178, 95, 0.16);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 抓马结算块 */
.win-tile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(217, 178, 95, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #fffdf5;
}
.win-tile-banner .tile {
  width: 38px;
  height: 53px;
  padding: 3px 2px;
  border-top-width: 2.5px;
  border-bottom-width: 3.5px;
}

.horse-section {
  background: rgba(217, 178, 95, 0.08);
  border: 1px solid rgba(217, 178, 95, 0.42);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.horse-section.zhahu {
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(127, 29, 29, 0.3);
}
.horse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.horse-formula { font-size: 13px; color: #fde68a; font-weight: 700; }
.horse-tiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.horse-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.horse-card .tile { width: 46px; height: 64px; padding: 3px; border-top-width: 3px; border-bottom-width: 4px; }
.horse-card.hit .tile {
  box-shadow: 0 0 0 2.5px #facc15, 0 0 18px rgba(250, 204, 21, 0.85);
  transform: translateY(-3px);
}
.horse-card.miss .tile { opacity: 0.45; filter: grayscale(0.45); }
.horse-tag { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.horse-tag.hit { background: #eab308; color: #1c1100; }
.horse-tag.miss { color: var(--muted); }

.settle-players { display: flex; flex-direction: column; gap: 10px; }
.settle-player-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px;
}
.settle-player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.settle-hand { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.settle-hand .tile {
  width: 32px;
  height: 44px;
  padding: 2.5px 2px;
  border-top-width: 2.5px;
  border-bottom-width: 3.5px;
  border-radius: 5px;
}
.settle-hand .tile .red-wild-badge { font-size: 7px; padding: 1px 2px; }
.meld-group {
  display: inline-flex;
  gap: 1px;
  background: rgba(0, 0, 0, 0.38);
  padding: 2px 3px;
  border-radius: 5px;
  margin-right: 5px;
}
.settle-events {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
  padding: 8px 10px;
  border-radius: 8px;
}

.rules-content ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #e6e2d5;
}
.confirm-hu-text { font-size: 14px; line-height: 1.6; color: #f3f1e8; }

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td {
  padding: 7px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  text-align: center;
}
.history-table th { color: var(--gold-bright); }

/* ================= 聊天抽屉 ================= */
.chat-drawer {
  position: fixed;
  top: 40px;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 88vw;
  background: rgba(9, 15, 12, 0.96);
  border-left: 1px solid var(--border-gold);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.chat-msg strong { color: var(--gold-bright); margin-right: 6px; }
.quick-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.phrase-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(217, 178, 95, 0.25);
  color: #ebe4cf;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
}
.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.chat-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 13, 0.94);
  border: 1px solid var(--gold);
  color: #fffdf5;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 99;
}

/* ================= 手机端默认横屏自适应（真实横屏 + 竖屏自动旋转伪横屏统一规则） ================= */
.stage-shell.is-mobile-landscape {
  --tile-w: clamp(32px, calc((100% - 148px) / 14.7), 50px);
  --tile-h: calc(var(--tile-w) * 1.38);
}

.stage-shell.force-landscape {
  --tile-w: clamp(32px, calc((100dvh - 148px) / 14.7), 50px);
  --tile-h: calc(var(--tile-w) * 1.38);
}

.stage-shell.is-mobile-landscape .mobile-only {
  display: inline-flex;
  align-items: center;
}

.stage-shell.is-mobile-landscape .hide-xs {
  display: none;
}

.stage-shell.is-mobile-landscape .top-bar {
  height: 32px;
  padding: 0 10px;
  gap: 6px;
}

.stage-shell.is-mobile-landscape .room-pill {
  padding: 2px 8px;
  font-size: 11px;
}

.stage-shell.is-mobile-landscape .round-status-pill {
  padding: 2px 10px;
  font-size: 11px;
}

.stage-shell.is-mobile-landscape .icon-btn {
  padding: 2px 7px;
  font-size: 11px;
}

.stage-shell.is-mobile-landscape .live-banner {
  top: 38px;
  font-size: 12px;
  padding: 4px 14px;
}

.stage-shell.is-mobile-landscape .avatar-seat-card {
  width: 64px;
  padding: 4px;
  gap: 2px;
  border-radius: 8px;
}

.stage-shell.is-mobile-landscape .seat-avatar-box {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.stage-shell.is-mobile-landscape .seat-name {
  font-size: 10px;
  max-width: 56px;
}

.stage-shell.is-mobile-landscape .seat-score {
  font-size: 10px;
}

.stage-shell.is-mobile-landscape .dealer-seal {
  width: 18px;
  height: 18px;
  font-size: 9px;
  top: -5px;
  left: -5px;
}

.stage-shell.is-mobile-landscape .seat-pos-top {
  top: 36px;
  left: 16%;
}

.stage-shell.is-mobile-landscape .seat-pos-left {
  left: 12px;
  top: 32%;
}

.stage-shell.is-mobile-landscape .seat-pos-right {
  right: 12px;
  top: 32%;
}

.stage-shell.is-mobile-landscape .bottom-dock {
  padding: 0 12px 5px;
}

.stage-shell.is-mobile-landscape .bottom-row {
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}

.stage-shell.is-mobile-landscape .seat-pos-self {
  width: 64px;
  flex-direction: column;
  padding: 4px;
}

.stage-shell.is-mobile-landscape .my-hand {
  gap: 2px;
  padding-top: 10px;
}

.stage-shell.is-mobile-landscape .tile.hand-tile {
  padding: 3px 2.5px;
  border-top-width: 2.5px;
  border-bottom-width: 4px;
  border-radius: 6px;
}

.stage-shell.is-mobile-landscape .tile.hand-tile.selected {
  transform: translateY(-10px);
}

.stage-shell.is-mobile-landscape .tile.hand-tile.just-drawn {
  margin-left: 8px;
}

.stage-shell.is-mobile-landscape .red-wild-badge {
  font-size: 8px;
  padding: 1px 2.5px;
}

.stage-shell.is-mobile-landscape .hand-timer-bar {
  margin-bottom: 3px;
  padding: 3px 12px;
  font-size: 11px;
}

.stage-shell.is-mobile-landscape .hand-timer-clock {
  font-size: 13px;
}

.stage-shell.is-mobile-landscape .floating-actions {
  margin-bottom: 3px;
  min-height: 28px;
  gap: 6px;
}

.stage-shell.is-mobile-landscape .act-btn {
  padding: 5px 12px;
  font-size: 12px;
}

.stage-shell.is-mobile-landscape .action-choice-popup {
  bottom: calc(var(--tile-h) + 56px);
  width: min(76%, 390px);
}

.stage-shell.is-mobile-landscape .action-choice-card {
  padding: 10px 14px 12px;
}

.stage-shell.is-mobile-landscape .action-choice-tile-wrap .tile {
  width: 38px;
  height: 53px;
}

.stage-shell.is-mobile-landscape .choice-btn {
  padding: 8px 12px;
  font-size: 14px;
}

.stage-shell.is-mobile-landscape .waiting-box {
  max-height: 92%;
  overflow-y: auto;
  padding: 14px 16px;
}

.stage-shell.is-mobile-landscape .qr-img {
  width: 84px;
  height: 84px;
}

.stage-shell.is-mobile-landscape .modal-card {
  max-height: 94%;
  max-width: 92%;
}

.stage-shell.is-mobile-landscape .modal-header {
  padding: 8px 14px;
}

.stage-shell.is-mobile-landscape .modal-header h2 {
  font-size: 15px;
}

.stage-shell.is-mobile-landscape .modal-body {
  padding: 10px 14px;
}

.stage-shell.is-mobile-landscape .modal-footer {
  padding: 8px 14px;
}

.stage-shell.is-mobile-landscape .horse-section {
  padding: 8px 10px;
  margin-bottom: 8px;
}

.stage-shell.is-mobile-landscape .horse-card .tile {
  width: 36px;
  height: 50px;
}

.stage-shell.is-mobile-landscape .settle-player-row {
  padding: 7px 9px;
}

.stage-shell.is-mobile-landscape .settle-hand .tile {
  width: 26px;
  height: 36px;
}

.stage-shell.is-mobile-landscape .chat-drawer {
  top: 32px;
  width: 260px;
}

.stage-shell.is-mobile-landscape .toast {
  bottom: 72px;
}

/* ================= 手机端默认竖屏专属优化布局（双排大牌 + 顶部双行精简栏 + 居中3D牌桌） ================= */
.stage-shell.is-mobile-portrait {
  --tile-w: clamp(41px, calc((100vw - 44px) / 7.45), 54px);
  --tile-h: calc(var(--tile-w) * 1.38);
}

.stage-shell.is-mobile-portrait .mobile-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stage-shell.is-mobile-portrait .landscape-only-btn {
  display: none !important;
}

.stage-shell.is-mobile-portrait .hide-xs {
  display: none;
}

.stage-shell.is-mobile-portrait .orientation-btn,
.stage-shell.is-mobile-landscape .orientation-btn {
  background: rgba(217, 178, 95, 0.22);
  border-color: rgba(250, 204, 21, 0.72);
  color: #fef08a;
  font-weight: 800;
}

/* 顶部双行精简栏：第1行房号+局数状态，第2行横屏切换及常用功能键 */
.stage-shell.is-mobile-portrait .top-bar {
  height: auto;
  padding: calc(5px + env(safe-area-inset-top, 0px)) 8px 6px;
  flex-wrap: wrap;
  row-gap: 5px;
  column-gap: 6px;
}

.stage-shell.is-mobile-portrait .top-left {
  gap: 6px;
}

.stage-shell.is-mobile-portrait .top-center {
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.stage-shell.is-mobile-portrait .round-status-pill {
  padding: 2px 10px;
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-shell.is-mobile-portrait .room-pill {
  padding: 2px 9px;
  font-size: 11px;
}

.stage-shell.is-mobile-portrait .top-right {
  width: 100%;
  justify-content: space-between;
  gap: 4px;
}

.stage-shell.is-mobile-portrait .top-right .icon-btn {
  flex: 1;
  padding: 4px 3px;
  font-size: 11px;
  text-align: center;
  border-radius: 7px;
}

.stage-shell.is-mobile-portrait .live-banner {
  top: calc(114px + env(safe-area-inset-top, 0px));
  max-width: 92vw;
  font-size: 12px;
  padding: 5px 14px;
  white-space: normal;
  text-align: center;
}

/* 对手座卡：对家改成顶部横条胶囊（节省纵向高度），左右两家贴边紧凑卡片 */
.stage-shell.is-mobile-portrait .avatar-seat-card {
  width: 58px;
  padding: 4px 3px 5px;
  gap: 2px;
  border-radius: 8px;
}

.stage-shell.is-mobile-portrait .seat-avatar-box {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}

.stage-shell.is-mobile-portrait .seat-name {
  font-size: 10px;
  max-width: 52px;
}

.stage-shell.is-mobile-portrait .seat-score {
  font-size: 10px;
}

.stage-shell.is-mobile-portrait .wind-tag {
  font-size: 9px;
  padding: 1px 3px;
  top: 2px;
  right: 2px;
}

.stage-shell.is-mobile-portrait .dealer-seal {
  width: 18px;
  height: 18px;
  font-size: 10px;
  top: -6px;
  left: -6px;
}

.stage-shell.is-mobile-portrait .seat-pos-top {
  top: calc(68px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 132px;
  flex-direction: row;
  padding: 4px 10px 4px 5px;
  gap: 7px;
}

.stage-shell.is-mobile-portrait .seat-pos-top .seat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-right: 14px;
}

.stage-shell.is-mobile-portrait .seat-pos-top .seat-name {
  max-width: 84px;
  text-align: left;
  font-size: 11px;
}

.stage-shell.is-mobile-portrait .seat-pos-top .seat-score {
  font-size: 11px;
}

.stage-shell.is-mobile-portrait .seat-pos-left {
  left: 5px;
  top: 21%;
}

.stage-shell.is-mobile-portrait .seat-pos-right {
  right: 5px;
  top: 21%;
}

/* 底部手牌操控区：Grid 网格让本家横卡与操作按钮并排一行，下方为拇指友好的双排大牌 */
.stage-shell.is-mobile-portrait .bottom-dock {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 8px;
  row-gap: 5px;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(
    180deg,
    rgba(6, 14, 10, 0) 0%,
    rgba(6, 14, 10, 0.72) 26%,
    rgba(5, 11, 8, 0.94) 100%
  );
}

.stage-shell.is-mobile-portrait .ting-bar {
  grid-column: 1 / -1;
  justify-self: center;
  margin-bottom: 0;
  font-size: 11px;
  padding: 3px 10px;
}

.stage-shell.is-mobile-portrait .hand-timer-bar {
  grid-column: 1 / -1;
  justify-self: center;
  margin-bottom: 0;
  padding: 4px 14px;
  font-size: 12px;
}

.stage-shell.is-mobile-portrait .hand-timer-clock {
  font-size: 14px;
}

.stage-shell.is-mobile-portrait .bottom-row {
  display: contents;
}

.stage-shell.is-mobile-portrait .seat-pos-self {
  grid-column: 1;
  grid-row: 3;
  justify-self: start;
  width: auto;
  flex-direction: row;
  padding: 4px 10px 4px 5px;
  gap: 7px;
}

.stage-shell.is-mobile-portrait .seat-pos-self .seat-avatar-box {
  width: 32px;
  height: 32px;
}

.stage-shell.is-mobile-portrait .seat-pos-self .seat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-right: 14px;
}

.stage-shell.is-mobile-portrait .seat-pos-self .seat-name {
  max-width: 82px;
  text-align: left;
  font-size: 11px;
}

.stage-shell.is-mobile-portrait .seat-pos-self .seat-score {
  font-size: 11px;
}

.stage-shell.is-mobile-portrait .floating-actions {
  grid-column: 2;
  grid-row: 3;
  width: auto;
  justify-self: end;
  justify-content: flex-end;
  margin-bottom: 0;
  min-height: 0;
  gap: 6px;
}

.stage-shell.is-mobile-portrait .act-btn {
  padding: 6px 13px;
  font-size: 13px;
}

.stage-shell.is-mobile-portrait .act-btn.hu-btn.muted-hu {
  padding: 5px 10px;
  font-size: 11px;
}

/* 双排大号手牌：每行最多 7 张，约 45~52px 宽，单手/双拇指精准点选不误触 */
.stage-shell.is-mobile-portrait .my-hand {
  grid-column: 1 / -1;
  grid-row: 4;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 3px;
  row-gap: 7px;
  padding-top: 10px;
  width: 100%;
  max-width: calc(var(--tile-w) * 7 + 34px);
  justify-self: center;
}

.stage-shell.is-mobile-portrait .tile.hand-tile {
  padding: 3.5px 2.5px;
  border-top-width: 3px;
  border-bottom-width: 4.5px;
  border-radius: 7px;
}

.stage-shell.is-mobile-portrait .tile.hand-tile:hover {
  transform: none;
}

.stage-shell.is-mobile-portrait .tile.hand-tile.selected {
  transform: translateY(-10px);
  z-index: 22;
}

.stage-shell.is-mobile-portrait .tile.hand-tile.just-drawn {
  margin-left: 7px;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(250, 204, 21, 0.85);
}

.stage-shell.is-mobile-portrait .tile.hand-tile.just-drawn::after {
  content: '摸';
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  color: #1c1100;
  background: #facc15;
  padding: 1.5px 3px;
  border-radius: 3px;
  pointer-events: none;
}

.stage-shell.is-mobile-portrait .red-wild-badge {
  font-size: 8px;
  padding: 1.5px 2.5px;
}

/* 竖屏中央碰/杠/抢杠操作弹窗：悬停在双排手牌上方，完全不遮挡自己手牌 */
.stage-shell.is-mobile-portrait .action-choice-popup {
  bottom: calc(var(--tile-h) * 2 + 102px + env(safe-area-inset-bottom, 0px));
  width: min(92vw, 360px);
}

.stage-shell.is-mobile-portrait .action-choice-card {
  padding: 12px 14px;
}

.stage-shell.is-mobile-portrait .action-choice-tile-wrap .tile {
  width: 42px;
  height: 58px;
}

.stage-shell.is-mobile-portrait .choice-btn {
  padding: 10px 12px;
  font-size: 15px;
  min-width: 82px;
}

/* 竖屏等待框、结算弹窗、聊天抽屉适配 */
.stage-shell.is-mobile-portrait .waiting-box {
  max-height: 86%;
  overflow-y: auto;
  padding: 16px 14px;
}

.stage-shell.is-mobile-portrait .wait-lan-grid {
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.stage-shell.is-mobile-portrait .wait-lan-right {
  width: 100%;
}

.stage-shell.is-mobile-portrait .wait-seat-item {
  font-size: 12px;
  padding: 7px 8px;
}

.stage-shell.is-mobile-portrait .modal-card {
  max-width: 96%;
  max-height: 86%;
}

.stage-shell.is-mobile-portrait .modal-header {
  padding: 11px 14px;
  flex-wrap: wrap;
}

.stage-shell.is-mobile-portrait .modal-header h2 {
  font-size: 16px;
}

.stage-shell.is-mobile-portrait .modal-body {
  padding: 12px 13px;
}

.stage-shell.is-mobile-portrait .horse-card .tile {
  width: 40px;
  height: 55px;
}

.stage-shell.is-mobile-portrait .settle-hand .tile {
  width: 26px;
  height: 36px;
}

.stage-shell.is-mobile-portrait .chat-drawer {
  top: calc(64px + env(safe-area-inset-top, 0px));
  width: min(86vw, 310px);
}

.stage-shell.is-mobile-portrait .toast {
  bottom: calc(var(--tile-h) * 2 + 88px);
}
