@font-face {
  font-family: "Kassen Serif";
  src: url("fonts/noto-serif-sc-display.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: "Kassen Display";
  src: url("fonts/dela-gothic-title.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kassen Han";
  src: url("fonts/mashan-title.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kassen Sans";
  src: url("fonts/noto-sans-sc-ui.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Barlow SC";
  src: url("fonts/barlow-semi-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow SC";
  src: url("fonts/barlow-semi-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #fdf5f0;
  --paper: #fffbf7;
  --paper-2: #fff4ec;
  --ink: #2b1f38;
  --muted: #5d4d6b;
  --pink: #ff6e98;
  --pink-soft: #ffe5ee;
  --pink-deep: #d94875;
  --mint: #3fb8a6;
  --mint-soft: #dff7f2;
  --mint-deep: #1d8a7a;
  --gold: #e6a832;
  --gold-soft: #fff4d9;
  --line: rgba(226, 198, 212, 0.72);
  --shadow: 0 10px 26px rgba(176, 122, 142, 0.12);
  --serif: "Kassen Serif", "Noto Serif SC", "Songti SC", serif;
  --display: "Kassen Display", "Kassen Han", "Barlow SC", var(--sans);
  --sans: "Kassen Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --numeric: "Barlow SC", "Kassen Sans", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}
button, input, select, textarea { font-family: inherit; }

.bg-aura {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 190, 214, 0.3), transparent 40%),
    radial-gradient(circle at 86% 14%, rgba(162, 236, 224, 0.25), transparent 38%),
    radial-gradient(circle at 50% 82%, rgba(255, 224, 158, 0.22), transparent 46%);
  pointer-events: none;
  z-index: 0;
}
.bg-dots {
  position: fixed;
  inset: 0;
  background: radial-gradient(rgba(232, 148, 178, 0.2) 1.6px, transparent 2px) 0 0 / 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* 登录门禁 */
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 440px;
  margin: auto;
  min-width: 0;
  border-radius: 26px;
  background: var(--paper);
  border: 2px solid #fff;
  box-shadow: 0 6px 0 rgba(235, 212, 222, 0.9), 0 24px 50px rgba(176, 122, 142, 0.22);
  padding: 30px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gate-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.gate-head > div { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; flex: 1; }
.gate-mascot { width: 82px; flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(150, 90, 120, 0.2)); }
.gate-logo { max-width: 100%; height: 28px; width: auto; object-fit: contain; align-self: flex-start; display: block; }
.brand-en {
  display: inline-block;
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.05em;
  transform: skewX(-6deg);
  background: linear-gradient(112deg, #e82c6a 0%, #ff5c8d 52%, #f59428 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sep {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--pink);
  line-height: 1;
  opacity: 0.85;
}
.brand-cn {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.08em;
  line-height: 1.15;
}
.gate-title { margin: 0; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 7px; max-width: 100%; }
.gate-title .brand-en { font-size: 22px; line-height: 1.1; }
.gate-title .brand-cn { font-size: 20px; }
.gate-field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; letter-spacing: 0.03em; color: var(--muted); min-width: 0; }
.gate-field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: rgba(250, 242, 245, 0.75);
  padding: 0 14px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  outline: 0;
}
.gate-field input::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }
.gate-field input:focus { border-color: var(--pink); background: #fff; }
.gate-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.gate-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--pink);
  cursor: pointer;
  flex-shrink: 0;
}
.gate-submit { width: 100%; height: 46px; font-size: 15px; font-weight: 700; letter-spacing: 0.06em; justify-content: center; }
.gate-err { margin: 0; color: #d6365e; font-size: 13px; font-weight: 600; }
.gate-back { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-decoration: none; }
.gate-back:hover { color: var(--pink-deep); }

/* 通用按钮与控件 */
.site-shell { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }
.site-shell[hidden] { display: none; }

.tb-btn, .btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(226, 198, 212, 0.7);
  transition: transform 0.16s cubic-bezier(0.22, 1.4, 0.36, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.tb-btn:hover:not(:disabled), .btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--pink);
  box-shadow: 0 5px 14px rgba(255, 110, 152, 0.2);
}
.tb-btn:active:not(:disabled), .btn:active:not(:disabled) {
  transform: translateY(1px);
}
.tb-btn:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tb-btn.sm { height: 30px; padding: 0 11px; font-size: 12px; }
.tb-btn.wide { width: 100%; }
.tb-btn.pri, .btn.pri {
  background: linear-gradient(135deg, #ff6392, #ff8ab0);
  color: #fff;
  border: 0;
  font-weight: 700;
  box-shadow: 0 3px 0 #d44672;
}
.tb-btn.is-on {
  background: var(--mint-soft);
  border-color: var(--mint);
  color: var(--mint-deep);
}
.tb-btn.is-muted {
  background: var(--pink-soft);
  border-color: var(--pink);
  color: var(--pink-deep);
}
.tb-btn.toggle-pill {
  padding: 0 13px 0 10px;
}
.tb-btn.toggle-pill .pill-track {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: rgba(140, 118, 150, 0.28);
  flex-shrink: 0;
  transition: background-color 0.22s ease;
}
.tb-btn.toggle-pill .pill-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(43, 31, 56, 0.24);
  transition: transform 0.24s cubic-bezier(0.22, 1.32, 0.36, 1);
}
.tb-btn.toggle-pill.is-on .pill-track {
  background: var(--mint);
}
.tb-btn.toggle-pill.is-on .pill-track::after {
  transform: translateX(12px);
}
.tb-btn.toggle-pill.is-muted .pill-track {
  background: rgba(217, 72, 117, 0.45);
}
.tb-btn.danger { color: #d1385b; border-color: #f4b7c7; background: #fff5f8; }
.kbd {
  font: 600 11px/1 var(--mono);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(140, 118, 150, 0.14);
  border: 1px solid rgba(140, 118, 150, 0.24);
  border-bottom-width: 2px;
  color: var(--ink);
}

/* 顶部导航栏 */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(255, 251, 247, 0.92);
  border-bottom: 1.5px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .logo { height: 34px; }
.brand-title { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; }
.brand-title .brand-en { font-size: 18px; line-height: 1.08; }
.brand-title .brand-cn { font-size: 16px; }
.top-tabs {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(235, 218, 226, 0.5);
  padding: 4px;
  border-radius: 13px;
}
.tabs-indicator {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 2px 8px rgba(180, 120, 145, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1.18, 0.36, 1), width 0.28s cubic-bezier(0.22, 1.18, 0.36, 1), opacity 0.18s ease;
}
.tabs-indicator.no-anim {
  transition: none !important;
}
.top-tabs .tab-btn,
.top-tabs a {
  position: relative;
  z-index: 1;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.14s ease;
}
.top-tabs .tab-btn:not(.on):hover,
.top-tabs a:not(.on):hover {
  background: rgba(255, 251, 247, 0.58);
  color: var(--ink);
}
.top-tabs .tab-btn.on,
.top-tabs a.on {
  color: var(--pink-deep);
  font-weight: 700;
}
.top-tabs .tab-btn:active,
.top-tabs a:active {
  transform: scale(0.96);
}
.top-tabs .tab-btn:focus-visible,
.top-tabs a:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}
.saved-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mint-deep);
  background: var(--mint-soft);
  padding: 6px 13px;
  border-radius: 999px;
}
.saved-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
}
.saved-badge[data-s="busy"] { background: var(--gold-soft); color: #9c6a08; }
.saved-badge[data-s="busy"] i { background: var(--gold); }
.saved-badge[data-s="err"] { background: var(--pink-soft); color: #c73258; }
.saved-badge[data-s="err"] i { background: #e63963; }
.top-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* 主内容容器与视图切换 */
.admin-main {
  width: min(1860px, 100%);
  margin: 0 auto;
  padding: 18px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-view[hidden] { display: none !important; }
.admin-view.is-active {
  animation: adminViewEnter 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes adminViewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 2px 2px 4px;
}
.view-sub {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.panel {
  min-width: 0;
  max-width: 100%;
  background: var(--paper);
  border: 2px solid #fff;
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: 0 4px 0 rgba(235, 212, 222, 0.85), var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.panel-head strong {
  font: 700 15px/1 var(--numeric);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.mini-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--pink-deep);
  text-decoration: none;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.mini-link:hover { transform: translateX(2px); text-decoration: underline; }

/* 裁判台 3 栏（流式自适应，窄笔记本不裁切） */
.ref-layout {
  display: grid;
  grid-template-columns: clamp(248px, 18.5vw, 310px) minmax(0, 1fr) clamp(310px, 23.5vw, 390px);
  gap: clamp(14px, 1.4vw, 20px);
  align-items: start;
}

.ref-queue { display: flex; flex-direction: column; gap: 6px; }
.qsec {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 6px 4px 1px;
}
.qi {
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px 8px 13px;
  border-radius: 14px;
  background: rgba(246, 236, 241, 0.55);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.qi::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 3.5px;
  height: 0;
  border-radius: 999px;
  background: var(--pink);
  opacity: 0;
  transform: translateY(-50%);
  transition: height 0.22s cubic-bezier(0.22, 1.25, 0.36, 1), opacity 0.18s ease;
}
.qi:hover {
  border-color: rgba(255, 110, 152, 0.55);
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(255, 110, 152, 0.14);
}
.qi:active {
  transform: translateX(1px) scale(0.99);
}
.qi.selected {
  background: linear-gradient(135deg, #fff1f5, #fffaf6);
  border-color: var(--pink);
  box-shadow: 0 4px 14px rgba(255, 110, 152, 0.18);
}
.qi.selected::before {
  height: 60%;
  opacity: 1;
}
.qi .id { font-size: 11.5px; font-weight: 600; line-height: 1.3; color: var(--muted); }
.qi .ps { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; line-height: 1.35; min-width: 0; }
.qi .ps span { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qi .ps img,
.qi .ps .mini-av {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(135deg, #ff8eb5, #7fd8cd);
}
.qi .ps .w { color: var(--pink-deep); font-weight: 700; }
.qi .ps .l { color: var(--muted); opacity: 0.55; text-decoration: line-through; }
.qi .st {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(140, 118, 150, 0.12);
  color: var(--muted);
  white-space: nowrap;
}
.qi.done .st { background: var(--mint-soft); color: var(--mint-deep); }
.qi.live .st { background: var(--pink); color: #fff; }
.qi.next .st { background: var(--gold-soft); color: #a6710c; }

/* 中栏裁判卡片 */
.ref-center { display: flex; flex-direction: column; gap: 16px; }
.ref-ctrl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.ref-ctrl-head h1 { margin: 0; font: 700 24px/1.2 var(--sans); letter-spacing: 0.03em; color: var(--ink); }
.ref-sub { margin: 4px 0 0; font-size: 13px; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); }
/* 通用分段滑块控件（裁判状态 / 入口阶段） */
.seg-control {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  background: rgba(235, 218, 226, 0.52);
  padding: 4px;
  border-radius: 13px;
}
.seg-thumb {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 2px 8px rgba(160, 100, 130, 0.18);
  pointer-events: none;
  opacity: 0;
  transition:
    transform 0.26s cubic-bezier(0.22, 1.18, 0.36, 1),
    width 0.26s cubic-bezier(0.22, 1.18, 0.36, 1),
    background 0.22s ease,
    box-shadow 0.22s ease,
    opacity 0.18s ease;
}
.seg-thumb.no-anim {
  transition: none !important;
}
.seg-control button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 0.2s ease, background-color 0.18s ease, transform 0.14s ease;
}
.seg-control button:not(.is-on):hover {
  background: rgba(255, 251, 247, 0.52);
  color: var(--ink);
}
.seg-control button:active {
  transform: scale(0.96);
}
.seg-control button.is-on {
  color: var(--ink);
  font-weight: 700;
}
.seg-control button:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.state-toggle {
  margin-left: auto;
}
.state-toggle .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.state-toggle[data-state="live"] .seg-thumb {
  background: linear-gradient(135deg, #ff6392, #ff8ab0);
  box-shadow: 0 3px 12px rgba(255, 99, 146, 0.34);
}
.state-toggle button[data-state="live"].is-on {
  color: #fff;
}
.state-toggle button[data-state="live"].is-on .live-dot {
  opacity: 1;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.32); opacity: 0.65; }
}

.ref-duel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: stretch;
}
.ref-side {
  border-radius: 24px;
  padding: clamp(14px, 1.4vw, 20px);
  background: var(--paper);
  border: 2px solid #fff;
  box-shadow: 0 5px 0 rgba(235, 212, 222, 0.9), var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ref-side:hover {
  transform: translateY(-2px);
}
.ref-side.a { background: linear-gradient(170deg, #fff8fa, #fffdf9 65%); border-color: #ffd6e3; }
.ref-side.b { background: linear-gradient(190deg, #f3fcf9, #fffdf9 65%); border-color: #bdeee4; }
.ref-side.is-win { box-shadow: 0 0 0 3px var(--pink), var(--shadow); }
.ref-side.b.is-win { box-shadow: 0 0 0 3px var(--mint), var(--shadow); }

.ph { display: flex; align-items: center; gap: 14px; }
.ph-av {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 4px 14px rgba(150, 90, 120, 0.18);
  overflow: hidden;
  display: grid;
  place-items: center;
  font: 700 24px/1 var(--sans);
  color: #fff;
  background: linear-gradient(135deg, var(--g1, #ff8eb5), var(--g2, #7fd8cd));
  flex-shrink: 0;
  cursor: pointer;
}
.ref-side.a .ph-av { border-color: #ffb8ce; }
.ref-side.b .ph-av { border-color: #9ae8da; }
.ph-av img { width: 100%; height: 100%; object-fit: cover; }
.ph-info { min-width: 0; flex: 1; }
.ph-info b { display: block; font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-badges { margin-top: 7px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-btn {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(63, 184, 166, 0.35);
  background: var(--mint-soft);
  color: var(--mint-deep);
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.role-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(63, 184, 166, 0.2);
}
.role-btn:active {
  transform: scale(0.94);
}
.role-btn.is-old { background: var(--gold-soft); color: #9c6a08; border-color: #f0d080; }
.role-btn.is-old:hover { box-shadow: 0 3px 8px rgba(230, 168, 50, 0.22); }
.sec-lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); margin-bottom: 7px; }
.weap-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.weap-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.22, 1.35, 0.36, 1), border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.weap-chip:hover {
  transform: translateY(-2px);
  border-color: var(--pink);
  background: var(--pink-soft);
  box-shadow: 0 3px 8px rgba(255, 110, 152, 0.16);
}
.weap-chip:active {
  transform: translateY(0) scale(0.95);
}
.weap-chip .weapon-icon { width: 14px; height: 14px; }
.weap-chip.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(43, 31, 56, 0.26);
}
.weap-chip.on:hover {
  background: #3d2c4f;
  border-color: #3d2c4f;
}

.win-cta {
  margin-top: auto;
  height: 76px;
  border: 0;
  border-radius: 18px;
  font: 700 17.5px/1 var(--sans);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.18s cubic-bezier(0.22, 1.4, 0.36, 1), box-shadow 0.18s ease, opacity 0.2s ease;
}
.win-cta:hover:not(:disabled) { transform: translateY(-3px) scale(1.015); }
.win-cta:active:not(:disabled) { transform: translateY(1px); }
.win-cta:disabled { opacity: 0.4; cursor: not-allowed; }
.ref-side.a .win-cta {
  background: linear-gradient(135deg, #ff6291, #ff8db1);
  box-shadow: 0 5px 0 #d64572, 0 12px 24px rgba(255, 98, 145, 0.28);
}
.ref-side.b .win-cta {
  background: linear-gradient(135deg, #32b8a4, #68dccb);
  box-shadow: 0 5px 0 #218f7e, 0 12px 24px rgba(50, 184, 164, 0.26);
}
.win-cta .kbd {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.vsmid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.vs-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid #f0bfd0;
  display: grid;
  place-items: center;
  font: 700 17px/1 var(--numeric);
  letter-spacing: 0.04em;
  color: var(--pink-deep);
  box-shadow: var(--shadow);
}
.swap-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.22, 1.4, 0.36, 1), border-color 0.2s ease, color 0.2s ease;
}
.swap-btn:hover:not(:disabled) {
  transform: rotate(180deg) scale(1.08);
  border-color: var(--pink);
  color: var(--pink-deep);
}
.swap-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.vsmid small { font-size: 11.5px; font-weight: 600; color: var(--muted); }

.ref-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.note-panel textarea {
  width: 100%;
  height: 74px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: rgba(250, 242, 245, 0.7);
  padding: 10px 12px;
  font: 500 13px/1.6 var(--sans);
  color: var(--ink);
  resize: none;
}
.note-panel textarea::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }
.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; font-size: 12.5px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.keys-grid div { display: flex; align-items: center; gap: 6px; }

.undo-toast-slot { min-height: 58px; display: flex; align-items: center; justify-content: center; }
.undo-toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  border-radius: 16px;
  background: #3a2e45;
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 14px 30px rgba(58, 46, 69, 0.28);
}
.undo-toast[hidden] { display: none; }
.undo-toast img { width: 32px; height: 32px; }
.undo-toast button {
  border: 0;
  padding: 6px 13px;
  border-radius: 9px;
  background: #ff7ea6;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* 右栏：实时小窗 + 拖拽排种子 + 小助手 */
.ref-right { display: flex; flex-direction: column; gap: 16px; }
.live-preview-box {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 15px;
  border: 1.5px solid var(--line);
  overflow: hidden;
  background: var(--bg);
}
.live-preview-box iframe {
  position: absolute;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
}
.live-preview-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
}

.quick-roster { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.qr-item {
  display: grid;
  grid-template-columns: 12px 32px 1fr;
  gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(246, 236, 241, 0.55);
  border: 1.5px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.qr-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 110, 152, 0.45);
  background: rgba(255, 240, 245, 0.9);
}
.qr-item.dragging { opacity: 0.5; border-color: var(--pink); }
.qr-item.over { border-color: var(--mint); background: var(--mint-soft); }
.qr-grip { color: #bfa8b8; letter-spacing: -2px; }
.qr-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--g1, #ff8eb5), var(--g2, #7fd8cd));
}
.qr-av img { width: 100%; height: 100%; object-fit: cover; }
.qr-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-text small { display: block; font-size: 11px; font-weight: 500; margin-top: 1px; color: var(--muted); }

.assist-card {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 12px;
  align-items: center;
  background: linear-gradient(145deg, #fff9fc, #fff4ec);
}
.assist-card img { width: 94px; filter: drop-shadow(0 6px 10px rgba(150, 90, 120, 0.2)); }
.assist-copy strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; color: var(--pink-deep); margin-bottom: 4px; }
.assist-copy p { margin: 0; font-size: 12.5px; line-height: 1.65; font-weight: 500; color: var(--muted); }

/* 全量可内联编辑的对阵总览（#rounds 保留 8 卡 16 席位，兼容 test-ui.mjs） */
.overview-section { display: flex; flex-direction: column; gap: 14px; }
.overview-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.overview-head h2 { margin: 0; font: 700 18px/1.3 var(--sans); letter-spacing: 0.02em; color: var(--ink); }
.overview-sub { margin: 4px 0 0; font-size: 12.5px; font-weight: 500; letter-spacing: 0.04em; color: var(--muted); }
.overview-meta { display: flex; gap: 8px; align-items: center; }
.chip-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip-pill.muted { background: rgba(140, 118, 150, 0.12); color: var(--muted); }

.bracket-wrap { position: relative; overflow-x: auto; padding-bottom: 6px; }
.links { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.link-done { fill: none; stroke: #f2a8be; stroke-width: 2.2; }
.link-hot { fill: none; stroke: var(--pink); stroke-width: 2.8; stroke-dasharray: 5 5; }
.link-idle { fill: none; stroke: #dfd0db; stroke-width: 1.8; }
.node-done { fill: var(--pink); }
.node-hot { fill: var(--pink); }
.node-idle { fill: #cbb8c6; }

.rounds {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(310px, 1fr));
  grid-auto-rows: auto;
  gap: 12px 32px;
}
.round-head {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.round-head .line { flex: 1; height: 1px; background: var(--line); }

.match {
  background: rgba(255, 248, 244, 0.9);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.match:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 110, 152, 0.55);
  box-shadow: 0 8px 20px rgba(176, 122, 142, 0.14);
}
.match[data-state="live"] { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 110, 152, 0.14); }
.match-head { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.mname { padding: 1px 8px; border-radius: 999px; background: rgba(155, 123, 255, 0.12); color: #7c5ca8; }
.mid { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-chip[data-s="live"] { color: var(--pink-deep); }
.state-chip[data-s="done"] { color: var(--mint-deep); }

.slots { display: flex; flex-direction: column; gap: 5px; }
.slot {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 11px;
  background: rgba(246, 236, 241, 0.55);
}
.slot.is-win { background: var(--pink-soft); }
.slot.is-lose { opacity: 0.5; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--g1, #ff8eb5), var(--g2, #7fd8cd));
}
.avatar-pick { cursor: pointer; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.ghost { background: rgba(226, 212, 222, 0.6); color: var(--muted); border: 1.5px dashed #c8b4c4; }

.who { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.line1 { display: flex; align-items: center; gap: 5px; }
.name-in {
  min-width: 0;
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 6px;
}
.name-in:focus { outline: 0; border-color: var(--pink); background: #fff; }
.badge {
  border: 0;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.badge-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(150, 90, 120, 0.18); }
.badge-btn:active { transform: scale(0.92); }
.badge.is-new { background: var(--mint-soft); color: var(--mint-deep); }
.badge.is-old { background: var(--gold-soft); color: #9c6a08; }

.weapon-in {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 5px;
}
.score-box { display: flex; align-items: center; gap: 4px; }
.score-in { display: none; }
.win-btn {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.22, 1.35, 0.36, 1), border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.win-btn:hover {
  transform: translateY(-1px);
  border-color: var(--pink);
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.win-btn:active { transform: scale(0.93); }
.win-btn.on {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 110, 152, 0.3);
}
.win-btn.on:hover {
  background: var(--pink-deep);
  border-color: var(--pink-deep);
  color: #fff;
}

.match-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.state-in, .note-in {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 6px;
}
.note-in { flex: 1; min-width: 0; }
.note-in::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }
.link-btn { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.link-btn:hover { color: var(--pink-deep); }

.overview-foot { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.podium { display: flex; flex-direction: column; gap: 6px; }
.podium-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 11px;
  background: rgba(246, 236, 241, 0.55);
  font-size: 12px;
  font-weight: 600;
}
.podium-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: #9c6a08;
}
.podium-main { flex: 1; display: flex; gap: 8px; align-items: center; }
.podium-label { color: var(--muted); }
.mini-roster .roster-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-roster .roster-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(246, 236, 241, 0.55);
  font-size: 12px;
  font-weight: 600;
}
.mini-roster .roster-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--g1, #ff8eb5), var(--g2, #7fd8cd));
}
.mini-roster .roster-av img { width: 100%; height: 100%; object-fit: cover; }

/* 角色应援与台词管理 */
.speech-section { display: flex; flex-direction: column; gap: 18px; }
.speech-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.speech-subtabs button { padding: 7px 13px; font-size: 12.5px; }
.speech-pane { display: flex; flex-direction: column; gap: 18px; }
.speech-pane[hidden] { display: none !important; }
.speech-pane.is-active { animation: adminViewEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }

.speech-theater-card,
.speech-cheers-card { display: flex; flex-direction: column; gap: 14px; }
.speech-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.speech-card-head .speech-meta { flex: 1; min-width: 140px; }
.speech-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.speech-pos { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.speech-av {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(246, 236, 241, 0.7);
  padding: 3px;
  border: 1.5px solid #fff;
  box-shadow: 0 3px 10px rgba(176, 122, 142, 0.16);
  flex-shrink: 0;
}
.speech-count {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(140, 118, 150, 0.12);
  color: var(--muted);
  white-space: nowrap;
}

.speech-tpl-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 244, 236, 0.85);
  border: 1.5px dashed rgba(255, 110, 152, 0.35);
}
.tpl-tip { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.tpl-tip code {
  font: 700 12px/1 var(--mono);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.tpl-btns { display: flex; flex-wrap: wrap; gap: 6px; }

.speech-live-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 236, 243, 0.7), rgba(223, 247, 242, 0.55));
  border: 1.5px solid rgba(255, 110, 152, 0.25);
}
.preview-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  flex-shrink: 0;
}
.preview-text { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.55; }
.preview-text b { color: var(--pink-deep); font-weight: 800; padding: 0 2px; }

.speech-theater-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.speech-col { display: flex; flex-direction: column; gap: 7px; }
.speech-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.speech-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.speech-card { display: flex; flex-direction: column; gap: 11px; }
.speech-textarea {
  width: 100%;
  min-height: 96px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: rgba(250, 242, 245, 0.68);
  padding: 10px 12px;
  font: 500 13px/1.65 var(--sans);
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}
.speech-textarea:focus {
  outline: 0;
  border-color: var(--pink);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 110, 152, 0.14);
}
.speech-textarea::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }

.speech-cheer-list { display: flex; flex-direction: column; gap: 9px; }
.speech-cheer-row {
  display: grid;
  grid-template-columns: 36px 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 14px;
  background: rgba(246, 236, 241, 0.55);
  border: 1.5px solid transparent;
}
.speech-cheer-row img { width: 34px; height: 34px; object-fit: contain; }
.speech-cheer-row strong { font-size: 13px; font-weight: 700; color: var(--ink); }
.speech-cheer-row input {
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
}
.speech-cheer-row input:focus {
  outline: 0;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 110, 152, 0.14);
}

/* 设置与舞台画面 */
.section-heading {
  grid-column: 1 / -1;
  margin: 0;
  font: 700 19px/1.25 var(--sans);
  letter-spacing: 0.03em;
  color: var(--ink);
}
.control-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field input {
  height: 38px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: rgba(250, 242, 245, 0.65);
  padding: 0 11px;
  color: var(--ink);
  font-weight: 500;
}
.field input::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }
.stage-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
.stage-switch button {
  padding: 7px 6px;
  font-size: 12px;
}
.stage-switch[data-stage="live"] .seg-thumb {
  background: linear-gradient(135deg, #ff6392, #ff8ab0);
  box-shadow: 0 3px 10px rgba(255, 99, 146, 0.3);
}
.stage-switch[data-stage="done"] .seg-thumb {
  background: linear-gradient(135deg, #2fb5a1, #5ad4c1);
  box-shadow: 0 3px 10px rgba(63, 184, 166, 0.28);
}
.stage-switch[data-stage="live"] button.is-on,
.stage-switch[data-stage="done"] button.is-on {
  color: #fff;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
}
.switch-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(210, 188, 204, 0.45);
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(43, 31, 56, 0.24);
  transition: transform 0.24s cubic-bezier(0.22, 1.32, 0.36, 1);
}
.switch-row:hover input[type="checkbox"] {
  border-color: var(--pink);
}
.switch-row input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #ff6392, #ff8ab0);
  border-color: #f05585;
  box-shadow: 0 2px 8px rgba(255, 99, 146, 0.28);
}
.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}
.switch-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.pairs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pair-row { display: grid; grid-template-columns: 48px 1fr 22px 1fr; gap: 6px; align-items: center; }
.pair-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.pair-vs { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); }
.pair-row select {
  width: 100%;
  min-width: 0;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  padding: 0 6px;
}

.roster-edit { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.re-row { display: grid; grid-template-columns: 32px 1fr auto 92px; gap: 7px; align-items: center; }
.re-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--g1, #ff8eb5), var(--g2, #7fd8cd));
}
.re-avatar img { width: 100%; height: 100%; object-fit: cover; }
.re-name {
  width: 100%;
  min-width: 0;
  height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.re-tag {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: var(--mint-soft);
  color: var(--mint-deep);
  transition: transform 0.14s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.re-tag:hover { transform: translateY(-1px); border-color: rgba(63, 184, 166, 0.45); box-shadow: 0 2px 8px rgba(63, 184, 166, 0.18); }
.re-tag:active { transform: scale(0.93); }
.re-tag[data-new="0"] { background: var(--gold-soft); color: #9c6a08; }
.re-tag[data-new="0"]:hover { border-color: rgba(230, 168, 50, 0.5); box-shadow: 0 2px 8px rgba(230, 168, 50, 0.2); }
.re-weapon {
  width: 100%;
  min-width: 0;
  height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.roster-add { display: flex; gap: 8px; margin-bottom: 10px; }
.roster-add[hidden] { display: none; }
.roster-add input { flex: 1; min-width: 0; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); padding: 0 10px; font-weight: 500; }
.roster-add input::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }

.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.media-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.media-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  margin-bottom: 10px;
}
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.bg-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.bg-row { display: grid; grid-template-columns: 36px 1fr 44px; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.bg-row b { text-align: right; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.account-section { display: flex; flex-direction: column; gap: 18px; }
.account-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.account-card { display: flex; flex-direction: column; gap: 12px; }
.account-card .panel-head { margin-bottom: 0; }
.account-tip { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.tool-row, .pwd-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pwd-row input { flex: 1; min-width: 180px; height: 38px; border-radius: 11px; border: 1.5px solid var(--line); padding: 0 12px; font-weight: 500; }
.pwd-row input::placeholder { font-weight: 400; color: rgba(93, 77, 107, 0.56); }

.site-foot { text-align: center; padding: 14px; font-size: 12px; font-weight: 500; color: var(--muted); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  padding: 10px 16px;
  border-radius: 14px;
  background: #3a2e45;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(40, 24, 52, 0.3);
}
.toast[data-tone="err"] { background: #c93058; }

@media (max-width: 1200px) {
  .ref-layout,
  .control-grid,
  .media-grid,
  .account-cards,
  .overview-foot,
  .speech-theater-cols,
  .speech-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ref-layout > *,
  .control-grid > *,
  .media-grid > *,
  .account-cards > *,
  .overview-foot > *,
  .speech-theater-cols > *,
  .speech-grid > * {
    min-width: 0;
    max-width: 100%;
  }
}
@media (max-width: 820px) {
  .kbd { display: none; }

  /* 顶部导航：避免 sticky 占满半屏，标签与快捷工具各占一行横向滑动 */
  .top-bar {
    position: relative;
    min-height: 0;
    padding: 10px 12px;
    gap: 8px;
  }
  .brand { gap: 8px; min-width: 0; flex: 1 1 auto; }
  .brand .logo { height: 24px; max-width: 96px; object-fit: contain; }
  .brand-title { min-width: 0; }
  .brand-title .brand-en { font-size: 16px; }
  .brand-title .brand-cn { font-size: 14px; }
  .saved-badge {
    padding: 4px 10px;
    font-size: 11.5px;
    gap: 5px;
  }
  .top-tabs {
    order: 2;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .top-tabs::-webkit-scrollbar { display: none; }
  .top-tabs .tab-btn,
  .top-tabs a {
    flex-shrink: 0;
    padding: 7px 11px;
    font-size: 13px;
    scroll-snap-align: center;
  }
  .top-tools {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }
  .top-tools::-webkit-scrollbar { display: none; }
  .top-tools .tb-btn {
    flex-shrink: 0;
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
    box-shadow: none;
  }
  .top-tools .tb-btn.toggle-pill { padding: 0 10px 0 8px; }

  /* 主容器与面板 */
  .admin-main {
    padding: 12px 12px 28px;
    gap: 14px;
  }
  .panel {
    padding: 13px 12px;
    border-radius: 18px;
  }
  .panel-head { margin-bottom: 10px; }

  /* 裁判台：顶部横向赛程条 + 直接进入当前焦点判胜 */
  .ref-layout { gap: 12px; }
  .ref-queue-panel { padding: 11px 12px; width: 100%; min-width: 0; max-width: 100%; }
  .ref-queue {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 2px 2px 4px;
    scroll-snap-type: x proximity;
  }
  .ref-queue::-webkit-scrollbar { display: none; }
  .qsec { display: none; }
  .qi {
    flex: 0 0 156px;
    width: 156px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 13px;
    scroll-snap-align: start;
  }
  .qi::before {
    left: 50%;
    top: auto;
    bottom: 3px;
    width: 0;
    height: 3px;
    transform: translateX(-50%);
    transition: width 0.22s cubic-bezier(0.22, 1.25, 0.36, 1), opacity 0.18s ease;
  }
  .qi.selected::before {
    width: 44%;
    height: 3px;
    opacity: 1;
  }
  .qi:hover { transform: none; box-shadow: none; }
  .qi .id { font-size: 11px; }
  .qi .st { font-size: 10.5px; padding: 2px 6px; }
  .qi .ps { grid-column: 1 / -1; font-size: 12.5px; }

  .ref-center { gap: 12px; min-width: 0; max-width: 100%; }
  .ref-ctrl-head {
    gap: 10px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
  }
  .ref-ctrl-head > div:first-child { flex: 1; min-width: 0; }
  .ref-ctrl-head h1 { font-size: 19px; }
  .ref-sub { font-size: 12px; margin-top: 2px; }
  #btnRefReset {
    order: 2;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .state-toggle {
    order: 3;
    width: 100%;
    margin-left: 0;
    min-width: 0;
  }
  .state-toggle button { padding: 8px 10px; }

  .ref-duel {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    max-width: 100%;
  }
  .vsmid {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    padding: 2px 0;
  }
  .vs-badge { width: 36px; height: 36px; font-size: 14px; }
  .swap-btn { width: 34px; height: 34px; font-size: 16px; }
  .swap-btn:hover:not(:disabled) { transform: none; }

  .ref-side {
    min-width: 0;
    max-width: 100%;
    padding: 13px 12px;
    border-radius: 18px;
    gap: 11px;
  }
  .ref-side:hover { transform: none; }
  .ph { gap: 11px; min-width: 0; }
  .ph-av { width: 52px; height: 52px; border-width: 3px; font-size: 19px; }
  .ph-info b { font-size: 17px; }
  .ph-badges { margin-top: 5px; gap: 6px; }
  .weap-grid { gap: 6px; }
  .weap-chip { padding: 6px 10px; font-size: 12px; }
  .weap-chip:hover { transform: none; }
  .win-cta {
    width: 100%;
    max-width: 100%;
    min-height: 50px;
    height: auto;
    padding: 12px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    border-radius: 14px;
    font-size: 15.5px;
  }
  .win-cta:hover:not(:disabled) { transform: none; }

  .ref-bottom-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .note-panel textarea { height: 64px; font-size: 15px; }
  .ref-keys-panel { display: none; }

  .undo-toast-slot { min-height: 0; }
  .undo-toast {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 62;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 12.5px;
  }
  .undo-toast button { flex-shrink: 0; }
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    text-align: center;
  }

  .ref-right { gap: 12px; }
  .quick-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .qr-item {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 7px;
    padding: 6px 8px;
  }
  .qr-grip { display: none; }
  .qr-av { width: 28px; height: 28px; }
  .assist-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
  }
  .assist-card img { width: 64px; }

  /* 对阵总览：取消 3 列强制网格与横向滚动，竖排展示全部 8 场 */
  .overview-head h2 { font-size: 16px; }
  .bracket-wrap { overflow-x: visible; padding-bottom: 0; }
  .links { display: none; }
  .rounds {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .rounds > * {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .round-head { margin-top: 4px; }
  .match:hover { transform: none; }
  .slot {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px;
  }
  .avatar { width: 30px; height: 30px; }
  .name-in { width: 100%; font-size: 14px; padding: 3px 5px; }
  .weapon-in { max-width: 100%; font-size: 12px; padding: 3px 5px; }
  .win-btn { padding: 6px 12px; font-size: 12.5px; }
  .match-foot { flex-wrap: wrap; }
  .state-in { font-size: 12px; }
  .note-in { min-width: 120px; font-size: 13px; }

  /* 赛事设置与选手管理 */
  .control-grid { gap: 12px; }
  .field input { height: 40px; font-size: 15px; }
  .stage-switch button { padding: 8px 4px; font-size: 12px; }
  .pair-row {
    grid-template-columns: 44px minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 5px;
  }
  .pair-row select { height: 36px; font-size: 13px; padding: 0 4px; }
  .re-row {
    grid-template-columns: 30px minmax(0, 1fr) auto 86px;
    gap: 6px;
  }
  .re-avatar { width: 30px; height: 30px; }
  .re-name { height: 34px; font-size: 14px; padding: 0 7px; }
  .re-tag { height: 34px; padding: 0 8px; }
  .re-weapon { height: 34px; font-size: 12px; }
  .roster-add input { height: 38px; font-size: 15px; }

  /* 角色应援 */
  .speech-section { gap: 12px; }
  .speech-head-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .speech-subtabs { width: 100%; }
  .speech-subtabs button {
    padding: 8px 6px;
    font-size: 12px;
    white-space: normal;
    line-height: 1.25;
  }
  .speech-tpl-bar { padding: 9px 10px; gap: 8px; }
  .speech-textarea { font-size: 15px; }
  .speech-cheer-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }
  .speech-cheer-row input {
    grid-column: 1 / -1;
    order: 4;
    width: 100%;
    height: 38px;
    font-size: 15px;
  }

  /* 舞台画面 */
  .media-grid { gap: 12px; }
  .media-actions .tb-btn {
    flex: 1 1 auto;
    height: 36px;
    font-size: 12.5px;
  }
  .bg-sliders { grid-template-columns: 1fr; gap: 10px; }
  .bg-row { grid-template-columns: 38px minmax(0, 1fr) 44px; }
  .bg-row input[type="range"] { min-width: 0; width: 100%; }

  /* 设置与备份 */
  .account-cards { gap: 12px; }
  .tool-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .tool-row .tb-btn { width: 100%; height: 38px; font-size: 12.5px; }
  .pwd-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pwd-row input,
  .pwd-row .tb-btn {
    width: 100%;
    min-width: 0;
    height: 40px;
    font-size: 15px;
  }
}

@media (max-width: 540px) {
  .gate { padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px)); }
  .gate-card { padding: 20px 16px 18px; border-radius: 22px; gap: 14px; }
  .gate-head { gap: 12px; }
  .gate-mascot { width: 58px; }
  .gate-logo { height: 22px; }
  .gate-title .brand-en { font-size: 18px; }
  .gate-title .brand-cn { font-size: 16px; }
  .gate-field input { font-size: 16px; }
}

@media (max-width: 400px) {
  .quick-roster { grid-template-columns: 1fr; }
  .re-row { grid-template-columns: 28px minmax(0, 1fr) auto 76px; gap: 5px; }
  .re-avatar { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .admin-view.is-active,
  .speech-pane.is-active,
  .state-toggle button[data-state="live"].is-on .live-dot {
    animation: none !important;
  }
  .tabs-indicator,
  .seg-thumb,
  .tb-btn,
  .btn,
  .tb-btn.toggle-pill .pill-track,
  .tb-btn.toggle-pill .pill-track::after,
  .switch-row input[type="checkbox"],
  .switch-row input[type="checkbox"]::after,
  .qi,
  .qi::before,
  .weap-chip,
  .win-btn,
  .role-btn,
  .re-tag,
  .badge {
    transition: none !important;
  }
}
