@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Work+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --void: #0B0D10;
  --panel: #14171C;
  --panel-raised: #1B1F26;
  --line: #262B33;
  --signal: #E8452C;
  --signal-dim: #7A2A1E;
  --scan: #3FD9C7;
  --paper: #EDEAE2;
  --mute: #8A8F98;

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--signal); color: var(--void); }

:focus-visible {
  outline: 2px solid var(--scan);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(6px);
  z-index: 50;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wordmark .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-dim);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--mute);
}

.topnav a {
  padding: 6px 10px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.topnav a:hover, .topnav a.active {
  color: var(--paper);
  background: var(--panel-raised);
}

#clock { color: var(--scan); }

.guide-strip {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 2px 28px 14px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.guide-card {
  flex: 0 0 auto;
  width: 148px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
  position: relative;
}

.guide-card:hover { transform: translateY(-2px); border-color: var(--scan); }
.guide-card.active { border-color: var(--signal); background: var(--panel-raised); }

.guide-card .ch-num { font-family: var(--font-mono); font-size: 11px; color: var(--mute); }

.guide-card .ch-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-card .ch-status {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse 1.6s infinite ease-in-out;
}

@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

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

.ch-status.live { color: var(--signal); }
.ch-status.off { color: var(--mute); }

.hero { padding: 24px 28px; max-width: 1280px; margin: 0 auto; }

.hero-frame {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.hero-frame iframe, .hero-frame video { width: 100%; height: 100%; border: 0; display: block; }

.hero-frame.tuning::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, #222 0px, #222 1px, #000 1px, #000 3px);
  z-index: 5;
  animation: static-flicker 0.35s steps(6) 2;
}

@keyframes static-flicker { 0% { opacity: 1; } 100% { opacity: 0; } }

.off-air {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle at 50% 40%, #1a1d22, #0a0b0d 70%);
}

.off-air .bars { display: flex; gap: 6px; margin-bottom: 10px; }
.off-air .bars span { width: 10px; height: 40px; background: var(--line); }
.off-air .bars span:nth-child(2) { background: var(--signal-dim); }
.off-air .bars span:nth-child(4) { background: var(--scan); opacity: 0.4; }

.off-air h3 { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; margin: 0; color: var(--mute); }

.hero-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-title-block { display: flex; align-items: center; gap: 12px; }
.hero-title-block img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); }

.hero-name { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.hero-sub { font-size: 13px; color: var(--mute); max-width: 560px; }

.on-air-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--signal);
  color: var(--signal);
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-count { font-family: var(--font-mono); font-size: 13px; color: var(--scan); }

.platform-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--panel-raised);
  color: var(--mute);
  border: 1px solid var(--line);
  letter-spacing: 0.5px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 28px;
  margin: 34px auto 12px;
  max-width: 1280px;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 28px 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.roster-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.roster-card:hover { border-color: var(--scan); }

.roster-thumb { aspect-ratio: 16/9; background: var(--panel-raised); position: relative; overflow: hidden; }
.roster-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.roster-thumb.offline img { filter: grayscale(1) brightness(0.5); }

.roster-live-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--signal);
  color: var(--void);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.roster-viewers {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 3px;
}

.roster-body { padding: 10px 12px; }
.roster-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.roster-title { font-size: 12px; color: var(--mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ticker {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 0;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-track {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--scan);
  animation: scroll-left 30s linear infinite;
  padding-left: 100%;
}

@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; padding-left: 0; } }

@keyframes scroll-left { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.ticker-track span { margin-right: 48px; }

.clips-wrap { max-width: 1280px; margin: 0 auto; padding: 28px; }

.clips-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.clips-header h1 { font-family: var(--font-display); font-size: 32px; margin: 0; }

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--signal);
  color: var(--void);
  border: none;
  padding: 10px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s ease;
}

.btn:hover { filter: brightness(1.1); }
.btn.secondary { background: transparent; color: var(--paper); border: 1px solid var(--line); }

.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.clip-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.clip-card video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }
.clip-card.vertical video { aspect-ratio: 9/16; max-height: 480px; margin: 0 auto; }
.orientation-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--scan);
  color: var(--void);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.clip-body { padding: 12px 14px; }
.clip-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }

.clip-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.clip-tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.clip-tags span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--scan);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 3px;
}

.ai-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--void);
  background: var(--scan);
  border-radius: 3px;
  padding: 2px 6px;
  font-weight: 600;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 60px 20px;
  text-align: center;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 13px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
}

.modal h2 { font-family: var(--font-display); font-size: 22px; margin: 0 0 16px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.field input[type="text"], .field select, .field input[type="file"] {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 10px;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
}

.field input:focus, .field select:focus { border-color: var(--scan); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.form-error { color: var(--signal); font-family: var(--font-mono); font-size: 12px; margin-top: 8px; display: none; }

.loading-row { padding: 28px; text-align: center; color: var(--mute); font-family: var(--font-mono); font-size: 13px; }

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .guide-strip, .hero, .section-label, .roster-grid, .clips-wrap { padding-left: 16px; padding-right: 16px; }
  .hero-name { font-size: 20px; }
}
