/* =========================================================
   川麻牌桌 — UI 设计系统
   ========================================================= */
:root {
  --bg-0: #07140f;
  --bg-1: #0c241c;
  --felt: #0f6b4d;
  --felt-deep: #0a4a36;
  --wood: #6b4423;
  --wood-dark: #3d2612;
  --panel: rgba(10, 22, 18, 0.82);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f3f7f4;
  --text-dim: #8eaa9b;
  --gold: #f0c14b;
  --gold-soft: #ffe9a8;
  --danger: #ef5b5b;
  --ok: #3dcf8a;
  --blue: #5eb0ff;
  --tile: #f8f4ea;
  --tile-edge: #d2c8b0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 16px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  user-select: none;
  overflow: hidden;
}

#app {
  height: 100%;
  position: relative;
}

.hidden {
  display: none !important;
}

/* ---------- Screens ---------- */
.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: auto;
}

.bg-ornament {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 50% -15%, rgba(45, 160, 110, 0.28), transparent 55%),
    radial-gradient(700px 400px at 100% 100%, rgba(240, 193, 75, 0.08), transparent 45%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  z-index: 0;
}
.bg-ornament.dim {
  opacity: 0.9;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 16px 16px calc(20px + var(--safe-b));
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shell-narrow {
  width: min(400px, 100%);
  justify-content: center;
  min-height: 100%;
}

/* ---------- Typography / panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 14px;
  text-align: left;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  border-color: rgba(240, 193, 75, 0.55);
  box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.12);
}

.footnote {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  height: 44px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
  margin: 0;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}
.btn-xl {
  height: 52px;
  font-size: 16px;
  border-radius: 14px;
}
.btn-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 12px;
  border-radius: 10px;
}
.btn-xs {
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
  border-radius: 8px;
}
.btn-primary {
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  color: #1a1400;
  box-shadow: 0 8px 24px rgba(240, 193, 75, 0.28);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.danger-text {
  color: #ff8e8e !important;
  border-color: rgba(239, 91, 91, 0.35) !important;
}

/* ---------- Segmented control ---------- */
.seg {
  display: flex;
  gap: 0;
  padding: 3px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.seg-item {
  flex: 1;
  height: 40px;
  margin: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.seg-item.active {
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  color: #1a1400;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}
.tag-gold {
  background: rgba(240, 193, 75, 0.15);
  color: var(--gold);
  border: 1px solid rgba(240, 193, 75, 0.28);
}
.tag.ready {
  background: rgba(61, 207, 138, 0.2);
  color: #7dffb5;
}
.tag.host {
  background: rgba(240, 193, 75, 0.2);
  color: var(--gold-soft);
}

/* =========================================================
   登录
   ========================================================= */
.screen-login {
  background: transparent;
}
.login-hero {
  text-align: center;
  margin-bottom: 18px;
}
.logo-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: linear-gradient(145deg, rgba(240, 193, 75, 0.35), rgba(15, 80, 55, 0.5));
  border: 1px solid rgba(240, 193, 75, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.logo-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.logo-desc {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}
.login-panel {
  text-align: center;
}
.login-avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.login-avatar-preview.compact {
  margin-bottom: 10px;
}
.avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 3px solid rgba(240, 193, 75, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  background: #1a3a2c;
}
.chip-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(240, 193, 75, 0.12);
  border: 1px solid rgba(240, 193, 75, 0.25);
  padding: 3px 12px;
  border-radius: 999px;
}
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 120px;
  overflow: auto;
  padding: 2px;
}
.avatar-pick {
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-pick.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(240, 193, 75, 0.25);
}

/* =========================================================
   大厅
   ========================================================= */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.player-card .avatar,
.me-profile .avatar,
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(240, 193, 75, 0.4);
  background: #1a3a2c;
}
.player-card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.player-card-meta strong {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-card-sub {
  display: flex;
  gap: 6px;
}

.banner-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(240, 193, 75, 0.18), rgba(240, 193, 75, 0.06));
  border: 1px solid rgba(240, 193, 75, 0.4);
}
.banner-title {
  margin: 0;
  font-weight: 800;
  color: var(--gold-soft);
  font-size: 14px;
}
.banner-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.block {
  margin-bottom: 18px;
}
.block-head {
  margin-bottom: 10px;
}
.block-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-card {
  margin: 0;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  min-height: 96px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.mode-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.mode-card:active {
  transform: scale(0.99);
}
.mode-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.06);
}
.mode-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mode-card-body b {
  font-size: 14px;
  font-style: normal;
}
.mode-card-body i {
  font-style: normal;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
  font-weight: 500;
}
.mode-card.active {
  border-color: var(--ok);
  background: linear-gradient(160deg, rgba(61, 207, 138, 0.16), rgba(0, 0, 0, 0.2));
  box-shadow: inset 0 0 0 1px rgba(61, 207, 138, 0.15);
}
.mode-card[data-mode="huan3"].active {
  border-color: var(--blue);
  background: linear-gradient(160deg, rgba(94, 176, 255, 0.16), rgba(0, 0, 0, 0.2));
}
.mode-card[data-mode="fkxl"].active {
  border-color: var(--danger);
  background: linear-gradient(160deg, rgba(239, 91, 91, 0.16), rgba(0, 0, 0, 0.2));
}
.mode-card[data-mode="xuezhan"].active {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(240, 193, 75, 0.16), rgba(0, 0, 0, 0.2));
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tier-card {
  margin: 0;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.tier-card:hover {
  border-color: rgba(240, 193, 75, 0.35);
}
.tier-card b {
  font-size: 13px;
}
.tier-card span {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
}
.tier-card.active {
  border-color: var(--gold);
  background: rgba(240, 193, 75, 0.12);
}

.join-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.join-box input {
  flex: 1;
}
.join-box .btn {
  min-width: 88px;
  flex-shrink: 0;
}

/* =========================================================
   资料弹窗
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-sheet {
  position: relative;
  width: min(440px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(180deg, #152820, #0c1a14);
  border: 1px solid var(--panel-border);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  box-shadow: var(--shadow);
}
.modal-head h2 {
  margin: 0 0 12px;
  font-size: 18px;
  text-align: center;
}
.modal-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

/* =========================================================
   房间准备 · 明亮同系（不抢戏）
   ========================================================= */
.screen-room {
  overflow: hidden;
  height: 100%;
  background: #8fc4e0;
  color: #1a2a30;
}
.screen-room .shell.room-shell {
  width: min(560px, 100%);
  position: relative;
  z-index: 2;
}
.room-shell {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: max(10px, env(safe-area-inset-top));
}

.room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.room-chip-btn {
  margin: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #2a3a48;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 50, 70, 0.1);
}
.room-chip-mini {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.95);
}
.room-code-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 12px;
  color: #5a6a78;
  box-shadow: 0 2px 10px rgba(20, 50, 70, 0.1);
}
.room-code-pill b {
  color: #c48a10;
  font-size: 16px;
  letter-spacing: 0.12em;
}
.room-rice-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 248, 220, 0.92);
  border: 1px solid rgba(240, 193, 75, 0.45);
  color: #8a6a10;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(20, 50, 70, 0.08);
}
.room-meta-badge {
  margin: 0 auto;
  text-align: center;
  max-width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: #2a5a40;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(80, 180, 120, 0.35);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 2px 8px rgba(20, 50, 70, 0.08);
}
.room-invite {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: #4a6070;
  line-height: 1.4;
  opacity: 0.9;
}
.room-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.table-disk {
  position: relative;
  width: min(340px, 86vw);
  aspect-ratio: 1;
  filter: drop-shadow(0 16px 28px rgba(40, 70, 50, 0.22));
}
.table-disk-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 30deg, #c49a6c, #8b5a2b, #d4a574, #6b4423, #c49a6c);
  box-shadow:
    0 0 0 2px rgba(255, 240, 210, 0.35) inset,
    0 10px 0 #7a4e28,
    0 16px 28px rgba(60, 40, 20, 0.22);
}
.table-disk-felt {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(160, 230, 190, 0.55), transparent 48%),
    radial-gradient(circle at 70% 75%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle, #3cb87a 0%, #24965c 55%, #1a7a4a 100%);
  box-shadow:
    inset 0 0 28px rgba(0, 40, 20, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-disk-felt::before {
  content: "人人";
  position: absolute;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  z-index: 1;
}
.room-seats-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.room-seats-ring .seat-card {
  pointer-events: auto;
  position: absolute;
  margin: 0;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(30, 60, 50, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #1a2a30;
  width: min(132px, 38%);
  max-width: 148px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
/* 四面环位：下 / 右 / 上 / 左 */
.room-seats-ring .seat-s {
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
}
.room-seats-ring .seat-n {
  left: 50%;
  top: 6%;
  transform: translateX(-50%);
}
.room-seats-ring .seat-e {
  right: 4%;
  top: 50%;
  transform: translateY(-50%);
}
.room-seats-ring .seat-w {
  left: 4%;
  top: 50%;
  transform: translateY(-50%);
}
.room-seats-ring .seat-card.is-ready {
  border-color: #3dcf8a;
  box-shadow: 0 0 0 2px rgba(61, 207, 138, 0.25), 0 4px 14px rgba(30, 60, 50, 0.14);
}
.room-seats-ring .seat-card.is-host {
  border-color: #e0b030;
}
.room-seats-ring .seat-left-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-seats-ring .seat-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.room-seats-ring .seat-sub {
  font-size: 11px;
  color: #6a7a88;
}
.room-seats-ring .avatar,
.room-seats-ring .seat-av {
  width: 34px;
  height: 34px;
  font-size: 16px;
  flex-shrink: 0;
}
.room-seats-ring .seat-av.empty {
  background: #e8eef2 !important;
  color: #8a9aa8;
  border-color: rgba(0, 0, 0, 0.06);
}
.room-seats-ring strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  color: #1a2a30;
}
.room-seats-ring .ops {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.room-seats-ring .tag {
  background: rgba(30, 60, 80, 0.08);
  color: #4a6070;
}
.room-seats-ring .tag.ready {
  background: rgba(61, 207, 138, 0.2);
  color: #1a8a50;
}
.room-seats-ring .tag.host {
  background: rgba(240, 193, 75, 0.28);
  color: #8a6a10;
}
.room-seats-ring .tag.tag-gold {
  background: rgba(240, 193, 75, 0.2);
  color: #9a7010;
  border-color: rgba(240, 193, 75, 0.35);
}
.room-seats-ring .kick {
  margin: 0;
  height: 24px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: rgba(220, 80, 80, 0.15);
  color: #c04040;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.seat-offline {
  opacity: 0.55;
}
/* 准备房间：不显示中央骰子（对局桌才需要） */
.screen-room #room-dice,
.screen-room .table-disk-felt > .dice-pad {
  display: none !important;
}
.room-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 max(8px, env(safe-area-inset-bottom));
}
.screen-room .room-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.88);
  color: #2a3a48;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 10px rgba(30, 50, 60, 0.1);
}
.screen-room .room-footer .btn-ghost {
  background: rgba(255, 255, 255, 0.55);
  color: #c05050;
  border: 1px solid rgba(200, 80, 80, 0.25);
}
.screen-room .room-footer .btn-primary {
  box-shadow: 0 5px 0 #a85a08, 0 8px 18px rgba(160, 90, 20, 0.25);
}

/* 骰子 */
.dice-pad {
  position: relative;
  z-index: 2;
  border: none;
  cursor: pointer;
  background: linear-gradient(160deg, #fff8ee, #f0e0c8);
  border-radius: 14px;
  padding: 10px 12px 8px;
  box-shadow:
    0 3px 0 #c8a878,
    0 6px 14px rgba(60, 40, 20, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #5a4030;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  border: 1px solid rgba(200, 160, 100, 0.45);
}
.screen-table .dice-pad {
  /* 牌桌中央仍用深色，避免亮块抢戏 */
  background: linear-gradient(160deg, #3a2418, #1a0e08);
  color: #f5e6c8;
  border-color: rgba(240, 193, 75, 0.25);
  box-shadow: 0 4px 0 #0a0503, 0 8px 18px rgba(0, 0, 0, 0.4);
}
.dice-pad:active {
  transform: scale(0.97);
}
.dice-pair {
  display: flex;
  gap: 8px;
}
.die {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, #fffef8, #e8e0d0);
  color: #1a1a1a;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.die.rolling {
  animation: dice-shake 0.15s linear infinite;
}
@keyframes dice-shake {
  0% {
    transform: translate(0, 0) rotate(0);
  }
  25% {
    transform: translate(2px, -2px) rotate(-8deg);
  }
  50% {
    transform: translate(-2px, 1px) rotate(6deg);
  }
  75% {
    transform: translate(1px, 2px) rotate(-4deg);
  }
  100% {
    transform: translate(0, 0) rotate(0);
  }
}
.dice-hint {
  font-size: 11px;
  color: #8a7050;
}
.screen-table .dice-hint {
  color: rgba(245, 230, 200, 0.65);
}
.dice-who {
  font-size: 11px;
  color: #b8860b;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 1em;
}
.screen-table .dice-who {
  color: var(--gold);
}
.dice-sum {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}

/* =========================================================
   牌桌
   ========================================================= */
.screen-table {
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 22%, #1c9468 0%, #0d553e 40%, #061a12 100%);
  padding: 0;
}

.table-hud {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 10;
}
.hud-info {
  font-size: 13px;
  font-weight: 800;
  color: #e8f5ee;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-timer {
  min-width: 2.2em;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(240, 193, 75, 0.35);
  border-radius: 999px;
  padding: 2px 10px;
}
.hud-timer.urgent {
  color: #fff;
  background: var(--danger);
  border-color: transparent;
}
.hud-wall {
  font-size: 12px;
  font-weight: 800;
  color: #b8dcc9;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
}

.table-arena {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 8px 2px;
  gap: 2px;
}
.arena-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-height: 28%;
  overflow: hidden;
}
.arena-mid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(68px, 20%) 1fr minmax(68px, 20%);
  gap: 4px;
  align-items: stretch;
}
.arena-left,
.arena-right {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}
.arena-left {
  align-items: flex-start;
}
.arena-right {
  align-items: flex-end;
}
.arena-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 0;
}

.felt-box {
  position: relative;
  width: min(220px, 48vw);
  height: min(158px, 34vw);
  border-radius: 18px;
  background: linear-gradient(145deg, #8b5a2b, #3d2612 48%, #6b4423);
  box-shadow:
    0 0 0 1px rgba(255, 220, 160, 0.1) inset,
    0 10px 0 #2a180c,
    0 16px 32px rgba(0, 0, 0, 0.42);
  padding: 10px;
}
.felt-box::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 40% 30%, rgba(50, 160, 110, 0.4), transparent 55%),
    radial-gradient(circle, #157a54 0%, #0a4a34 75%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.35);
  z-index: 0;
}

.wall-ring {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.wall-side {
  position: absolute;
  display: flex;
  gap: 1px;
  align-items: center;
  justify-content: center;
}
.wall-side-top {
  top: 4px;
  left: 16%;
  right: 16%;
  height: 16px;
}
.wall-side-bottom {
  bottom: 4px;
  left: 16%;
  right: 16%;
  height: 16px;
}
.wall-side-left {
  left: 4px;
  top: 16%;
  bottom: 16%;
  width: 14px;
  flex-direction: column;
}
.wall-side-right {
  right: 4px;
  top: 16%;
  bottom: 16%;
  width: 14px;
  flex-direction: column;
}
.wall-tile {
  flex-shrink: 0;
  border-radius: 2px;
  background: linear-gradient(145deg, #3a6ab0, #1a3a6e);
  border: 1px solid #0d2848;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.wall-side-top .wall-tile,
.wall-side-bottom .wall-tile {
  width: 10px;
  height: 14px;
}
.wall-side-left .wall-tile,
.wall-side-right .wall-tile {
  width: 14px;
  height: 10px;
}
.wall-ring.draw-pulse {
  animation: wall-pulse 0.45s ease;
}
@keyframes wall-pulse {
  0% {
    filter: drop-shadow(0 0 0 rgba(240, 193, 75, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(240, 193, 75, 0.8));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(240, 193, 75, 0));
  }
}

.table-dice-pad {
  position: absolute;
  inset: 22% 18%;
  min-width: 0;
  width: auto;
  height: auto;
  margin: 0;
  z-index: 2;
  justify-content: center;
  border: 1px solid rgba(240, 193, 75, 0.25);
}
.die-3d {
  transform: perspective(80px) rotateX(10deg) rotateY(-6deg);
}

.hint-bar {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(240, 193, 75, 0.4);
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  max-width: min(280px, 92%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.hint-bar.hu {
  border-color: var(--danger);
  color: #ffb4b4;
  background: rgba(120, 20, 20, 0.5);
  animation: pulse-hint 1.2s ease-in-out infinite;
}
.hint-bar.warn {
  border-color: #e89b3c;
  color: #ffd9a8;
}
@keyframes pulse-hint {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(232, 93, 93, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(232, 93, 93, 0);
  }
}
.center-info {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 4px;
}
.score-live {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.score-live span {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 2px 7px;
}
.score-live b {
  color: var(--gold);
  margin-left: 2px;
}

/* 玩家 chip */
.player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
  border: 2px solid transparent;
  max-width: 100%;
  backdrop-filter: blur(6px);
}
.player-chip.active {
  border-color: var(--gold);
  background: rgba(240, 193, 75, 0.12);
  box-shadow: 0 0 12px rgba(240, 193, 75, 0.35);
}
.player-chip.hu-done {
  opacity: 0.65;
  filter: grayscale(0.25);
}
.player-chip .chip-av,
.player-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
}
.player-chip .meta {
  min-width: 0;
  text-align: left;
  line-height: 1.2;
}
.player-chip .pname,
.player-chip .chip-name {
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7em;
}
.player-chip .psub {
  font-size: 10px;
  color: var(--text-dim);
}
.player-chip .psub .que-tag {
  color: #ffb070;
  font-weight: 800;
}
.player-chip .psub .score-pos {
  color: #8fdf9a;
}
.player-chip .psub .score-neg {
  color: #f88;
}
.player-chip .badge-ai,
.player-chip .badge-hu {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 2px;
}
.player-chip .badge-ai {
  background: #3a5a8a;
}
.player-chip .badge-hu {
  background: #a33;
}
.player-chip .chip-lv {
  color: var(--gold);
}

/* 牌河 / 手牌 / 牌面 */
.river {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  align-content: flex-start;
  max-width: 100%;
  min-height: 26px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}
.river-self {
  flex: 1;
  max-width: none;
  min-height: 30px;
}
.river-v {
  flex-direction: column;
  flex-wrap: wrap;
  max-height: 130px;
  max-width: 52px;
  align-content: center;
}
.seat-left .river-v {
  align-content: flex-start;
}
.seat-right .river-v {
  align-content: flex-end;
}

.opp-hand {
  display: flex;
  gap: 1px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}
.opp-hand-v {
  flex-direction: column;
  max-height: 100px;
  flex-wrap: wrap;
}

.tile {
  width: 38px;
  height: 52px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fffef8, var(--tile));
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 2px 0 var(--tile-edge), 0 3px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--tile-edge);
  line-height: 1.05;
  position: relative;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
.tile .suit {
  font-size: 10px;
  color: #555;
  font-weight: 700;
}
.tile.m .suit {
  color: #1a1a1a;
}
.tile.p .suit {
  color: #1b5eab;
}
.tile.s .suit {
  color: #1b7a3a;
}
.tile.z,
.tile.z1 {
  background: linear-gradient(180deg, #fff5f5, #ffd6d6) !important;
  border-color: #c0392b !important;
}
.tile.z .suit,
.tile.z .num {
  color: #c0392b !important;
  font-weight: 900;
}
.tile.selected {
  transform: translateY(-12px);
  border-color: var(--gold);
  box-shadow: 0 8px 0 var(--tile-edge), 0 12px 20px rgba(0, 0, 0, 0.4);
}
.tile.que {
  background: linear-gradient(180deg, #fff0e0, #f0d0b0);
  border-color: #c45c26;
}
.tile.que::after {
  content: "缺";
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  color: #c45c26;
  font-weight: 900;
}
.tile.disabled {
  opacity: 0.35;
  filter: grayscale(0.4);
  pointer-events: none;
}
.tile.drawn {
  margin-left: 12px;
  outline: 2px solid var(--gold);
  box-shadow: 0 0 12px rgba(240, 193, 75, 0.55);
  transform: translateY(-6px);
}
.tile.drawn::before {
  content: "摸";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 900;
  color: var(--gold);
}
.tile.suggest {
  outline: 2px solid #5cf;
  box-shadow: 0 0 8px rgba(80, 200, 255, 0.45);
}
.tile.suggest::after {
  content: "荐";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #7df;
  font-weight: 800;
}
.tile.river-tile {
  width: 22px;
  height: 30px;
  font-size: 10px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 1px 0 #c8bfa8;
}
.tile.river-tile .suit {
  font-size: 8px;
}
.tile.river-latest {
  outline: 2px solid var(--gold);
  box-shadow: 0 0 8px rgba(240, 193, 75, 0.7);
  transform: translateY(-2px);
}
.tile.back {
  width: 14px;
  height: 20px;
  background: linear-gradient(145deg, #2a5a9e, #1a3a6e);
  border-color: #0d2848;
  color: transparent;
  pointer-events: none;
  box-shadow: none;
}
.opp-hand-v .tile.back {
  width: 20px;
  height: 12px;
}
.tile.mini {
  width: 22px;
  height: 30px;
  font-size: 10px;
  border-radius: 3px;
}
.tile.mini .suit {
  font-size: 8px;
}
.tile.gap-before {
  margin-left: 10px;
}
.hand-sep {
  width: 8px;
  flex-shrink: 0;
}

/* 自己底栏 */
.self-dock {
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(8, 28, 20, 0.88), rgba(0, 0, 0, 0.94));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.4);
  padding: 8px 10px calc(10px + var(--safe-b));
  z-index: 12;
  max-height: 48vh;
  overflow: auto;
}
.self-dock-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.self-dock .self-chip {
  flex-shrink: 0;
}
.melds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 4px;
  min-height: 4px;
  justify-content: center;
}
.melds-area {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}
.meld-group {
  display: flex;
  gap: 1px;
  padding: 1px 2px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.meld-group.gang {
  border-color: rgba(240, 193, 75, 0.45);
}

.phase-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 0 0 8px;
  background: linear-gradient(180deg, rgba(28, 36, 52, 0.96), rgba(14, 20, 32, 0.96));
  border: 1px solid rgba(240, 193, 75, 0.45);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.phase-bar-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-soft);
}
.phase-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.dq-btn {
  margin: 0 !important;
  width: 58px;
  height: 42px;
  border-radius: 12px !important;
  font-size: 16px !important;
  font-weight: 900;
  color: #111 !important;
  border: 2px solid rgba(255, 255, 255, 0.12) !important;
  cursor: pointer;
  padding: 0 !important;
}
.dq-m {
  background: linear-gradient(180deg, #fffef8, #e8e0d0) !important;
}
.dq-p {
  background: linear-gradient(180deg, #eef4ff, #c5d8f5) !important;
  color: #1b5eab !important;
}
.dq-s {
  background: linear-gradient(180deg, #eefaf0, #b8e0c0) !important;
  color: #1b7a3a !important;
}

.play-tips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 6px 10px;
  margin: 0 0 6px;
  background: rgba(20, 40, 55, 0.9);
  border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 10px;
  font-size: 12px;
  color: #cfe8ff;
}
.play-tips .tip-best {
  color: #7df;
  font-weight: 800;
}
.play-tips .tip-wait {
  color: var(--gold-soft);
  font-weight: 800;
}
.play-tips .tip-xt {
  color: var(--text-dim);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  min-height: 76px;
  align-content: center;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(20, 40, 32, 0.5), rgba(0, 0, 0, 0.45));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.hand:empty::after {
  content: "等待手牌…";
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}
.dice-phase-tip {
  text-align: center;
  padding: 16px 12px;
  color: var(--gold-soft);
  font-weight: 800;
  line-height: 1.5;
  width: 100%;
  font-size: 14px;
}
.dice-phase-tip small {
  font-weight: 500;
  color: var(--text-dim);
  font-size: 12px;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 8px 4px 2px;
  min-height: 52px;
}
.action-bar button {
  margin: 0;
  min-width: 80px;
  height: 46px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(180deg, #e25a5a, #b83232);
  color: #fff;
  box-shadow: 0 4px 12px rgba(180, 40, 40, 0.3);
}
.action-bar button.pass {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}
.action-bar button.go {
  background: linear-gradient(180deg, #ffd76a, var(--gold));
  color: #1a1400;
  box-shadow: 0 4px 14px rgba(240, 193, 75, 0.28);
}
.action-bar button.hu-btn {
  background: linear-gradient(180deg, #ff7a7a, #c43c3c);
  font-size: 17px;
  min-width: 104px;
  box-shadow: 0 0 0 2px rgba(255, 200, 100, 0.55), 0 6px 16px rgba(200, 40, 40, 0.35);
  animation: pulse-hint 1.2s ease-in-out infinite;
}

/* toast / floats / draw */
.action-toast {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 80;
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid var(--gold);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: toast-pop 0.35s ease-out;
}
.action-toast.peng {
  border-color: #5cf;
  color: #9df;
}
.action-toast.gang {
  border-color: var(--gold);
  color: var(--gold-soft);
}
.action-toast.hu {
  border-color: #f55;
  color: #fcc;
  font-size: 34px;
}
@keyframes toast-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.score-floats {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  overflow: hidden;
}
.score-float {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  animation: float-up 1.6s ease-out forwards;
  white-space: nowrap;
}
.score-float.plus {
  color: #6f6;
}
.score-float.minus {
  color: #f66;
}
@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56px);
  }
}

.draw-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  overflow: hidden;
}
.draw-fx-hand {
  position: absolute;
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  z-index: 2;
  transition: left 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.2s;
}
.draw-fx-tile {
  position: absolute;
  width: 36px;
  height: 50px;
  border-radius: 6px;
  background: linear-gradient(145deg, #3a6ab0, #1a3a6e);
  border: 1px solid #0d2848;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  z-index: 1;
  transition: left 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.5s, opacity 0.15s;
}
.draw-fx-tile.face {
  background: linear-gradient(180deg, #fffef8, #f7f3e8);
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  border-color: #d4cbb5;
}

.result-panel {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.result-panel .box {
  background: linear-gradient(160deg, #1a2a22, #0c1612);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  width: min(360px, 100%);
  box-shadow: var(--shadow);
}
.result-panel h2 {
  margin-top: 0;
}
.result-panel li {
  margin: 6px 0;
  list-style: none;
}
.settlement-box {
  max-height: 50vh;
  overflow: auto;
  text-align: left;
  font-size: 13px;
}
.settlement-box h3 {
  margin: 12px 0 6px;
  font-size: 14px;
  color: var(--gold);
}
.settlement-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.settlement-box li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* 兼容旧 class 名（app.js 可能仍 toggle） */
.mode-btn {
  /* 与 mode-card 同用时由 mode-card 主导 */
}
.tier-btn {
}
.glass,
.glass-bar {
}
.dingque-dock,
.swap3-dock,
.dock-bar {
  /* 新结构用 phase-bar；保留防止 hidden 冲突 */
}

/* 头像配色兜底 */
.av-0 {
  background: linear-gradient(145deg, #e85d5d, #8a2020);
}
.av-1 {
  background: linear-gradient(145deg, #5b8def, #1e3a8a);
}
.av-2 {
  background: linear-gradient(145deg, #f0c14b, #8a6a10);
}
.av-3 {
  background: linear-gradient(145deg, #4ecf8a, #1a6b40);
}

@media (min-width: 480px) {
  .tile {
    width: 42px;
    height: 56px;
    font-size: 16px;
  }
  .shell {
    width: min(520px, 100%);
  }
}

@media (max-width: 380px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .tier-card span {
    font-size: 10px;
  }
  .tile {
    width: 32px;
    height: 46px;
    font-size: 13px;
  }
  .arena-mid {
    grid-template-columns: minmax(60px, 20%) 1fr minmax(60px, 20%);
  }
}

/* =========================================================
   大厅 v3 — 安卓横屏分区（对齐商业大厅结构，自绘）
   ========================================================= */
.screen-lobby {
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  color: #fff;
}

.lobby-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.lobby-bg-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, #7ec8ff 0%, transparent 55%),
    linear-gradient(180deg, #4aa3e8 0%, #7ec8f0 35%, #a8d8f0 55%, #c8e4b0 78%, #8fbf78 100%);
}
.lobby-bg-city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  height: 42%;
  background:
    linear-gradient(180deg, transparent, rgba(40, 90, 60, 0.15)),
    repeating-linear-gradient(
      90deg,
      transparent 0 40px,
      rgba(255, 255, 255, 0.06) 40px 42px,
      transparent 42px 90px,
      rgba(255, 255, 255, 0.04) 90px 96px
    );
  opacity: 0.55;
}
.lobby-bg-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(180deg, #b8d4a8 0%, #8fbc78 40%, #6a9a58 100%);
  box-shadow: inset 0 12px 24px rgba(255, 255, 255, 0.25);
}

.lobby-top,
.lobby-mid,
.lobby-bottom,
.lobby-resume {
  position: relative;
  z-index: 2;
}

/* —— 顶栏 —— */
.lobby-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 6px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-top: max(8px, env(safe-area-inset-top));
}
.lobby-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px 4px 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(230, 240, 255, 0.85));
  box-shadow: 0 4px 12px rgba(0, 40, 80, 0.18);
  color: #1a2a3a;
  cursor: pointer;
  max-width: 42%;
  min-width: 0;
}
.lobby-user-av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid #f0c14b;
  flex-shrink: 0;
  background: #1a3a2c;
}
.lobby-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.lobby-user-meta strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9em;
}
.lobby-rank {
  font-size: 11px;
  font-weight: 800;
  color: #5a6a8a;
  background: linear-gradient(90deg, #e8eef8, #d0dcf0);
  border-radius: 999px;
  padding: 1px 8px;
}

.lobby-currencies {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.currency-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px 0 10px;
  border-radius: 999px;
  background: rgba(20, 30, 50, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.currency-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffe08a, #f0c14b);
  color: #5a3a00;
}
.currency-plus {
  width: 24px;
  height: 24px;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, #6ad0ff, #2a8adf);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.lobby-top-tools {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.top-tool {
  margin: 0;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 10px rgba(0, 40, 80, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  color: #334;
  font-size: 16px;
  padding: 0;
}
.top-tool i {
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  color: #567;
}

.lobby-resume {
  margin: 0 12px 4px;
  flex-shrink: 0;
}

/* —— 中部三栏 —— */
.lobby-mid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(280px, 1.35fr);
  gap: 8px;
  padding: 0 10px;
  align-items: stretch;
}

/* 左侧活动轨 */
.lobby-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 4px 0;
}
.rail-item {
  margin: 0;
  width: 64px;
  padding: 8px 4px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(230, 240, 255, 0.9));
  box-shadow: 0 4px 12px rgba(0, 40, 80, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: #234;
}
.rail-item.rail-hot {
  background: linear-gradient(180deg, #fff3c4, #ffd76a);
}
.rail-emoji {
  font-size: 22px;
  line-height: 1.2;
}
.rail-item b {
  font-size: 11px;
  font-weight: 800;
}

/* 中间角色 */
.lobby-hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  padding-bottom: 4px;
}
.hero-stage {
  position: relative;
  width: 100%;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-glow {
  position: absolute;
  bottom: 18%;
  width: 70%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 70%);
  filter: blur(4px);
}
.hero-figure {
  position: relative;
  z-index: 1;
  width: min(160px, 28vw);
  height: min(160px, 28vw);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(88px, 16vw);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(160deg, #3d8f6e, #1a4a38);
  border: 4px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 12px 28px rgba(0, 40, 30, 0.35),
    inset 0 -8px 20px rgba(0, 0, 0, 0.2);
}
.hero-pedestal {
  width: 72%;
  height: 14px;
  margin-top: -8px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.28), transparent 70%);
  z-index: 0;
}
.hero-name {
  margin: 4px 0 0;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #1a2a20;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 右侧玩法宫格 */
.lobby-modes-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 28px;
}
.mode-palace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  height: min(100%, 280px);
  max-height: 100%;
  min-height: 160px;
}
.mode-tile {
  margin: 0;
  border: none;
  border-radius: 18px;
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.12),
    0 10px 20px rgba(0, 40, 80, 0.15);
  color: #1a2430;
  transition: transform 0.12s, box-shadow 0.12s, outline 0.12s;
  position: relative;
  overflow: hidden;
}
.mode-tile:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12), 0 6px 12px rgba(0, 40, 80, 0.12);
}
.mode-tile.active {
  outline: 3px solid #fff;
  outline-offset: 0;
  box-shadow:
    0 0 0 3px rgba(240, 193, 75, 0.9),
    0 8px 0 rgba(0, 0, 0, 0.1),
    0 12px 24px rgba(0, 40, 80, 0.2);
}
.mode-tile b {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.mode-tile-art {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}
.mj-face {
  width: 52px;
  height: 68px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffefb, #f2ebe0);
  border: 2px solid #e0d6c4;
  box-shadow: 0 3px 0 #c8bfa8, 0 6px 10px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #222;
  transform: rotate(-6deg);
}
.mj-zhong {
  color: #c0392b;
  background: linear-gradient(180deg, #fff8f8, #ffd8d8);
  border-color: #e8a0a0;
}
.mj-wan { color: #1a1a1a; }
.mj-swap {
  color: #1b5eab;
  background: linear-gradient(180deg, #f4f8ff, #d0e4ff);
}
.mj-blade {
  color: #8a3a10;
  background: linear-gradient(180deg, #fff8e8, #ffd8a0);
}
.mj-friend {
  color: #1b7a3a;
  background: linear-gradient(180deg, #f0fff4, #c8f0d0);
}
.mj-dice {
  font-size: 40px;
  line-height: 1;
}

.mode-fkxl {
  background: linear-gradient(160deg, #ffe566, #f0b429 55%, #e89a18);
}
.mode-classic {
  background: linear-gradient(160deg, #7dffb0, #2ecc71 55%, #1fa85a);
}
.mode-huan3 {
  background: linear-gradient(160deg, #9fd4ff, #4aa3f0 55%, #2a7ad4);
}
.mode-xuezhan {
  background: linear-gradient(160deg, #ffb08a, #ef6b4a 55%, #d04430);
}
.mode-friend {
  background: linear-gradient(160deg, #c8f0e0, #5dcea0 55%, #2a9a70);
}
.mode-join {
  background: linear-gradient(160deg, #d8e8ff, #8ab4f0 55%, #5a88d0);
}

.modes-more-tab {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  margin: 0;
  padding: 14px 6px;
  border: none;
  border-radius: 12px 0 0 12px;
  background: linear-gradient(180deg, #5eb0ff, #2a7ad4);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
  box-shadow: -2px 4px 12px rgba(0, 40, 100, 0.25);
  cursor: pointer;
}

/* —— 底栏 —— */
.lobby-bottom {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
.lobby-dock {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex-wrap: wrap;
  max-width: 58%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(230, 240, 255, 0.4));
  border-radius: 16px 16px 12px 12px;
  padding: 6px 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 16px rgba(0, 40, 80, 0.12);
}
.dock-item {
  margin: 0;
  border: none;
  background: transparent;
  min-width: 48px;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  color: #2a3a4a;
}
.dock-icon {
  font-size: 22px;
  line-height: 1.2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.12));
}
.dock-shop {
  font-size: 24px;
}
.dock-item i {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.lobby-quick {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.tier-pills {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 999px;
}
.tier-pill {
  margin: 0;
  border: none;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.tier-pill.active {
  background: linear-gradient(180deg, #fffef8, #f0c14b);
  color: #3a2a00;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-quick-start {
  position: relative;
  margin: 0;
  min-width: 168px;
  height: 64px;
  padding: 8px 28px 10px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffe566 0%, #f0b429 45%, #e08a10 100%);
  color: #3a2200;
  box-shadow:
    0 5px 0 #a85a08,
    0 10px 22px rgba(180, 80, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1.15;
}
.btn-quick-start:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #a85a08, 0 6px 12px rgba(180, 80, 0, 0.3);
}
.btn-quick-start strong {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.btn-quick-start small {
  font-size: 11px;
  font-weight: 700;
  color: rgba(60, 30, 0, 0.75);
  margin-top: 2px;
}
.qs-tag {
  position: absolute;
  left: -4px;
  top: -6px;
  background: linear-gradient(180deg, #ff7a5a, #e03a2a);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px 8px 8px 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* 加入 / 更多 浮层 */
.join-sheet {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.join-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.join-sheet-panel {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, #1a2e26, #0c1814);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  color: var(--text);
}
.join-sheet-panel h3 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 18px;
}
.more-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  text-align: left;
}
.more-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}
.more-list b {
  color: var(--gold-soft);
}

/* 竖屏手机：改为可滚动堆叠 */
@media (orientation: portrait) {
  .screen-lobby {
    overflow: auto;
  }
  .lobby-mid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }
  .lobby-rail {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
  .rail-item {
    width: 72px;
  }
  .lobby-hero {
    min-height: 140px;
  }
  .hero-figure {
    width: 120px;
    height: 120px;
    font-size: 64px;
  }
  .lobby-modes-wrap {
    padding-right: 0;
    padding-bottom: 8px;
  }
  .mode-palace {
    height: auto;
    min-height: 220px;
    max-height: none;
  }
  .modes-more-tab {
    position: static;
    transform: none;
    writing-mode: horizontal-tb;
    width: 100%;
    margin-top: 8px;
    border-radius: 12px;
    padding: 10px;
    letter-spacing: 0.2em;
  }
  .lobby-bottom {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .lobby-dock {
    max-width: none;
    justify-content: space-between;
  }
  .lobby-quick {
    align-items: stretch;
  }
  .btn-quick-start {
    width: 100%;
  }
  .tier-pills {
    justify-content: center;
  }
}

@media (max-height: 420px) and (orientation: landscape) {
  .hero-figure {
    width: 100px;
    height: 100px;
    font-size: 52px;
  }
  .mode-tile-art {
    width: 44px;
    height: 44px;
  }
  .mj-face {
    width: 36px;
    height: 48px;
    font-size: 18px;
  }
  .mode-tile b {
    font-size: 12px;
  }
  .mode-palace {
    gap: 6px;
  }
  .btn-quick-start {
    height: 52px;
    min-width: 140px;
  }
  .btn-quick-start strong {
    font-size: 18px;
  }
  .lobby-user-av {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .top-tool {
    width: 40px;
    height: 40px;
  }
  .rail-item {
    width: 52px;
    padding: 6px 2px;
  }
  .rail-emoji {
    font-size: 18px;
  }
}

/* =========================================================
   登录 v4 — 横屏分栏（与大厅同一天空/地面）
   ========================================================= */
.screen-login {
  overflow: hidden;
  height: 100%;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.screen-login .lobby-bg {
  z-index: 0;
}
.login-land {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(260px, 1.1fr);
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  align-items: center;
  box-sizing: border-box;
}
.login-land-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #123;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  box-shadow: 0 4px 14px rgba(0, 40, 80, 0.12);
}
.login-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(145deg, #ffe08a, #f0c14b);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.login-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #1a2a20;
}
.login-brand p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #567;
  font-weight: 600;
}
.login-hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.login-hero-figure {
  width: min(140px, 28vw) !important;
  height: min(140px, 28vw) !important;
  font-size: min(72px, 14vw) !important;
}
.login-land-right {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.login-card {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  background: rgba(8, 22, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 14px 16px 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.field-compact {
  margin-bottom: 10px;
}
.field-compact .field-label {
  color: rgba(200, 220, 210, 0.75);
  margin-bottom: 6px;
}
.avatar-picker-land {
  grid-template-columns: repeat(6, 1fr);
  max-height: 96px;
  gap: 6px;
}
.avatar-picker-land .avatar-pick {
  border-radius: 10px;
  font-size: 16px;
}
.btn-enter-lobby {
  width: 100%;
  height: 50px;
  margin: 4px 0 0;
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  color: #3a2200;
  background: linear-gradient(180deg, #ffe566 0%, #f0b429 50%, #e08a10 100%);
  box-shadow: 0 5px 0 #a85a08, 0 10px 20px rgba(180, 80, 0, 0.3);
}
.btn-enter-lobby:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #a85a08, 0 6px 12px rgba(180, 80, 0, 0.25);
}
.login-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: rgba(180, 200, 190, 0.7);
}

@media (orientation: portrait) {
  .login-land {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: auto;
  }
  .login-land-left {
    padding-top: 8px;
  }
  .login-hero-figure {
    width: 100px !important;
    height: 100px !important;
    font-size: 52px !important;
  }
}
@media (max-height: 400px) and (orientation: landscape) {
  .login-brand p { display: none; }
  .login-hero-figure {
    width: 88px !important;
    height: 88px !important;
    font-size: 44px !important;
  }
  .avatar-picker-land { max-height: 72px; }
  .btn-enter-lobby { height: 44px; font-size: 16px; }
  .login-card { padding: 10px 12px; }
}

/* =========================================================
   默认卡通角色 mascot
   ========================================================= */
.mascot-wrap {
  position: relative;
  z-index: 1;
  width: min(168px, 32vw);
  height: min(168px, 32vw);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), transparent 50%),
    linear-gradient(160deg, #7ec8a0, #2a6b50);
  border: 4px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 12px 28px rgba(0, 40, 30, 0.35),
    inset 0 -8px 20px rgba(0, 0, 0, 0.12);
}
.mascot-img {
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: center 18%;
  pointer-events: none;
  user-select: none;
}
.login-hero-stage .mascot-wrap {
  width: min(150px, 30vw);
  height: min(150px, 30vw);
}
.lobby-mascot {
  width: min(160px, 28vw);
  height: min(160px, 28vw);
}
.mascot-sm {
  width: 80px !important;
  height: 80px !important;
  border-width: 3px;
}
.avatar.has-mascot,
.lobby-user-av.has-mascot,
.chip-av.has-mascot {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #7ec8a0, #2a6b50) !important;
}
.avatar.has-mascot .mascot-img,
.lobby-user-av.has-mascot .mascot-img,
.chip-av.has-mascot .mascot-img {
  width: 120%;
  height: 120%;
  object-fit: cover;
  object-position: center 20%;
}
.chip-av.has-mascot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

@media (max-height: 400px) and (orientation: landscape) {
  .login-hero-stage .mascot-wrap {
    width: 96px;
    height: 96px;
  }
  .lobby-mascot {
    width: 100px;
    height: 100px;
  }
}

/* =========================================================
   分账提示 / 结算明细
   ========================================================= */
.score-live {
  gap: 6px;
  max-width: min(320px, 96%);
}
.score-live .sc-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.score-live .sc-gang {
  font-style: normal;
  font-size: 10px;
  color: #ffd76a;
  margin-left: 2px;
}
.score-live .sc-mult {
  font-style: normal;
  font-size: 10px;
  color: #ff9a9a;
  font-weight: 800;
}
.score-live .sc-hu {
  font-style: normal;
  font-size: 10px;
  background: #a33;
  color: #fff;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 2px;
}

.score-feed {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: min(280px, 92%);
  max-height: 88px;
  overflow: hidden;
  pointer-events: none;
}
.score-feed-row {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: feed-in 0.25s ease-out;
}
.score-feed-row.plus {
  color: #8fef9a;
  border-color: rgba(100, 220, 120, 0.35);
}
.score-feed-row.minus {
  color: #ff9a9a;
  border-color: rgba(240, 100, 100, 0.35);
}
@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.score-float {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
}
.score-float b {
  font-size: 12px;
  opacity: 0.9;
}
.score-float span {
  font-size: 22px;
  font-weight: 900;
}
.score-float small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
}
.score-float.float-gang {
  border: 1px solid rgba(240, 193, 75, 0.55);
  box-shadow: 0 0 16px rgba(240, 193, 75, 0.35);
}
.score-float.float-hu {
  border: 1px solid rgba(255, 100, 100, 0.55);
  box-shadow: 0 0 18px rgba(255, 80, 80, 0.4);
  font-size: 1.05em;
}

.play-tips .tip-mult {
  color: #ffb4b4;
  font-weight: 900;
  background: rgba(120, 20, 20, 0.45);
  border: 1px solid rgba(255, 120, 120, 0.4);
  border-radius: 8px;
  padding: 2px 8px;
}
.play-tips .tip-detail {
  color: #ffd9a8;
  font-size: 11px;
}

.result-box {
  max-height: 88vh;
  overflow: auto;
  width: min(400px, 96vw) !important;
}
.stl-scores {
  margin: 0;
  padding: 0;
  list-style: none;
}
.stl-score {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}
.stl-score em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 11px;
  color: var(--text-dim);
}
.stl-score.win strong {
  color: #6f6;
}
.stl-score.lose strong {
  color: #f88;
}
.stl-lines {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}
.stl-lines li {
  padding: 6px 0;
  font-size: 12px;
  color: #d8e8df;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.4;
}
.stl-empty {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.settlement-box h3 {
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.04em;
}

/* =========================================================
   登录 / 大厅 背景图（自绘）
   ========================================================= */
.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.scene-bg-img {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
}
.scene-bg-veil {
  position: absolute;
  inset: 0;
  /* 轻微压暗上下，保证 UI 可读 */
  background:
    linear-gradient(180deg, rgba(10, 30, 50, 0.18) 0%, transparent 28%, transparent 62%, rgba(8, 24, 18, 0.22) 100%),
    radial-gradient(ellipse 70% 55% at 50% 45%, transparent 40%, rgba(0, 20, 30, 0.12) 100%);
}
.scene-bg-login .scene-bg-img {
  background-image: url('/img/bg-login.jpg');
}
.scene-bg-lobby .scene-bg-img {
  background-image: url('/img/bg-lobby.jpg');
}

/* 有实景背景时减弱旧 CSS 假天空，避免叠色发脏 */
.screen-login .lobby-bg,
.screen-lobby .lobby-bg {
  display: none;
}

.screen-login,
.screen-lobby {
  background: #7eb8d8;
}

/* 登录卡稍提对比，贴在风景上更清晰 */
.screen-login .login-card {
  background: rgba(8, 22, 16, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 48px rgba(0, 20, 30, 0.4);
}
.screen-login .login-brand {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 大厅顶栏/底栏在风景上的可读性 */
.screen-lobby .lobby-top {
  background: linear-gradient(180deg, rgba(0, 20, 40, 0.25), transparent);
}
.screen-lobby .lobby-bottom {
  background: linear-gradient(0deg, rgba(0, 20, 30, 0.28), transparent);
}

/* 房间准备：与大厅同系风景背景，轻遮罩不抢戏 */
.scene-bg-room .scene-bg-img {
  background-image: url('/img/bg-lobby.jpg');
  filter: saturate(0.92) brightness(1.06);
}
.scene-bg-veil-soft {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 30%, transparent 55%, rgba(255, 255, 255, 0.18) 100%),
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(255, 255, 255, 0.12), transparent 70%) !important;
}

@media (orientation: landscape) and (max-height: 430px) {
  .screen-room .room-invite {
    display: none;
  }
  .table-disk {
    width: min(260px, 42vh);
  }
  .room-shell {
    gap: 4px;
  }
  .room-footer .btn {
    height: 40px;
  }
}

/* =========================================================
   注册 / 登录鉴权
   ========================================================= */
.auth-boot {
  text-align: center;
  padding: 28px 12px;
}
.auth-boot-text {
  margin: 0;
  color: rgba(220, 235, 230, 0.85);
  font-size: 14px;
  font-weight: 700;
}
.auth-panel {
  text-align: left;
}
.auth-tip {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(240, 193, 75, 0.12);
  border: 1px solid rgba(240, 193, 75, 0.35);
  color: #ffe9a8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}
.auth-tabs {
  margin-bottom: 12px;
}
.auth-form.hidden {
  display: none !important;
}
.auth-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(200, 40, 40, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ffb4b4;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.auth-error.hidden {
  display: none !important;
}
.login-card input[type='password'] {
  letter-spacing: 0.08em;
}
