* { box-sizing: border-box; }

:root {
  --bg: #05070d;
  --text: #f4f7ff;
  --muted: #8b98b1;
  --red: #ff3d3d;
  --orange: #ff7a45;
  --blue: #5b9bff;
  --green: #2ee6a8;
  --line: rgba(255, 255, 255, 0.1);
  --display-font: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --num-font: "SF Pro Display", "Segoe UI", "PingFang SC", sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display-font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(255, 61, 61, 0.13), transparent 55%),
    radial-gradient(90% 70% at 10% 110%, rgba(75, 141, 255, 0.12), transparent 60%),
    radial-gradient(70% 60% at 95% 100%, rgba(255, 122, 69, 0.08), transparent 60%),
    #05070d;
}

.ambient {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 61, 61, 0.12), transparent 42%),
    radial-gradient(circle at 72% 70%, rgba(75, 141, 255, 0.1), transparent 45%);
  filter: blur(20px);
  animation: ambientFloat 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ambientFloat {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}

/* ---------- 顶部 HUD ---------- */

.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(14px, 2.4vh, 30px) clamp(18px, 3vw, 48px);
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.4s ease;
}
/* 播报字幕/语音时隐藏顶栏（设备名、绑定码、连接状态），避免遮挡内容 */
body.broadcasting .hud { opacity: 0; }
/* 播报时同样隐藏待机元素（设备行、绑定码行），滚动字幕模式下保持画面干净 */
body.broadcasting .idle-main { opacity: 0; }
.hud-brand { display: flex; align-items: center; gap: 12px; }
.hud-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #ff6b6b;
  background: rgba(255, 61, 61, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.25);
}
.hud-logo svg { width: 21px; height: 21px; stroke-width: 2; }
.hud-name { font-size: clamp(14px, 1.4vw, 19px); font-weight: 600; letter-spacing: 1px; }
.hud-tag {
  font-size: clamp(10px, 0.85vw, 12px);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 9px;
  border-radius: 20px;
}
.hud-groups {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hud-groups.hidden { display: none; }
.hud-pair {
  font-family: var(--num-font);
  letter-spacing: 1px;
  color: #8ea3c8;
  border-color: rgba(75, 141, 255, 0.28);
}
.hud-status {
  display: flex; align-items: center; gap: 9px;
  font-size: clamp(11px, 0.9vw, 13px);
  color: var(--muted);
}
.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5d6a83;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
  transition: background 0.3s, box-shadow 0.3s;
}
.conn-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(46, 230, 168, 0.16); }
.conn-dot.off { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 61, 61, 0.16); }
/* ---------- 视图切换 ---------- */

.view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.view.show { opacity: 1; visibility: visible; }

/* ---------- 启动遮罩 ---------- */

.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(80% 60% at 50% 20%, rgba(255, 61, 61, 0.13), transparent 60%),
    #05070d;
  text-align: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.start-overlay.gone { opacity: 0; visibility: hidden; }
.start-inner { padding: 24px; }
.start-logo {
  width: 92px; height: 92px;
  margin: 0 auto 26px;
  border-radius: 26px;
  display: grid; place-items: center;
  color: #ff6b6b;
  background: linear-gradient(150deg, rgba(255, 61, 61, 0.24), rgba(255, 122, 69, 0.05));
  border: 1px solid rgba(255, 100, 100, 0.35);
  box-shadow: 0 24px 70px rgba(255, 45, 45, 0.25);
}
.start-logo svg { width: 54px; height: 54px; stroke-width: 2; }
.start-inner h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: 4px;
  font-weight: 700;
}
.start-inner p { margin: 0 0 34px; color: var(--muted); font-size: clamp(13px, 1.4vw, 17px); letter-spacing: 1px; }
.start-btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: clamp(52px, 7vh, 64px);
  padding: 0 clamp(34px, 5vw, 58px);
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #ff4d4d, #c91818);
  color: #fff;
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(255, 45, 45, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.start-btn svg { width: 20px; height: 20px; }
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 24px 60px rgba(255, 45, 45, 0.45); }
.start-note { margin-top: 34px; font-size: 12px; color: #5f6c85; letter-spacing: 0.5px; }

/* ---------- 配对 ---------- */

.pair-view { padding: 80px 24px 24px; }
.pair-card {
  width: min(720px, 92vw);
  padding: clamp(28px, 5vh, 54px) clamp(24px, 5vw, 60px);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(26, 37, 60, 0.86), rgba(11, 17, 30, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  text-align: center;
  backdrop-filter: blur(10px);
}
.pair-eyebrow {
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 8px;
  color: #ff8a8a;
  margin-bottom: clamp(16px, 3vh, 30px);
}
.pair-label { font-size: clamp(12px, 1.1vw, 15px); color: var(--muted); letter-spacing: 3px; }
.pair-code {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: clamp(54px, 10vw, 108px);
  font-weight: 700;
  letter-spacing: clamp(8px, 1.8vw, 18px);
  color: #fff;
  text-shadow: 0 0 50px rgba(255, 80, 80, 0.45);
  margin: clamp(8px, 1.5vh, 18px) 0 clamp(14px, 2.5vh, 26px);
  font-variant-numeric: tabular-nums;
}
.pair-desc {
  font-size: clamp(13px, 1.3vw, 16px);
  color: #a6b3c9;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto clamp(18px, 3vh, 30px);
}
.pair-server {
  display: inline-block;
  font-family: "SF Mono", Consolas, monospace;
  font-size: clamp(11px, 1vw, 13px);
  color: #7e8ca6;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  margin-bottom: clamp(16px, 3vh, 28px);
}
.pair-wait {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: clamp(12px, 1.1vw, 14px);
  color: #ffb36b;
}
.pair-wait i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff9d4d;
  animation: pairoPulse 1.4s ease-in-out infinite;
}
@keyframes pairoPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 157, 77, 0.4); }
  50% { opacity: 0.55; box-shadow: 0 0 0 8px rgba(255, 157, 77, 0); }
}
.pair-platform { margin-top: clamp(20px, 3vh, 34px); font-size: 11px; color: #56627a; letter-spacing: 0.5px; }

/* ---------- 待机 ---------- */

.idle-view { flex-direction: column; }
.idle-main { text-align: center; z-index: 2; transition: opacity 0.4s ease; }
.idle-device {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: clamp(13px, 1.2vw, 16px);
  color: #c5d0e4;
  letter-spacing: 1px;
}
.idle-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(46, 230, 168, 0.7); }
.idle-hint {
  margin-top: 14px;
  font-size: clamp(11px, 1vw, 13px);
  color: #5f6c86;
  letter-spacing: 2px;
}
.idle-pair {
  margin-top: 10px;
  font-size: clamp(11px, 1vw, 13px);
  color: #4d5970;
  letter-spacing: 1px;
}
.idle-pair b {
  font-family: "SF Mono", Consolas, monospace;
  font-weight: 600;
  font-size: clamp(13px, 1.2vw, 16px);
  color: #8ea3c8;
  letter-spacing: 3px;
  margin: 0 2px;
}
.idle-pair span { font-size: 0.92em; }
.idle-rings { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.idle-rings span {
  position: absolute;
  left: 50%; top: 50%;
  width: 42vmin; height: 42vmin;
  margin: -21vmin 0 0 -21vmin;
  border-radius: 50%;
  border: 1px solid rgba(255, 90, 90, 0.1);
  animation: ringExpand 9s linear infinite;
}
.idle-rings span:nth-child(2) { animation-delay: 3s; }
.idle-rings span:nth-child(3) { animation-delay: 6s; }
@keyframes ringExpand {
  0% { transform: scale(0.55); opacity: 0; }
  25% { opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- 播报舞台 ---------- */

.stage {
  padding: clamp(80px, 11vh, 130px) clamp(24px, 6vw, 130px) clamp(70px, 10vh, 120px);
  z-index: 5;
}
.stage-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 70% at 50% 40%, rgba(255, 61, 61, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(5, 7, 13, 0.2), rgba(5, 7, 13, 0.55));
  transition: background 0.4s;
  z-index: -1;
}
.stage-top {
  position: absolute;
  top: clamp(76px, 10vh, 120px);
  left: clamp(24px, 6vw, 130px);
  right: clamp(24px, 6vw, 130px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.live {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  border-radius: 22px;
  background: rgba(255, 61, 61, 0.12);
  border: 1px solid rgba(255, 100, 100, 0.25);
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 3px;
  color: #ffb0b0;
}
.live i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  animation: livePulse 1.1s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 61, 61, 0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 0 9px rgba(255, 61, 61, 0); }
}
.stage-meta { font-size: clamp(11px, 0.9vw, 13px); color: var(--muted); letter-spacing: 1px; }

.text-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.shout-text {
  margin: 0;
  text-align: center;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: clamp(1px, 0.18vw, 3px);
  color: #ffffff;
  text-shadow: 0 4px 40px rgba(255, 80, 60, 0.35), 0 0 90px rgba(255, 80, 60, 0.16);
  max-width: 100%;
  max-height: 100%;
  padding: 0 10px;
  word-break: break-word;
  overflow-wrap: anywhere;
  animation: textIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes textIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* 紧急样式 */
.stage.urgent .stage-bg {
  background:
    radial-gradient(80% 80% at 50% 45%, rgba(255, 55, 55, 0.35), transparent 62%),
    linear-gradient(180deg, #6d0c0c, #200305 70%, #170204);
}
.stage.urgent .shout-text {
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.25), 0 4px 60px rgba(255, 30, 30, 0.6);
}
.stage.urgent::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 10px solid rgba(255, 60, 60, 0.55);
  box-shadow: inset 0 0 80px rgba(255, 30, 30, 0.4);
  animation: urgentBorder 1.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 8;
}
@keyframes urgentBorder {
  0%, 100% { border-color: rgba(255, 60, 60, 0.3); }
  50% { border-color: rgba(255, 90, 60, 0.75); }
}
.stage.urgent .live { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; }

/* 公告样式 */
.stage.notice .stage-bg {
  background:
    radial-gradient(80% 80% at 50% 45%, rgba(75, 141, 255, 0.3), transparent 62%),
    linear-gradient(180deg, #0a2550, #050c1c 72%);
}
.stage.notice .shout-text {
  color: #eaf3ff;
  text-shadow: 0 0 24px rgba(90, 155, 255, 0.45), 0 4px 60px rgba(75, 141, 255, 0.35);
}
.stage.notice .live { background: rgba(75, 141, 255, 0.16); border-color: rgba(120, 170, 255, 0.3); color: #b9d3ff; }
.stage.notice .live i { background: var(--blue); }

/* 滚动字幕 */
.stage.scroll-mode .text-wrap { justify-content: flex-start; align-items: center; }
.stage.scroll-mode .shout-text {
  white-space: nowrap;
  max-width: none;
  max-height: none;
  text-align: left;
  animation: none;
  padding: 0;
  will-change: transform;
}

/* ---------- 语音喊话卡片 ---------- */

.voice-card {
  position: absolute;
  left: 50%;
  bottom: clamp(90px, 15vh, 180px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.6vw, 22px);
  padding: clamp(14px, 1.8vh, 22px) clamp(20px, 2.4vw, 34px);
  border-radius: 20px;
  background: rgba(14, 22, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  max-width: min(760px, 88vw);
  animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  z-index: 9;
}
@keyframes cardIn {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.voice-icon {
  width: clamp(44px, 5vh, 58px);
  height: clamp(44px, 5vh, 58px);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ff8c8c;
  background: radial-gradient(circle at 35% 30%, rgba(255, 90, 90, 0.3), rgba(255, 61, 61, 0.08));
  border: 1px solid rgba(255, 100, 100, 0.28);
}
.voice-icon svg { width: 55%; height: 55%; stroke-width: 1.8; }
.voice-body { min-width: 0; }
.voice-title {
  font-size: clamp(16px, 1.7vw, 24px);
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.voice-sub { font-size: clamp(10px, 0.9vw, 12px); color: var(--muted); letter-spacing: 2px; margin-top: 3px; }
.eq { display: flex; align-items: center; gap: 4px; height: 30px; margin-left: auto; flex: none; }
.eq i {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ff9a62, #ff3d3d);
  animation: eqBar 0.9s ease-in-out infinite;
}
.eq i:nth-child(1) { animation-delay: 0.05s; }
.eq i:nth-child(2) { animation-delay: 0.28s; }
.eq i:nth-child(3) { animation-delay: 0.12s; }
.eq i:nth-child(4) { animation-delay: 0.4s; }
.eq i:nth-child(5) { animation-delay: 0.2s; }
.eq i:nth-child(6) { animation-delay: 0.33s; }
.eq i:nth-child(7) { animation-delay: 0.08s; }
@keyframes eqBar {
  0%, 100% { height: 7px; opacity: 0.55; }
  50% { height: 28px; opacity: 1; }
}

/* ---------- 进度 ---------- */

.stage-bottom {
  position: absolute;
  left: clamp(24px, 6vw, 130px);
  right: clamp(24px, 6vw, 130px);
  bottom: clamp(30px, 5vh, 54px);
  z-index: 6;
}
.progress {
  height: 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #ff7a45, #ff3d3d);
  transition: width 0.5s linear;
}
.stage-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: clamp(10px, 0.8vw, 12px);
  color: #5e6b84;
  letter-spacing: 1px;
}

/* ---------- 浮层 ---------- */

.toast-layer {
  position: absolute;
  top: clamp(70px, 9vh, 110px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 10px 22px;
  border-radius: 24px;
  background: rgba(18, 28, 48, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #dbe5f6;
  font-size: clamp(12px, 1vw, 14px);
  letter-spacing: 1px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.3s ease;
}
.toast.ok { border-color: rgba(46, 230, 168, 0.35); color: #a9f5d8; }
.toast.err { border-color: rgba(255, 61, 61, 0.4); color: #ffb3b3; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.unbound-mask {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 12, 0.94);
  text-align: center;
  padding: 24px;
}
.unbound-title { font-size: clamp(20px, 2.4vw, 30px); font-weight: 600; letter-spacing: 2px; margin-bottom: 10px; }
.unbound-sub { font-size: 13px; color: var(--muted); letter-spacing: 1px; }

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

@media (max-aspect-ratio: 1/1) {
  .hud { padding: 14px 18px; }
  .hud-name { font-size: 14px; }
  .hud-tag { display: none; }
  .stage { padding: 100px 20px 80px; }
  .stage-top { top: 84px; left: 20px; right: 20px; }
  .stage-bottom { left: 20px; right: 20px; bottom: 24px; }
  .pair-code { letter-spacing: 8px; }
  .voice-card { bottom: 110px; padding: 12px 16px; }
  .voice-title { max-width: 48vw; font-size: 16px; }
  .eq { display: none; }
  .idle-device { margin-top: 28px; font-size: 13px; }
}

@media (max-width: 720px) {
  .hud-status span#connText { display: none; }
  .pair-card { padding: 30px 20px; }
  .pair-code { font-size: 58px; letter-spacing: 8px; }
  .pair-desc { font-size: 13px; }
  .pair-server { font-size: 10px; }
  .stage.urgent::after { border-width: 6px; }
}

@media (max-height: 500px) {
  .stage-top { top: 48px; }
  .stage { padding: 70px 30px 60px; }
  .stage-bottom { bottom: 16px; }
}

body.idle-cursor { cursor: none; }

