/* ============================================================
   8 Ball Online · 设计系统（深墨蓝黑 / 翡翠绿 / 金色点缀）
   ============================================================ */

:root {
  /* ---- PC 宽屏设计令牌 ---- */
  --bg: #070b0f;
  --bg-card: #0f161e;
  --brand: #2ee6a8;
  --gold: #ffd166;
  --text: #e9eff6;
  --muted: #8fa0b0;
  --line: rgba(255, 255, 255, 0.08);
  --radius-card: 14px;
  --radius-btn: 10px;
  --sidebar-w: 220px;
  --fs-title: 18px;
  --fs-body: 14px;
  --fs-small: 12px;
  /* ---- 既有令牌 ---- */
  --bg-deep: #080d1a;
  --surface: #111a2e;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.16);
  --primary: #17c37b;
  --primary-bright: #2ee6a8;
  --danger: #ff5a5a;
  --ink: #052015;
  --green: var(--primary-bright);
  --radius: 16px;
  --radius-pill: 999px;
  --shadow: 0 24px 70px rgba(2, 6, 14, 0.55);
  --shadow-soft: 0 12px 34px rgba(2, 6, 14, 0.38);
  --glow-primary: 0 8px 24px rgba(23, 195, 123, 0.3);
  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 640px at 85% -12%, rgba(23, 195, 123, 0.14), transparent 60%),
    radial-gradient(880px 600px at -8% 108%, rgba(64, 110, 255, 0.12), transparent 58%),
    linear-gradient(180deg, #0b1020 0%, #0d1428 52%, #080d1a 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

::selection {
  background: rgba(23, 195, 123, 0.35);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ---------- 工具类与关键状态 ---------- */

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.tiny {
  font-size: 12px;
}

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

.row.between,
.between {
  justify-content: space-between;
}

.pager {
  padding: 14px 24px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(46, 230, 168, 0.22);
  border-top-color: var(--primary-bright);
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

/* ---------- 品牌 ---------- */

.brand {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--text);
}

.brand span {
  color: var(--gold);
  text-shadow: 0 0 24px rgba(245, 197, 66, 0.45);
}

.brand em {
  display: block;
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.62em;
  color: var(--muted);
  margin-top: 12px;
  font-weight: 600;
}

.brand.small {
  font-size: 24px;
  letter-spacing: 0.14em;
}

.brand.small em {
  display: none;
}

/* ---------- 按钮 ---------- */

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: var(--radius-btn);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  box-sizing: border-box;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-bright) 100%);
  border-color: transparent;
  color: var(--ink);
  box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1fd88c, #4bf0b6);
  box-shadow: 0 12px 32px rgba(46, 230, 168, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: rgba(46, 230, 168, 0.08);
  border-color: rgba(46, 230, 168, 0.45);
  color: #d9fff0;
}

.btn.danger {
  color: #ff9d9d;
  border-color: rgba(255, 90, 90, 0.4);
  background: rgba(255, 90, 90, 0.08);
}

.btn.danger:hover {
  background: rgba(255, 90, 90, 0.15);
  border-color: rgba(255, 90, 90, 0.6);
  color: #ffc4c4;
}

.btn.big {
  padding: 15px 32px;
  font-size: 16px;
}

.btn.small {
  padding: 7px 14px;
  font-size: 13px;
}

.btn.tiny {
  padding: 4px 10px;
  font-size: 12px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s ease;
  flex: 0 0 auto;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

/* ---------- chip / 徽章 ---------- */

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  box-sizing: border-box;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-bright));
  border-color: transparent;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(23, 195, 123, 0.32);
}

.badge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.on {
  color: var(--primary-bright);
  border-color: rgba(46, 230, 168, 0.35);
  background: rgba(23, 195, 123, 0.1);
}

.badge.equipped {
  color: var(--gold);
  border-color: rgba(245, 197, 66, 0.38);
  background: rgba(245, 197, 66, 0.1);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 90;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background: rgba(13, 20, 40, 0.9);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s var(--ease);
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 90, 90, 0.5);
  color: #ffd9d9;
  box-shadow: 0 12px 30px rgba(255, 90, 90, 0.12);
}

/* ---------- 屏幕切换 ---------- */

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px clamp(16px, 4vw, 56px) 40px;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ---------- 登录页 ---------- */

#screen-login {
  justify-content: center;
  align-items: center;
}

.login-card {
  width: min(400px, 100%);
  padding: 44px 34px 30px;
  border-radius: 24px;
  background: rgba(9, 14, 23, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
}

.screen.active .login-card {
  animation: fade-up 0.45s var(--ease) both;
}

.tagline {
  margin: 14px 0 26px;
  color: #b6c5d2;
  letter-spacing: 0.04em;
  font-size: 14px;
}

/* 登录页语言切换：卡片顶部三枚全称按钮，与卡片同宽等分 */
.lang-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin-bottom: 18px;
}

.lang-option {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.lang-option:hover {
  border-color: rgba(46, 230, 168, 0.42);
  color: #eaf6f1;
}

.lang-option.active {
  border-color: var(--brand);
  background: rgba(46, 230, 168, 0.14);
  color: #eaf6f1;
}

/* 登录方式切换：游客 / 邮箱登录 / 注册，沿用大厅 chip 视觉 */
.login-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 4px;
}

.login-tab {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  padding: 7px 10px;
  font-size: 12.5px;
  white-space: normal;
  text-align: center;
}

.login-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.login-pane.active {
  display: flex;
}

#login-form,
#email-login-form,
#email-register-form,
#reset-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.link-btn {
  align-self: center;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: #7df0c6;
}

.login-pane .hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.login-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(255, 90, 90, 0.12);
  color: #ffb9b9;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}

.code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.code-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.code-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

#login-name,
#email-login-email,
#email-login-password,
#register-email,
#register-code,
#register-password,
#register-name,
#reset-email,
#reset-code,
#reset-password,
#security-email-input,
#security-email-code,
#security-password,
#security-reset-code,
#security-new-password,
.field input,
.field select,
.input-inline {
  padding: 15px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(4, 8, 18, 0.45);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#login-name {
  width: 100%;
}

.field input,
.field select {
  width: 100%;
}

.input-inline {
  padding: 9px 14px;
  font-size: 13px;
  width: auto;
}

#login-name:focus,
.field input:focus,
.field select:focus,
.input-inline:focus {
  border-color: rgba(46, 230, 168, 0.55);
  box-shadow: 0 0 0 3px rgba(23, 195, 123, 0.15);
  background: rgba(4, 8, 18, 0.6);
}

.input-inline option,
.field select option {
  background: var(--surface);
  color: var(--text);
}

.hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.login-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  font-size: 11px;
  color: var(--muted);
}

.login-features span {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

/* 版本互跳入口（PC 页脚 → 手机版；移动端页面 → 电脑版） */
.screen-switch {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.screen-switch:hover,
.screen-switch:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- 大厅顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto 28px;
}

.screen.active .topbar {
  animation: fade-up 0.35s var(--ease) both;
}

.user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

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

.coin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 197, 66, 0.3);
  background: rgba(245, 197, 66, 0.08);
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.coin i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffe89a, #e0a915 62%, #a97b06);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.16), 0 0 8px rgba(245, 197, 66, 0.5);
}

.coin.silver {
  border-color: rgba(196, 209, 222, 0.32);
  background: rgba(196, 209, 222, 0.09);
  color: #cfdae4;
}

.coin.silver i {
  background: radial-gradient(circle at 34% 30%, #ffffff, #c3ced9 62%, #7e8b97);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.14), 0 0 8px rgba(196, 209, 222, 0.45);
}

.level-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 197, 66, 0.35);
  background: rgba(245, 197, 66, 0.07);
}

.level-badge b {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1;
}

.rank-chip {
  --rank-color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rank-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--rank-color);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.18);
}

.rank-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rank-color);
  box-shadow: 0 0 8px var(--rank-color);
}

.xp-bar {
  width: 72px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.xp-bar i,
#xp-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--gold), #ffe9a8);
  box-shadow: 0 0 6px rgba(245, 197, 66, 0.6);
  transition: width 0.4s ease;
}

#open-daily {
  position: relative;
}

.dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 90, 90, 0.9);
  animation: dot-pulse 1.6s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}

/* ---------- 大厅布局 ---------- */

.lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  margin-bottom: 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.lobby-topbar .tb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lobby-topbar .tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* 下载客户端主按钮：顶部唯一强 CTA */
.tb-download {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px 7px 10px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(245, 197, 66, 0.42);
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.16), rgba(46, 230, 168, 0.12));
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.18s ease, box-shadow 0.18s ease;
}

.tb-download:hover {
  border-color: rgba(245, 197, 66, 0.7);
  box-shadow: 0 6px 20px rgba(245, 197, 66, 0.18);
}

.tb-download:active {
  transform: scale(0.97);
}

.tb-download-icon {
  font-size: 20px;
  line-height: 1;
}

.tb-download-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.tb-download-copy b {
  font-size: 13px;
  color: var(--gold);
}

.tb-download-sub {
  font-size: 11px;
  color: var(--muted);
}

.tb-download-cta {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(46, 230, 168, 0.12);
}

/* 顶部次级入口：消息 / 设置（通知与工具，不承载身份信息） */
.tb-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.15s var(--ease);
}

.tb-action:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.tb-action:active {
  transform: scale(0.97);
}

.tb-action-icon {
  font-size: 15px;
}

.tb-action .dot {
  position: absolute;
  top: 6px;
  right: 8px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.lobby-grid .panel.hero {
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: 0;
}

.lobby-grid .panel.entry-panel {
  grid-column: 2;
  grid-row: 1;
}

.lobby-grid .panel.friend-panel {
  grid-column: 2;
  grid-row: 2;
}

.lobby-grid .panel.board-panel {
  grid-column: 1 / -1;
  grid-row: 3;
}

/* 入口网格在面板内紧凑显示 */
.entry-panel .entry-grid.lobby-entries {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.entry-panel .entry-card.row-entry {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 12px;
  min-height: 44px;
  box-sizing: border-box;
}

.entry-panel .entry-card.row-entry .entry-icon {
  font-size: 18px;
}

.entry-panel .entry-card.row-entry .entry-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-panel .entry-card.row-entry .entry-main b {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.entry-panel .entry-card.row-entry .entry-main .muted {
  font-size: 11px;
  line-height: 1.35;
}

/* 底部面板横向子面板 */
.board-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.board-panel .board-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 战绩列表 */
.match-list.rich {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.match-list.rich li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.match-list.rich .mh-result {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.match-list.rich .mh-result.win {
  background: rgba(46, 230, 168, 0.18);
  color: var(--brand);
}

.match-list.rich .mh-result.lose {
  background: rgba(255, 90, 90, 0.15);
  color: #ff7a7a;
}

.match-list.rich .mh-opp {
  font-size: 13px;
  color: var(--text);
}

.match-list.rich .mh-mode {
  font-size: 11px;
  color: var(--muted);
}

.match-list.rich .mh-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

/* 排行榜在底部面板中 */
.board-panel .leaderboard.rich {
  max-height: 200px;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  overflow: hidden;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.screen.active .lobby-grid > .panel {
  animation: fade-up 0.45s var(--ease) both;
}

.screen.active .lobby-grid > .panel:nth-child(2) {
  animation-delay: 0.06s;
}

.screen.active .lobby-grid > .panel:nth-child(3) {
  animation-delay: 0.12s;
}

.screen.active .lobby-grid > .panel:nth-child(4) {
  animation-delay: 0.18s;
}

.hero {
  grid-area: hero;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  background:
    linear-gradient(160deg, rgba(23, 195, 123, 0.13), rgba(255, 255, 255, 0.03) 45%, rgba(64, 110, 255, 0.09));
}

.hero-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  right: -140px;
  top: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 230, 168, 0.24), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.36em;
  color: var(--primary-bright);
  font-weight: 700;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}

.hero .muted {
  max-width: 420px;
  margin-bottom: 26px;
  font-size: 14px;
}

.hero .btn.big {
  align-self: flex-start;
}

.mode-select {
  margin: 18px 0 14px;
}

.mode-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.mode-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-chips .chip {
  padding: 9px 18px;
  font-size: 13px;
}

.practice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.practice-row .mode-label {
  margin-bottom: 0;
  font-size: 12px;
}

.friend-section {
  margin-top: 16px;
}

.friend-section details {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.friend-section summary {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.18s ease;
}

.friend-section summary:hover {
  color: var(--text);
}

.friend-section summary::-webkit-details-marker {
  display: none;
}

.friend-section summary::before {
  content: "▶";
  font-size: 10px;
  transition: transform 0.2s ease;
}

.friend-section details[open] summary::before {
  transform: rotate(90deg);
}

.friend-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.friend-mode .mode-label {
  margin-bottom: 0;
}

.friend-mode .mode-chips .chip {
  padding: 6px 12px;
  font-size: 12px;
}

.friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.friend-join {
  display: flex;
  gap: 6px;
  align-items: center;
}

.friend-join input {
  width: 120px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 18, 0.45);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.friend-join input:focus {
  border-color: rgba(46, 230, 168, 0.55);
  box-shadow: 0 0 0 3px rgba(23, 195, 123, 0.14);
}

.friend-code {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  background: rgba(23, 195, 123, 0.06);
  border: 1px dashed rgba(46, 230, 168, 0.35);
}

.friend-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--primary-bright);
}

.friend-waiting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.friend-waiting-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.friend-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.friend-player b {
  font-weight: 600;
  color: var(--text);
}

.friend-player.ready {
  border-color: rgba(46, 230, 168, 0.5);
  background: rgba(23, 195, 123, 0.08);
}

.friend-player.ready .friend-player-status {
  color: var(--primary-bright);
}

.friend-waiting-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-status {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  margin-top: 14px;
  padding: 10px 12px 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(46, 230, 168, 0.32);
  background: rgba(23, 195, 123, 0.08);
  font-size: 14px;
}

.stats {
  display: flex;
  gap: 40px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.stats div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats b {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 17px;
  letter-spacing: 0.02em;
}

/* ---------- 商城 ---------- */

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.shop-grid.compact {
  grid-template-columns: 1fr;
  gap: 10px;
}

.shop-card {
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease, transform 0.2s var(--ease), box-shadow 0.2s ease;
}

.shop-card:hover {
  border-color: rgba(46, 230, 168, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(2, 6, 14, 0.4);
}

.shop-grid.compact .shop-card {
  flex-direction: row;
  align-items: center;
  padding: 10px;
}

.skin-preview {
  height: 74px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.shop-grid.compact .skin-preview {
  width: 74px;
  height: 52px;
}

.skin-preview.table {
  background:
    radial-gradient(circle at 50% 50%, #07130f 0 9%, transparent 10%),
    linear-gradient(135deg, var(--p1, #0c6b52) 0 62%, var(--p2, #5b3a22) 62% 100%);
}

.skin-preview.table::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--p1, #0c6b52);
  box-shadow: 0 0 14px var(--p3, #2ee6a8), inset 0 0 13px var(--p3, #2ee6a8);
}

.skin-preview.cue {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.3));
}

/* 球杆等级特效：卡片/商城/背包的静态帧按 Lv2-Lv5 逐级增强（--fx/--fx2 为该皮肤主题色） */
.skin-fx {
  --fx: #ffd166;
  --fx2: #d4af37;
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.skin-fx::before {
  content: "";
  position: absolute;
  inset: -30% -45%;
  background: linear-gradient(112deg, transparent 40%, var(--fx) 50%, transparent 60%);
  opacity: 0.4;
  animation: fx-sheen 7s linear infinite;
}

.skin-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 120%, var(--fx), transparent 62%);
  box-shadow: inset 0 0 16px -4px var(--fx);
  opacity: 0.3;
}

.skin-fx[data-level="3"]::before {
  opacity: 0.72;
  animation-duration: 3.2s;
}

.skin-fx[data-level="3"]::after {
  opacity: 0.56;
  box-shadow: inset 0 0 24px 0 var(--fx), 0 0 18px -6px var(--fx);
}

.skin-fx[data-level="4"]::before {
  opacity: 0.88;
  animation-duration: 2.2s;
}

.skin-fx[data-level="4"]::after {
  opacity: 0.8;
  background:
    radial-gradient(circle at 12% 54%, var(--fx) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 34%, var(--fx2) 0 2px, transparent 3px),
    radial-gradient(circle at 58% 64%, var(--fx) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 44%, var(--fx2) 0 2px, transparent 3px),
    radial-gradient(ellipse at 50% 50%, transparent 34%, var(--fx) 130%, transparent 68%);
  box-shadow: inset 0 0 28px 0 var(--fx);
  animation: fx-pulse 2.6s ease-in-out infinite;
}

.skin-fx[data-level="5"]::before {
  opacity: 1;
  animation-duration: 1.7s;
}

.skin-fx[data-level="5"]::after {
  opacity: 1;
  background:
    radial-gradient(circle at 8% 62%, var(--fx2) 0 2px, transparent 3px),
    radial-gradient(circle at 22% 28%, var(--fx) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 70%, var(--fx2) 0 2px, transparent 3px),
    radial-gradient(circle at 56% 26%, var(--fx) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 60%, var(--fx2) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 36%, var(--fx) 0 2px, transparent 3px),
    radial-gradient(circle at 50% 50%, transparent 20%, var(--fx) 120%, transparent 64%);
  box-shadow: inset 0 0 34px 2px var(--fx), 0 0 22px -6px var(--fx);
  animation: fx-pulse 1.9s ease-in-out infinite, fx-breathe 3.4s ease-in-out infinite alternate;
}

@keyframes fx-sheen {
  from { transform: translateX(-55%); }
  to { transform: translateX(55%); }
}

@keyframes fx-pulse {
  0%, 100% { filter: brightness(0.92); }
  50% { filter: brightness(1.25); }
}

@keyframes fx-breathe {
  from { opacity: 0.78; }
  to { opacity: 1; }
}

/* 满级（Lv5）一次性解锁高亮：只在升级完成后那一帧渲染，播一次即停止 */
.shop-card.fx-lv5-gain {
  animation: fx-lv5-gain 1.5s ease-out 1;
}

@keyframes fx-lv5-gain {
  0% { box-shadow: 0 0 0 0 var(--fx, #ffd166); }
  35% { box-shadow: 0 0 26px 6px var(--fx, #ffd166); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.tier-badge.fx-badge {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.72;
}

.tier-badge.fx-badge[data-level="3"] {
  opacity: 0.88;
}

.tier-badge.fx-badge[data-level="4"] {
  opacity: 1;
  box-shadow: 0 0 10px -2px currentColor;
}

.tier-badge.fx-badge[data-level="5"] {
  opacity: 1;
  color: #ffe6a3;
  border-color: rgba(255, 214, 102, 0.85);
  box-shadow: 0 0 14px -2px rgba(255, 214, 102, 0.9);
}

.skin-preview.cue::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 48%;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--p2, #7a4a24), var(--p1, #e3c18c) 55%, var(--p3, #c9a24a));
  transform: rotate(-8deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), 0 0 16px var(--p4, #c9a24a);
}

.skin-preview.ball {
  background: radial-gradient(circle at 50% 45%, var(--p2, #7ad7ff), transparent 60%), rgba(0, 0, 0, 0.25);
}

.skin-preview.ball::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 34% 30%, #fff, var(--p1, #f2fbff) 55%, #9fb2bd);
  box-shadow: 0 0 18px var(--p2, #7ad7ff);
}

.skin-preview.avatar {
  background: radial-gradient(circle at 50% 50%, var(--p3, #2ee6a8) 0 28%, transparent 29%),
    radial-gradient(circle at 50% 50%, var(--p1, #0c6b52) 0 24%, transparent 25%);
}

.skin-preview.avatar::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--p2, #ffffff);
  -webkit-mask: radial-gradient(circle, #000 40%, transparent 60%);
  mask: radial-gradient(circle, #000 40%, transparent 60%);
  box-shadow: 0 0 18px var(--p4, #2ee6a8);
}

.skin-preview.avatar.face {
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  background: radial-gradient(circle at 50% 50%, var(--p1, #0c6b52) 0 62%, transparent 63%);
  box-shadow: inset 0 0 20px var(--p4, #2ee6a8);
}

.skin-preview.avatar.face::after {
  display: none;
}

.skin-preview.bundle {
  background: linear-gradient(120deg, var(--p1, #2ee6a8), var(--p2, #c9a24a) 45%, var(--p3, #7ad7ff));
}

.skin-preview.bundle::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 7px;
  background: conic-gradient(
    from 0deg,
    var(--p1, #2ee6a8),
    var(--p2, #c9a24a),
    var(--p3, #7ad7ff),
    var(--p4, #ff6b35),
    var(--p5, #b06bff),
    var(--p1, #2ee6a8)
  );
  box-shadow: 0 0 20px var(--p3, #7ad7ff), inset 0 0 12px rgba(255, 255, 255, 0.35);
}

.skin-preview.cue_effect {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.15));
}

.skin-preview.cue_effect::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, var(--p1, #ffffff) 30%, var(--p1, #ffffff) 70%, transparent);
  box-shadow: 0 0 12px var(--p2, #7ad7ff), 0 0 24px var(--p2, #7ad7ff);
}

/* 悬停流光：让皮肤卡片更有炫彩质感 */
.skin-preview::before {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -40%;
  right: -40%;
  z-index: 2;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.3) 50%, transparent 58%);
  opacity: 0;
  transform: translateX(-60%);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.shop-card:hover .skin-preview::before {
  opacity: 1;
  animation: skin-sheen 1.05s var(--ease);
}

@keyframes skin-sheen {
  from {
    transform: translateX(-60%);
  }
  to {
    transform: translateX(60%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-card:hover .skin-preview::before {
    animation: none;
    opacity: 0;
  }
}

.skin-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.skin-info b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skin-info span {
  font-size: 11px;
  color: var(--muted);
}

.skin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.price.free {
  color: var(--primary-bright);
}

.shop-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---------- 排行榜 ---------- */

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 10px;
  font-size: 13px;
  transition: background 0.15s ease;
}

.leaderboard li:hover {
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard .rank {
  width: 22px;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.leaderboard li:first-child .rank {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245, 197, 66, 0.5);
}

.leaderboard .who {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.leaderboard .score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lv-tag {
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(245, 197, 66, 0.12);
  color: var(--gold);
  border: 1px solid rgba(245, 197, 66, 0.3);
  vertical-align: 1px;
  flex: 0 0 auto;
}

.rank-tag {
  --rank-color: var(--gold);
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--rank-color);
  border: 1px solid var(--rank-color);
  vertical-align: 1px;
  flex: 0 0 auto;
}

/* ---------- 最近战绩 ---------- */

.match-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.match-history::-webkit-scrollbar {
  width: 6px;
}

.match-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.match-history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.35);
  transition: border-color 0.15s ease;
}

.match-history li:hover {
  border-color: var(--line-strong);
}

.result-tag,
.mh-result {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.result-tag.win,
.mh-result.win {
  background: rgba(23, 195, 123, 0.16);
  color: var(--primary-bright);
  border: 1px solid rgba(46, 230, 168, 0.4);
}

.result-tag.lose,
.mh-result.lose {
  background: rgba(255, 90, 90, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 90, 90, 0.35);
}

.mh-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.mh-main b {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-opp {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mh-time {
  flex: 0 0 auto;
}

/* ---------- 对局页 ---------- */

#screen-game {
  padding-top: 14px;
  gap: 14px;
}

.game-head {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.screen.active .game-head {
  animation: fade-up 0.35s var(--ease) both;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(17, 26, 46, 0.55);
  backdrop-filter: blur(14px);
  min-width: 0;
  flex: 1;
  max-width: 380px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.player-card.right {
  flex-direction: row-reverse;
  text-align: right;
}

.player-card.active {
  border-color: rgba(46, 230, 168, 0.55);
  background: rgba(23, 195, 123, 0.09);
  box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.22), 0 12px 32px rgba(23, 195, 123, 0.16);
}

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(135deg, var(--primary-bright), var(--primary));
  box-shadow: 0 4px 14px rgba(23, 195, 123, 0.35);
}

.avatar.opp {
  background: linear-gradient(135deg, #8fb6ff, #4a7ad6);
  color: #071021;
  box-shadow: 0 4px 14px rgba(74, 122, 214, 0.35);
}

.avatar.face {
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}

.player-card .meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.player-card .meta b {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card .meta span {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-card.right .meta span {
  justify-content: flex-end;
}

.grp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4d5b68;
  display: inline-block;
  flex: 0 0 auto;
}

.grp-dot.solids {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(245, 197, 66, 0.6);
}

.grp-dot.stripes {
  background: #4a8df0;
  box-shadow: 0 0 6px rgba(74, 141, 240, 0.6);
}

.balls-left {
  margin-left: auto;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player-card.active .balls-left {
  color: var(--primary-bright);
}

.player-card.right .balls-left {
  margin-left: 0;
  margin-right: auto;
}

.turn-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 90px;
}

.turn-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.25s ease;
}

.turn-badge.mine {
  color: var(--ink);
  background: linear-gradient(135deg, var(--primary), var(--primary-bright));
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(23, 195, 123, 0.4);
}

.turn-badge.foul {
  color: var(--danger);
  border-color: rgba(255, 90, 90, 0.4);
}

.timer {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.timer.warn {
  color: var(--danger);
  border-color: rgba(255, 90, 90, 0.45);
}

.canvas-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(2, 6, 14, 0.45));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 1.814;
  position: relative;
}

.screen.active .canvas-shell {
  animation: fade-up 0.4s var(--ease) 0.05s both;
}

#table {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

#table.disabled {
  cursor: default;
}

/* 底部与左侧栏重复的控件隐藏（DOM 保留以维持联动逻辑），改为已入袋球托盘 */

.footer-dup {
  display: none !important;
}

.tray {
  flex: 1;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.6vw, 16px);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tray::-webkit-scrollbar {
  display: none;
}

.tray-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tray-group.mine {
  border-color: rgba(46, 230, 168, 0.55);
  background: rgba(46, 230, 168, 0.08);
}

.tray-label {
  font-size: 10px;
  color: rgba(235, 255, 248, 0.5);
  margin-right: 2px;
}

.tray-ball {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c, #888);
  opacity: 0.28;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  flex: 0 0 auto;
}

.tray-ball.stripe {
  background: linear-gradient(180deg, var(--c) 0 24%, #f4f4f4 24% 76%, var(--c) 76% 100%);
}

.tray-ball.down {
  opacity: 1;
  box-shadow: 0 0 7px rgba(46, 230, 168, 0.55);
}

.tray-reds {
  font-size: 11px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 移动端托盘紧凑化，保证横屏也能完整放下 */
@media (max-width: 900px) {
  .tray {
    gap: 6px;
  }

  .tray-group {
    padding: 3px 6px;
    gap: 3px;
  }

  .tray-ball {
    width: 15px;
    height: 15px;
    font-size: 8px;
  }

  .tray-label {
    font-size: 9px;
  }
}

/* 三区布局：左右控制器｜球台+消息+操作条｜左右控制器，整体居中 */

.table-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.1vw, 20px);
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

/* 中列同时承载球台、消息条与底部操作条，三者宽度天然对齐；
   宽度与球台同源（高度换算上限），使左右控制器始终紧贴球台两侧 */
.game-center {
  flex: 0 1 auto;
  width: min(100%, calc((100dvh - var(--game-chrome)) * 1.814));
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 球台宽度取「中列宽度」与「按可用高度换算」的较小值，高度由 1.814 比例决定 */
#screen-game .table-row .canvas-shell {
  flex: 0 0 auto;
  width: min(100%, calc((100dvh - var(--game-chrome)) * 1.814));
  min-width: 0;
  max-width: none;
  margin-inline: auto;
}

.side-control {
  position: relative;
  flex: 0 0 auto;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 7px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 23, 32, 0.82), rgba(6, 10, 15, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.2s ease;
}

.side-value {
  margin-top: -1px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: #eafff7;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.side-value em {
  margin-left: 1px;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  color: rgba(46, 230, 168, 0.9);
}

.side-control.off {
  opacity: 0.38;
}

.side-control.off .side-meter {
  pointer-events: none;
}

.side-label {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: rgba(235, 255, 248, 0.85);
}

.side-sub {
  font-size: 9px;
  color: rgba(235, 255, 248, 0.45);
  white-space: nowrap;
}

.side-meter {
  position: relative;
  width: 34px;
  height: clamp(120px, 32vh, 220px);
  border-radius: 11px;
  background: linear-gradient(90deg, #0b1015, #333c46 22%, #141a21 52%, #333c46 78%, #0b1015);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 14px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 6px 18px rgba(0, 0, 0, 0.45);
  overflow: visible;
  touch-action: none;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.side-meter.active {
  border-color: rgba(46, 230, 168, 0.55);
}

/* 刻度：10% 一格，30% 一条主刻度，页面上能直接估出力度档位 */
.side-tick {
  position: absolute;
  z-index: 2;
  left: 3px;
  right: 3px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.side-tick.major {
  left: 1px;
  right: 1px;
  background: linear-gradient(90deg, rgba(245, 197, 66, 0.62), rgba(245, 197, 66, 0.12));
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.6),
    0 0 5px rgba(245, 197, 66, 0.28);
}

.side-fill {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 3px;
  right: 3px;
  height: 60%;
  border-radius: 6px;
  background: linear-gradient(180deg, #2ee6a8, #17c37b 56%, #f5c542);
  opacity: 0.9;
  pointer-events: none;
  transition: box-shadow 0.16s ease;
}

/* 按压时的条内流光 */
.side-fill-flow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.44) 40%,
    rgba(255, 255, 255, 0.06) 62%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 100% 220%;
  opacity: 0.42;
  animation: side-flow 2s linear infinite;
  pointer-events: none;
}

.side-meter.active .side-fill-flow {
  opacity: 0.95;
  animation-duration: 0.85s;
}

.side-meter.active .side-fill {
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.4),
    0 0 16px rgba(46, 230, 168, 0.55);
}

/* 玻璃层：左右竖向反光，金属条不再像色块 */
.side-glass {
  position: absolute;
  z-index: 3;
  inset: 2px;
  border-radius: 9px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.18) 12%,
    rgba(255, 255, 255, 0.02) 36%,
    rgba(255, 255, 255, 0) 64%,
    rgba(255, 255, 255, 0.09) 88%,
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.side-knob {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 60%;
  transform: translate(-50%, 50%);
  min-width: 30px;
  height: 22px;
  padding: 0 4px;
  border-radius: 11px;
  background: #0b1522;
  border: 1px solid rgba(46, 230, 168, 0.7);
  color: #ebfff8;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

@keyframes side-flow {
  0% {
    background-position: 0 -110%;
  }
  100% {
    background-position: 0 110%;
  }
}

.aim-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

/* 方向刻度：与力度条同一套刻线语言，30% 为主线 */
.aim-tick {
  position: absolute;
  z-index: 2;
  left: 4px;
  right: 4px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.aim-tick.major {
  left: 2px;
  right: 2px;
  height: 2px;
  background: linear-gradient(90deg, rgba(232, 199, 102, 0.12), rgba(232, 199, 102, 0.62), rgba(232, 199, 102, 0.12));
  box-shadow: 0 0 5px rgba(232, 199, 102, 0.22);
}

.aim-center {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(90deg, rgba(46, 230, 168, 0), rgba(46, 230, 168, 0.85), rgba(46, 230, 168, 0));
  box-shadow: 0 0 8px rgba(46, 230, 168, 0.45);
  pointer-events: none;
}

.aim-arrow {
  font-size: 13px;
  color: rgba(46, 230, 168, 0.85);
  pointer-events: none;
}

.side-fire {
  margin-top: 2px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(46, 230, 168, 0.8);
  background: radial-gradient(circle at 35% 30%, rgba(46, 230, 168, 0.45), rgba(6, 20, 16, 0.9));
  color: #ebfff8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 14px rgba(46, 230, 168, 0.35), 0 3px 10px rgba(0, 0, 0, 0.5);
}

.side-fire:active {
  transform: scale(0.93);
}

.side-control.off .side-fire {
  pointer-events: none;
}

/* 左侧栏击球点小转盘（参考 247pool 左下角旋钮） */

.side-spin {
  position: relative;
  width: 46px;
  height: 46px;
  margin-top: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #cfd6dd 65%, #9aa7b4);
  border: 2px solid rgba(47, 111, 208, 0.75);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 -3px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  touch-action: none;
}

.side-spin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2f6fd0;
  box-shadow: 0 0 5px rgba(47, 111, 208, 0.8);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.side-control.off .side-spin {
  pointer-events: none;
}

/* 竖屏：球台占满顶部，操作栏落在原「横屏提示」区域，左右分居像游戏机手柄 */
@media (max-width: 900px) and (orientation: portrait) {
  .table-row {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    flex-wrap: wrap;
    align-content: space-evenly;
    justify-content: space-between;
    gap: 10px 6px;
  }

  #screen-game .table-row .canvas-shell {
    flex: 1 1 100%;
    width: 100%;
  }

  .side-control.left {
    order: 2;
  }

  .side-control.right {
    order: 3;
  }

  .side-control {
    padding: 10px 8px;
    border-radius: 14px;
    gap: 5px;
  }

  .side-meter {
    width: 34px;
    height: clamp(120px, 20vh, 170px);
  }

  .side-fire {
    width: 46px;
    height: 46px;
    font-size: 13px;
  }

  .side-spin {
    width: 42px;
    height: 42px;
  }

  .tray {
    flex: 1 1 100%;
  }
}

/* 矮屏手机再压缩一档，保证球台+控制盘+底栏不重叠 */
@media (max-width: 900px) and (orientation: portrait) and (max-height: 680px) {
  .side-meter {
    height: clamp(72px, 13vh, 100px);
  }

  .side-fire {
    width: 38px;
    height: 38px;
    font-size: 12px;
  }

  .side-spin {
    width: 34px;
    height: 34px;
  }

  .side-sub {
    display: none;
  }
}

/* 局内消息：固定在球台与操作条之间的消息流，不再悬浮在空景上 */

.chat-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 2px 4px;
  min-width: 0;
}

.chat-strip-label {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(235, 255, 248, 0.42);
  white-space: nowrap;
}

.chat-bubbles {
  position: static;
  transform: none;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  width: auto;
  max-width: none;
}

.chat-bubbles .chat-bubble {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 14px;
  font-size: 12px;
}

.chat-bubble {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(8, 13, 26, 0.88);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(2, 6, 14, 0.45);
  animation: bubble-in 0.22s var(--ease);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.chat-bubble.mine {
  border-color: rgba(46, 230, 168, 0.5);
  background: rgba(11, 40, 30, 0.88);
}

.chat-bubble.out {
  opacity: 0;
  transform: translateY(-8px);
}

.chat-name {
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 auto;
}

.chat-bubble.mine .chat-name {
  color: var(--primary-bright);
}

.chat-text {
  font-size: 14px;
  line-height: 1.3;
  word-break: break-all;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(17, 26, 46, 0.55);
  backdrop-filter: blur(14px);
  animation: fade-up 0.2s var(--ease);
}

.chat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-item {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-item:hover {
  border-color: rgba(46, 230, 168, 0.5);
  background: rgba(23, 195, 123, 0.12);
}

.chat-item.emoji {
  font-size: 17px;
  padding: 5px 12px;
}

/* 底部操作条 */

.game-foot {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(17, 26, 46, 0.55);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.screen.active .game-foot {
  animation: fade-up 0.4s var(--ease) 0.1s both;
}

.power-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  min-width: 240px;
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.power-box b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  width: 40px;
  text-align: right;
}

.spin-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 14px 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  flex: 0 0 auto;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.spin-box:hover,
.spin-box:focus-visible {
  border-color: rgba(46, 230, 168, 0.45);
  background: rgba(46, 230, 168, 0.08);
}

.spin-label {
  white-space: nowrap;
}

.spin-adjust {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  color: var(--primary-bright);
  background: rgba(46, 230, 168, 0.12);
  border: 1px solid rgba(46, 230, 168, 0.22);
  white-space: nowrap;
}

/* 大号击球点选择面板 */
.spin-card {
  width: min(400px, 100%);
  text-align: left;
}

.spin-stage {
  display: flex;
  justify-content: center;
  padding: 6px 0 18px;
}

.spin-big {
  width: clamp(190px, 62vw, 260px);
  height: clamp(190px, 62vw, 260px);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff, #dbe1e9 62%, #aab3c0 100%);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.16), 0 16px 34px rgba(2, 6, 14, 0.45);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  padding: 16px;
}

.spin-cell {
  width: clamp(34px, 11vmin, 46px);
  height: clamp(34px, 11vmin, 46px);
  padding: 0;
  border: 1px solid rgba(17, 26, 46, 0.3);
  border-radius: 50%;
  background: rgba(17, 26, 46, 0.16);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.spin-cell:hover {
  background: rgba(23, 195, 123, 0.28);
}

.spin-cell.active {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.85), 0 0 16px rgba(46, 230, 168, 0.6);
  transform: scale(1.12);
}

.spin-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spin-current {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-bright);
}

.spin-ball {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff, #dbe1e9 62%, #aab3c0 100%);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.16), 0 6px 14px rgba(0, 0, 0, 0.32);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  padding: 5px;
}

.spin-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(17, 26, 46, 0.28);
  border-radius: 50%;
  background: rgba(17, 26, 46, 0.16);
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.spin-dot:hover {
  background: rgba(23, 195, 123, 0.55);
  transform: scale(1.18);
}

.spin-dot.active {
  background: var(--primary);
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.55), 0 0 10px rgba(46, 230, 168, 0.6);
}

#power-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(23, 195, 123, 0.35), rgba(46, 230, 168, 0.75));
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  outline: none;
}

#power-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eafff5, var(--primary-bright) 55%, var(--primary));
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.85), 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: grab;
  transition: transform 0.15s ease;
}

#power-range::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

#power-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(23, 195, 123, 0.35), rgba(46, 230, 168, 0.75));
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.25);
}

#power-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
}

#power-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eafff5, var(--primary-bright) 55%, var(--primary));
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 12px rgba(46, 230, 168, 0.85), 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: grab;
}

#power-range:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.game-message {
  font-size: 13px;
  color: var(--text);
  flex: 1.4;
  min-width: 200px;
  text-align: center;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- 弹窗通用 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(10px);
  animation: fade-in 0.18s ease;
}

.modal-card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #141e35, #0d1428);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  animation: scale-in 0.22s var(--ease);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.modal-card.wide {
  width: min(940px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  font-size: 21px;
  margin-bottom: 6px;
}

.modal-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 结算弹窗 ---------- */

.result-card {
  text-align: center;
  padding: 36px 28px 28px;
}

.result-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-bright), var(--primary));
  color: var(--ink);
  box-shadow: 0 14px 38px rgba(23, 195, 123, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.result-mark.lose {
  background: linear-gradient(135deg, #6b7280, #39424d);
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.practice-tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 197, 66, 0.4);
  background: rgba(245, 197, 66, 0.1);
  color: var(--gold);
}

.result-card h2 {
  font-size: 26px;
  margin-top: 4px;
  margin-bottom: 6px;
}

.result-stats,
.result-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 24px;
}

.result-stats div,
.result-row {
  padding: 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-stats b,
.result-value {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.result-stats b.pos {
  color: var(--primary-bright);
}

.result-stats b.neg {
  color: #ff7b7b;
}

.result-stats div:nth-child(1) b,
.result-value.gold {
  color: var(--gold);
}

.result-stats div:nth-child(2) b,
.result-value.xp {
  color: var(--primary-bright);
}

.result-stats span {
  font-size: 11px;
  color: var(--muted);
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
}

.result-actions .btn {
  flex: 1;
}

/* ---------- 每日签到 ---------- */

.daily-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.daily-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 4px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: day-pop 0.32s var(--ease) both;
}

.daily-day:nth-child(1) { animation-delay: 0.02s; }
.daily-day:nth-child(2) { animation-delay: 0.06s; }
.daily-day:nth-child(3) { animation-delay: 0.1s; }
.daily-day:nth-child(4) { animation-delay: 0.14s; }
.daily-day:nth-child(5) { animation-delay: 0.18s; }
.daily-day:nth-child(6) { animation-delay: 0.22s; }
.daily-day:nth-child(7) { animation-delay: 0.26s; }

@keyframes day-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.daily-day .day-label,
.daily-day-label {
  font-size: 10px;
  color: var(--muted);
}

.daily-day b,
.daily-day-reward {
  font-size: 15px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.daily-day .day-state {
  font-size: 10px;
  color: var(--muted);
}

.daily-day.claimed {
  border-color: rgba(46, 230, 168, 0.45);
  background: rgba(23, 195, 123, 0.09);
}

.daily-day.claimed .day-state {
  color: var(--primary-bright);
}

.daily-day.next {
  border-color: rgba(245, 197, 66, 0.7);
  background: rgba(245, 197, 66, 0.1);
  animation: day-pop 0.32s var(--ease) both, next-glow 2s ease-in-out 0.4s infinite;
}

.daily-day.next .day-state {
  color: var(--gold);
  font-weight: 700;
}

@keyframes next-glow {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(245, 197, 66, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(245, 197, 66, 0.42);
  }
}

.daily-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  text-align: center;
}

/* ---------- 每日任务 ---------- */

.daily-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 10px;
}

.daily-section-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.daily-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.daily-task {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  padding: 12px 14px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease;
}

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

.dt-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dt-progress {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dt-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.dt-side b {
  color: var(--gold);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dt-side .btn.small {
  padding: 4px 12px;
  font-size: 12px;
}

.dt-state {
  font-size: 11px;
  color: var(--muted);
}

.dt-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.dt-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-bright));
  transition: width 0.35s ease;
}

.daily-task.ready {
  border-color: rgba(245, 197, 66, 0.6);
  background: rgba(245, 197, 66, 0.08);
}

.daily-task.done {
  border-color: rgba(23, 195, 123, 0.35);
}

.daily-task.done .dt-bar i {
  background: rgba(23, 195, 123, 0.55);
}

/* ---------- 充值 ---------- */

.recharge-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.recharge-stage {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.recharge-packages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.package-card {
  position: relative;
  text-align: left;
  padding: 15px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  color: var(--text);
  font-family: inherit;
}

.package-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.package-card.active {
  border-color: rgba(245, 197, 66, 0.65);
  background: rgba(245, 197, 66, 0.08);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.2), 0 8px 22px rgba(245, 197, 66, 0.1);
}

.pkg-coins {
  display: block;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pkg-usd {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.pkg-cny {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.pkg-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
}

.package-card.active .pkg-tag {
  color: var(--gold);
  border-color: rgba(245, 197, 66, 0.4);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  cursor: pointer;
  transition: all 0.18s ease;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}

.channel-option:hover {
  border-color: var(--line-strong);
}

.channel-option.active {
  border-color: rgba(46, 230, 168, 0.55);
  background: rgba(23, 195, 123, 0.09);
  box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.18);
}

.channel-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #04120d;
  flex: 0 0 auto;
}

.channel-icon.wechat {
  background: #3fca7a;
}

.channel-icon.alipay {
  background: #4a9cff;
}

.channel-icon.stripe {
  background: #8f7bff;
}

.channel-icon.paypal {
  background: #7ab8ff;
}

.channel-icon.nowpayments {
  background: var(--gold);
}

.channel-icon.mock {
  background: #9aa7b3;
}

.channel-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.channel-meta b {
  font-size: 13px;
}

.channel-meta span {
  font-size: 11px;
  color: var(--muted);
}

.channel-mode {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
}

.recharge-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  flex-wrap: wrap;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.summary-item span {
  font-size: 11px;
  color: var(--muted);
}

.summary-item b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.summary-item b#recharge-coins {
  color: var(--gold);
}

.recharge-summary .btn {
  margin-left: auto;
}

.recharge-pay {
  text-align: center;
  padding: 8px 0 4px;
}

.qr-wrap img {
  width: min(260px, 70vw);
  height: auto;
  background: #fff;
  border-radius: 14px;
  padding: 10px;
}

.qr-wrap p {
  margin-top: 12px;
}

.recharge-pay > div > p {
  margin-bottom: 16px;
}

.pay-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

/* 人工审核支付渠道（Pago Móvil / Zelle / Binance） */
.recharge-manual {
  text-align: left;
  max-width: 520px;
  margin: 0 auto 16px;
}

.manual-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.manual-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.manual-info-row b {
  word-break: break-all;
  text-align: right;
}

.manual-info-row .copy-btn {
  flex: 0 0 auto;
}

.manual-amount {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin: 6px 0 10px;
}

.manual-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.manual-field input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
}

.recharge-manual .btn.big {
  width: 100%;
}

.recharge-history {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 6px;
  text-align: left;
}

.recharge-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 12px;
}

.recharge-history-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1100px) {
  .lobby-grid {
    grid-template-columns: 1.1fr 1fr;
    gap: 12px;
  }

  /* hero 不再强制跨两行撑满，改为自然高度 */
  .lobby-grid .panel.hero {
    grid-row: auto;
    align-self: start;
    padding: 20px;
  }

  .lobby-grid .panel.entry-panel,
  .lobby-grid .panel.friend-panel {
    padding: 16px;
  }

  /* hero 内部间距压缩 */
  .lobby-grid .panel.hero h1 {
    margin-bottom: 10px;
  }
  .lobby-grid .panel.hero > .muted {
    margin-bottom: 12px;
  }
  .lobby-grid .panel.hero .mode-select {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  .lobby-grid .panel.hero .practice-row {
    margin-top: 10px;
  }
  .lobby-grid .panel.hero .stats {
    margin-top: 14px;
  }
}

/* 窄屏高（≤650px 视口高度）进一步压缩 hero */
@media (max-height: 650px) {
  .lobby-grid .panel.hero .stats {
    display: none;
  }
  .lobby-grid .panel.hero .practice-row {
    display: none;
  }
}

@media (max-width: 900px) {
  .lobby-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "hero" "shop" "board";
  }

  .hero {
    min-height: auto;
    padding: 28px;
  }

  .game-head {
    flex-wrap: wrap;
  }

  .player-card {
    max-width: none;
  }

  .turn-info {
    order: -1;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  .game-foot {
    gap: 12px;
  }

  .game-message {
    order: -1;
    width: 100%;
    min-width: 0;
  }

  .power-box {
    min-width: 0;
  }

  .screen {
    padding: 16px 12px 24px;
  }
}

@media (max-width: 720px) {
  .recharge-stage {
    grid-template-columns: 1fr;
  }

  .recharge-summary {
    grid-column: auto;
  }

  .recharge-summary .btn {
    width: 100%;
    margin-left: 0;
  }

  .channel-mode {
    display: none;
  }
}

@media (max-width: 560px) {
  .daily-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .login-card {
    padding: 32px 22px 26px;
  }

  .user {
    gap: 10px;
  }

  .user-name {
    display: none;
  }

  .panel {
    padding: 18px;
  }

  .stats {
    gap: 24px;
  }

  .shop-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-card {
    padding: 20px;
  }

  .result-actions {
    flex-direction: column;
  }

  .level-badge {
    padding: 5px 10px;
  }

  .xp-bar {
    width: 56px;
  }

  .rank-chip {
    padding: 5px 9px;
    font-size: 11px;
  }

  .rank-chip::before {
    width: 5px;
    height: 5px;
  }
}

/* ---------- 键盘焦点 ---------- */

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary-bright);
  outline-offset: 2px;
}

.btn:focus-visible,
.chip:focus-visible,
.icon-btn:focus-visible,
.chat-item:focus-visible,
.package-card:focus-visible,
.channel-option:focus-visible {
  outline: 2px solid rgba(46, 230, 168, 0.8);
  outline-offset: 2px;
}

#login-name:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.input-inline:focus-visible,
#friend-code-input:focus-visible {
  outline: none;
  border-color: rgba(46, 230, 168, 0.55);
  box-shadow: 0 0 0 3px rgba(23, 195, 123, 0.18);
}

.modal-card:focus {
  outline: none;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- 断线提示 ---------- */

.net-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 88;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 28px);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 197, 66, 0.4);
  background: rgba(38, 29, 8, 0.94);
  color: var(--gold);
  font-size: 12.5px;
  line-height: 1.4;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(2, 6, 14, 0.45);
  animation: fade-up 0.24s var(--ease);
  pointer-events: none;
}

.net-banner .spinner {
  border-color: rgba(245, 197, 66, 0.25);
  border-top-color: var(--gold);
}

body.net-off .toast {
  top: 64px;
}

/* ---------- 空状态与加载状态 ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 18px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.shop-grid > .empty-state,
.loading-state {
  grid-column: 1 / -1;
}

.empty-state .empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: rgba(23, 195, 123, 0.1);
  border: 1px solid rgba(46, 230, 168, 0.25);
  color: var(--primary-bright);
}

.empty-state b {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.empty-state span:not(.empty-icon) {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 36ch;
}

/* ---------- 新手引导 ---------- */

.onboarding-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 8, 18, 0.78);
  backdrop-filter: blur(6px);
  z-index: 20;
  animation: fade-in 0.22s var(--ease);
}

.onboarding-card {
  max-width: 340px;
  width: 100%;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(20, 28, 48, 0.98), rgba(12, 18, 32, 0.98));
  border: 1px solid rgba(245, 197, 66, 0.3);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  animation: scale-in 0.28s var(--ease);
}

.onboarding-card h3 {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--gold);
}

.onboarding-card ol {
  margin: 0 0 18px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.onboarding-card li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.onboarding-card li b {
  color: var(--text);
  margin-right: 4px;
}

.onboarding-card .btn {
  width: 100%;
}

/* ---------- 下载客户端弹层 ---------- */

.download-card {
  max-width: 560px;
  width: 100%;
}

.download-body {
  display: grid;
  grid-template-columns: 1fr 168px;
  gap: 18px;
  padding: 4px 0 8px;
}

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

.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.download-item.is-recommended {
  border-color: rgba(46, 230, 168, 0.4);
  background: rgba(46, 230, 168, 0.07);
}

.download-item.is-soon {
  opacity: 0.72;
}

.download-icon {
  font-size: 22px;
  flex: 0 0 auto;
}

.download-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.download-main b {
  font-size: 14px;
}

.download-btn {
  flex: 0 0 auto;
  min-width: 92px;
  text-align: center;
}

.download-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: auto;
}

.download-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.download-qr-box {
  width: 148px;
  height: 148px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.download-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.download-qr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.download-qr-empty span {
  font-size: 34px;
  opacity: 0.5;
}

.download-qr-empty em {
  font-style: normal;
  font-size: 11px;
}

.download-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(245, 197, 66, 0.28);
  background: rgba(245, 197, 66, 0.08);
  color: var(--gold);
  font-size: 12px;
  line-height: 1.55;
}

/* 小屏：顶部功能条换行、下载弹层单列，避免溢出 */
@media (max-width: 720px) {
  .lobby-topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .lobby-topbar .tb-left {
    flex: 1 1 100%;
  }

  .tb-download {
    width: 100%;
    justify-content: flex-start;
  }

  .tb-download-cta {
    margin-left: auto;
  }

  .lobby-topbar .tb-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .tb-action {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .download-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .download-qr {
    order: -1;
  }

  .download-qr-box {
    width: 120px;
    height: 120px;
  }

  .download-item {
    flex-wrap: wrap;
  }

  .download-btn {
    width: 100%;
    min-height: 44px;
  }
}

.leaderboard li.list-empty,
.match-history li.list-empty {
  display: block;
  padding: 0;
  border: 0;
  background: none;
}

.leaderboard li.list-empty:hover {
  background: none;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 18px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

/* ---------- 小屏细节 ---------- */

@media (max-width: 720px) {
  .topbar {
    margin-bottom: 14px;
    gap: 8px;
  }

  /* 用户信息区：横向可滑动的紧凑 chips 条，不再挤成一团换行 */
  .user {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .user::-webkit-scrollbar {
    display: none;
  }

  .user > * {
    flex: 0 0 auto;
  }

  .user-name {
    font-size: 13px;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .coin {
    padding: 5px 10px;
    font-size: 12px;
    gap: 5px;
  }

  .rank-chip {
    font-size: 11px;
    padding: 3px 8px;
  }

  .user .btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .hero {
    min-height: 0;
    padding: 22px 18px;
  }

  .hero h1 {
    font-size: clamp(24px, 7vw, 32px);
  }

  .lobby-grid {
    gap: 12px;
  }

  .panel {
    padding: 18px 16px;
  }

  .shop-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .shop-filters::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 560px) {
  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card,
  .modal-card.wide {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .game-foot {
    padding: 10px 12px;
    gap: 10px;
  }

  .game-message {
    padding: 8px 12px;
  }
}

/* ---------- 对局页自适应（手机横屏 / 竖屏） ---------- */

/* 竖屏时球台受宽度限制，用「建议横屏」卡片填充剩余空间，避免大片空白 */
.portrait-card {
  display: none !important;
}

@media (max-width: 900px) and (orientation: portrait) {
  .portrait-card {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.4vh, 22px);
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(46, 230, 168, 0.16);
    background:
      radial-gradient(90% 70% at 50% 0%, rgba(46, 230, 168, 0.1), transparent 62%),
      linear-gradient(180deg, rgba(17, 26, 46, 0.66), rgba(9, 15, 21, 0.72));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: center;
    overflow: hidden;
  }

  .portrait-card .phone-turn {
    position: relative;
    width: 46px;
    height: 72px;
    border: 2px solid rgba(46, 230, 168, 0.78);
    border-radius: 11px;
    box-shadow: 0 0 22px rgba(46, 230, 168, 0.24), inset 0 0 12px rgba(46, 230, 168, 0.14);
    animation: phone-turn 2.8s ease-in-out infinite;
    flex: 0 0 auto;
  }

  .portrait-card .phone-turn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 6px;
    width: 15px;
    height: 2px;
    margin-left: -7.5px;
    border-radius: 2px;
    background: rgba(46, 230, 168, 0.55);
  }

  .portrait-card .phone-turn::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 7px;
    width: 5px;
    height: 5px;
    margin-left: -2.5px;
    border-radius: 50%;
    border: 1px solid rgba(46, 230, 168, 0.55);
  }

  .portrait-card strong {
    font-size: 17px;
    letter-spacing: 0.04em;
    color: var(--text);
  }

  .portrait-card p {
    margin: 0;
    max-width: 300px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--muted);
  }

  .portrait-card .tips {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin-top: 2px;
    text-align: left;
  }

  .portrait-card .tips span {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
  }

  .portrait-card .tips i {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-bright);
    background: rgba(46, 230, 168, 0.14);
  }
}

/* 竖屏过矮时只保留图标与标题，避免卡片内容被裁切 */
@media (max-width: 900px) and (orientation: portrait) and (max-height: 680px) {
  .portrait-card p,
  .portrait-card .tips {
    display: none;
  }
}

@keyframes phone-turn {
  0%,
  38% {
    transform: rotate(0deg);
  }

  62%,
  100% {
    transform: rotate(90deg);
  }
}

#screen-game {
  --game-chrome: 196px;
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 12px clamp(10px, 3vw, 32px) 14px;
  gap: 10px;
  overflow: hidden;
}

#screen-game .canvas-shell {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
}

@media (max-width: 900px) {
  #screen-game {
    --game-chrome: 268px;
    padding: 10px 10px 12px;
    gap: 9px;
  }

  #screen-game .player-card {
    padding: 8px 12px;
  }

  .turn-info {
    gap: 4px;
  }
}

@media (max-width: 720px) {
  #screen-game {
    --game-chrome: 246px;
  }

  #screen-game .canvas-shell {
    width: 100%;
    border-radius: 14px;
  }

  #screen-game .player-card {
    padding: 6px 10px;
    gap: 8px;
  }

  #screen-game .avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  #screen-game .balls-left {
    font-size: 15px;
  }

  #screen-game .game-foot {
    padding: 8px 10px;
    gap: 8px;
  }

  .spin-box {
    padding: 4px 10px;
  }

  .spin-ball {
    width: 38px;
    height: 38px;
    padding: 4px;
  }

  .spin-dot {
    width: 7px;
    height: 7px;
  }

  .power-box {
    flex: 1 1 100%;
    min-width: 0;
    padding: 6px 12px;
  }

  .game-message {
    flex: 1 1 100%;
    min-width: 0;
    padding: 6px 12px;
    font-size: 12px;
  }

  #chat-toggle,
  #leave-game {
    flex: 1 1 0;
  }
}

/* 手机/小平板横屏：压缩上下控件，把高度全部让给球台 */
@media (orientation: landscape) and (max-height: 620px) {
  /* 结算弹窗横屏紧凑布局：左侧胜负标+标题，统计横排，按钮不独占行 */
  #result-modal {
    padding: 10px;
  }

  .result-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    text-align: left;
    gap: 6px 14px;
    padding: 16px 18px;
    width: min(560px, 100%);
  }

  .result-mark {
    width: 46px;
    height: 46px;
    margin: 0;
    font-size: 17px;
    flex: 0 0 auto;
  }

  .result-card h2 {
    font-size: 18px;
    margin: 0;
  }

  .practice-tag {
    margin: 0;
  }

  #result-reason {
    flex: 1 1 100%;
    margin: 0;
    font-size: 12px;
  }

  .result-stats {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    justify-content: flex-start;
  }

  .result-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin: 0;
  }

  .result-actions .btn.big {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* 手机横屏大厅：恢复双列网格，压缩顶栏与面板，避免一屏看不到内容 */
  #screen-lobby .topbar {
    margin-bottom: 10px;
    gap: 8px;
  }

  #screen-lobby .user {
    gap: 6px;
  }

  #screen-lobby .coin {
    padding: 4px 9px;
    font-size: 12px;
    gap: 4px;
  }

  #screen-lobby .user .btn {
    padding: 4px 9px;
    font-size: 12px;
  }

  #screen-lobby .lobby-grid {
    grid-template-columns: 1.1fr 1fr;
    grid-template-areas:
      "hero shop"
      "hero board";
    gap: 12px;
  }

  #screen-lobby .lobby-grid > .panel:nth-child(4) {
    grid-column: 1 / -1;
  }

  #screen-lobby .hero {
    min-height: 0;
    padding: 18px 20px;
  }

  #screen-lobby .hero h1 {
    font-size: clamp(20px, 4.5vw, 28px);
  }

  #screen-lobby .panel {
    padding: 14px 16px;
  }

  #screen-game {
    --game-chrome: 126px;
    padding: 6px 10px 8px;
    gap: 6px;
    justify-content: flex-start;
  }

  #screen-game .game-head {
    flex-wrap: nowrap;
    gap: 8px;
  }

  #screen-game .turn-info {
    order: 0;
    width: auto;
    flex-direction: column;
    gap: 2px;
  }

  #screen-game .player-card {
    flex: 1 1 0;
    max-width: none;
    padding: 5px 10px;
    gap: 8px;
  }

  #screen-game .avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  #screen-game .player-card .meta span {
    display: none;
  }

  #screen-game .turn-badge {
    padding: 3px 10px;
    font-size: 11px;
  }

  #screen-game .timer {
    padding: 2px 8px;
    min-width: 44px;
  }

  #screen-game .game-foot {
    flex-wrap: nowrap;
    padding: 5px 10px;
    gap: 8px;
  }

  #screen-game .spin-box {
    padding: 3px 8px;
  }

  .spin-adjust {
    display: none;
  }

  #screen-game .spin-ball {
    width: 30px;
    height: 30px;
    padding: 3px;
  }

  #screen-game .spin-dot {
    width: 6px;
    height: 6px;
  }

  #screen-game .power-box {
    flex: 1 1 0;
    min-width: 120px;
    padding: 4px 10px;
  }

  #screen-game .power-box span {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #screen-game .game-message {
    flex: 1 1 0;
    order: 0;
    min-width: 100px;
    padding: 4px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #screen-game #chat-toggle,
  #screen-game #leave-game {
    flex: 0 0 auto;
    padding-inline: 12px;
  }

  #screen-game .chat-panel {
    position: absolute;
    left: 50%;
    bottom: 58px;
    transform: translateX(-50%);
    width: min(640px, calc(100vw - 24px));
    z-index: 20;
    box-shadow: 0 18px 44px rgba(2, 6, 14, 0.6);
  }
}



@media (prefers-reduced-motion: reduce) {
  .screen.active .login-card,
  .screen.active .topbar,
  .screen.active .lobby-grid > .panel,
  .screen.active .game-head,
  .screen.active .canvas-shell,
  .screen.active .game-foot,
  .modal,
  .modal-card,
  .chat-bubble,
  .toast,
  .dot,
  .spinner,
  .net-banner {
    animation: none !important;
  }

  .btn,
  .chip,
  .icon-btn,
  .shop-card,
  .skin-preview::before {
    transition-duration: 0.01ms;
  }
}

/* ============================================================
   移动端手游化 UI（仅 ≤900px 生效，桌面 Web 版完全不受影响）
   参照主流手游：大触控目标、主 CTA 突出、竖屏三段式对局、安全区适配
   ============================================================ */

/* ---- 通用触控目标 / iOS 输入防自动放大 ---- */

@media (max-width: 900px) {
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn.small {
    min-height: 38px;
  }

  .btn.tiny {
    min-height: 30px;
  }

  .chip {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .screen {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .toast {
    top: calc(10px + env(safe-area-inset-top));
  }
}

/* ---- 对局·竖屏：顶栏状态条 / 全宽球台 / 拇指控制盘 ---- */

@media (max-width: 900px) and (orientation: portrait) {
  /* 竖屏已是完整可玩布局，不再占用空间提示横屏 */
  .portrait-card {
    display: none !important;
  }

  #screen-game {
    padding: max(8px, env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  /* 紧凑单行状态条：我 | 回合+倒计时 | 对手 */
  .game-head {
    flex-wrap: nowrap;
    gap: 8px;
  }

  #screen-game .player-card {
    padding: 6px 10px;
    gap: 8px;
    border-radius: 12px;
    min-width: 0;
  }

  #screen-game .avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .player-card .meta b {
    font-size: 12.5px;
  }

  .player-card .meta span {
    font-size: 10px;
    gap: 4px;
  }

  #screen-game .balls-left {
    font-size: 15px;
  }

  .turn-info {
    order: 0;
    width: auto;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
    flex: 0 0 auto;
  }

  .turn-badge {
    font-size: 11px;
    padding: 4px 10px;
  }

  .timer {
    font-size: 11px;
    padding: 2px 8px;
    min-width: 0;
  }

  /* 球台占满宽度，居中一行 */
  .table-row {
    flex: 1 1 auto;
    min-height: 0;
    gap: 12px 8px;
  }

  /* 控制盘：左右分居拇指区，加大触控尺寸 */
  .side-control {
    padding: 12px 10px;
    gap: 7px;
    border-radius: 18px;
  }

  .side-label {
    font-size: 12px;
  }

  .side-sub {
    font-size: 10px;
  }

  .side-meter {
    width: 44px;
    height: clamp(140px, 24vh, 210px);
    border-radius: 12px;
  }

  .side-knob {
    min-width: 36px;
    height: 26px;
    font-size: 12px;
    border-radius: 13px;
  }

  .side-fire {
    width: 64px;
    height: 64px;
    font-size: 15px;
  }

  .side-spin {
    width: 56px;
    height: 56px;
  }

  .side-spin-dot {
    width: 11px;
    height: 11px;
  }

  /* 底栏：托盘独占一行，消息与按钮同行 */
  .game-foot {
    padding: 8px 10px;
    gap: 8px;
    border-radius: 14px;
  }

  .game-foot .tray {
    flex: 1 1 100%;
    order: -2;
    min-height: 22px;
  }

  .game-message {
    order: -1;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    font-size: 12px;
    padding: 8px 12px;
  }

  #chat-toggle,
  #leave-game {
    flex: 0 0 auto;
    min-height: 38px;
  }

  /* 短语面板浮在底栏上方，不挤占布局 */
  #screen-game .chat-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    width: auto;
    margin: 0;
    z-index: 20;
    box-shadow: 0 18px 44px rgba(2, 6, 14, 0.6);
  }
}

/* 竖屏矮机再压缩一档，保证不溢出 */
@media (max-width: 900px) and (orientation: portrait) and (max-height: 680px) {
  .side-meter {
    width: 40px;
    height: clamp(96px, 18vh, 140px);
  }

  .side-fire {
    width: 52px;
    height: 52px;
    font-size: 13px;
  }

  .side-spin {
    width: 46px;
    height: 46px;
  }

  .side-sub {
    display: none;
  }
}

/* ---- 大厅·手机：大 CTA、等分模式键、全宽卡片 ---- */

@media (max-width: 720px) {
  .screen {
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin-bottom: 12px;
  }

  .brand.small {
    font-size: 20px;
  }

  .hero {
    padding: 24px 18px 20px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: clamp(26px, 7.6vw, 34px);
    margin-bottom: 10px;
  }

  .hero .muted {
    font-size: 13px;
    margin-bottom: 18px;
  }

  .mode-select {
    margin: 14px 0 12px;
  }

  .mode-select .mode-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .mode-select .chip {
    padding: 10px 6px;
  }

  /* 主操作按钮：全宽、最高、最醒目 */
  #start-match {
    width: 100%;
    align-self: stretch;
    min-height: 54px;
    margin-top: 14px;
    font-size: 17px;
    border-radius: 14px;
  }

  .practice-row {
    display: block;
    margin-top: 16px;
  }

  .practice-row .mode-label {
    margin-bottom: 8px;
  }

  .practice-row .mode-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
  }

  .practice-row .chip {
    padding: 10px 4px;
    font-size: 12.5px;
  }

  #start-practice {
    width: 100%;
    min-height: 46px;
  }

  .friend-section summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .friend-mode .mode-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .friend-actions {
    display: grid;
    gap: 10px;
  }

  #create-friend-room {
    width: 100%;
  }

  .friend-join {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .friend-join input {
    width: 100%;
    min-height: 46px;
  }

  .friend-join .btn {
    min-height: 46px;
  }

  .queue-status {
    align-self: stretch;
    justify-content: center;
    min-height: 48px;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
  }

  .stats div {
    align-items: center;
    text-align: center;
  }

  .stats b {
    font-size: 20px;
  }

  .panel {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .panel-head {
    margin-bottom: 12px;
  }

  .panel-head h2 {
    font-size: 16px;
  }

  .panel-head .btn {
    min-height: 38px;
  }
}

/* ---- 登录页·手机：大输入框、全宽主按钮 ---- */

@media (max-width: 560px) {
  #screen-login {
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
  }

  .login-card {
    padding: 36px 22px 26px;
    border-radius: 20px;
  }

  .lang-switch {
    margin-bottom: 12px;
    gap: 4px;
  }

  .lang-option {
    min-height: 44px;
    padding: 0 4px;
    font-size: 11px;
  }

  .brand {
    font-size: clamp(38px, 11vw, 48px);
  }

  #login-name {
    min-height: 52px;
  }

  #login-form .btn.big {
    width: 100%;
    min-height: 52px;
  }

  .login-features span {
    padding: 8px 12px;
  }
}

/* ---- 弹窗·手机：底部抽屉 + 安全区 + 大触控 ---- */

@media (max-width: 560px) {
  .modal-card,
  .modal-card.wide {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .modal-card .btn {
    min-height: 46px;
  }

  .modal-card input,
  .modal-card select {
    min-height: 46px;
  }
}

/* === 皮肤图鉴与养成（三端对齐） === */

/* 卡片预览改走 SVG 美术后，隐藏原有 palette 伪元素造型，避免与素材叠影 */
.skin-preview.art::after {
  display: none;
}

.skin-preview.art {
  background-color: #101820;
}

/* 名称行：名称 + 等级徽章 + 品质徽章 */
.skin-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.skin-name-row b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.3;
}

.tier-badge.level-badge {
  color: var(--gold);
  border-color: rgba(245, 197, 66, 0.45);
  background: rgba(245, 197, 66, 0.08);
}

/* 非商城渠道（活动/签到/夺宝/仅展示）标签 */
.badge.activity {
  color: var(--primary-bright);
  border-color: rgba(46, 230, 168, 0.4);
  background: rgba(23, 195, 123, 0.1);
}

/* 图鉴：排序行与网格 */
.codex-sort-row {
  align-items: center;
}

.codex-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.codex-item {
  border: 1px solid var(--line);
  background: rgba(6, 10, 22, 0.4);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s var(--ease);
}

.codex-item:hover {
  border-color: rgba(46, 230, 168, 0.3);
  transform: translateY(-2px);
}

.codex-item.locked .codex-swatch {
  filter: saturate(0.55) brightness(0.8);
}

.codex-swatch {
  height: 92px;
  border: none;
  border-radius: 0;
  position: relative;
}

.codex-tier {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(4, 8, 18, 0.62);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.codex-state {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 13px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(4, 8, 18, 0.62);
  z-index: 1;
}

.codex-state.owned {
  color: var(--primary-bright);
  box-shadow: 0 0 0 1px rgba(46, 230, 168, 0.45);
}

.codex-bar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px 11px;
  min-width: 0;
}

.codex-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-hint {
  font-size: 11px;
  color: var(--muted);
}

.codex-hint.owned {
  color: var(--primary-bright);
}

/* ---------- 公告横幅（三端对齐） ---------- */

.announce-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1240px;
  width: 100%;
  margin: -14px auto 20px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(245, 197, 66, 0.28);
  background: linear-gradient(90deg, rgba(245, 197, 66, 0.12), rgba(23, 195, 123, 0.08));
  cursor: pointer;
}

.announce-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  color: #04120d;
  background: linear-gradient(135deg, #f5c542, #ffdf8a);
  border-radius: 6px;
  padding: 2px 8px;
}

.announce-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.announce-title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announce-content {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announce-link {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.announce-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.announce-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- 幸运夺宝（三端对齐） ---------- */

.gacha-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gacha-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 10, 22, 0.4);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gacha-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.gacha-card-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.gacha-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.gacha-pool-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(6, 10, 22, 0.35);
  border-top: 2px solid var(--rarity-color, var(--line));
}

.gacha-pool-preview {
  height: 72px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background-color: #101820;
}

.gacha-pool-silver {
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.14), rgba(126, 139, 151, 0.18));
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #cfe0ee;
}

.gacha-pool-rarity {
  font-size: 10px;
  font-weight: 700;
  color: var(--rarity-color, var(--muted));
}

.gacha-pool-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gacha-pool-prob,
.gacha-pool-limit {
  font-size: 11px;
  color: var(--muted);
}

.gacha-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.gacha-result {
  margin-top: 14px;
  border: 1px solid rgba(245, 197, 66, 0.3);
  border-radius: 14px;
  background: rgba(245, 197, 66, 0.07);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gacha-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gacha-result-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gacha-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.gacha-result-rarity {
  font-size: 11px;
  font-weight: 700;
  color: var(--rarity-color, var(--muted));
}

.gacha-records {
  margin-top: 16px;
}

.gacha-records summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.gacha-records-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gacha-record-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
}

.gacha-record-names {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gacha-record-cost {
  flex-shrink: 0;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ---------- 限时活动（三端对齐） ---------- */

.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.campaign-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 10, 22, 0.4);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.campaign-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.campaign-tag {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  color: #04120d;
  background: linear-gradient(135deg, #f5c542, #ffdf8a);
  border-radius: 6px;
  padding: 2px 8px;
}

.campaign-skin {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.campaign-skin-preview {
  width: 64px;
  height: 48px;
  border-radius: 9px;
  flex-shrink: 0;
  background-color: #101820;
}

.campaign-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.campaign-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  background: rgba(6, 10, 22, 0.35);
}

.campaign-day.claimed {
  opacity: 0.62;
}

.campaign-day.claimable {
  border-color: rgba(46, 230, 168, 0.45);
  background: rgba(23, 195, 123, 0.09);
}

.campaign-day.clickable {
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.campaign-day.clickable:hover {
  transform: translateY(-2px);
}

.campaign-day-label {
  font-size: 11px;
  color: var(--muted);
}

.campaign-day-reward {
  font-size: 12px;
}

.campaign-day-status {
  font-size: 11px;
  color: var(--muted);
}

.campaign-day-status.done {
  color: var(--primary-bright);
}

.campaign-day-status.ready {
  color: var(--gold);
  font-weight: 700;
}

.campaign-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   PC 宽屏：侧边栏导航 + 内容区分页（手游助手布局）
   ============================================================ */

#screen-lobby {
  padding: 0;
  background: var(--bg);
}

#screen-lobby .app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---- 左侧边栏 ---- */

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 14px;
  background: var(--bg-card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar .brand.small {
  padding: 0 6px;
  font-size: 22px;
}

.player-mini {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.pm-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pm-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(46, 230, 168, 0.4);
  background: rgba(46, 230, 168, 0.16);
  color: var(--brand);
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.18s ease;
}

.pm-avatar:hover {
  background: rgba(46, 230, 168, 0.24);
}

.pm-avatar:active {
  transform: scale(0.94);
}

.pm-ident {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pm-ident .user-name {
  font-size: var(--fs-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-coins {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-coins .coin {
  width: 100%;
  justify-content: flex-start;
  gap: 7px;
  font-size: var(--fs-small);
  padding: 7px 12px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.18s ease;
}

.pm-coins .coin-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pm-coins .coin b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.pm-coins .coin:hover {
  border-color: rgba(245, 197, 66, 0.5);
}

.pm-coins .coin:active {
  transform: scale(0.97);
}

.player-mini .level-badge {
  border-radius: var(--radius-btn);
}

.player-mini .xp-bar {
  width: 100%;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-body);
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease,
    transform 0.15s var(--ease);
}

.side-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.side-nav-item.active {
  color: var(--brand);
  background: rgba(46, 230, 168, 0.1);
  border-color: rgba(46, 230, 168, 0.35);
}

.side-nav-item:active {
  transform: scale(0.98);
}

.nav-icon {
  width: 20px;
  text-align: center;
  flex: 0 0 auto;
}

.side-logout {
  margin-top: auto;
}

/* ---- 右侧内容区 ---- */

.content {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.content-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 24px 28px 36px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.content-panel.active {
  display: block;
}

.content-panel.active > * {
  animation: fade-up 0.3s var(--ease) both;
}

.content-panel .announce-bar {
  max-width: none;
  margin: 0 0 16px;
}

.lobby-cols {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: start;
}

.lobby-cols .hero {
  min-height: 430px;
}

.friend-panel .friend-section {
  margin-top: 0;
}

.friend-panel .friend-actions {
  align-items: stretch;
}

/* ---- 子页签条 ---- */

.sub-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.sub-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: var(--fs-body);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.15s var(--ease);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
}

.sub-tab:hover {
  color: var(--text);
}

.sub-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.sub-tab:active {
  transform: scale(0.96);
}

/* ---- 入口卡 ---- */

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 18px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.18s var(--ease), box-shadow 0.2s ease;
}

.entry-card:hover {
  border-color: rgba(46, 230, 168, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(2, 6, 14, 0.4);
}

.entry-card:active {
  transform: scale(0.98);
}

.entry-card b {
  font-size: 15px;
}

.entry-icon {
  font-size: 22px;
  line-height: 1;
}

.entry-card.flash {
  animation: card-flash 1.1s ease;
}

@keyframes card-flash {
  0%,
  100% {
    box-shadow: none;
  }
  30% {
    box-shadow: 0 0 0 2px var(--brand);
  }
}

#panel-shop .shop-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

#panel-shop .shop-grid.compact .shop-card {
  flex-direction: column;
  align-items: stretch;
}

#panel-shop .shop-grid.compact .skin-preview {
  width: auto;
  height: 74px;
}

/* ---- 背包：当前装备摘要 ---- */

.equipped-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.equipped-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.equipped-item .skin-preview {
  width: 56px;
  height: 40px;
}

.equipped-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.equipped-meta b {
  font-size: var(--fs-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 我的：资料卡 ---- */

.me-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-items: stretch;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

#me-avatar {
  width: 56px;
  height: 56px;
  font-size: 26px;
}

.profile-who {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.profile-who b {
  font-size: var(--fs-title);
}

.profile-rows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-rows > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.profile-rows span {
  font-size: var(--fs-small);
  color: var(--muted);
}

.profile-rows b {
  font-size: var(--fs-title);
  font-variant-numeric: tabular-nums;
}

.profile-stats {
  margin-top: 0;
  gap: 24px;
}

.daily-entry {
  justify-content: center;
}

/* ---- 整页弹层（商城 / 我的皮肤 / 图鉴） ---- */

.modal-card.sheet {
  position: fixed;
  inset: 0;
  width: auto;
  max-height: none;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  animation: fade-in 0.2s ease;
}

.modal-card.sheet .modal-head {
  flex: 0 0 auto;
  align-items: center;
  margin-bottom: 0;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
}

.modal-card.sheet .sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 28px calc(32px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.modal-card.sheet .sheet-body > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- 按钮按压态补齐 ---- */

.chip:active {
  transform: scale(0.96);
}

/* ---- 移动端降级（<1100px）：边栏折叠为顶部横排导航 ---- */

@media (max-width: 1100px) {
  #screen-lobby .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex: none;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .sidebar .brand.small {
    font-size: 18px;
    padding: 0;
  }

  .side-nav {
    flex: 1;
    flex-direction: row;
    justify-content: center;
    gap: 4px;
    overflow-x: auto;
  }

  .side-nav-item {
    padding: 8px 12px;
    font-size: var(--fs-small);
    white-space: nowrap;
  }

  .side-logout {
    margin: 0;
    padding: 8px 12px;
  }

  .player-mini {
    order: 4;
    width: 100%;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 12px;
  }

  .pm-head {
    flex: 0 0 auto;
  }

  .pm-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .player-mini .level-badge {
    flex: 1 1 140px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .player-mini .xp-bar {
    width: 72px;
    flex: 1;
  }

  .pm-coins {
    flex-direction: row;
    gap: 8px;
    margin-left: auto;
  }

  .pm-coins .coin {
    width: auto;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .content-panel {
    height: auto;
    overflow: visible;
    padding: 14px 12px 24px;
  }

  .lobby-cols {
    grid-template-columns: 1fr;
  }

  .me-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 第一批模块：消息 / 任务 / 好友 / 设置 / 排行榜 ===== */

.me-entries {
  grid-column: 1 / -1;
  margin-top: 0;
}

/* ---- Mine tab 分组 ---- */

.entry-group {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--bg-card);
}

.entry-group + .entry-group {
  margin-top: 2px;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 4px;
}

.group-title {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.entry-group .entry-grid {
  margin-top: 2px;
  gap: 10px;
}

.entry-group .entry-card {
  padding: 14px;
  gap: 6px;
}

.leaderboard-tabs {
  margin-bottom: 10px;
}

.leaderboard.rich li {
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
}

.leaderboard.rich .rank {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard.rich .lb-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: rgba(46, 230, 168, 0.14);
  color: var(--brand);
  flex: none;
}

.leaderboard.rich .lb-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard.rich .lb-main b {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard.rich .lb-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.leaderboard.rich .lb-score {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard.rich .lb-score b {
  font-variant-numeric: tabular-nums;
}

.leaderboard.rich .lb-me {
  outline: 1px solid rgba(46, 230, 168, 0.35);
  background: rgba(46, 230, 168, 0.06);
}

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

.mail-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s var(--ease);
}

.mail-item:hover {
  border-color: rgba(46, 230, 168, 0.4);
}

.mail-item:active {
  transform: scale(0.99);
}

.mail-item.unread {
  border-color: rgba(46, 230, 168, 0.28);
  background: rgba(46, 230, 168, 0.05);
}

.mail-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 18px;
}

.mail-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mail-main b {
  font-size: 14px;
}

.mail-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mail-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: none;
}

.mail-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}

.mail-detail h3 {
  font-size: 20px;
}

.mail-detail .mail-content {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--muted);
}

.mail-detail-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reward-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 197, 66, 0.35);
  background: rgba(245, 197, 66, 0.1);
  color: var(--gold);
  font-size: 12px;
}

.task-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.friend-avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(46, 230, 168, 0.14);
  color: var(--brand);
  font-weight: 700;
  position: relative;
}

.friend-avatar .online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #566274;
  box-shadow: 0 0 0 2px var(--bg);
}

.friend-avatar .online-dot.on {
  background: var(--brand);
}

.friend-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.friend-info b {
  font-size: 14px;
}

.friend-info span {
  color: var(--muted);
  font-size: 11px;
}

.friend-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.friend-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.friend-search-row input {
  flex: 1;
  min-width: 180px;
}

.invite-code {
  font-size: 14px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--brand);
}

.settings-pane {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 820px;
  margin: 0 auto;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

/* 设置自动保存标记：默认低调，保存成功后短暂高亮 */
.save-state {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  transition: background 0.2s ease, color 0.2s ease;
}

.save-state.visible {
  background: rgba(64, 196, 140, 0.16);
  color: #56d6a0;
}

.settings-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* 账号安全：换绑 / 改密表单与设备列表 */
.settings-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.settings-block-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-block input {
  padding: 11px 14px;
  font-size: 13.5px;
}

.settings-block .code-row input {
  min-width: 0;
}

.settings-block .login-error {
  margin: 0;
  font-size: 12px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.session-row.current {
  border-color: rgba(46, 230, 168, 0.32);
  background: rgba(46, 230, 168, 0.06);
}

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

.session-info b {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.settings-row input[type='range'] {
  width: min(260px, 46vw);
  accent-color: var(--brand);
}

.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dbe4ee;
  transition: transform 0.18s var(--ease), background 0.18s ease;
}

.switch input:checked + span {
  background: rgba(46, 230, 168, 0.32);
  border-color: rgba(46, 230, 168, 0.6);
}

.switch input:checked + span::after {
  transform: translateX(20px);
  background: var(--brand);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.tag.ok {
  border-color: rgba(46, 230, 168, 0.4);
  color: var(--brand);
}

.btn.danger {
  color: #ff8a8a;
  border-color: rgba(255, 95, 95, 0.35);
}

.agreement-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.agreement-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.02);
}

.agreement-item summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  list-style: none;
}

.agreement-item summary::-webkit-details-marker {
  display: none;
}

.agreement-item .agreement-body {
  padding: 0 14px 14px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

@media (max-width: 720px) {
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .settings-row input[type='range'] {
    width: 100%;
  }

  .friend-row {
    flex-wrap: wrap;
  }

  .friend-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: 50px;
  }
}

/* ---------- 第二批：赛季段位 / 通行证 / 成就 ---------- */
.season-hero { display:flex; gap:16px; align-items:center; padding:16px; background:linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,.08)); border-radius:16px; margin-bottom:16px; }
.tier-badge { min-width:88px; text-align:center; padding:16px 18px; border-radius:14px; font-weight:700; font-size:20px; color:#fff; box-shadow:0 6px 20px rgba(0,0,0,.25); text-shadow:0 1px 3px rgba(0,0,0,.4); }
.season-meta { display:grid; grid-template-columns:repeat(2, 1fr); gap:6px 18px; font-size:13px; flex:1; }
.season-meta b { color:#fff; }
.season-bar-wrap { flex:1; min-width:160px; }
.season-bar { height:10px; border-radius:5px; background:rgba(255,255,255,.12); overflow:hidden; transition:width .3s; }
.season-tiers { display:flex; flex-direction:column; gap:8px; }
.tier-row { display:flex; gap:12px; align-items:center; padding:8px 12px; background:rgba(255,255,255,.04); border-radius:10px; font-size:13px; }
.tier-mini { width:56px; padding:4px 8px; border-radius:6px; text-align:center; font-weight:600; font-size:12px; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,.3); }

.pass-progress-wrap { margin-bottom:12px; }
.pass-progress { height:8px; border-radius:4px; background:linear-gradient(90deg,#6aa8ff,#b07bff); transition:width .3s; }
.pass-table { display:flex; flex-direction:column; gap:2px; max-height:420px; overflow-y:auto; }
.pass-row { display:grid; grid-template-columns:42px 1fr auto 1fr auto; gap:8px; align-items:center; padding:6px 8px; border-radius:8px; background:rgba(255,255,255,.03); }
.pass-lv { width:42px; text-align:center; font-weight:700; font-size:13px; color:#8a9ab0; }
.pass-lv.reached { color:#fff; }
.pass-lv.current { color:#ff8a5c; }
.pass-cell { font-size:12px; padding:4px 8px; border-radius:6px; }
.pass-cell.free.locked, .pass-cell.paid.locked { color:#556677; background:rgba(255,255,255,.04); }
.pass-cell.free.available, .pass-cell.paid.available { color:#b0e0b0; background:rgba(90,200,120,.12); }
.pass-cell.free.claimed, .pass-cell.paid.claimed { color:#8a9ab0; text-decoration:line-through; background:rgba(255,255,255,.03); }

.ach-list { display:grid; grid-template-columns:1fr; gap:10px; max-height:420px; overflow-y:auto; padding-right:4px; }
.ach-card { padding:12px 14px; border-radius:12px; background:rgba(255,255,255,.05); border-left:3px solid; display:flex; flex-direction:column; gap:4px; }
.ach-card.rar-common  { border-left-color:#8a9ab0; }
.ach-card.rar-rare    { border-left-color:#5fd0c4; }
.ach-card.rar-epic    { border-left-color:#b07bff; }
.ach-card.rar-legendary { border-left-color:#ff8a5c; }
.ach-title { font-weight:700; font-size:14px; color:#fff; }
.ach-progress-bar { height:4px; background:rgba(255,255,255,.1); border-radius:2px; overflow:hidden; }
.ach-progress-fill { height:100%; background:linear-gradient(90deg,#5fd0c4,#6aa8ff); transition:width .3s; }
.ach-meta { font-size:11px; color:#8a9ab0; }

/* ============================================================
   移动端可用性补丁（360–430px 竖屏 / 小屏横屏）
   全部改动限定在 max-width / orientation 断点内，桌面端不受影响
   ============================================================ */

/* 操作指引改为覆盖整个对局页，避免被过矮的球台容器裁切 */
#screen-game .onboarding-overlay {
  z-index: 30;
}

@media (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    overscroll-behavior-x: none;
    touch-action: manipulation;
  }

  /* 可点区域统一：去掉双击缩放等待与长按文字选中，减少误触 */
  .btn,
  .chip,
  .sub-tab,
  .side-nav-item,
  .icon-btn,
  .tb-action,
  .tb-download,
  .entry-card,
  .row-entry,
  .package-card,
  .channel-option,
  .shop-card,
  .chat-item,
  .side-fire,
  .side-spin,
  .announce-bar,
  .announce-close,
  .pm-coins .coin,
  .pm-avatar {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
  }

  /* 触控目标 ≥ 44px */
  .btn.small {
    min-height: 44px;
  }

  .btn.tiny {
    min-height: 44px;
    padding: 4px 10px;
  }

  .chip {
    min-height: 44px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .chat-item {
    min-height: 44px;
  }

  .announce-close {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
  }

  .settings-row .switch {
    min-height: 44px;
    align-items: center;
  }

  .settings-row input[type="range"] {
    height: 34px;
  }

  .spin-cell {
    min-width: 44px;
    min-height: 44px;
  }

  .tb-download,
  .tb-action,
  .pm-coins .coin,
  .friend-join input,
  .friend-search-row input,
  .input-inline {
    min-height: 44px;
  }

  #screen-game #chat-toggle,
  #screen-game #leave-game {
    min-height: 44px;
  }

  /* iOS 聚焦输入框不自动放大页面 */
  #login-name,
  #admin-password,
  #friend-code-input,
  .friend-join input,
  .friend-search-row input,
  .settings-row input[type="text"],
  .settings-row input[type="password"],
  .input-inline,
  .field input,
  .field select,
  .modal-card input,
  .modal-card select,
  .modal-card textarea,
  .admin-console input,
  .admin-console select,
  .admin-console textarea {
    font-size: 16px;
  }

  /* 安全区：左右刘海 / 底部 Home 条不裁切内容 */
  .screen {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  #screen-lobby {
    padding-top: max(0px, env(safe-area-inset-top));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .modal-card.sheet .modal-head {
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }

  .modal-card.sheet .sheet-body {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }

  #screen-game {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .modal {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .net-banner {
    top: calc(12px + env(safe-area-inset-top));
  }

  .toast {
    top: calc(12px + env(safe-area-inset-top));
    max-width: calc(100vw - 24px);
    text-align: center;
  }

  body.net-off .toast {
    top: calc(60px + env(safe-area-inset-top));
  }
}

/* ---- 大厅：修复小屏下 explicit grid-column 造成的隐式列溢出 ---- */

@media (max-width: 900px) and (orientation: portrait),
  (max-width: 900px) and (orientation: landscape) and (min-height: 621px) {
  .lobby-grid,
  #screen-lobby .lobby-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lobby-grid .panel.hero,
  .lobby-grid .panel.entry-panel,
  .lobby-grid .panel.friend-panel,
  .lobby-grid .panel.board-panel {
    grid-column: 1 / -1;
    grid-row: auto;
    min-width: 0;
  }
}

/* ---- 大厅·手机（≤560px）：导航单行紧凑 + 玩家卡两行网格 ---- */

@media (max-width: 560px) {
  #screen-login {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .sidebar {
    position: static;
    gap: 8px;
    padding: 8px 10px;
  }

  .sidebar .brand.small {
    flex: 0 0 auto;
    font-size: 15px;
    letter-spacing: 0.08em;
  }

  .side-nav {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: space-between;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav-item {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
    padding: 5px 2px;
    min-height: 48px;
    font-size: 10.5px;
    line-height: 1.2;
    text-align: center;
  }

  .side-nav-item .nav-icon {
    width: auto;
    font-size: 16px;
    line-height: 1;
  }

  .side-logout {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 4px 10px;
    font-size: 11px;
  }

  .player-mini {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 10px;
  }

  .pm-head {
    flex: initial;
    min-width: 0;
  }

  .player-mini .level-badge {
    grid-column: 2;
    flex: 0 0 auto;
    min-width: 108px;
  }

  .pm-coins {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .pm-coins .coin {
    flex: 1 1 0;
    min-width: 0;
    justify-content: flex-start;
  }

  .content-panel {
    padding: 12px 10px calc(20px + env(safe-area-inset-bottom));
  }

  .panel {
    padding: 16px 12px;
  }

  .hero {
    padding: 22px 16px 18px;
  }

  .hero h1 {
    font-size: clamp(22px, 6.6vw, 28px);
  }

  .hero .muted {
    font-size: 12.5px;
  }

  .panel-head h2 {
    font-size: 15px;
  }

  .content-panel .announce-bar {
    margin: 0 0 12px;
  }

  .lobby-topbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .tb-download {
    padding: 8px 10px;
  }

  .tb-action {
    font-size: 12px;
  }

  .board-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 对局顶部玩家信息：窄屏下裁切而不是溢出压到比分 */
  .player-card .meta b {
    font-size: 12.5px;
  }

  .player-card .meta span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  .player-card .balls-left {
    flex: 0 0 auto;
  }

  /* 弹窗头部：标题与操作分行，避免按钮把标题挤出容器 */
  .modal-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .modal-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-head h2 {
    font-size: clamp(17px, 5vw, 20px);
  }

  .modal-head-right {
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  /* 下载弹层右侧只有关闭按钮，保持标题与关闭同排，避免关闭钮掉到左下 */
  .download-card .modal-head {
    flex-wrap: nowrap;
  }

  .download-card .modal-head > div:first-child {
    min-width: 0;
  }

  .modal-card.sheet .modal-head {
    padding: calc(14px + env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
  }

  .modal-card.sheet .sheet-body {
    padding: 14px max(14px, env(safe-area-inset-right))
      calc(18px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .modal .modal-card:not(.sheet) {
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .result-card {
    padding: 26px 16px 20px;
  }

  .result-card h2 {
    font-size: clamp(21px, 6.4vw, 25px);
  }

  /* 设置/成就等子页签可横向滑动，不再被裁切 */
  .sub-tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sub-tab-bar::-webkit-scrollbar {
    display: none;
  }

  .sub-tab {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 赛季 / 通行证：窄屏换行而非挤压 */
  .season-hero {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .season-hero .tier-badge {
    min-width: 0;
    padding: 10px 14px;
    font-size: 17px;
  }

  .season-meta {
    flex: 1 1 150px;
    gap: 6px 12px;
    font-size: 12px;
  }

  .season-bar-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .tier-row {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  .pass-table {
    max-height: none;
    overflow: visible;
  }

  .pass-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas:
      "lv free freeBtn"
      "lv paid paidBtn";
    gap: 4px 6px;
    padding: 6px;
  }

  .pass-row > :nth-child(1) { grid-area: lv; }
  .pass-row > :nth-child(2) { grid-area: free; }
  .pass-row > :nth-child(3) { grid-area: freeBtn; }
  .pass-row > :nth-child(4) { grid-area: paid; }
  .pass-row > :nth-child(5) { grid-area: paidBtn; }

  .pass-row .pass-lv {
    width: auto;
  }

  .pass-row button.tiny {
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }

  .pass-row button.tiny:disabled {
    opacity: 0.45;
  }

  .ach-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

/* ---- 对局·竖屏：短语面板不压住底栏；力度/方向条满足触控宽度 ---- */

@media (max-width: 900px) and (orientation: portrait) {
  #screen-game .chat-panel {
    bottom: calc(110px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    max-height: 38vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .side-meter {
    width: 44px;
  }
}

/* ---- 对局·矮竖屏（浏览器工具条占高，如 375×553）：进一步压缩控制条 ---- */

@media (max-width: 900px) and (orientation: portrait) and (max-height: 620px) {
  #screen-game .side-control {
    gap: 4px;
    padding: 5px 4px;
    border-radius: 10px;
  }

  #screen-game .side-label {
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  #screen-game .side-meter {
    height: clamp(48px, 12vh, 64px);
  }

  #screen-game .side-spin,
  #screen-game .side-fire {
    width: 44px;
    height: 44px;
    margin-top: 0;
  }

  #screen-game .side-sub {
    display: none;
  }
}

/* ---- 对局·小屏横屏：控制条保持可点，尽量把高度留给球台 ---- */

@media (orientation: landscape) and (max-height: 620px) {
  #screen-game .side-meter {
    width: 44px;
  }

  #screen-game .chat-panel {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    max-height: 50vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* ---- 超窄屏（≤430px）末级压缩：字号与间距再收一档 ---- */

@media (max-width: 430px) {
  .hero h1 {
    font-size: clamp(21px, 6.4vw, 26px);
  }

  .tb-download-copy b {
    font-size: 12.5px;
  }

  .tb-download-sub {
    font-size: 10px;
  }

  .panel-head h2 {
    font-size: 14.5px;
  }

  .modal-head-right .btn {
    flex: 1 1 auto;
  }

  .modal-head-right .icon-btn {
    flex: 0 0 44px;
  }

  .shop-grid {
    gap: 8px;
  }
}

/* ============================================================
   背景体系：Cyber Billiard 动态背景层
   底图 Ken Burns 20~30s 往复 + CSS 霓虹光带/粒子 + 暗化/模糊遮罩
   暗化 --bg-dim（0~0.95）、模糊 --bg-blur（0~24px）由 background.js 注入
   ============================================================ */

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #05080d;
  transition: opacity 0.45s var(--ease), visibility 0.45s var(--ease);
}

body.bg-off .bg-stage {
  opacity: 0;
  visibility: hidden;
}

.bg-photo {
  position: absolute;
  inset: -6%;
  background-image: var(--bg-image, url("/assets/bg/cyber-billiard.jpg"));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(var(--bg-blur, 0px)) saturate(1.06);
  transform: scale(1.04);
  will-change: transform;
  animation: bg-ken-burns 28s ease-in-out infinite alternate;
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(52px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

.bg-glow-a {
  width: 62vw;
  height: 46vh;
  left: -12vw;
  top: 6vh;
  background: radial-gradient(closest-side, rgba(46, 230, 168, 0.55), rgba(46, 230, 168, 0) 72%);
  animation: bg-drift-a 26s ease-in-out infinite alternate;
}

.bg-glow-b {
  width: 58vw;
  height: 40vh;
  right: -14vw;
  top: 18vh;
  background: radial-gradient(closest-side, rgba(96, 168, 255, 0.5), rgba(96, 168, 255, 0) 72%);
  animation: bg-drift-b 30s ease-in-out infinite alternate;
}

.bg-glow-c {
  width: 120vw;
  height: 18vh;
  left: -10vw;
  top: 60vh;
  border-radius: 999px;
  background: linear-gradient(92deg, transparent 4%, rgba(46, 230, 168, 0.28) 36%, rgba(122, 215, 255, 0.3) 64%, transparent 96%);
  filter: blur(28px);
  opacity: 0.42;
  animation: bg-band-flow 24s linear infinite;
}

.bg-particles {
  position: absolute;
  inset: -22%;
  opacity: 0.55;
  background-image:
    radial-gradient(2px 2px at 18% 24%, rgba(196, 255, 235, 0.75), transparent 62%),
    radial-gradient(1.5px 1.5px at 72% 58%, rgba(160, 220, 255, 0.6), transparent 62%),
    radial-gradient(1.5px 1.5px at 44% 82%, rgba(255, 224, 160, 0.5), transparent 62%),
    radial-gradient(2.5px 2.5px at 88% 12%, rgba(46, 230, 168, 0.45), transparent 65%);
  background-size: 340px 340px, 420px 420px, 300px 300px, 520px 520px;
  background-repeat: repeat;
  animation: bg-particles-drift 60s linear infinite;
}

/* 暗化遮罩：中心稍亮、四周压暗，保证卡片与正文对比度 */
.bg-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      130% 105% at 50% 32%,
      rgba(4, 8, 14, calc(var(--bg-dim, 0.62) * 0.74)) 0%,
      rgba(4, 8, 14, calc(var(--bg-dim, 0.62) * 0.96)) 78%,
      rgba(4, 8, 14, var(--bg-dim, 0.62)) 100%
    ),
    linear-gradient(
      180deg,
      rgba(4, 8, 14, calc(var(--bg-dim, 0.62) * 0.94)) 0%,
      rgba(4, 8, 14, calc(var(--bg-dim, 0.62) * 0.58)) 52%,
      rgba(4, 8, 14, var(--bg-dim, 0.62)) 100%
    );
}

/* 低于 720px 使用移动端竖图 */
@media (max-width: 719px) {
  .bg-photo {
    background-image: var(--bg-image-mobile, url("/assets/bg/cyber-billiard-mobile.jpg"));
  }
}

@keyframes bg-ken-burns {
  0% {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.13) translate3d(-1.6%, -1.3%, 0);
  }
  100% {
    transform: scale(1.07) translate3d(1.7%, 1.1%, 0);
  }
}

@keyframes bg-drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.42;
  }
  to {
    transform: translate3d(9vw, 4vh, 0) scale(1.18);
    opacity: 0.62;
  }
}

@keyframes bg-drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.12);
    opacity: 0.5;
  }
  to {
    transform: translate3d(-8vw, -5vh, 0) scale(0.96);
    opacity: 0.34;
  }
}

@keyframes bg-band-flow {
  from {
    transform: translate3d(-6vw, 0, 0) rotate(-2deg);
  }
  to {
    transform: translate3d(6vw, -4vh, 0) rotate(2deg);
  }
}

@keyframes bg-particles-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-70px, -90px, 0);
  }
}

/* 静态降级：system 省电、低端设备、后台选择静态/关闭动态时停掉所有动画 */
body.bg-static .bg-photo,
body.bg-static .bg-glow,
body.bg-static .bg-particles {
  animation: none;
}

body.bg-static .bg-photo {
  transform: scale(1.02);
}

body.bg-static .bg-glow-c,
body.bg-static .bg-particles {
  opacity: 0.3;
}

/* 进入对局暂停动画，回大厅恢复 */
body.bg-paused .bg-stage .bg-photo,
body.bg-paused .bg-stage .bg-glow,
body.bg-paused .bg-stage .bg-particles {
  animation-play-state: paused !important;
}

/* 屏幕内容位于背景层之上，背景开启时原有不透明底色改为玻璃质感 */
.screen {
  position: relative;
  z-index: 1;
}

body.bg-active #screen-lobby {
  background: transparent;
}

body.bg-active #screen-lobby .sidebar {
  background: rgba(13, 21, 35, 0.84);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

/* 大厅卡片只加一层很浅的玻璃模糊，保留原有渐变与文字对比度 */
body.bg-active .lobby-grid > .panel:not(.hero) {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (prefers-reduced-motion: reduce) {
  .bg-photo,
  .bg-glow,
  .bg-particles {
    animation: none !important;
  }
}

/* 观战：只读模式下隐藏所有击球控件，仅保留球台、比分与退出入口 */
.spectate-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  margin: 0 auto 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(12, 18, 26, 0.86);
  border: 1px solid rgba(46, 230, 168, 0.35);
  color: var(--text, #e8eef5);
  position: relative;
  z-index: 6;
}
.spectate-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ee6a8;
  box-shadow: 0 0 8px #2ee6a8;
  animation: spectate-pulse 1.6s ease-in-out infinite;
}
@keyframes spectate-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.spectate-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#screen-game.spectating .side-control,
#screen-game.spectating .footer-dup,
#screen-game.spectating #chat-toggle,
#screen-game.spectating #leave-game,
#screen-game.spectating #pocket-tray {
  display: none !important;
}
#screen-game.spectating #power-range { pointer-events: none; }

#screen-game.spectating #table { pointer-events: none; }

/* 三区布局补充：底部操作条与球台同宽、排队状态信息 */

#screen-game .table-row .game-foot {
  width: min(100%, calc((100dvh - var(--game-chrome)) * 1.814));
  margin: 0 auto;
}

.result-opponent {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
}

.result-opponent b {
  color: var(--text);
  font-weight: 600;
}

.queue-online,
.queue-wait {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .queue-status {
    flex-wrap: wrap;
    max-width: 100%;
  }
}

/* 窗口较矮：控制器收窄但保持与球台分离，不遮挡桌面 */
@media (max-height: 700px) {
  #screen-game {
    --game-chrome: 176px;
    padding: 8px 12px 10px;
    gap: 8px;
  }

  #screen-game .side-control {
    padding: 6px 4px;
    gap: 4px;
  }

  #screen-game .side-sub {
    display: none;
  }

  .chat-strip {
    min-height: 26px;
  }

  #screen-game .game-foot {
    padding: 8px 12px;
    gap: 10px;
  }
}
