:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --text: #e8ecf1;
  --muted: #9aa4b2;
  --accent: #3ea6ff;
  --live: #ff4d4f;
  --border: #262c35;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --panel-2: #eef1f5;
    --text: #1a1f26;
    --muted: #5b6572;
    --accent: #1769d1;
    --live: #e0353a;
    --border: #dce1e8;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.2px; }

.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-live { background: var(--live); color: #fff; }
.badge-live::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #fff;
  vertical-align: middle;
  animation: pulse 1.4s infinite;
}
.badge-off { background: var(--panel-2); color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.visits {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.visits svg { opacity: 0.75; }
.visits b { color: var(--accent); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.visits-label { opacity: 0.85; }
@media (max-width: 480px) { .visits-label { display: none; } }

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

.stage {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}
.player { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }

.offline {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.offline img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(0.35) brightness(0.7); }
.offline-note {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.65); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-size: 0.85rem;
}
.hidden { display: none !important; }

.archive { margin-top: 30px; }
.archive h2 { font-size: 1.05rem; margin: 0 0 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .thumb {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--panel-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 2rem;
}
.card .meta { padding: 8px 10px; }
.card .date { font-weight: 600; font-size: 0.95rem; }
.card .size { color: var(--muted); font-size: 0.8rem; }
.empty { color: var(--muted); }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal-inner { width: min(960px, 100%); position: relative; }
.modal-inner .player { aspect-ratio: 16 / 9; border-radius: 10px; }
.modal-title { color: #fff; margin-top: 10px; text-align: center; }
.modal-close {
  position: absolute; top: -14px; right: -6px;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: #fff; color: #000;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
