/* ===========================================================
   Streaming Pablo — dark neon / synthwave theme
   =========================================================== */

:root {
  --bg: #070310;
  --bg-2: #0d0620;
  --ink: #f3e9ff;
  --muted: #b9a9d8;
  --dim: #7a6b9a;
  --magenta: #ff3bd4;
  --violet: #9b6bff;
  --pink: #ff5ca8;
  --line: rgba(155, 107, 255, 0.22);
  --glass: rgba(18, 9, 36, 0.55);
  --accent: var(--magenta); /* overridden per-service in the player */
  --ui-pad: clamp(16px, 3vw, 34px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Rajdhani", system-ui, sans-serif;
  overflow: hidden; /* immersive single screen */
}

body { position: relative; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---------- WebGL canvas ---------- */
#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#scene canvas { display: block; touch-action: none; }

/* ---------- Atmosphere overlay (vignette + grain) ---------- */
#atmos {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 18%, transparent 40%, rgba(7, 3, 16, 0.55) 78%, rgba(7, 3, 16, 0.92) 100%),
    radial-gradient(80% 60% at 50% 120%, rgba(255, 59, 212, 0.10), transparent 60%);
  mix-blend-mode: normal;
}
#atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: radial-gradient(60% 60% at 50% 45%, var(--bg-2), var(--bg));
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.defrag {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
  width: 168px;
  height: 168px;
  filter: drop-shadow(0 0 18px rgba(255, 59, 212, 0.35));
}
.defrag .cell {
  border: 1px solid rgba(155, 107, 255, 0.18);
  background: rgba(155, 107, 255, 0.04);
  border-radius: 2px;
  animation: defrag 1.5s ease-in-out infinite;
}
@keyframes defrag {
  0%, 100% { background: rgba(155, 107, 255, 0.04); box-shadow: none; border-color: rgba(155, 107, 255, 0.16); }
  42%, 58% { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); border-color: var(--magenta); }
}
.boot-text {
  position: relative;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.42em;
  font-size: 0.72rem;
  color: var(--muted);
}
.boot-text::before, .boot-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  overflow: hidden;
}
.boot-text::before { color: var(--magenta); animation: glitchA 2.2s infinite steps(2); }
.boot-text::after { color: #38f0ff; animation: glitchB 2.6s infinite steps(2); }
@keyframes glitchA {
  0%, 100% { transform: translate(0); clip-path: inset(0 0 78% 0); }
  50% { transform: translate(-2px, 1px); clip-path: inset(38% 0 30% 0); }
}
@keyframes glitchB {
  0%, 100% { transform: translate(0); clip-path: inset(78% 0 0 0); }
  50% { transform: translate(2px, -1px); clip-path: inset(22% 0 48% 0); }
}

/* ---------- UI chrome layer ---------- */
#ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none; /* let drags reach the canvas; re-enable on controls */
}
#ui button,
#ui a,
#ui nav { pointer-events: auto; }

/* Topbar */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ui-pad);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 26px; height: 26px;
  border: 1.5px solid var(--magenta);
  transform: rotate(45deg);
  box-shadow: 0 0 14px rgba(255, 59, 212, 0.6), inset 0 0 8px rgba(255, 59, 212, 0.4);
}
.brand-text {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
  color: var(--ink);
}
.brand-text strong { color: var(--magenta); margin-left: 0.35em; }

.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  backdrop-filter: blur(8px);
}
.menu-btn em {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
}
.menu-btn span {
  display: block; width: 16px; height: 2px; border-radius: 2px;
  background: var(--ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.menu-btn span + span { margin-top: 4px; }

/* Left nav */
#nav {
  position: absolute;
  left: var(--ui-pad);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  padding: 7px 0;
  text-align: left;
  color: var(--dim);
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  transition: color 0.25s ease, transform 0.25s ease;
}
.nav-item .bullet {
  width: 7px; height: 7px; flex: none;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.nav-item:hover,
.nav-item.active { color: var(--ink); transform: translateX(4px); }
.nav-item:hover .bullet,
.nav-item.active .bullet {
  background: var(--c, var(--magenta));
  box-shadow: 0 0 12px var(--c, var(--magenta));
}

/* Bottom bar */
#bottombar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: var(--ui-pad);
  font-size: 0.72rem;
}
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  backdrop-filter: blur(8px);
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--magenta); }
.ghost-btn svg { width: 18px; height: 18px; }
.ghost-btn em { font-style: normal; }
.ghost-btn .ico-off { display: none; }
.ghost-btn[aria-pressed="false"] .ico-on { display: none; }
.ghost-btn[aria-pressed="false"] .ico-off { display: inline; }

.hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  letter-spacing: 0.16em;
  font-weight: 500;
}
.hint svg { width: 15px; height: 15px; opacity: 0.8; }

.credit {
  margin: 0;
  color: var(--dim);
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* ---------- Player overlay ---------- */
.player {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.player.open { opacity: 1; visibility: visible; pointer-events: auto; }
.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 12, 0.72);
  backdrop-filter: blur(14px) saturate(120%);
}
.player-window {
  position: relative;
  width: min(720px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(20, 10, 38, 0.96), rgba(10, 5, 22, 0.96));
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 20px;
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.9), 0 0 60px -20px var(--accent);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.player.open .player-window { transform: none; }
.player-window::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  border-radius: 20px 20px 0 0;
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
}
.player-tag {
  display: inline-block;
  font-family: "Orbitron", sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.34em;
  color: var(--accent);
  margin-bottom: 4px;
}
.player-name {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  letter-spacing: 0.04em;
}
.player-close {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.player-close svg { width: 20px; height: 20px; }
.player-close:hover { background: var(--accent); color: #120018; border-color: var(--accent); transform: rotate(90deg); }

.player-body { padding: 6px 22px 8px; }

/* embed frames */
.frame {
  background: #05030b;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.frame iframe { display: block; width: 100%; border: 0; }
.frame.tv { position: relative; aspect-ratio: 16 / 9; }
.frame.tv iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- themed radio player (AzuraCast API + native audio) ---------- */
.radio-player {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  background:
    radial-gradient(130% 150% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 58%),
    #0a0518;
}
.rp-art {
  position: relative;
  width: 104px; height: 104px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 40%, #15082b), #0a0518);
  box-shadow: 0 0 26px -6px var(--accent);
}
.rp-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.radio-player.no-art .rp-art img { display: none; }
.rp-art-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: "Orbitron", sans-serif; font-weight: 900; font-size: 2.4rem;
  color: color-mix(in srgb, var(--accent) 75%, #fff);
}
.rp-info { min-width: 0; }
.rp-status { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; letter-spacing: 0.16em; font-weight: 700; color: var(--accent); }
.rp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.6s infinite; }
.rp-dot.off { background: var(--dim); box-shadow: none; animation: none; }
.rp-listeners { color: var(--dim); font-weight: 600; letter-spacing: 0.04em; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.rp-title { font-family: "Orbitron", sans-serif; font-weight: 700; font-size: 1.02rem; margin-top: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-artist { color: var(--muted); font-size: 0.92rem; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.rp-play {
  flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #120018; border: 0;
  box-shadow: 0 0 22px -4px var(--accent);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.rp-play:hover { transform: scale(1.06); filter: brightness(1.08); }
.rp-play svg { width: 22px; height: 22px; }
.rp-play svg:nth-child(2) { display: none; }
.radio-player.is-playing .rp-play svg:nth-child(1) { display: none; }
.radio-player.is-playing .rp-play svg:nth-child(2) { display: block; }
.rp-eq { display: flex; align-items: flex-end; gap: 3px; height: 22px; opacity: 0.35; }
.rp-eq i { width: 3px; height: 5px; background: var(--accent); border-radius: 2px; box-shadow: 0 0 6px var(--accent); }
.radio-player.is-playing .rp-eq { opacity: 1; }
.radio-player.is-playing .rp-eq i { animation: eq 0.9s ease-in-out infinite; }
.rp-eq i:nth-child(1) { animation-delay: 0s; }
.rp-eq i:nth-child(2) { animation-delay: 0.18s; }
.rp-eq i:nth-child(3) { animation-delay: 0.36s; }
.rp-eq i:nth-child(4) { animation-delay: 0.12s; }
.rp-eq i:nth-child(5) { animation-delay: 0.28s; }
@keyframes eq { 0%, 100% { height: 5px; } 50% { height: 20px; } }
.rp-vol { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); }
.rp-vol svg { width: 18px; height: 18px; }
.rp-vol input { width: 88px; accent-color: var(--accent); }

/* ---------- coming soon ---------- */
.soon-card { text-align: center; padding: 32px 18px 26px; }
.soon-glyph { color: var(--accent); margin: 0 auto 14px; filter: drop-shadow(0 0 16px var(--accent)); }
.soon-glyph svg { width: 64px; height: 64px; }
.soon-tag { font-family: "Orbitron", sans-serif; letter-spacing: 0.3em; font-size: 0.6rem; color: var(--accent); }
.soon-card h3 { font-family: "Orbitron", sans-serif; margin: 8px 0 10px; font-size: 1.4rem; }
.soon-card p { color: var(--muted); max-width: 430px; margin: 6px auto; line-height: 1.55; }
.soon-card .soon-sub { color: var(--dim); font-size: 0.9rem; }

/* about face */
.about-card { padding: 4px 2px 10px; }
.about-card p { color: var(--muted); line-height: 1.6; }
.about-card .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.about-card .links a {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-weight: 600; letter-spacing: 0.08em;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.about-card .links a:hover { border-color: var(--accent); color: var(--accent); }

/* quick switch bar */
.player-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 22px 22px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.switch-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  transition: all 0.2s ease;
}
.switch-item:hover { color: var(--ink); border-color: var(--c, var(--accent)); }
.switch-item.active {
  color: #120018;
  background: var(--c, var(--accent));
  border-color: var(--c, var(--accent));
}

/* ---------- Fallback (no WebGL) ---------- */
#fallback {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  background: radial-gradient(70% 70% at 50% 20%, var(--bg-2), var(--bg));
}
.fallback-inner { max-width: 760px; margin: 0 auto; padding: 64px 22px; }
#fallback h1 { font-family: "Orbitron", sans-serif; letter-spacing: 0.16em; text-shadow: 0 0 24px rgba(255, 59, 212, 0.4); }
#fallback p { color: var(--muted); }
.fallback-list { display: grid; gap: 18px; margin: 26px 0; }
.fallback-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: rgba(18, 9, 36, 0.5); }
.fallback-card h2 { margin: 0 0 12px; font-family: "Orbitron", sans-serif; font-size: 1.05rem; }
.fallback-card iframe { width: 100%; border: 0; border-radius: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  /* compact, always-visible nav (no menu button) */
  #nav { gap: 2px; left: calc(var(--ui-pad) - 4px); }
  .nav-item { font-size: 0.7rem; letter-spacing: 0.1em; padding: 6px 0; }
  .nav-item .label { text-shadow: 0 1px 6px rgba(7, 3, 16, 0.9); }
  #bottombar { flex-wrap: wrap; justify-content: center; text-align: center; gap: 10px; }
  .hint { display: none; }
  .credit { width: 100%; text-align: center; }
  .player-window { max-height: 92vh; border-radius: 16px; }
}

@media (max-width: 520px) {
  .player-body { padding: 6px 14px 8px; }
  .radio-player { grid-template-columns: 1fr; text-align: center; }
  .radio-player .rp-art { margin: 0 auto; }
  .radio-player .rp-status, .radio-player .rp-controls { justify-content: center; }
}

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