/* ============================================================
   城市飞奔 · 赛事记录
   视觉系统 v2 —— 夜宴黑金（深色默认） / 香槟金（浅色）
   只换视觉，不改功能
   ============================================================ */

/* ---------- 令牌：浅色（香槟金，白天户外） ---------- */
:root {
  color-scheme: light;

  --bg: #f5efe3;
  --surface: #fffcf5;
  --surface-2: #f1e7d3;
  --ink: #211c14;
  --ink-2: #6b6151;
  --ink-3: #9c907b;
  --line: rgba(140, 110, 60, 0.2);

  --gold: #c29a52;
  --gold-text: #7c5c24;
  --gold-deep: #5e4617;
  --gold-tint: rgba(194, 154, 82, 0.14);
  --gold-soft: rgba(194, 154, 82, 0.08);
  --gold-line: rgba(140, 110, 60, 0.34);

  --danger: #b4402e;
  --danger-soft: rgba(180, 64, 46, 0.1);
  --success: #4f6b52;

  --radius-card: 22px;
  --radius-ctl: 14px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 18px 40px -34px rgba(60, 44, 14, 0.55);
  --shadow-float: 0 18px 44px -30px rgba(60, 44, 14, 0.5);

  --font-sans: 'Inter', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --font-display: 'Playfair Display', 'Times New Roman', serif;
  --font-kai: 'Kaiti SC', 'KaiTi', 'STKaiti', 'Songti SC', 'SimSun', serif;
  --font-mono: 'Cascadia Mono', 'SF Mono', Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  --header-h: 58px;
  --tabbar-h: 56px;
  --blur: 10px;
}

/* ---------- 令牌：深色（夜宴黑金，默认观感） ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0a0a;
  --surface: #121110;
  --surface-2: #1b1916;
  --ink: #f2ece0;
  --ink-2: #a79e8e;
  --ink-3: #6f675b;
  --line: rgba(201, 169, 110, 0.16);

  --gold: #c9a96a;
  --gold-text: #e7cf9a;
  --gold-deep: #8c6f3a;
  --gold-tint: rgba(201, 169, 110, 0.14);
  --gold-soft: rgba(201, 169, 110, 0.07);
  --gold-line: rgba(201, 169, 110, 0.28);

  --danger: #c4584a;
  --danger-soft: rgba(196, 88, 74, 0.14);
  --success: #7d9a7e;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 44px -34px rgba(0, 0, 0, 0.95);
  --shadow-float: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
body::before {
  content: '';
  position: fixed;
  inset: -20% 0 auto 0;
  height: 420px;
  pointer-events: none;
  background: radial-gradient(60% 60% at 50% 0%, var(--gold-soft), transparent 70%);
  z-index: 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-text); }
svg { display: block; }
::selection { background: var(--gold-tint); }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.text-muted { color: var(--ink-3); font-size: 12.5px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--gold-line); color: var(--ink);
}
.skip-link:focus { top: 12px; }

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

/* ---------- 外壳 ---------- */
.app-bar {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}
.app-bar-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--gold-text);
  border: 1px solid var(--gold-line);
  background: var(--gold-soft);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { min-width: 0; }
.app-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-subtitle {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--ink-2);
  white-space: nowrap;
}
.ai-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-3);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.ai-badge.ok { color: var(--gold-text); border-color: var(--gold-line); }
.ai-badge.ok .ai-dot { background: var(--gold); }
.ai-badge.warn .ai-dot { background: var(--danger); }

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: transparent;
  color: var(--ink-2);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:active { background: var(--gold-tint); color: var(--gold-text); }
.btn-role {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: transparent;
  color: var(--gold-text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.18s ease;
}
.btn-role:active { background: var(--gold-tint); }

#mainView {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}
.container { min-height: 0; }
body[data-tab="chat"] #mainView { overflow: hidden; }
body[data-tab="dash"] #mainView { overflow-y: auto; padding: 14px var(--gutter) 24px; }
body[data-tab="login"] #mainView { overflow-y: auto; padding: 0; }

/* ---------- 底部导航 ---------- */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px var(--gutter) calc(6px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.tab {
  flex: 1;
  height: 46px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-ctl);
  background: transparent;
  color: var(--ink-3);
}
.tab svg { width: 22px; height: 22px; }
.tab.active {
  color: var(--gold-text);
  border-color: var(--gold-line);
  background: var(--gold-tint);
}

/* ---------- 通用按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 999px; }
.btn-primary {
  border: 1px solid var(--gold-deep);
  background: linear-gradient(180deg, var(--gold-text) 0%, var(--gold) 60%, var(--gold-deep) 100%);
  color: #1a1408;
  font-weight: 600;
}
[data-theme="light"] .btn-primary {
  color: #2a2010;
  border-color: rgba(120, 90, 40, 0.55);
  background: linear-gradient(180deg, #f0d9a8 0%, #c9a96a 55%, #a5843f 100%);
  box-shadow: 0 10px 22px -16px rgba(120, 90, 40, 0.55);
}
.btn-block { width: 100%; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field input,
.form-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.form-field input::placeholder { color: var(--ink-3); }
.form-field input:focus,
.form-field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }

/* ---------- 登录 ---------- */
.gate {
  width: min(460px, calc(100% - 2 * var(--gutter)));
  margin: clamp(20px, 7vh, 72px) auto 32px;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.gate-head { margin-bottom: 6px; }
.gate-title {
  margin: 0 0 5px;
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.gate-hint { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.role-pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 480px) { .role-pills { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.role-pill {
  height: 44px;
  padding: 0 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}
.role-pill.active {
  border-color: var(--gold);
  background: var(--gold-tint);
  color: var(--gold-text);
}

/* ---------- 聊天气泡 ---------- */
.chat-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-list.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px var(--gutter) 10px;
}
.chat-row {
  position: relative;
  width: 100%;
  padding: 10px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  animation: rise-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.chat-row.has-tint {
  background: color-mix(in srgb, var(--tint, var(--gold-tint)) 55%, var(--surface));
  border-color: color-mix(in srgb, var(--tint-main, var(--gold)) 30%, transparent);
}
[data-theme="dark"] .chat-row.has-tint {
  background: color-mix(in srgb, var(--tint-main, var(--gold)) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--tint-main, var(--gold)) 34%, transparent);
}
.chat-row.mine {
  border-color: var(--gold-line);
  background: color-mix(in srgb, var(--gold) 7%, var(--surface));
}
.chat-row.is-pending { opacity: 0.7; }
.chat-row.is-plain .chat-content { color: var(--ink); }
.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.chat-meta-left { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.chat-meta-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-role-badge {
  display: inline-flex; align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--gold-line);
  color: var(--gold-text);
  font-size: 10px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.chat-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-leg-text {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  white-space: nowrap;
}
.chat-meta-right .text-muted { font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.chat-content {
  font-size: 14.5px;
  line-height: 1.66;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.team-tag {
  display: inline;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--tag-main, var(--gold)) 38%, transparent);
  background: color-mix(in srgb, var(--tag-main, var(--gold)) 12%, var(--surface));
  color: var(--tag-ink, var(--gold-text));
  font-weight: 600;
  font-size: 0.94em;
  white-space: nowrap;
}
[data-theme="dark"] .team-tag {
  color: var(--tag-ink-light, var(--gold-text));
  background: color-mix(in srgb, var(--tag-main, var(--gold)) 16%, transparent);
}
.chat-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-img {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: zoom-in;
}
.chat-img img { display: block; width: auto; height: auto; max-width: 172px; max-height: 172px; object-fit: cover; }

/* ---------- 输入区 ---------- */
.chat-input-wrap {
  flex: 0 0 auto;
  padding: 8px var(--gutter) calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.leg-bar { display: flex; align-items: center; gap: 8px; padding: 2px 0 8px; }
.leg-buttons { display: flex; gap: 6px; width: 100%; }
.leg-btn {
  flex: 1 1 0;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.leg-btn.active {
  border-color: color-mix(in srgb, var(--gold-deep) 60%, transparent);
  background: linear-gradient(180deg, #f0d9a8 0%, #c9a96a 100%);
  color: #241a0b;
  font-weight: 600;
}
[data-theme="dark"] .leg-btn.active { color: #1a1408; }
.leg-bar-alert .leg-buttons { animation: leg-flash 0.5s ease 2; }
.leg-bar-label { display: none; }

.attach-tray {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.attach-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gold-tint);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.attach-del {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  padding: 0; line-height: 1;
  border: none; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  display: grid; place-items: center;
}
.chat-input-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  background: var(--surface-2);
}
.chat-input-bar:focus-within { border-color: var(--gold); }
.chat-input-bar input {
  flex: 1; min-width: 0;
  min-height: 38px;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.chat-input-bar input::placeholder { color: var(--ink-3); }
.btn-plus {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
}
.btn-plus:active { background: var(--gold-tint); color: var(--gold-text); }
.btn-plus svg { width: 18px; height: 18px; }
#sendBtn {
  width: 40px; min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--gold-deep) 60%, transparent);
  background: linear-gradient(180deg, #f0d9a8 0%, #c9a96a 100%);
  color: #241a0b;
  box-shadow: 0 8px 18px -12px color-mix(in srgb, var(--gold) 70%, transparent);
}
[data-theme="dark"] #sendBtn { color: #1a1408; }
#sendBtn svg { width: 17px; height: 17px; }

.mention-popup {
  position: absolute;
  left: 0; right: 0; bottom: calc(100% + 6px);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  z-index: 5;
}
.mention-item {
  display: flex; align-items: center; gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
}
.mention-item:active { background: var(--gold-tint); }
.mention-at { color: var(--gold-text); }

.pending-slot { flex: 0 0 auto; padding: 0 var(--gutter) 8px; }
.pending-pill {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--gold-line);
  background: var(--gold-soft);
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
}
.pending-pill:active { background: var(--gold-tint); }
.pending-dot {
  width: 6px; height: 6px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-tint);
  animation: pending-pulse 1.8s ease-in-out infinite;
}
.pending-arrow { margin-left: auto; opacity: 0.6; font-size: 15px; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  background: rgba(4, 4, 4, 0.54);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.modal {
  width: min(400px, 100%);
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  border: 1px solid var(--gold-line);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: modal-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal-head { padding: 18px 18px 10px; }
.modal-title {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.modal-sub { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.modal-body {
  padding: 2px 16px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
@media (max-width: 420px) {
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
}

.pending-card {
  list-style: none;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.pending-main { display: flex; flex-direction: column; gap: 6px; }
.pending-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-line .badge {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--gold-line);
  background: var(--gold-soft);
  color: var(--gold-text);
  font-size: 11px;
  font-weight: 600;
}
.pending-line .badge.type-penalty,
.pending-line .badge.type-quit,
.pending-line .badge.type-elimination {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}
.pending-detail { font-size: 13px; color: var(--ink-2); }
.pending-reason { font-size: 11.5px; color: var(--ink-3); }
.pending-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.picker-modal { max-height: min(70vh, 560px); }
.picker-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 16px 16px; }
.picker-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}
.picker-item:active { background: var(--gold-soft); }
.picker-item.active {
  border-color: var(--gold);
  background: var(--gold-tint);
  color: var(--gold-text);
  font-weight: 600;
}

/* ---------- 图片查看器 ---------- */
.image-viewer { position: fixed; inset: 0; z-index: 95; background: rgba(4, 4, 4, 0.97); }
.image-viewer.hidden { display: none; }
body.viewer-open { overflow: hidden; }
.img-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(64px + var(--safe-top)) 12px calc(52px + var(--safe-bottom));
}
.img-full {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.img-close {
  position: absolute;
  top: calc(12px + var(--safe-top)); right: 12px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  height: 40px; padding: 0 14px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--gold-line);
  background: rgba(10, 10, 10, 0.5);
  color: var(--gold-text);
  font-size: 13px;
}
.img-close svg { width: 15px; height: 15px; }
.img-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: rgba(10, 10, 10, 0.42);
  color: var(--gold-text);
  font-size: 20px;
}
.img-nav.prev { left: 10px; }
.img-nav.next { right: 10px; }
.img-foot {
  position: absolute; left: 0; right: 0;
  bottom: calc(12px + var(--safe-bottom));
  display: flex; justify-content: center; gap: 14px;
  color: rgba(242, 236, 224, 0.62);
  font-size: 12px;
}

/* ---------- 看板 ---------- */
.dash-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 2px 0 6px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent);
}
.dash-tab {
  grid-column: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 36px;
  padding: 0 4px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-tab.active {
  border-color: var(--gold-line);
  background: var(--gold-tint);
  color: var(--gold-text);
  font-weight: 600;
}

#dashBody { min-width: 0; }
.card {
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 15px;
  box-shadow: var(--shadow-card);
}
.dash-row { margin-bottom: 10px; }
.dash-row:last-child { margin-bottom: 0; }
.dash-row strong { font-weight: 600; }

.penalty-total {
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--danger);
}
.penalty-steps { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.penalty-step {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.penalty-step.first { border-top: none; padding-top: 0; }
.penalty-step.total { font-weight: 600; color: var(--ink); }
.step-desc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.step-tag {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--gold-line);
  color: var(--gold-text);
  background: var(--gold-soft);
  flex-shrink: 0;
}
.step-tag.quit { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); background: var(--danger-soft); }
.step-tag.violation { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); background: var(--danger-soft); }
.step-reason { color: var(--ink-2); font-size: 12.5px; }
.step-min { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.penalty-step.plus .step-min::before { content: '+'; margin-right: 2px; color: var(--ink-3); }
.penalty-step.total .step-min { color: var(--danger); font-weight: 600; }

/* ---------- 活点地图 ---------- */
.map-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.switch-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.switch-label input {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 20px; margin: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.switch-label input::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-3);
  transition: transform 0.18s ease, background-color 0.18s ease;
}
.switch-label input:checked { background: color-mix(in srgb, var(--gold) 28%, transparent); border-color: var(--gold-line); }
.switch-label input:checked::after { transform: translateX(14px); background: var(--gold); }
.map-toolbar-line { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.map-wrap { position: relative; }
.map-card {
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* 纵向（手机） */
.mv-canvas { position: relative; width: 100%; }
.mv-line {
  position: absolute; left: 124px; width: 1px;
  background-image: repeating-linear-gradient(180deg, var(--gold-line) 0 4px, transparent 4px 9px);
  opacity: 0.55;
}
.mv-line-done {
  position: absolute; left: 124px; width: 1px;
  background: linear-gradient(180deg, var(--gold-line), var(--gold));
  opacity: 0.85;
}
.mv-station {
  position: absolute; left: 0; width: 124px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  transform: translateY(-50%);
}
.mv-station-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--bg);
  flex: 0 0 auto;
}
.mv-station-dot.on { background: var(--gold); border-color: var(--gold); }
.mv-station-name {
  font-family: var(--font-kai);
  font-size: 12.5px;
  color: var(--ink-3);
  max-width: 100px;
  text-align: right;
  line-height: 1.25;
  white-space: normal;
}
.mv-station.passed .mv-station-name { color: var(--ink-2); }
.mv-team { position: absolute; left: 0; right: 0; height: 0; }
.mv-point {
  position: absolute; left: 124px; top: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--tag-main, var(--gold));
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-main, var(--gold)) 20%, transparent),
    0 0 12px color-mix(in srgb, var(--tag-main, var(--gold)) 55%, transparent);
  animation: point-float var(--float-dur, 3.4s) ease-in-out var(--float-delay, 0s) infinite;
}
.mv-name {
  position: absolute; top: 0; left: 136px;
  transform: translateY(-50%);
  font-family: var(--font-kai);
  font-size: 13px;
  color: var(--tag-ink, var(--gold-text));
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .mv-name { color: var(--tag-ink-light, var(--gold-text)); text-shadow: 0 0 12px rgba(0, 0, 0, 0.5); }
.mv-rank {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-left: 5px;
}
.mv-dash {
  position: absolute; left: 124px; width: 1px;
  background-image: linear-gradient(180deg, var(--tag-main, var(--gold)) 0 4px, transparent 4px 8px);
  background-size: 1px 8px;
  opacity: 0.5;
}
.map-transit {
  font-style: normal;
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 5px;
  margin-left: 4px;
}

/* 横向（桌面） */
.map-scroll { overflow: auto; }
.map-scroll-h { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
.mh-canvas { position: relative; }
.mh-line {
  position: absolute; height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--gold-line) 0 4px, transparent 4px 9px);
  opacity: 0.6;
}
.mh-line-done {
  position: absolute; height: 1px;
  background: linear-gradient(90deg, var(--gold-line), var(--gold));
  opacity: 0.85;
}
.mh-station {
  position: absolute;
  top: 18px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 128px;
}
.mh-station-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--bg);
}
.mh-station-dot.on { background: var(--gold); border-color: var(--gold); }
.mh-station-name {
  font-family: var(--font-kai);
  font-size: 12px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 126px;
}
.mh-row {
  position: absolute; left: 0;
  display: flex; align-items: center;
  height: 1px;
  transform: translateY(-50%);
}
.mh-team-name {
  position: absolute; left: 0; width: 112px;
  text-align: right;
  font-family: var(--font-kai);
  font-size: 13px;
  color: var(--tag-ink, var(--gold-text));
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transform: translateY(-50%);
}
.mh-leader {
  position: absolute; height: 1px;
  background: var(--gold-line);
  opacity: 0.45;
  transform: translateY(-50%);
}
.mh-track {
  position: absolute; height: 1px;
  background: var(--tag-main, var(--gold));
  opacity: 0.32;
  transform: translateY(-50%);
}
.mh-dash {
  position: absolute; height: 1px;
  background-image: linear-gradient(90deg, var(--tag-main, var(--gold)) 0 4px, transparent 4px 9px);
  opacity: 0.55;
  transform: translateY(-50%);
}
.mh-point {
  position: absolute;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--tag-main, var(--gold));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-main, var(--gold)) 20%, transparent),
    0 0 12px color-mix(in srgb, var(--tag-main, var(--gold)) 55%, transparent);
  transform: translate(-50%, -50%);
  animation: point-float var(--float-dur, 3.4s) ease-in-out var(--float-delay, 0s) infinite;
}
.mh-rank {
  position: absolute; right: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}

/* ---------- 相册 ---------- */
.album-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.album-total { font-size: 12.5px; color: var(--ink-2); }
.album-total strong { color: var(--ink); font-family: var(--font-display); font-size: 15px; }
.album-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 1440px) { .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.album-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  text-align: left;
}
.album-card.is-empty { opacity: 0.55; }
.album-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
}
.album-cover-empty { display: grid; place-items: center; width: 100%; height: 100%; font-size: 12px; color: var(--ink-3); }
.album-name {
  padding: 0 11px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.album-count { padding: 0 11px 10px; font-size: 11.5px; color: var(--ink-3); }
.album-hint { margin-top: 12px; font-size: 11.5px; color: var(--ink-3); }
.album-cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.album-back {
  height: 34px; padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
}
.album-cat-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.album-cat-count { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.album-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 640px) { .album-photos { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } }
@media (min-width: 1024px) { .album-photos { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.album-photo {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
}
.album-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Toast / 骨架 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 120;
  max-width: min(88vw, 420px);
  padding: 11px 16px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--gold-line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.toast.hidden { opacity: 0; }

.boot-skeleton { padding: 18px var(--gutter); display: flex; flex-direction: column; gap: 12px; }
.sk { border-radius: 14px; background: linear-gradient(100deg, var(--gold-soft) 20%, var(--gold-tint) 40%, var(--gold-soft) 60%); background-size: 200% 100%; animation: sk-shine 1.4s linear infinite; }
.sk-hero { height: 88px; }
.sk-line { height: 16px; }
.sk-card { height: 72px; }

/* ---------- 桌面双栏 ---------- */
@media (min-width: 1024px) {
  :root { --gutter: 20px; }
  #mainView { display: flex; overflow: hidden; padding: 0; }
  body[data-tab="chat"] #mainView,
  body[data-tab="dash"] #mainView { display: flex; overflow: hidden; padding: 0; }
  body[data-tab="login"] #mainView { display: block; overflow-y: auto; }
  .pane { min-height: 0; }
  .pane-chat { flex: 0 0 440px; width: 440px; border-right: 1px solid var(--line); overflow: hidden; }
  .pane-dash { flex: 1 1 auto; overflow-y: auto; padding: 16px 22px 24px; }
  .tabbar { display: none; }
  .gate { margin-top: clamp(32px, 10vh, 88px); }
  .chat-list.chat-scroll { padding: 16px 18px 10px; }
  .chat-input-wrap { padding: 8px 18px 14px; }
  .pending-slot { padding: 0 18px 8px; }
  .dash-tabs { top: 0; }
  .dash-tab { height: 36px; }
}

/* ---------- 小屏微调 ---------- */
@media (max-width: 380px) {
  :root { --gutter: 12px; }
  .app-bar-inner { gap: 8px; }
  .ai-badge { display: none; }
  .role-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chat-row { border-radius: 14px; }
  .dash-tabs { gap: 4px; }
  .dash-tab { height: 34px; padding: 0 2px; font-size: 12px; }
}

/* ---------- 动效 ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes point-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(-2px); }
  50% { transform: translate(-50%, -50%) translateY(2px); }
}
@keyframes pending-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sk-shine { from { background-position: 120% 0; } to { background-position: -20% 0; } }
@keyframes leg-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 登录：输入匹配列表 ---------- */
.combo-field { position: relative; }
.combo-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 30;
  max-height: 212px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-float);
}
.combo-item {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
}
.combo-item:active { background: var(--gold-tint); }

/* ---------- 看板：手动修改 ---------- */
.dash-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.rec-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.rec-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.rec-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-item-main strong { font-size: 13px; }
.rec-item-main .text-muted { font-size: 12px; }
.rec-del {
  width: 28px; height: 28px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
}
.rec-form {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.rec-field { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.rec-field > select, .rec-field > input {
  flex: 1; min-width: 0;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.rec-field > select:focus, .rec-field > input:focus { border-color: var(--gold); outline: none; }
.rec-fixed { font-size: 12.5px; color: var(--ink-2); }

/* ---------- 相册：删除/上传 ---------- */
.album-photo-wrap { position: relative; }
.album-del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  background: rgba(10, 8, 6, 0.72);
  color: #f0c8bf;
  font-size: 14px;
  line-height: 1;
}

/* ---------- 队伍卡片可点击修改 ---------- */
.dash-row.is-editable { cursor: pointer; position: relative; padding-right: 30px; }
.dash-row.is-editable::after {
  content: '›';
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  opacity: 0.7;
}
.dash-row.is-editable:active { border-color: var(--gold-line); background: var(--gold-soft); }

/* ---------- 相册：底部大上传按钮 ---------- */
.album-upload-bar {
  position: sticky;
  bottom: calc(8px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  margin: 16px 0 2px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--gold-deep);
  background: linear-gradient(180deg, var(--gold-text), var(--gold) 62%, var(--gold-deep));
  color: #1a1408;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
}
.album-upload-bar svg { width: 18px; height: 18px; }
[data-theme="light"] .album-upload-bar { color: #2a2010; }

/* ---------- 队伍色点 / 顶栏紧凑 ---------- */
[data-theme="dark"] .mh-team-name { color: var(--tag-ink-light, var(--gold-text)); }
.team-mark {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tag-main, var(--gold));
  margin-right: 7px;
  vertical-align: 1px;
}
#btnContext { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.btn-role svg { width: 16px; height: 16px; }
.btn-role.btn-icon { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 560px) {
  .ai-badge { width: 26px; padding: 0; justify-content: center; border-color: var(--gold-line); }
  .ai-badge #aiBadgeText { display: none; }
  .app-bar-inner { gap: 8px; }
  .app-title { font-size: 15px; }
  .app-bar-right { gap: 6px; }
  #btnContext { max-width: 88px; }
}
/* ---------- 系统提示：新消息顶部推送 ---------- */
.system-push {
  position: fixed;
  top: calc(var(--safe-top) + var(--header-h) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(92vw, 520px);
  padding: 10px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.system-push.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  cursor: pointer;
}
.system-push.hidden { display: none; }
.sp-kicker {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--gold);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  padding: 2px 7px;
}
.sp-who { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sp-text {
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 手机竖版泳道 ---------- */
.map-v2 { display: flex; align-items: stretch; }
.mv2-stations { position: relative; flex: 0 0 auto; }
.mv2-sline {
  position: absolute; right: 3px; width: 1px;
  background-image: repeating-linear-gradient(180deg, var(--gold-line) 0 4px, transparent 4px 9px);
  opacity: 0.55;
}
.mv2-station {
  position: absolute; right: 0;
  display: flex; align-items: center; gap: 7px;
  transform: translateY(-50%);
}
.mv2-station-name {
  font-family: var(--font-kai);
  font-size: 11px;
  line-height: 1.2;
  text-align: right;
  color: var(--ink-3);
  max-width: 72px;
  white-space: normal;
  overflow: hidden;
}
.mv2-station.passed .mv2-station-name { color: var(--ink-2); }
.mv2-station-dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--bg);
  flex: 0 0 auto;
}
.mv2-station-dot.on { background: var(--gold); border-color: var(--gold); }
.mv2-canvas { position: relative; }
.mv2-lane { position: absolute; top: 0; bottom: 0; }
.mv2-lane-head {
  position: absolute; top: 0; left: 0; right: 0; height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px; padding-bottom: 6px;
}
.mv2-rank { font-family: var(--font-mono); font-size: 9.5px; font-style: normal; color: var(--ink-3); }
.mv2-lane-head b {
  font-family: var(--font-kai);
  font-size: 11px;
  font-weight: 500;
  color: var(--tag-ink, var(--gold-text));
  max-width: 68px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[data-theme="dark"] .mv2-lane-head b { color: var(--tag-ink-light, var(--gold-text)); }
.mv2-lane-line {
  position: absolute; left: 50%; width: 1px;
  background-image: repeating-linear-gradient(180deg, var(--gold-line) 0 4px, transparent 4px 9px);
  opacity: 0.45;
}
.mv2-lane-done {
  position: absolute; left: 50%; width: 1px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tag-main, var(--gold)) 35%, transparent), var(--tag-main, var(--gold)));
  opacity: 0.75;
}
.mv2-dash { position: absolute; left: 50%; width: 1px; opacity: 0.6; }
.mv2-point {
  position: absolute; left: 50%;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--tag-main, var(--gold));
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-main, var(--gold)) 20%, transparent),
    0 0 12px color-mix(in srgb, var(--tag-main, var(--gold)) 55%, transparent);
  animation: point-float var(--float-dur, 3.4s) ease-in-out var(--float-delay, 0s) infinite;
}
.mv2-transit {
  position: absolute; left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ink-3);
  white-space: nowrap;
}
/* ---------- 罚时编辑：条目与合计 ---------- */
.rec-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.rec-total strong {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

/* ---------- AI 判定依据：浮动视图 ---------- */
.basis-btn, .rec-basis, .step-basis {
  flex: 0 0 auto;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: 11.5px;
  line-height: 1;
  padding: 6px 10px;
}
.rec-basis { margin-right: 8px; }
.step-basis { margin-left: 8px; padding: 4px 8px; }
.basis-btn:active, .rec-basis:active, .step-basis:active { background: var(--gold-tint); }

.basis-modal { max-height: 84vh; display: flex; flex-direction: column; }
.basis-modal .modal-body { overflow-y: auto; }
.basis-section-title {
  margin: 14px 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.basis-section-title:first-child { margin-top: 0; }
.basis-msg {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.basis-msg.is-target { border-color: var(--gold); background: var(--gold-tint); }
.basis-msg-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
}
.basis-msg-meta .chat-name { font-weight: 600; color: var(--ink); }
.basis-msg-text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.basis-context {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 30vh;
  overflow-y: auto;
}
.basis-reason {
  padding: 9px 11px;
  border: 1px dashed var(--gold-line);
  border-radius: 12px;
  background: var(--gold-soft);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ---------- 时间表（一级页面） ---------- */
body[data-tab="time"] #mainView { overflow-y: auto; padding: 14px var(--gutter) 24px; }
@media (min-width: 1024px) {
  body[data-tab="time"] #mainView { display: flex; overflow: hidden; padding: 0; }
}

.right-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.right-switch-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
}
.right-switch-btn.active { border-color: var(--gold); color: var(--gold); background: var(--gold-tint); }

.time-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.time-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 12px; }
.time-table th, .time-table td {
  padding: 7px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: top;
  white-space: nowrap;
}
.time-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 11.5px;
}
.time-table thead tr:nth-child(2) th { top: 31px; }
.time-table .time-leg { color: var(--gold); border-bottom: 1px solid var(--gold-line); }
.time-table .time-sticky {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 74px;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  color: var(--ink);
}
.time-table thead .time-sticky { z-index: 4; }
.time-table tbody tr:last-child th, .time-table tbody tr:last-child td { border-bottom: none; }
.time-table th:last-child, .time-table td:last-child { border-right: none; }
.time-table th.is-relay { color: var(--gold); }
.time-cell { min-width: 86px; }
.time-cell .tc-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.time-cell .tc-line em { font-style: normal; color: var(--ink-3, var(--ink-2)); font-size: 10.5px; }
.time-cell .tc-line b { font-weight: 500; color: var(--ink); font-size: 12px; }
.time-cell.is-relay { background: var(--gold-soft); }

.step-leg {
  margin-left: 6px;
  font-size: 10.5px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
}
.empty-step { opacity: 0.75; }
.danger-outline { border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); background: transparent; }

/* ---------- 手机活点地图：不横向滚动 + 队伍名竖排 ---------- */
.map-v2 .map-scroll-h { overflow: hidden; }
.mv2-lane-head b {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 1px;
  max-height: 56px;
  overflow: hidden;
}

/* ---------- 对话：动态加载更早记录 ---------- */
.chat-more-hint {
  padding: 8px 0 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-2);
}
.chat-more-hint:active { color: var(--gold); }

/* 修复：手机竖版泳道容器宽度塌陷导致队伍不可见 */
.map-v2 .map-scroll {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}
.map-v2 .mv2-canvas { width: 100%; }

/* ---------- 罚时编辑整页 ---------- */
.penalty-page { padding: 14px var(--gutter) 28px; max-width: 760px; margin: 0 auto; }
.penalty-page .page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: 13px;
}
.back-btn:active { background: var(--gold-tint); }
.page-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.penalty-page-body { display: flex; flex-direction: column; gap: 10px; }
.penalty-page-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.danger-solid { background: var(--danger); border: 1px solid var(--danger); color: #fff; }

/* ---------- 重置确认：输入强校验 ---------- */
.reset-confirm-field {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.reset-confirm-field > input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.reset-confirm-field > input:focus { border-color: var(--gold); outline: none; }
.btn[disabled], .btn:disabled { opacity: 0.45; pointer-events: none; }

/* ---------- 对话输入栏：+ / 相机 / 发送 按钮保持正圆，禁止被 flex 或 min-height 拉扁 ---------- */
.chat-input-bar .btn-plus {
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  line-height: 0;
}
#sendBtn {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  line-height: 0;
}
.chat-input-bar .btn-plus svg,
#sendBtn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
}
