:root {
  --bg: #07080b;
  --panel: rgba(18, 21, 29, 0.72);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #eef0f5;
  --text-2: #b9bfcc;
  --muted: #7f8798;
  --accent: #19c37d;
  --accent-soft: rgba(25, 195, 125, 0.14);
  --live: #ff4d6d;
  --gold: #f5b83d;
  --ok: #34d399;
  --yt: #ff6b81;
  --geo: #fbbf24;
  --ext: #60a5fa;
  --off: #6b7280;
  --radius: 18px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 70px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 6% -10%, rgba(25, 195, 125, 0.16), transparent 62%),
    radial-gradient(820px 520px at 100% -12%, rgba(255, 77, 109, 0.13), transparent 60%),
    radial-gradient(760px 520px at 50% 115%, rgba(245, 184, 61, 0.07), transparent 60%);
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--topbar-h);
  padding: 12px clamp(16px, 3vw, 32px);
  background: rgba(7, 8, 11, 0.74);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #1f2430, #0e1117);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 10px 26px -10px rgba(25, 195, 125, 0.45);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-text strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.brand-text small {
  display: block;
  font-size: 10.5px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.search {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 10px 0 14px;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: text;
}

.search svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.search:focus-within {
  border-color: rgba(25, 195, 125, 0.55);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(25, 195, 125, 0.12);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--muted);
}

.search input::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.45);
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font: 600 11px/1.2 var(--font);
  text-align: center;
}

.clocks {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}

.clock span {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.clock time {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  align-items: start;
  gap: 20px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 32px) 8px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Player ---------- */

.player-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 34px 80px -34px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--line);
  isolation: isolate;
}

.player-shell media-i18n {
  display: contents;
}

.player-shell video-player {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.player-shell video-skin {
  display: block;
  width: 100%;
  height: 100%;
  --media-accent-color: var(--accent);
  --media-accent-text-color: #0b0d12;
  --media-border-color: transparent;
  --media-border-radius: 0;
  --media-font-family: var(--font);
}

.player-shell[data-mode="youtube"] video-player,
.player-shell[data-mode="external"] video-player {
  visibility: hidden;
}

.yt-host {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  background: #000;
}

.player-shell[data-mode="youtube"] .yt-host {
  display: block;
}

.yt-host iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 38%, rgba(24, 28, 38, 0.92), rgba(5, 6, 9, 0.97));
  animation: fade-in 0.25s ease;
}

.overlay-card {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.overlay-card h3 {
  margin: 6px 0 0;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.35;
}

.overlay-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.75;
}

.overlay-card .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.overlay-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--geo);
  background: rgba(251, 191, 36, 0.1);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.25);
}

.overlay-icon svg {
  width: 26px;
  height: 26px;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.unmute-chip {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #0b0d12;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  animation: pop-in 0.3s ease;
}

.unmute-chip svg {
  width: 17px;
  height: 17px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.08s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.btn:focus-visible,
.chip:focus-visible,
.seg-btn:focus-visible,
.fav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn.icon {
  width: 38px;
  padding: 0;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #22d892, #0fa968);
  color: #03140b;
  font-weight: 650;
}

.btn.primary:hover {
  filter: brightness(1.07);
}

.btn[data-action="fav"][aria-pressed="true"] {
  color: var(--gold);
  border-color: rgba(245, 184, 61, 0.4);
  background: rgba(245, 184, 61, 0.1);
}

.btn[data-action="theater"][aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(25, 195, 125, 0.45);
  background: var(--accent-soft);
}

#btn-recheck.spinning svg {
  animation: spin 0.9s linear infinite;
}

/* ---------- Channel tiles ---------- */

.tile {
  --from: #475569;
  --to: #0f172a;
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--from), var(--to));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 12px 18px -12px rgba(255, 255, 255, 0.55);
  user-select: none;
}

.tile[data-len="2"] {
  font-size: 16px;
}

.tile[data-len="3"] {
  font-size: 13.5px;
}

.tile[data-len="4"] {
  font-size: 11.5px;
  letter-spacing: 0;
}

.tile-lg {
  width: 64px;
  height: 64px;
  border-radius: 17px;
  font-size: 27px;
}

.tile-lg[data-len="2"] {
  font-size: 23px;
}

.tile-lg[data-len="3"] {
  font-size: 19px;
}

.tile-lg[data-len="4"] {
  font-size: 16px;
}

.tile-xl {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  font-size: 34px;
}

.tile-xl[data-len="2"] {
  font-size: 30px;
}

.tile-xl[data-len="3"] {
  font-size: 25px;
}

.tile-xl[data-len="4"] {
  font-size: 21px;
}

/* ---------- Now playing ---------- */

.now {
  padding: 20px 22px 22px;
  min-height: 220px;
}

.now:empty {
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent) 0 0 / 200% 100%,
    var(--panel);
  animation: shimmer 1.4s infinite linear;
}

.now-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.now-title {
  flex: 1;
  min-width: 0;
}

.now-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}

.live-pill,
.ext-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.live-pill {
  background: rgba(255, 77, 109, 0.14);
  color: #ff8199;
}

.live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.6s infinite;
}

.ext-pill {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
}

.now h1 {
  margin: 6px 0 2px;
  font-size: clamp(22px, 2.3vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.now h1 .zh {
  margin-left: 10px;
  font-size: 0.6em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-2);
  white-space: nowrap;
}

.now-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.now-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 470px;
}

.now-intro {
  max-width: 76ch;
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-2);
}

.now-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}

.now-sources {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.now-sources .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.seg-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.seg-btn[aria-checked="true"] {
  color: var(--text);
  border-color: rgba(25, 195, 125, 0.6);
  background: var(--accent-soft);
}

.seg-btn small {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.seg-btn .yt-mark {
  width: 16px;
  height: 16px;
  color: var(--yt);
}

.src-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 4px;
}

.src-foot .source-note {
  flex: 1 1 260px;
}

.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  flex-shrink: 0;
}

.btn.small svg {
  width: 15px;
  height: 15px;
}

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

/* ---------- 右键菜单与统计信息 ---------- */

.ctx-menu {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 164px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(20, 23, 31, 0.96);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line-strong);
  backdrop-filter: blur(12px);
  animation: fade-in 0.12s ease;
}

.ctx-menu[hidden] {
  display: none;
}

.ctx-menu button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.ctx-menu button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.ctx-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.stats-panel {
  position: absolute;
  z-index: 15;
  top: 12px;
  left: 12px;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 12, 17, 0.84);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--line-strong);
  color: var(--text);
  font-size: 12px;
}

.stats-panel[hidden] {
  display: none;
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.stats-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.stats-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.stats-body {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 12px;
  margin: 0 0 10px;
}

.stats-body dt {
  color: var(--muted);
  white-space: nowrap;
}

.stats-body dd {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stats-panel .btn.small {
  width: 100%;
  justify-content: center;
}

.source-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.source-note a {
  color: var(--ext);
}

/* ---------- Status dots ---------- */

.dot,
.status i,
.legend i {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--off);
}

[data-status="ok"] {
  --c: var(--ok);
}

[data-status="yt"] {
  --c: var(--yt);
}

[data-status="geo"] {
  --c: var(--geo);
}

[data-status="ext"] {
  --c: var(--ext);
}

[data-status="down"],
[data-status="blocked"],
[data-status="checking"] {
  --c: var(--off);
}

.dot[data-status],
.legend i[data-status] {
  background: var(--c);
}

.dot[data-status="ok"] {
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.dot[data-status="checking"],
.status[data-status="checking"] i {
  animation: blink 1s infinite;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 36px);
  overflow: hidden;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 8px 18px;
}

.side-head h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-size: 15px;
}

.count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 12px;
}

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.chip svg {
  width: 13px;
  height: 13px;
  color: var(--gold);
}

.chip b {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.chip:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.chip[aria-selected="true"] {
  border-color: transparent;
  background: var(--text);
  color: #0a0b0f;
}

.chip[aria-selected="true"] b {
  color: rgba(10, 11, 15, 0.55);
}

.channel-list {
  position: relative;
  flex: 1;
  margin: 0;
  padding: 2px 8px 10px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.group-title {
  padding: 12px 10px 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.ch {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 8px 9px 10px;
  border-radius: 14px;
  outline: none;
  cursor: pointer;
  transition: background 0.16s;
}

.ch:hover {
  background: rgba(255, 255, 255, 0.045);
}

.ch:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(25, 195, 125, 0.7);
}

.ch[aria-selected="true"] {
  background: linear-gradient(90deg, rgba(25, 195, 125, 0.17), rgba(25, 195, 125, 0.03));
  box-shadow: inset 0 0 0 1px rgba(25, 195, 125, 0.32);
}

.ch-main {
  min-width: 0;
}

.ch-name,
.ch-sub {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ch-name {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}

.ch-sub {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.ch-side {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--c, var(--off));
  white-space: nowrap;
}

.status i {
  background: currentColor;
}

.status em {
  font-style: normal;
}

.fav {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.fav svg {
  width: 16px;
  height: 16px;
}

.ch:hover .fav,
.ch:focus-within .fav,
.fav[aria-pressed="true"] {
  opacity: 1;
}

.fav:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.fav[aria-pressed="true"] {
  color: var(--gold);
}

.eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  margin-left: 8px;
  vertical-align: -1px;
}

.ch[aria-selected="true"] .eq {
  display: inline-flex;
}

.eq i {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--accent);
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}

.eq i:nth-child(2) {
  animation-delay: -0.45s;
}

.eq i:nth-child(3) {
  animation-delay: -0.2s;
}

.empty {
  padding: 36px 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Footer & toast ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px clamp(16px, 3vw, 32px) 36px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}

.footer p {
  margin: 0;
  max-width: 820px;
}

.shortcuts kbd {
  margin: 0 2px 0 8px;
}

.shortcuts kbd + kbd {
  margin-left: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(24, 27, 36, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

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

/* ---------- Theater mode ---------- */

.layout.is-theater {
  grid-template-columns: minmax(0, 1fr);
}

.layout.is-theater .player-shell {
  width: min(100%, calc((100vh - var(--topbar-h) - 60px) * 16 / 9));
  margin-inline: auto;
}

.layout.is-theater .sidebar {
  position: static;
  max-height: none;
}

.layout.is-theater .channel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 2px 8px;
}

.layout.is-theater .group-title {
  grid-column: 1 / -1;
}

/* ---------- Animations ---------- */

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

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 77, 109, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 109, 0);
  }
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0, 0 0;
  }
}

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

/* ---------- Responsive ---------- */

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .now-head {
    flex-wrap: wrap;
  }

  .now-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .channel-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 2px 8px;
  }

  .group-title {
    grid-column: 1 / -1;
  }

  .fav {
    opacity: 1;
  }

  .btn[data-action="theater"] {
    display: none;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 0px;
  }

  .topbar {
    position: relative;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 10px 14px 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    height: 40px;
  }

  .search kbd {
    display: none;
  }

  .clocks {
    margin-left: auto;
  }

  .clock {
    padding: 3px 10px;
  }

  .layout {
    gap: 12px;
    padding: 0 0 8px;
  }

  /* 让播放器成为整个布局的直接子项，滚动到频道列表时也能一直吸顶 */
  .stage {
    display: contents;
  }

  .player-shell {
    position: sticky;
    top: 0;
    z-index: 30;
    border-radius: 0;
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.9);
  }

  /* 小尺寸播放器的左上角是投屏按钮，提示改为顶部居中 */
  .unmute-chip {
    top: 10px;
    left: 0;
    right: 0;
    width: max-content;
    margin: 0 auto;
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
  }

  .now,
  .sidebar {
    margin: 0 12px;
    border-radius: 16px;
  }

  .now {
    padding: 16px;
  }

  .now-intro {
    font-size: 14.5px;
  }

  .btn .lbl {
    display: none;
  }

  .btn:has(.lbl) {
    width: 38px;
    padding: 0;
  }

  .channel-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer {
    padding-bottom: 28px;
  }

  .shortcuts {
    display: none;
  }
}

@media (max-width: 400px) {
  .clock:last-child {
    display: none;
  }
}
