:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-border: #21262d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #2f81f7;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* ---------- 顶栏 ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 { font-size: 18px; font-weight: 600; }
.brand .sub { color: var(--text-dim); font-size: 12px; }

.status-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.dot-online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-connecting { background: var(--yellow); animation: blink 1s infinite; }
.dot-offline, .dot-error { background: var(--red); }

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

/* ---------- 地址栏 ---------- */
.url-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.url-bar input {
  flex: 1;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-family: Consolas, monospace;
}
.url-bar input:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: var(--radius);
  padding: 9px 22px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { filter: brightness(1.15); }
button.secondary { background: #30363d; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 播放器 ---------- */
.player {
  position: relative;
  background: #000;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.player video {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.6);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  text-align: center;
  padding: 20px;
}
.overlay.show { opacity: 1; }

.reconnect-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(210, 153, 34, 0.9);
  color: #1b1f24;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  display: none;
}
.reconnect-badge.show { display: block; }

/* ---------- 统计 & 开关 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat .label { font-size: 11px; color: var(--text-dim); }
.stat .value {
  font-size: 16px;
  font-family: Consolas, monospace;
  margin-top: 2px;
}

/* ---------- 开关 ---------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--panel-border); }

.switch-row .name { font-size: 13px; }
.switch-row .desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute; inset: 0;
  background: #30363d;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: 0.4; cursor: not-allowed; }

.badge-soon {
  font-size: 10px;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
}

footer {
  margin-top: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
