:root {
  --bg-primary: #000000; /* pure black = transparent on the additive display */
  --bg-secondary: #0a0a0f;
  --bg-card: #1a1a2e;
  --bg-card-hi: #232338;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.45);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
}

#app { width: 100%; height: 100%; position: relative; }

/* --- Screens --- */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
}
.header h1 { font-size: 24px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-meta { font-size: 14px; color: var(--text-secondary); }
.status-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  background: rgba(0, 212, 255, 0.18);
  color: var(--accent-primary);
}
.live-pill { background: rgba(255, 68, 102, 0.2); color: var(--danger); }

.back-btn {
  background: transparent;
  color: var(--text-primary);
  font-size: 30px;
  line-height: 1;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
}

/* --- Content / channel list --- */
.content { flex: 1; overflow-y: auto; padding: 16px 20px; }
.placeholder { color: var(--text-secondary); font-size: 18px; text-align: center; padding: 40px 0; }

.group-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 14px 4px 8px;
}
.group-label:first-child { margin-top: 0; }

.channel-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.channel-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 4px;
}
.channel-meta { flex: 1; min-width: 0; }
.channel-name { font-size: 22px; font-weight: 600; }
.channel-sub { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.channel-card.featured { background: var(--bg-card-hi); border-color: rgba(255, 68, 102, 0.4); }

/* --- Focus (D-pad) --- */
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px var(--focus-glow);
}
.channel-card.focusable:focus { background: var(--bg-card-hi); }

/* --- Player --- */
.player-stage {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(0, 0, 0, 0.55);
  text-align: center;
  padding: 24px;
}
.player-overlay.hidden { display: none; }
.overlay-msg { font-size: 18px; color: var(--text-secondary); max-width: 420px; }
.overlay-msg.error { color: var(--danger); }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  background: var(--accent-primary);
  color: #001018;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.btn.focusable:focus { border-color: #fff; box-shadow: 0 0 0 2px var(--focus-glow); }
