:root {
  --bg: #05070f;
  --bg2: #0a1020;
  --card: rgba(20, 30, 52, 0.62);
  --card2: rgba(34, 48, 76, 0.55);
  --line: rgba(103, 232, 249, 0.14);
  --line2: rgba(148, 163, 184, 0.16);
  --fg: #e8f2ff;
  --fg2: #9db2d4;
  --fg3: #63779a;
  --cyan: #22d3ee;
  --sky: #38bdf8;
  --violet: #8b5cf6;
  --pink: #f472b6;
  --accent: #22d3ee;
  --accent2: #7c3aed;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 背景：极光 + 网格 ---------------- */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 560px at 8% -8%, rgba(34, 211, 238, 0.20), transparent 62%),
    radial-gradient(720px 560px at 104% 4%, rgba(139, 92, 246, 0.22), transparent 62%),
    radial-gradient(760px 520px at 50% 118%, rgba(244, 114, 182, 0.13), transparent 62%);
  animation: aurora 26s ease-in-out infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 76%);
  mask-image: radial-gradient(circle at 50% 22%, #000 0%, transparent 76%);
}

@keyframes aurora {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-2.5%, 1.5%, 0) scale(1.07); }
}

body.host { overflow-y: auto; }

/* ---------------- 通用 ---------------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 22px 48px;
}

.card {
  position: relative;
  background:
    linear-gradient(158deg, rgba(32, 50, 84, 0.72), rgba(11, 17, 34, 0.84) 52%, rgba(30, 20, 58, 0.72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(16px);
  box-shadow:
    0 18px 46px -26px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* 卡片顶部一道渐变高光，像 HUD 面板 */
.card::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.6), rgba(139, 92, 246, 0.6), transparent);
  pointer-events: none;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #b6cdea;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card h2::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet));
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.75);
  flex: none;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: linear-gradient(96deg, #67e8f9, #a78bfa 58%, #f0abfc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hint { color: var(--fg3); font-size: 12.5px; line-height: 1.7; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }

button, select, input[type="text"], input[type="password"] {
  font: inherit;
  color: var(--fg);
  background: linear-gradient(180deg, rgba(38, 52, 82, 0.72), rgba(18, 27, 46, 0.72));
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 8px 13px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s, filter 0.16s;
}

button { cursor: pointer; }

button:hover:not(:disabled) {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.18), 0 0 20px -6px rgba(34, 211, 238, 0.6);
}

button:disabled { opacity: 0.4; cursor: not-allowed; }

button.primary {
  background: linear-gradient(120deg, #0891b2, #2563eb 52%, #7c3aed);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 24px -10px rgba(56, 189, 248, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.13);
  box-shadow: 0 10px 30px -8px rgba(124, 58, 237, 1);
}

button.danger {
  background: linear-gradient(120deg, #7f1d1d, #b91c1c);
  border-color: transparent;
  color: #ffe4e6;
}

button.danger:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow: 0 0 22px -6px rgba(248, 113, 113, 0.85);
}

button.ghost {
  background: rgba(20, 30, 52, 0.35);
  border-color: rgba(148, 163, 184, 0.18);
}

button.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }

select, input { outline: none; }

select:focus, input[type="text"]:focus, input[type="password"]:focus {
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13);
}

select {
  padding-right: 30px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #7dd3fc 50%),
    linear-gradient(135deg, #7dd3fc 50%, transparent 50%),
    linear-gradient(180deg, rgba(38, 52, 82, 0.72), rgba(18, 27, 46, 0.72));
  background-position: calc(100% - 17px) calc(50% + 1px), calc(100% - 12px) calc(50% + 1px), 0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

select option { background: #0d1729; color: var(--fg); }

label.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
label.switch input { width: 16px; height: 16px; accent-color: var(--cyan); }

/* ---------------- 状态点 / 标签 ---------------- */
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--fg3);
  flex: none;
}
.dot.on { background: radial-gradient(circle, #6ee7b7, #10b981); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16), 0 0 14px rgba(16, 185, 129, 0.9); }
.dot.warn { background: radial-gradient(circle, #fde68a, #f59e0b); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16), 0 0 14px rgba(245, 158, 11, 0.85); }
.dot.err { background: radial-gradient(circle, #fda4af, #ef4444); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.18), 0 0 14px rgba(239, 68, 68, 0.9); }
.dot.live { animation: pulse 1.6s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.14), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(103, 232, 249, 0.22);
  font-size: 12.5px;
  color: #b9d6f2;
}

/* ---------------- 链接框 ---------------- */
.linkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(6, 11, 22, 0.92), rgba(10, 18, 34, 0.92));
  border: 1px dashed rgba(103, 232, 249, 0.3);
  border-radius: 12px;
  padding: 13px 15px;
  margin-top: 4px;
  box-shadow: inset 0 0 30px -18px rgba(34, 211, 238, 0.9);
}

.linkbox .url {
  flex: 1;
  font-size: 16px;
  color: #7dd3fc;
  word-break: break-all;
  font-family: Consolas, monospace;
  user-select: all;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.45);
}

.linkbox .url.empty { color: var(--fg3); font-size: 13px; text-shadow: none; }

/* ---------------- 画面源选择 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(6px);
}
.modal.show { display: flex; }

.modal .panel {
  position: relative;
  background: linear-gradient(158deg, rgba(22, 34, 58, 0.96), rgba(8, 13, 26, 0.98));
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 16px;
  width: min(920px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.95), 0 0 60px -30px rgba(34, 211, 238, 0.6);
  overflow: hidden;
}
.modal .panel::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.75), rgba(139, 92, 246, 0.75), transparent);
}

.modal .head { padding: 16px 20px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; }
.modal .head h3 { margin: 0; font-size: 15px; color: #cfe2fb; }
.modal .body { padding: 16px 20px; overflow-y: auto; }
.modal .foot { padding: 12px 20px; border-top: 1px solid var(--line2); display: flex; justify-content: flex-end; gap: 10px; align-items: center; }

.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.source {
  border: 1px solid var(--line2);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(12, 20, 36, 0.7);
  cursor: pointer;
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
  text-align: left;
  padding: 0;
}

.source:hover {
  border-color: rgba(34, 211, 238, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -14px rgba(34, 211, 238, 0.85);
}

.source.sel {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25), 0 0 28px -10px rgba(34, 211, 238, 0.9);
}

.source img { width: 100%; height: 118px; object-fit: contain; background: #05080f; display: block; }

.source .name {
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--fg2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.source .name img { width: 16px; height: 16px; object-fit: contain; }
.source .kind { font-size: 11px; color: var(--fg3); padding: 0 10px 8px; }

/* ---------------- 观众列表 ---------------- */
.viewers { display: flex; flex-direction: column; gap: 8px; }

.viewer {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(34, 48, 76, 0.5), rgba(16, 25, 43, 0.5));
  border: 1px solid var(--line2);
  border-radius: 11px;
  padding: 11px 14px;
}

.viewer .id { font-family: Consolas, monospace; color: #8fd4f0; min-width: 76px; }
.viewer .stats { color: var(--fg3); font-size: 12.5px; font-family: Consolas, monospace; }
.empty { color: var(--fg3); text-align: center; padding: 18px 0; font-size: 13px; }

/* ---------------- 日志 / 折叠 ---------------- */
details summary { cursor: pointer; color: var(--fg2); font-size: 13px; padding: 4px 0; }
details summary::marker { color: var(--cyan); }

#log {
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.95), rgba(7, 12, 22, 0.95));
  border: 1px solid var(--line2);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #7fa3c9;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(120deg, rgba(14, 26, 46, 0.95), rgba(28, 20, 52, 0.95));
  border: 1px solid rgba(103, 232, 249, 0.28);
  color: var(--fg);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 99;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.9), 0 0 34px -14px rgba(34, 211, 238, 0.9);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.45), rgba(139, 92, 246, 0.45));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.7), rgba(139, 92, 246, 0.7));
  background-clip: padding-box;
}

/* ---------------- 观众页 ---------------- */
body.viewer { background: #03060c; overflow: hidden; }
body.viewer::before, body.viewer::after { display: none; }

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 700px at 50% 40%, #0a1222, #03060c 70%);
}

#screen {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
  cursor: pointer;
}

body.fit-cover #screen { object-fit: cover; }

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    radial-gradient(700px 500px at 50% 30%, rgba(34, 211, 238, 0.10), transparent 65%),
    radial-gradient(700px 500px at 50% 90%, rgba(139, 92, 246, 0.12), transparent 65%),
    #03060c;
  text-align: center;
  padding: 24px;
  z-index: 10;
  transition: opacity 0.32s;
}
#overlay.hide { opacity: 0; pointer-events: none; }
#overlay .logo { font-size: 36px; filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.8)); }
#overlay h1 { margin: 0; font-size: 19px; font-weight: 600; color: #d6e8ff; }
#overlay p { margin: 0; color: var(--fg2); font-size: 13.5px; max-width: 440px; line-height: 1.8; white-space: pre-line; }

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, var(--cyan) 140deg, var(--violet) 240deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: spin 0.95s linear infinite;
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.7));
}

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

#bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(80px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: linear-gradient(180deg, rgba(18, 28, 48, 0.9), rgba(9, 15, 28, 0.92));
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  transition: transform 0.24s;
  z-index: 20;
  box-shadow: 0 16px 44px -18px rgba(0, 0, 0, 0.95), 0 0 40px -22px rgba(34, 211, 238, 0.95);
  /* 固定定位 + left:50% 时，宽度会按「剩下的一半屏宽」去收缩，
     加了「连麦」以后按钮放不下就折行了。改成按内容取宽，靠 transform 居中。 */
  width: max-content;
  max-width: 96vw;
  flex-wrap: wrap;
  justify-content: center;
}
#bar.show { transform: translateX(-50%) translateY(0); }
#bar button { padding: 7px 15px; border-radius: 999px; font-size: 13px; }

#stats {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.9), rgba(8, 13, 24, 0.92));
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 11px;
  padding: 10px 14px;
  font-family: Consolas, monospace;
  font-size: 12.5px;
  color: var(--fg2);
  line-height: 1.8;
  display: none;
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px -20px rgba(0, 0, 0, 0.95);
}
#stats.show { display: block; }
#stats b { color: var(--fg); font-weight: 600; }

.badge-live {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
  display: none;
  align-items: center;
  gap: 7px;
  background: linear-gradient(120deg, rgba(190, 24, 93, 0.92), rgba(220, 38, 38, 0.92));
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 999px;
  box-shadow: 0 0 24px -8px rgba(244, 63, 94, 0.95);
}
.badge-live.show { display: inline-flex; }

/* ---------------- 一起看 ---------------- */
body.watch { background: #03060c; overflow: hidden; }
body.watch::before, body.watch::after { display: none; }

#watchTop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(9, 15, 28, 0.94), rgba(9, 15, 28, 0.58));
  border-bottom: 1px solid rgba(103, 232, 249, 0.14);
  backdrop-filter: blur(14px);
  z-index: 30;
}
.wt-left, .wt-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.wt-logo { font-size: 16px; filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.85)); }
.wt-title {
  font-weight: 600;
  font-size: 14.5px;
  color: #dbeafe;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wt-tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  white-space: nowrap;
}
.wt-peer { font-size: 12.5px; color: var(--fg2); white-space: nowrap; }
#watchTop button { padding: 6px 13px; border-radius: 999px; font-size: 12.5px; }

#watchStage {
  position: fixed;
  inset: 52px 0 74px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 700px at 50% 40%, #0a1222, #03060c 72%);
}
body.watch #screen {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
  cursor: pointer;
}

/* 横幅 */
#waitBanner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(14, 26, 46, 0.94), rgba(28, 20, 52, 0.94));
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: #cfe6ff;
  font-size: 13px;
  z-index: 15;
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.95), 0 0 30px -18px rgba(34, 211, 238, 0.9);
}
.wb-spin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, var(--cyan) 150deg, var(--violet) 260deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: spin 0.9s linear infinite;
}

#blockedBanner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 12, 0.6);
  backdrop-filter: blur(4px);
  z-index: 16;
}
#blockedBanner button { padding: 12px 26px; border-radius: 999px; font-size: 14.5px; }

#proxyNotice {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(76, 29, 149, 0.9), rgba(30, 64, 120, 0.9));
  border: 1px solid rgba(139, 92, 246, 0.42);
  color: #ddd6fe;
  font-size: 12.5px;
  z-index: 15;
  white-space: nowrap;
  box-shadow: 0 10px 34px -14px rgba(0, 0, 0, 0.95);
}

/* 底部控制条 */
#watchBar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(1080px, 96vw);
  padding: 8px 15px;
  background: linear-gradient(180deg, rgba(18, 28, 48, 0.92), rgba(9, 15, 28, 0.95));
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  z-index: 30;
  box-shadow: 0 16px 44px -18px rgba(0, 0, 0, 0.95), 0 0 40px -24px rgba(34, 211, 238, 0.95);
}
#watchBar button { padding: 6px 12px; border-radius: 999px; font-size: 13px; min-width: 38px; line-height: 1; }
#watchBar select { padding: 6px 10px; border-radius: 999px; font-size: 12.5px; }

.tcode {
  font-family: Consolas, monospace;
  font-size: 12px;
  color: var(--fg2);
  min-width: 52px;
  text-align: center;
  flex: none;
}

.seekwrap {
  position: relative;
  flex: 1;
  min-width: 140px;
  height: 18px;
  display: flex;
  align-items: center;
}
.seekwrap::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}
.seekfill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 12px -2px rgba(34, 211, 238, 0.9);
  z-index: 1;
  pointer-events: none;
}

body.watch input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  outline: none;
  cursor: pointer;
}
body.watch input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--cyan), var(--violet));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.85);
  cursor: pointer;
}
body.watch input[type="range"]:disabled { opacity: 0.45; cursor: default; }
body.watch #seek { flex: 1; background: transparent; position: relative; z-index: 2; }
body.watch #vol { width: 84px; flex: none; }

.sync-badge {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.42);
  color: #c4b5fd;
  white-space: nowrap;
  flex: none;
}
.sync-badge.ok {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.42);
  color: #6ee7b7;
}
.sync-badge.warn {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.42);
  color: #fcd34d;
}

/* 一起看：空状态 / 出错卡片 */
body.watch #overlay { z-index: 20; }
.ov-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  width: min(620px, 92vw);
}
.ov-card .logo { font-size: 38px; filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.8)); }
.ov-card h1 { margin: 0; font-size: 19px; font-weight: 600; color: #d6e8ff; }
.ov-card p { margin: 0; color: var(--fg2); font-size: 13.5px; line-height: 1.85; white-space: pre-line; }

.ov-form { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.ov-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 15px;
  border-radius: 11px;
  font-size: 13.5px;
}
.ov-form button { padding: 11px 24px; border-radius: 11px; flex: none; }

.ov-manual { display: block; margin-top: 2px; text-align: center; }
.linkbtn {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 12.5px;
  cursor: pointer;
  padding: 5px 8px;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
}
.linkbtn:hover { text-decoration: underline; }
.ov-manual-body { display: none; margin-top: 10px; text-align: left; }
.ov-manual-body input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 8px;
}
.ov-manual-body button { width: 100%; padding: 10px; border-radius: 10px; }
.ov-manual-body .hint {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--fg3);
  line-height: 1.75;
}
.ov-actions { display: flex; gap: 9px; margin-top: 4px; }
.ov-actions button { padding: 9px 20px; border-radius: 999px; font-size: 13px; }

/* 一起看：窄屏 */
@media (max-width: 720px) {
  .wt-title { max-width: 30vw; }
  .wt-peer { display: none; }
  #watchTop { height: 46px; padding: 0 10px; }
  #watchStage { inset: 46px 0 0 0; }
  #watchBar {
    width: 100vw;
    left: 0;
    bottom: 0;
    transform: none;
    border-radius: 14px 14px 0 0;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 10px;
  }
  .tcode { min-width: 44px; }
}

/* ---------------- 文字聊天 ---------------- */

.chat-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
body.watch .chat-dock,
body.viewer .chat-dock { bottom: 96px; }

.chat-fab {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
  color: var(--fg);
  background: linear-gradient(150deg, rgba(34, 211, 238, 0.22), rgba(139, 92, 246, 0.28));
  border: 1px solid rgba(103, 232, 249, 0.34);
  box-shadow: 0 10px 28px rgba(6, 12, 28, 0.62), 0 0 20px rgba(34, 211, 238, 0.16);
  backdrop-filter: blur(10px);
}
.chat-fab:hover { border-color: rgba(103, 232, 249, 0.62); }
.chat-dock.open .chat-fab {
  border-color: rgba(139, 92, 246, 0.72);
  box-shadow: 0 10px 28px rgba(6, 12, 28, 0.62), 0 0 24px rgba(139, 92, 246, 0.32);
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 12px rgba(244, 114, 182, 0.5);
}

.chat-panel {
  width: min(330px, calc(100vw - 36px));
  height: min(430px, calc(100vh - 170px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(158deg, rgba(32, 50, 84, 0.9), rgba(11, 17, 34, 0.95) 55%, rgba(30, 20, 58, 0.9));
  box-shadow: 0 20px 52px rgba(3, 7, 18, 0.74), inset 0 0 0 1px rgba(103, 232, 249, 0.05);
  backdrop-filter: blur(14px);
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.12), rgba(139, 92, 246, 0.12));
}
.chat-title { font-weight: 600; letter-spacing: 0.6px; font-size: 13px; }
.chat-head button { padding: 3px 9px; font-size: 11.5px; border-radius: 999px; }
.chat-head .chat-close { margin-left: auto; }
.chat-nameinput { flex: 1; min-width: 0; padding: 4px 9px; font-size: 12px; }
.chat-nameinput[hidden] { display: none; }

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
}
.chat-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--fg3);
}
.chat-meta b { color: var(--fg2); font-weight: 600; }
.chat-text {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(34, 48, 76, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.chat-row.me { align-items: flex-end; }
.chat-row.me .chat-meta { flex-direction: row-reverse; }
.chat-row.me .chat-text {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(139, 92, 246, 0.24));
  border-color: rgba(103, 232, 249, 0.3);
}
.chat-row.sys { align-items: center; }
.chat-row.sys span {
  font-size: 11.5px;
  color: var(--fg3);
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.09);
}

.chat-form {
  display: flex;
  gap: 7px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
}
.chat-input { flex: 1; min-width: 0; padding: 8px 11px; font-size: 13px; }
.chat-send { padding: 8px 14px; border-radius: 9px; }

/* ---------------- 连麦 ---------------- */

#btnVoice.live {
  border-color: rgba(52, 211, 153, 0.55);
  color: #a7f3d0;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.22);
}

#voicePanel {
  position: fixed;
  top: 62px;
  /* 放左边：聊天面板挂在右下角，两边同时开着不能互相压住 */
  left: 14px;
  z-index: 55;
  width: min(292px, calc(100vw - 28px));
  padding: 11px;
  font-size: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(158deg, rgba(32, 50, 84, 0.92), rgba(11, 17, 34, 0.96) 55%, rgba(30, 20, 58, 0.92));
  box-shadow: 0 20px 52px rgba(3, 7, 18, 0.74), inset 0 0 0 1px rgba(103, 232, 249, 0.05);
  backdrop-filter: blur(14px);
}
#voicePanel[hidden] { display: none; }

/* 主播面板是一整页卡片，浮动面板放右上角不挡正文；聊天在右下角，错开 */
body.host #voicePanel {
  top: 60px;
  right: 14px;
  left: auto;
}

.vp-head { display: flex; align-items: center; margin-bottom: 9px; }
.vp-title { font-weight: 600; letter-spacing: 0.6px; }
.vp-head button { margin-left: auto; padding: 2px 9px; font-size: 12px; border-radius: 999px; }

.vp-list { display: flex; flex-direction: column; gap: 5px; max-height: 176px; overflow-y: auto; }
.vp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(34, 48, 76, 0.42);
}
.vp-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.4);
  transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
}
.vp-row.talking .vp-dot {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  transform: scale(1.4);
}
.vp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-tag { font-size: 11px; color: var(--fg3); }
.vp-row.talking .vp-tag { color: var(--ok); }
.vp-empty { padding: 6px 2px; font-size: 12px; color: var(--fg3); }

/* 每个人的音量条：有人麦克风偏小，能拉到 300% */
.vp-item { display: block; }
.vp-vol {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px 3px 25px;
}
.vp-vol input[type='range'] {
  flex: 1;
  min-width: 0;
  height: 3px;
  margin: 0;
  accent-color: #67e8f9;
  cursor: pointer;
}
.vp-vol span { flex: none; width: 36px; text-align: right; font-size: 10.5px; color: var(--fg3); }
.vp-vol span.loud { color: #fca5a5; }

.vp-hint { margin: 9px 2px; font-size: 11.5px; line-height: 1.65; color: var(--fg3); }
.vp-hint.err { color: var(--err); }

.vp-echo {
  margin: 0 2px 9px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #a5f3fc;
  background: rgba(14, 116, 144, 0.24);
  border: 1px solid rgba(103, 232, 249, 0.28);
}
.vp-echo[hidden] { display: none; }

.vp-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.vp-actions button { flex: 1; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; }
.vp-actions button.on { border-color: rgba(251, 191, 36, 0.6); color: #fde68a; }

.vp-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg2);
  cursor: pointer;
}
.vp-toggle input { width: auto; flex: none; }

.voice-audio-bin { position: fixed; left: -9999px; width: 0; height: 0; overflow: hidden; }

@media (max-width: 720px) {
  .chat-dock { right: 10px; bottom: 10px; }
  body.watch .chat-dock,
  body.viewer .chat-dock { bottom: 84px; }
  .chat-panel { width: calc(100vw - 20px); height: min(60vh, 430px); }
  #voicePanel { top: 56px; right: 10px; left: 10px; width: auto; }
  .vp-actions button { flex: 1 1 40%; }
}

/* ---------------- 无障碍 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
