/* ============================================================
   排行榜控制台 · 藏蓝金版
   深藏蓝底 + 明亮琥珀金描边，克制、密度高、可长时间操作
   ============================================================ */

:root,
[data-theme="navy-gold"] {
  --bg: #0b1026;
  --surface-1: #151c3c;
  --surface-2: #1b2450;
  --surface-3: #243063;
  --gold-rgb: 242, 201, 106;
  --gold: rgb(var(--gold-rgb));
  --gold-light: #ffe6a6;
  --gold-deep: #9c6f1e;
  --ember: #f0a468;
  --line: rgba(var(--gold-rgb), 0.18);
  --line-strong: rgba(var(--gold-rgb), 0.38);
  --text: #f6f2e8;
  --muted: #bcc6d8;
  --danger: #e0705f;
  --font-title: "STKaiti", "KaiTi", "楷体", "Source Han Serif SC", serif;
  --font-body: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

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

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(8, 13, 32, 0.87) 0%, rgba(6, 10, 26, 0.8) 50%, rgba(5, 9, 22, 0.9) 100%),
    url("./assets/bg-live.jpg") center center / cover no-repeat;
  background-attachment: fixed;
}

.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(242, 201, 106, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 201, 106, 0.04) 1px, transparent 1px);
  background-size: 96px 96px;
  opacity: 0.55;
}

/* ---------- 登录 ---------- */
.login-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-wrap::before {
  content: "";
  position: absolute;
  width: 980px;
  height: 720px;
  max-width: 100vw;
  background: radial-gradient(ellipse at center, rgba(var(--gold-rgb), 0.13) 0%, transparent 66%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 420px;
  max-width: 100%;
  padding: 52px 42px 38px;
  background:
    radial-gradient(420px 260px at 50% 0%, rgba(var(--gold-rgb), 0.14), transparent 66%),
    linear-gradient(180deg, #1a2458 0%, #0b1026 100%);
  border: 1px solid rgba(var(--gold-rgb), 0.34);
  border-radius: 14px;
  box-shadow:
    0 34px 100px rgba(3, 8, 26, 0.62),
    0 0 90px rgba(var(--gold-rgb), 0.14),
    inset 0 1px 0 rgba(255, 248, 221, 0.08);
  text-align: center;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(var(--gold-rgb), 0.10);
  border-radius: 9px;
  pointer-events: none;
}

.login-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 8px;
  text-shadow: 0 0 16px rgba(var(--gold-rgb), 0.6);
}

.login-badge::before,
.login-badge::after {
  content: "";
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.55));
}

.login-badge::after {
  transform: scaleX(-1);
}

.login-card h1 {
  font-family: var(--font-title);
  font-size: 34px;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fffaf0 0%, var(--gold-light) 46%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(var(--gold-rgb), 0.25));
}

.login-sub {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(156, 148, 132, 0.7);
}

.login-card .field {
  text-align: left;
  margin-top: 34px;
  margin-bottom: 20px;
}

.login-hint {
  margin-top: 18px;
  font-size: 12px;
  color: rgba(156, 148, 132, 0.75);
}

/* ---------- 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  background: #0d1330;
  border: 1px solid rgba(var(--gold-rgb), 0.16);
  border-radius: 7px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:hover,
select:hover {
  border-color: rgba(var(--gold-rgb), 0.26);
}

input:focus,
select:focus {
  background: #131c42;
  border-color: rgba(var(--gold-rgb), 0.62);
  box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.10);
}

input::placeholder {
  color: rgba(156, 148, 132, 0.45);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c8b48c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px 15px;
  padding-right: 34px;
}

select option {
  background: #1b2450;
  color: var(--text);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 0.5px;
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(var(--gold-rgb), 0.24);
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  color: #fff8e8;
  background: rgba(var(--gold-rgb), 0.10);
  border-color: rgba(var(--gold-rgb), 0.52);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid rgba(var(--gold-rgb), 0.55);
  outline-offset: 2px;
}

.btn.primary {
  color: #2b1c05;
  font-weight: 700;
  background: linear-gradient(180deg, #fff8dd 0%, #ffe6a6 40%, #f2c96a 74%, #c69a3e 100%);
  border-color: rgba(255, 248, 221, 0.7);
  box-shadow: 0 8px 22px rgba(var(--gold-rgb), 0.22);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #fffdf2 0%, #f7dfae 40%, #e2b264 74%, #c9973a 100%);
  color: #241804;
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(var(--gold-rgb), 0.24);
  color: var(--gold-light);
}

.btn.block {
  width: 100%;
  margin-top: 6px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.018);
  border-color: rgba(var(--gold-rgb), 0.20);
  color: rgba(240, 212, 154, 0.9);
}

.btn.danger {
  background: rgba(180, 50, 50, 0.18);
  border-color: rgba(224, 112, 95, 0.45);
  color: #ffc6b8;
}

.btn.danger:hover {
  background: rgba(224, 80, 60, 0.30);
  border-color: rgba(255, 130, 110, 0.7);
  color: #fff;
}

/* ---------- 顶栏 ---------- */
.app {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  padding: 0 26px;
  background: rgba(16, 22, 52, 0.86);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 14px;
  border: 1px solid rgba(var(--gold-rgb), 0.45);
  border-radius: 10px;
  background: linear-gradient(160deg, #243063, #0b1026);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 221, 0.10),
    0 0 18px rgba(var(--gold-rgb), 0.18);
}

.brand strong {
  display: block;
  font-family: var(--font-title);
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--gold-light);
}

.brand small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

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

/* ---------- 一级导航 ---------- */
.view-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 18px;
  padding: 16px 26px 0;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
}

.view-actions .btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 6px;
}

.action-divider {
  width: 1px;
  height: 16px;
  margin: 0 3px;
  background: rgba(var(--gold-rgb), 0.20);
}

.view-tab {
  min-width: 118px;
  padding: 9px 18px;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(var(--gold-rgb), 0.16);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.view-tab:hover {
  color: var(--gold-light);
  border-color: rgba(var(--gold-rgb), 0.42);
  background: rgba(var(--gold-rgb), 0.07);
}

.view-tab.active {
  color: #2b1c05;
  background: linear-gradient(180deg, #fff8dd 0%, #ffe6a6 42%, #f2c96a 100%);
  border-color: rgba(255, 248, 221, 0.75);
  box-shadow:
    0 10px 26px rgba(var(--gold-rgb), 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.view-tab.active:hover {
  color: #2b1c05;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  padding: 18px 26px 34px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  position: relative;
  padding: 20px;
  background:
    radial-gradient(420px 240px at 8% 0%, rgba(var(--gold-rgb), 0.06), transparent 66%),
    linear-gradient(180deg, #18204a 0%, #0f1532 100%);
  border: 1px solid rgba(var(--gold-rgb), 0.13);
  border-radius: 12px;
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 248, 221, 0.045);
}

.panel + .panel {
  margin-top: 14px;
}

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

.panel-head.compact {
  margin-bottom: 16px;
}

.panel-head h2 {
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-light);
}

.panel-head p {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.panel-tools {
  display: flex;
  gap: 10px;
  flex: none;
}

.side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* 右侧面板内容比左侧长时在面板内滚动，不再把整页撑长，底部与选手列表平齐 */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

/* 右侧三区块分页（设备 / 设置 / 账户），避免三块面板纵向堆叠越做越长 */
.side-tabs {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex: none;
  gap: 6px;
  margin-bottom: 10px;
  padding: 2px 0 8px;
  background: linear-gradient(180deg, rgba(11, 16, 38, 0.94), rgba(11, 16, 38, 0.72));
  backdrop-filter: blur(6px);
}

.side-tab {
  flex: 1 1 0;
  height: 32px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(var(--gold-rgb), 0.16);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.side-tab:hover {
  color: var(--gold-light);
  border-color: rgba(var(--gold-rgb), 0.42);
  background: rgba(var(--gold-rgb), 0.07);
}

.side-tab.is-on {
  color: #2b1c05;
  font-weight: 700;
  background: linear-gradient(180deg, #fff8dd 0%, #ffe6a6 42%, #f2c96a 100%);
  border-color: rgba(255, 248, 221, 0.75);
}

/* 桌面端只显示当前分页；手机端仍由底部 4 标签（data-mtab）控制 */
@media (min-width: 769px) {
  body[data-stab="device"] #panelSettings,
  body[data-stab="device"] #panelAccount,
  body[data-stab="settings"] #panelDevice,
  body[data-stab="settings"] #panelAccount,
  body[data-stab="account"] #panelDevice,
  body[data-stab="account"] #panelSettings {
    display: none;
  }
}

@media (max-width: 768px) {
  .side-tabs {
    display: none;
  }
}

.side > .panel {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

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

.side .panel-head.compact {
  margin-bottom: 10px;
}

.side .panel-head h2 {
  font-size: 17px;
  letter-spacing: 1px;
}

.side .form-grid {
  flex: 1;
  justify-content: flex-start;
}

/* 左侧选手面板：表格占满剩余高度，内部滚动 */
.data-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.data-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 320px);
  border: 1px solid rgba(var(--gold-rgb), 0.12);
  border-radius: 9px;
  background: #0d1330;
}

.player-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 13px;
}

.player-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 7px 10px;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-align: left;
  background: #1b2450;
  border-bottom: 1px solid rgba(var(--gold-rgb), 0.16);
  white-space: nowrap;
}

.player-table tbody td {
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}

.player-table tbody tr:last-child td {
  border-bottom: none;
}

.player-table tbody tr:hover td {
  background: rgba(var(--gold-rgb), 0.035);
}

.col-avatar { width: 52px; }
.col-num { width: 78px; }
.col-rank { width: 56px; text-align: center; }
.col-op { width: 104px; text-align: center; }

.player-table .inp-name {
  max-width: 240px;
}

.player-table .cell-rank {
  text-align: center;
}

.player-table input[type="text"],
.player-table input[type="number"] {
  height: 28px;
  padding: 0 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.player-table .inp-num {
  text-align: center;
  min-width: 88px;
}

.player-table thead th.col-num,
.player-table tbody td.col-num {
  min-width: 92px;
}

.avatar-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(var(--gold-rgb), 0.55);
  background: radial-gradient(circle at 50% 30%, #1a2458, #0b1026);
  box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.18);
  cursor: pointer;
  padding: 0;
}

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

.avatar-btn .initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--gold-light);
}

.avatar-btn i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1px 0;
  font-style: normal;
  font-size: 9px;
  color: #2b1c05;
  background: rgba(240, 212, 154, 0.92);
  opacity: 0;
  transition: opacity 0.18s;
}

.avatar-btn:hover i {
  opacity: 1;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 21px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold-light);
  background: rgba(var(--gold-rgb), 0.10);
  border: 1px solid rgba(var(--gold-rgb), 0.30);
  border-radius: 6px;
}

.rank-badge.top1 {
  color: #2b1c05;
  background: linear-gradient(180deg, #fff8dd, #ffe6a6 45%, #f2c96a);
  border-color: rgba(255, 248, 221, 0.8);
  box-shadow: 0 0 16px rgba(var(--gold-rgb), 0.35);
}

.rank-badge.top2 {
  color: #f2f4f6;
  background: rgba(226, 228, 232, 0.12);
  border-color: rgba(226, 228, 232, 0.45);
}

.rank-badge.top3 {
  color: #ffd3b3;
  background: rgba(229, 127, 59, 0.14);
  border-color: rgba(229, 127, 59, 0.45);
}

.rank-badge.none {
  color: rgba(156, 148, 132, 0.5);
  background: transparent;
  border-color: rgba(156, 148, 132, 0.18);
  font-weight: 400;
}

.del-btn {
  height: 26px;
  padding: 0 7px;
  font-size: 11.5px;
  white-space: nowrap;
  color: rgba(224, 112, 95, 0.9);
  background: transparent;
  border: 1px solid rgba(224, 112, 95, 0.28);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.del-btn:hover {
  background: rgba(224, 112, 95, 0.12);
  border-color: rgba(224, 112, 95, 0.6);
}

.table-empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.table-toolbar .search-input {
  flex: 1;
  max-width: 300px;
  height: 30px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239c9484' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4.2-4.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 15px 15px;
}

.search-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}

.pager .page-info b {
  color: var(--gold-light);
  font-weight: 400;
}

.page-btn {
  height: 30px;
  min-width: 72px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--gold-light);
  background: #0d1330;
  border: 1px solid rgba(var(--gold-rgb), 0.20);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.page-btn:hover:not(:disabled) {
  background: rgba(var(--gold-rgb), 0.10);
  border-color: rgba(var(--gold-rgb), 0.5);
}

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

.save-status {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(156, 148, 132, 0.7);
  text-align: right;
}

.save-status.dirty {
  color: #ffe6a6;
}

/* ---------- 设置面板 ---------- */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

/* 右侧「大屏设置」用双列排布，缩短纵向长度，避免右侧明显长于左侧列表 */
.side .form-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

.side .form-grid.two-col .field.wide {
  grid-column: 1 / -1;
}

.labels-group {
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 10px;
  padding: 12px 14px 4px;
  background: rgba(255, 255, 255, 0.018);
}

.labels-title {
  color: rgba(var(--gold-rgb), 0.9);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
  display: block;
}

.labels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.labels-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.labels-col > b {
  font-size: 12px;
  color: rgba(240, 212, 154, 0.75);
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 1px dashed rgba(var(--gold-rgb), 0.22);
}

.labels-col .field.sm {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0;
  min-height: 0;
}

.labels-col .field.sm > span {
  font-size: 12px;
  white-space: nowrap;
  min-width: 108px;
  color: rgba(238, 232, 210, 0.72);
}

.labels-col .field.sm input {
  height: 32px;
  font-size: 12.5px;
  padding: 4px 10px;
}

@media (max-width: 768px) {
  .labels-grid { grid-template-columns: 1fr; }
  .labels-col .field.sm > span { min-width: 90px; }
}

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

.logo-preview {
  width: 134px;
  height: 64px;
  flex: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed rgba(var(--gold-rgb), 0.26);
  border-radius: 8px;
  background: #0d1330;
}

.logo-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-preview span {
  font-size: 12px;
  color: rgba(156, 148, 132, 0.7);
}

.logo-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.logo-tools .btn {
  width: 100%;
}

/* ---------- 大屏背景库 ---------- */
.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.bg-item {
  position: relative;
  padding: 0;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(var(--gold-rgb), 0.22);
  background: #0d1330;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

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

.bg-item:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--gold-rgb), 0.5);
}

.bg-item.active {
  border-color: rgba(var(--gold-rgb), 0.9);
  box-shadow:
    0 0 0 1px rgba(var(--gold-rgb), 0.55),
    0 0 14px rgba(var(--gold-rgb), 0.35);
}

.bg-item i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 0;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 2px;
  text-align: center;
  color: #1a1305;
  background: linear-gradient(180deg, #ffe9bd, #e2a463);
}

.bg-empty {
  grid-column: 1 / -1;
  padding: 14px 0;
  font-size: 12px;
  text-align: center;
  color: rgba(156, 148, 132, 0.6);
}

.bg-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.bg-tools .btn {
  flex: 1;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.control-grid .btn {
  height: 34px;
  padding: 0 8px;
  font-size: 13px;
}

.hint-text {
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(156, 148, 132, 0.65);
}

/* ---------- 榜单只读 ---------- */
.view-hint {
  margin-bottom: 12px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(var(--gold-rgb), 0.045);
  border: 1px solid rgba(var(--gold-rgb), 0.14);
  border-radius: 7px;
}

.view-hint b {
  color: var(--gold-light);
  font-weight: 400;
}

.readonly-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(var(--gold-rgb), 0.4);
  background: radial-gradient(circle at 50% 30%, #1a2458, #0b1026);
}

.readonly-avatar.initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--gold-light);
}

.cell-read {
  text-align: center;
  font-size: 13px;
  color: #e6dfd0;
  font-variant-numeric: tabular-nums;
}

.player-table.wide {
  min-width: 0;
}

.row-tools {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.edit-btn {
  height: 26px;
  padding: 0 7px;
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--gold-light);
  background: transparent;
  border: 1px solid rgba(var(--gold-rgb), 0.32);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.edit-btn:hover {
  background: rgba(var(--gold-rgb), 0.12);
  border-color: rgba(var(--gold-rgb), 0.65);
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 6, 0.76);
  backdrop-filter: blur(8px);
}

.modal {
  position: relative;
  width: 580px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 26px 20px;
  background:
    radial-gradient(420px 240px at 12% 0%, rgba(var(--gold-rgb), 0.09), transparent 66%),
    linear-gradient(180deg, #1a2458 0%, #0b1026 100%);
  border: 1px solid rgba(var(--gold-rgb), 0.32);
  border-radius: 14px;
  box-shadow:
    0 30px 90px rgba(3, 8, 26, 0.7),
    0 0 60px rgba(var(--gold-rgb), 0.10),
    inset 0 1px 0 rgba(255, 248, 221, 0.07);
}

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

.modal-head h3 {
  font-family: var(--font-title);
  font-size: 21px;
  letter-spacing: 2px;
  color: var(--gold-light);
}

.modal-close {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.modal-close:hover {
  color: var(--gold-light);
  border-color: rgba(var(--gold-rgb), 0.55);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(var(--gold-rgb), 0.12);
}

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  position: relative;
  width: 82px;
  height: 82px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(var(--gold-rgb), 0.6);
  background: radial-gradient(circle at 50% 30%, #1a2458, #0b1026);
  box-shadow: 0 0 22px rgba(var(--gold-rgb), 0.2);
  cursor: pointer;
}

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

.avatar-preview .initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-title);
  font-size: 34px;
  color: var(--gold-light);
}

.avatar-tip strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.avatar-tip small {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.form-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  padding: 10px 22px;
  font-size: 13px;
  color: var(--gold-light);
  background: rgba(12, 11, 9, 0.97);
  border: 1px solid rgba(var(--gold-rgb), 0.42);
  border-radius: 8px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100;
}

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

.toast.error {
  color: #ffb4a8;
  border-color: rgba(224, 112, 95, 0.5);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    display: block;
  }

  .side > .panel {
    display: block;
  }
}

/* ============================================================
   手机端（≤768px）：整页自然滚动 + 选手表转卡片
   供手机浏览器与手机 APK 内的 WebView 使用
   ============================================================ */
@media (max-width: 768px) {
  body {
    background-attachment: scroll;
    -webkit-text-size-adjust: 100%;
  }

  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .topbar {
    height: 56px;
    padding: 0 12px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .brand strong {
    font-size: 15px;
    letter-spacing: 1px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .view-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 0;
  }

  .view-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .view-tabs::-webkit-scrollbar,
  .view-actions::-webkit-scrollbar {
    display: none;
  }

  .view-tab {
    flex: none;
    min-width: auto;
    padding: 9px 12px;
    font-size: 13px;
    letter-spacing: 1px;
    white-space: nowrap;
  }

  .view-actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .view-actions .btn.sm {
    flex: none;
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .action-divider {
    display: none;
  }

  .layout {
    display: block;
    padding: 10px 12px 28px;
  }

  .panel {
    padding: 13px;
    border-radius: 10px;
  }

  .panel + .panel {
    margin-top: 12px;
  }

  .panel-head {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }

  .panel-head h2 {
    font-size: 17px;
    letter-spacing: 1px;
  }

  .panel-head p {
    font-size: 11px;
  }

  /* 标题与保存按钮吸顶，滚动时随时能保存 */
  .data-panel .panel-head {
    position: sticky;
    top: 56px;
    z-index: 8;
    margin: -13px -13px 10px;
    padding: 10px 13px 8px;
    background: #121a3f;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.14);
  }

  .panel-tools {
    width: 100%;
    gap: 8px;
  }

  .panel-tools .btn {
    flex: 1;
    height: 42px;
    font-size: 14px;
  }

  .side {
    display: block;
    overflow: visible;
    padding-right: 0;
  }

  .side > .panel {
    display: block;
  }

  .side .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .side .form-grid.two-col .field.wide {
    grid-column: 1;
  }

  .form-grid.two {
    grid-template-columns: 1fr;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  select {
    height: 42px;
    font-size: 16px;
  }

  .field > span {
    font-size: 11px;
  }

  .table-toolbar {
    gap: 8px;
  }

  .table-toolbar .search-input {
    max-width: none;
    height: 40px;
    font-size: 15px;
  }

  .search-count {
    font-size: 11px;
  }

  /* ---- 表格 → 卡片 ---- */
  .table-wrap {
    overflow: visible;
    max-height: none;
    border: none;
    background: transparent;
  }

  .player-table,
  .player-table.wide {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    font-size: 14px;
  }

  .player-table thead {
    display: none;
  }

  .player-table tbody {
    display: block;
  }

  .player-table tbody tr {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) 44px;
    gap: 8px 10px;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: linear-gradient(180deg, #18204a 0%, #0f1532 100%);
    border: 1px solid rgba(var(--gold-rgb), 0.16);
    border-radius: 10px;
  }

  .player-table tbody tr:hover td,
  .player-table tbody tr:last-child td {
    background: transparent;
  }

  .player-table tbody td {
    display: block;
    min-width: 0;
    padding: 0;
    border: none;
  }

  .player-table .avatar-btn,
  .player-table .readonly-avatar {
    width: 50px;
    height: 50px;
  }

  .player-table .avatar-btn .initial,
  .player-table .readonly-avatar.initial {
    font-size: 18px;
  }

  .player-table input[type="text"],
  .player-table input[type="number"] {
    width: 100%;
    height: 40px;
    font-size: 15px;
  }

  .player-table .inp-name {
    max-width: none;
    font-weight: 700;
  }

  .player-table .cell-rank {
    text-align: center;
  }

  .rank-badge {
    min-width: 26px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
  }

  /* 总榜（可编辑，8 列） */
  .player-table.wide tbody td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .player-table.wide tbody td:nth-child(2) {
    grid-column: 2 / span 2;
    grid-row: 1;
  }

  .player-table.wide tbody td:nth-child(7) {
    grid-column: 4;
    grid-row: 1;
  }

  .player-table.wide tbody td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .player-table.wide tbody td:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
  }

  .player-table.wide tbody td:nth-child(5) {
    grid-column: 2;
    grid-row: 3;
  }

  .player-table.wide tbody td:nth-child(6) {
    grid-column: 3;
    grid-row: 3;
  }

  .player-table.wide tbody td:nth-child(8) {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .player-table.wide tbody td:nth-child(3)::before,
  .player-table.wide tbody td:nth-child(4)::before,
  .player-table.wide tbody td:nth-child(5)::before,
  .player-table.wide tbody td:nth-child(6)::before {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--muted);
  }

  .player-table.wide tbody td:nth-child(3)::before { content: "本周胜场"; }
  .player-table.wide tbody td:nth-child(4)::before { content: "本周猎人卡"; }
  .player-table.wide tbody td:nth-child(5)::before { content: "本月胜场"; }
  .player-table.wide tbody td:nth-child(6)::before { content: "本月猎人卡"; }

  .player-table.wide tbody td:nth-child(8) .row-tools {
    gap: 8px;
    justify-content: stretch;
  }

  .player-table.wide tbody td:nth-child(8) .edit-btn,
  .player-table.wide tbody td:nth-child(8) .del-btn {
    flex: 1;
    height: 38px;
    font-size: 13px;
  }

  /* 只读榜（5 列） */
  .player-table:not(.wide) tbody td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .player-table:not(.wide) tbody td:nth-child(2) {
    grid-column: 2 / span 2;
    grid-row: 1;
    font-size: 16px;
    font-weight: 700;
  }

  .player-table:not(.wide) tbody td:nth-child(5) {
    grid-column: 4;
    grid-row: 1;
  }

  .player-table:not(.wide) tbody td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .player-table:not(.wide) tbody td:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
  }

  .player-table tbody td.cell-read {
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-light);
  }

  .player-table tbody td.cell-read::before {
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--muted);
  }

  body[data-view="champion"] .player-table:not(.wide) tbody td:nth-child(3)::before { content: "本周胜场"; }
  body[data-view="champion"] .player-table:not(.wide) tbody td:nth-child(4)::before { content: "本周猎人卡"; }
  body[data-view="hunter"] .player-table:not(.wide) tbody td:nth-child(3)::before { content: "本周胜场"; }
  body[data-view="hunter"] .player-table:not(.wide) tbody td:nth-child(4)::before { content: "本周猎人卡"; }
  body[data-view="monthChampion"] .player-table:not(.wide) tbody td:nth-child(3)::before { content: "本月胜场"; }
  body[data-view="monthChampion"] .player-table:not(.wide) tbody td:nth-child(4)::before { content: "本月猎人卡"; }
  body[data-view="monthHunter"] .player-table:not(.wide) tbody td:nth-child(3)::before { content: "本月胜场"; }
  body[data-view="monthHunter"] .player-table:not(.wide) tbody td:nth-child(4)::before { content: "本月猎人卡"; }

  .pager {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .page-btn {
    height: 38px;
    min-width: 84px;
    font-size: 13px;
  }

  .save-status {
    text-align: center;
    font-size: 11px;
  }

  .login-wrap {
    padding: 16px;
  }

  .login-card {
    width: 100%;
    padding: 28px 20px 22px;
  }

  .modal-mask {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92dvh;
    padding: 18px 16px 16px;
    border-radius: 14px 14px 0 0;
  }

  .avatar-preview {
    width: 68px;
    height: 68px;
  }

  .bg-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .toast {
    bottom: 18px;
    max-width: calc(100vw - 32px);
  }
}

/* ---------- 大屏设备 ---------- */
.tv-pair-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tv-pair-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 214, 150, 0.22);
  background: rgba(10, 14, 26, 0.6);
  color: #f2e8d5;
  font-size: 13px;
}

.tv-pair-row input::placeholder { color: rgba(242, 232, 213, 0.35); }

.tv-device-list { margin-top: 4px; }

.tv-device {
  border: 1px solid rgba(255, 214, 150, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(12, 16, 30, 0.55);
}

.tv-device + .tv-device { margin-top: 10px; }

.tv-device-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #f5ead2;
}

.tv-device-top .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot.online { background: #5dd97c; box-shadow: 0 0 8px rgba(93, 217, 124, 0.8); }
.dot.offline { background: #6b7280; }

.tv-device-top .state { font-size: 12px; color: rgba(242, 232, 213, 0.5); }

.tv-device-ops {
  display: flex;
  gap: 6px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.tv-device-ops .btn { padding: 4px 12px; font-size: 12px; }
.tv-device-ops .btn.danger { color: #ff9d9d; border-color: rgba(255, 130, 130, 0.3); }

.tv-empty { font-size: 12px; color: rgba(242, 232, 213, 0.4); padding: 6px 2px; }
/* ================ 授权管理面板 ================ */
.auth-subnav { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid rgba(212,175,55,0.2); padding-bottom: 8px; }
.auth-subnav .sub-tab { padding: 6px 14px; border: 1px solid rgba(212,175,55,0.3); border-radius: 6px; background: transparent; color: #b8bce0; font-size: 13px; cursor: pointer; transition: all .15s; }
.auth-subnav .sub-tab:hover { border-color: rgba(212,175,55,0.6); color: #f5d77a; }
.auth-subnav .sub-tab.active { background: rgba(212,175,55,0.15); border-color: #d4af37; color: #f5d77a; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.role-tag { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; background: rgba(212,175,55,0.15); color: #f5d77a; border: 1px solid rgba(212,175,55,0.3); }

.auth-gen-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; padding: 12px; background: rgba(212,175,55,0.05); border: 1px solid rgba(212,175,55,0.15); border-radius: 8px; }
.auth-gen-item { display: flex; flex-direction: column; gap: 4px; min-width: 100px; }
.auth-gen-item.wide { flex: 1; min-width: 180px; }
.auth-gen-item span { font-size: 11px; color: #8a91a8; text-transform: uppercase; letter-spacing: 0.5px; }
.auth-gen-item input { padding: 7px 10px; border: 1px solid rgba(212,175,55,0.25); border-radius: 5px; background: rgba(255,255,255,0.04); color: #e4e8f8; font-size: 13px; outline: none; }
.auth-gen-item input:focus { border-color: #d4af37; box-shadow: 0 0 0 2px rgba(212,175,55,0.12); }

.auth-list-wrap { max-height: 380px; overflow-y: auto; }
.auth-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.auth-table thead th { position: sticky; top: 0; background: #0f1630; color: #8a91a8; font-weight: 500; padding: 7px 8px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid rgba(212,175,55,0.25); }
.auth-table tbody td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); color: #b8bce0; vertical-align: middle; }
.auth-table tbody tr:hover { background: rgba(212,175,55,0.04); }
.auth-table .mono { font-family: 'Menlo','Monaco',monospace; font-size: 11.5px; }
.auth-table .mono.small { font-size: 10.5px; max-width: 120px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-table .copyable { cursor: pointer; color: #d4af37; user-select: none; }
.auth-table .copyable:hover { color: #f5d77a; text-decoration: underline; }
.auth-table .note { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #7a8098; font-size: 11.5px; }
.auth-table .warn { color: #e67e22; font-weight: 600; }
.auth-table .actions { white-space: nowrap; }
.auth-empty { text-align: center; padding: 30px; color: #5a6080; font-size: 13px; }

/* 账户信息面板 */
.account-info { margin-top: 4px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #7a8098; }
.info-value { color: #e8d9b0; font-weight: 500; text-align: right; word-break: break-all; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; }
.badge.unused { background: rgba(46,204,113,0.15); color: #27ae60; border: 1px solid rgba(46,204,113,0.3); }
.badge.partial { background: rgba(241,196,15,0.15); color: #e67e22; border: 1px solid rgba(241,196,15,0.3); }
.badge.exhausted { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.badge.revoked { background: rgba(149,165,166,0.15); color: #95a5a6; border: 1px solid rgba(149,165,166,0.3); }
.badge.active { background: rgba(46,204,113,0.15); color: #27ae60; border: 1px solid rgba(46,204,113,0.3); }

/* ---------- 播放控制（入场动画 / 周月榜自动切换） ---------- */
.play-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.play-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
}

.play-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.play-text b {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
}

.play-text small {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #0d1330;
  border: 1px solid rgba(var(--gold-rgb), 0.24);
  transition: background 0.22s, border-color 0.22s;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6b6455;
  transition: transform 0.22s, background 0.22s, box-shadow 0.22s;
}

.switch input:checked + .switch-track {
  background: rgba(var(--gold-rgb), 0.22);
  border-color: rgba(var(--gold-rgb), 0.75);
}

.switch input:checked + .switch-track .switch-knob {
  transform: translateX(20px);
  background: var(--gold);
  box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.55);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.18);
}

.play-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(var(--gold-rgb), 0.14);
}

.play-sub .field.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.seg {
  display: flex;
  gap: 6px;
}

.seg-btn {
  flex: 1 1 0;
  height: 32px;
  border-radius: 7px;
  border: 1px solid rgba(var(--gold-rgb), 0.2);
  background: #0d1330;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.seg-btn.is-on {
  color: #1a1206;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

/* 展示模块：两个大号模式按钮独占整行，标题说明在上方，避免被文字挤压变形 */
.template-head {
  min-height: 0;
}

.seg-lg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.seg-lg .seg-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  height: auto;
  min-height: 64px;
  padding: 10px 14px;
  text-align: left;
  border-radius: 9px;
}

.seg-lg .seg-btn strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}

.seg-lg .seg-btn small {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
}

.seg-lg .seg-btn:hover {
  border-color: rgba(var(--gold-rgb), 0.5);
  background: rgba(var(--gold-rgb), 0.08);
}

.seg-lg .seg-btn.is-on {
  background: linear-gradient(180deg, #fff8dd 0%, #ffe6a6 42%, #f2c96a 100%);
  border-color: rgba(255, 248, 221, 0.85);
  box-shadow: 0 10px 24px rgba(var(--gold-rgb), 0.24);
}

.seg-lg .seg-btn.is-on small {
  color: rgba(43, 28, 5, 0.72);
}

.seg-lg .seg-btn:focus-visible {
  outline: 2px solid rgba(var(--gold-rgb), 0.55);
  outline-offset: 2px;
}

/* 大屏设备页：背景库区块（从「大屏设置」移入） */
.device-bg-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--gold-rgb), 0.14);
}

.device-bg-block .section-label {
  margin-bottom: 4px;
}

/* 主店登录：没有商户档案，隐藏账户信息分页；改密码仍在大屏设置里 */
body.role-main #panelAccount,
body.role-main .side-tab[data-stab="account"],
body.role-main .mnav-item[data-mtab="account"] {
  display: none !important;
}

/* 修改管理密码仅主店显示；商户在账户信息里改自己的密码 */
.pwd-field {
  display: none;
}

body.role-main .pwd-field {
  display: flex;
}

/* 主店底部导航少一个账户信息，改为三列均分 */
body.role-main .mobile-nav {
  grid-template-columns: repeat(3, 1fr);
}

.play-split {
  height: 1px;
  background: rgba(var(--gold-rgb), 0.16);
}

/* 设置区分组小标题：展示模块 / 播放与切换 / 基础信息 */
.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(var(--gold-rgb), 0.85);
  white-space: nowrap;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.28), transparent);
}

.play-controls .section-label {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .play-sub {
    grid-template-columns: 1fr;
  }
  .play-row {
    min-height: 44px;
  }
  .switch-track {
    width: 50px;
    height: 28px;
  }
  .switch-knob {
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
  }
  .switch input:checked + .switch-track .switch-knob {
    transform: translateX(22px);
  }
}
.badge.warning { background: rgba(241,196,15,0.15); color: #e67e22; border: 1px solid rgba(241,196,15,0.3); }
.badge.expired { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.badge.disabled { background: rgba(149,165,166,0.15); color: #95a5a6; border: 1px solid rgba(149,165,166,0.3); }

.merchant-mode .view-actions { display: none; }

/* patch64：当前数据保存目标（身份标识） */
.save-target {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #f5d77a;
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.3);
  vertical-align: middle;
}
.save-target-bar {
  margin: 8px 0 4px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #f5d77a;
  background: rgba(212,175,55,0.08);
  border: 1px dashed rgba(212,175,55,0.28);
}

@media (max-width: 768px) {
  .save-target { display: none; }
}

/* 手机端专用元素默认隐藏（仅在 ≤768px 的媒体查询里显示） */
.mobile-nav,
.mobile-savebar,
.mobile-only {
  display: none;
}

/* 手机端：区块与按钮基础排版 */
@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }

  .mob-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(var(--gold-rgb), 0.14);
  }

  .mob-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--muted);
  }

  .mob-cmd-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mob-cmd-row .btn {
    height: 42px;
    font-size: 14px;
  }

  .mob-block > .btn.block {
    height: 42px;
    margin-top: 10px;
    font-size: 14px;
  }
}

/* 手机端：底部导航 + 吸底保存条 */
@media (max-width: 768px) {
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(13, 19, 44, 0.97);
    border-top: 1px solid rgba(var(--gold-rgb), 0.22);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
  }

  .mnav-item {
    position: relative;
    height: 56px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
  }

  .mnav-item.active {
    color: var(--gold-light);
  }

  .mnav-item.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 26px;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    transform: translateX(-50%);
  }

  .mobile-savebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: 35;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(21, 28, 60, 0.97), rgba(13, 19, 44, 0.99));
    border-top: 1px solid rgba(var(--gold-rgb), 0.18);
    box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.4);
  }

  .mobile-savebar .save-status {
    flex: 1;
    margin: 0;
    text-align: left;
  }

  .mobile-savebar .btn {
    flex: none;
    min-width: 108px;
    height: 42px;
    font-size: 14px;
  }

  .toast {
    bottom: 132px;
  }
}

/* 手机端：按底部 4 标签切换面板
   逐个“隐藏非当前面板”，未命中 data-mtab 时全部显示，避免白屏兜底 */
@media (max-width: 768px) {
  body[data-mtab="device"] .data-panel,
  body[data-mtab="device"] .view-bar,
  body[data-mtab="device"] #panelSettings,
  body[data-mtab="device"] #panelAccount {
    display: none;
  }

  body[data-mtab="rank"] #panelDevice,
  body[data-mtab="rank"] #panelSettings,
  body[data-mtab="rank"] #panelAccount {
    display: none;
  }

  body[data-mtab="settings"] .data-panel,
  body[data-mtab="settings"] .view-bar,
  body[data-mtab="settings"] #panelDevice,
  body[data-mtab="settings"] #panelAccount {
    display: none;
  }

  body[data-mtab="account"] .data-panel,
  body[data-mtab="account"] .view-bar,
  body[data-mtab="account"] #panelDevice,
  body[data-mtab="account"] #panelSettings {
    display: none;
  }

  /* 吸底保存条只在「排行榜」且当前榜单可编辑（总榜）时显示 */
  body[data-mtab="rank"][data-editable="1"] .mobile-savebar {
    display: flex;
  }

  /* 底部留出导航与保存条的空间 */
  .layout {
    padding-bottom: 84px;
  }

  body[data-mtab="rank"] .layout {
    padding-bottom: 148px;
  }

  /* 新增选手独占一行，清空周榜/清空月榜并排，保存数据独占一行，避免溢出 */
  .panel-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .panel-tools #addBtn {
    grid-column: 1 / -1;
  }

  .panel-tools #savePlayersBtn {
    grid-column: 1 / -1;
  }
}
