:root {
  --bg0: #070B12;
  --bg1: #0D1624;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.08);
  --text: #EAF0F8;
  --muted: #8B9AB1;
  --accent: #FFB020;
  --live: #31E1B4;
}

* { box-sizing: border-box; }
*:focus { outline: none; }

html, body {
  margin: 0;
  height: 100%;
  background: #05080E;
  overflow: hidden;
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ico { width: 26px; height: 26px; display: block; flex: 0 0 auto; }

/* ---------- escenario 1920x1080 ---------- */
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  display: flex;
  flex-direction: column;
  padding: 30px 56px 26px;
  background:
    radial-gradient(1100px 620px at 82% -12%, rgba(255, 176, 32, 0.10), transparent 62%),
    radial-gradient(900px 560px at 4% 112%, rgba(49, 225, 180, 0.07), transparent 60%),
    linear-gradient(158deg, var(--bg0), var(--bg1));
}

/* ---------- barra superior ---------- */
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 16px; color: var(--accent); }
.brand-mark { width: 46px; height: 46px; }
.brand-name {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text);
}
.status { display: flex; align-items: center; gap: 16px; }
.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 19px;
}
.pill[hidden] { display: none; }
.pill b { color: var(--text); font-weight: 600; }
.clock {
  font-size: 30px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* ---------- cuerpo ---------- */
.body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 44px;
  margin-top: 12px;
}

.rail {
  width: 296px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 4px;
}
.rail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 60px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 23px;
  color: var(--muted);
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
.rail-item .count { font-size: 17px; opacity: 0.55; }
.rail-item.is-active { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.rail-item.is-focus {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.20), rgba(255, 176, 32, 0.03));
  box-shadow: inset 4px 0 0 var(--accent);
}

.grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 172px;
  gap: 18px;
  align-content: start;
  overflow: hidden;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: inherit;
  color: inherit;
  text-align: left;
  overflow: hidden;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card::after {
  content: "";
  position: absolute;
  inset: -40% 40% 55% -30%;
  background: radial-gradient(closest-side, hsl(var(--h, 38) 80% 55% / 0.16), transparent);
  pointer-events: none;
}
.card.is-focus {
  transform: scale(1.035);
  background: var(--surface-2);
  border-color: rgba(255, 176, 32, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.22), 0 18px 44px rgba(0, 0, 0, 0.55);
  z-index: 2;
}
.card.is-playing { border-color: rgba(49, 225, 180, 0.55); }

.card-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mono {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: hsl(var(--h, 38) 88% 84%);
  background: linear-gradient(145deg, hsl(var(--h, 38) 65% 26%), hsl(var(--h, 38) 60% 14%));
  border: 1px solid hsl(var(--h, 38) 60% 42% / 0.35);
}
.card-id { min-width: 0; }
.card-name {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.16;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  margin-top: 4px;
  font-size: 16px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 0.6px;
  color: var(--muted);
  text-transform: uppercase;
}
.live {
  display: none;
  align-items: center;
  gap: 7px;
  color: var(--live);
  font-weight: 700;
}
.live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 10px var(--live);
}
.card.is-playing .live { display: flex; }

.empty {
  grid-column: 1 / -1;
  height: 210px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 22px;
  text-align: center;
  line-height: 1.6;
}

/* ---------- dock ---------- */
.dock {
  flex: 0 0 auto;
  height: 136px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}
.now { display: flex; align-items: center; gap: 20px; min-width: 0; }
.orb {
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 1px;
  color: hsl(var(--h, 38) 88% 86%);
  background: radial-gradient(circle at 32% 26%, hsl(var(--h, 38) 70% 34%), hsl(var(--h, 38) 64% 15%));
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.035);
}
.now-txt { min-width: 0; }
.now-name {
  font-size: 28px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 560px;
}
.now-sub {
  margin-top: 5px;
  font-size: 18px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.viz {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 42px;
  margin-left: 20px;
  opacity: 0.22;
  transition: opacity 0.25s ease;
}
.viz i {
  width: 5px;
  height: 8px;
  border-radius: 3px;
  background: var(--live);
}
.viz.is-live { opacity: 1; }
.viz.is-live i { animation: eq 0.9s ease-in-out infinite alternate; }
.viz.is-live i:nth-child(1) { animation-delay: 0.00s; }
.viz.is-live i:nth-child(2) { animation-delay: 0.12s; height: 14px; }
.viz.is-live i:nth-child(3) { animation-delay: 0.24s; }
.viz.is-live i:nth-child(4) { animation-delay: 0.36s; height: 12px; }
.viz.is-live i:nth-child(5) { animation-delay: 0.48s; }
@keyframes eq {
  from { height: 6px; }
  to   { height: 40px; }
}

.actions { display: flex; gap: 12px; flex: 0 0 auto; }
.act {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 20px;
  cursor: default;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.act.is-focus {
  background: rgba(255, 176, 32, 0.16);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.18);
}
.act[data-act="stop"].is-focus {
  background: rgba(255, 92, 92, 0.16);
  border-color: #FF5C5C;
  box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.18);
}

/* ---------- toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: 30px;
  transform: translate(-50%, -16px);
  padding: 16px 28px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.94);
  color: var(--text);
  font-size: 21px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
  white-space: nowrap;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- arranque ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background:
    radial-gradient(900px 520px at 50% 40%, rgba(255, 176, 32, 0.10), transparent 65%),
    linear-gradient(160deg, #070B12, #0B1421);
  transition: opacity 0.5s ease;
}
.boot.is-out { opacity: 0; pointer-events: none; }
.boot-dial { width: 240px; height: 144px; }
.boot-needle {
  transform-origin: 110px 124px;
  animation: sweep 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes sweep {
  0%   { transform: rotate(-42deg); }
  55%  { transform: rotate(38deg); }
  100% { transform: rotate(-42deg); }
}
.boot-word {
  font-size: 74px;
  font-weight: 300;
  letter-spacing: 2px;
  margin-top: 6px;
}
.boot-sub {
  font-size: 20px;
  letter-spacing: 7px;
  text-transform: uppercase;
  color: var(--muted);
}
.boot-bar {
  margin-top: 26px;
  width: 240px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--accent);
  animation: load 1.1s ease-in-out infinite;
}
@keyframes load {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}

/* ---------- logos de emisora ---------- */
.mono.has-logo {
  width: 58px;
  height: 58px;
  padding: 7px;
  background: #F4F7FB;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.orb.has-logo {
  padding: 13px;
  background: #F4F7FB;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.035), inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.mono.has-logo img,
.orb.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ---------- rejilla con más filas que pantalla ---------- */
.grid {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding-bottom: 6px;
  overscroll-behavior: contain;
}
.grid::-webkit-scrollbar { width: 0; height: 0; }

/* deja aire para la tarjeta enfocada (que escala 1.035) dentro de la rejilla */
.card { scroll-margin: 14px; }
.grid {
  padding: 6px 2px 10px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}

/* ---------- filtros: regiones (rail) + géneros (chips) ---------- */
.main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rail {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding-right: 4px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.rail::-webkit-scrollbar { width: 0; height: 0; }
.rail-item { scroll-margin: 8px; flex: 0 0 auto; }

.chips {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 2px 2px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}
.chips::-webkit-scrollbar { width: 0; height: 0; }

.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 19px;
  white-space: nowrap;
  scroll-margin: 0 26px;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.chip .count {
  font-size: 15px;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}
.chip.is-active { color: var(--text); background: rgba(255, 255, 255, 0.075); }
.chip.is-focus {
  color: #FFFFFF;
  border-color: var(--accent);
  background: rgba(255, 176, 32, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.18);
}

/* cuatro filas completas con la fila de chips arriba */
.grid {
  grid-auto-rows: 164px;
  gap: 16px;
  padding: 6px 2px 10px;
}

/* el atributo hidden pierde contra display:flex/grid del autor */
.card[hidden], .empty[hidden] { display: none; }

/* ---------- canción que suena ---------- */
.now-song {
  margin-top: 4px;
  max-width: 620px;
  font-size: 20px;
  color: #FFD37A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-song::before { content: "♪ "; opacity: 0.75; }
.now-song[hidden] { display: none; }

/* ---------- canción en la tarjeta que suena ---------- */
.card-song {
  min-height: 18px;
  margin-top: 3px;
  font-size: 15px;
  color: #FFD37A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-song[hidden] { display: none; }
