:root {
  --accent: #b7ef27;
  --accent-soft: #dbff7c;
  --ink: #f3f4ef;
  --muted: #8b9484;
  --bg: #0b0d09;
  --glass: rgba(12, 15, 10, 0.74);
  --line: rgba(243, 244, 239, 0.09);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

/* display:flex de los componentes anula el atributo hidden; lo forzamos */
[hidden] { display: none !important; }
/* ojo: los SVG no tienen propiedad .hidden, se ocultan con esta clase */
.is-hidden { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.55) 100%),
    radial-gradient(60% 40% at 50% 110%, rgba(183, 239, 39, 0.07), transparent 70%);
}

.hud { position: fixed; z-index: 5; }

/* ---------- marca ---------- */
.top {
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 26px;
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  line-height: 1;
}
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
}
.brand-fm {
  padding-bottom: 1px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status b { color: var(--ink); font-weight: 700; }
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: #b7ef27;
  box-shadow: 0 0 0 0 rgba(74, 227, 165, 0.6);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 227, 165, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(74, 227, 165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 227, 165, 0); }
}

/* ---------- explorador ---------- */
.explorer {
  position: fixed;
  z-index: 6;
  top: 108px;
  left: 26px;
  width: 330px;
  max-height: calc(100dvh - 240px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s;
}
.explorer.closed { transform: translateX(-120%); opacity: 0; pointer-events: none; }

.explorer-head { padding: 12px; border-bottom: 1px solid var(--line); }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--muted);
  transition: border-color 0.18s, background 0.18s;
}
.search:focus-within { border-color: rgba(183, 239, 39, 0.5); background: rgba(255, 255, 255, 0.075); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}
.search input::placeholder { color: #79826f; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font: inherit;
  font-size: 10px;
  color: #6d7666;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row:not(:empty) { margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(183, 239, 39, 0.35);
  background: rgba(183, 239, 39, 0.12);
  color: var(--accent-soft);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { background: rgba(183, 239, 39, 0.2); }
.chip span { opacity: 0.7; }

.explorer-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: #2a3024 transparent;
}
.explorer-body::-webkit-scrollbar { width: 8px; }
.explorer-body::-webkit-scrollbar-thumb { background: #2a3024; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }

.section-title {
  padding: 10px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7463;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 4px;
}
.section-head .back {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 244, 239, 0.04);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.section-head .back:hover { color: var(--ink); border-color: rgba(243, 244, 239, 0.22); }
.section-head span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7463;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.more {
  padding: 14px 12px 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s;
}
.row:hover, .row:focus-visible { background: rgba(255, 255, 255, 0.06); outline: none; }
.row.active { background: rgba(183, 239, 39, 0.14); }

.row .flag {
  display: grid;
  place-items: center;
  width: 24px;
  height: 17px;
  flex: none;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.flag-img {
  width: 20px;
  height: 14px;
  object-fit: cover;
  display: inline-block;
  vertical-align: -2px;
  border-radius: 2px;
}
.row .flag .flag-img,
.flag .flag-img { width: 100%; height: 100%; border-radius: 0; vertical-align: 0; }
.flag-code { font-size: 9px; font-weight: 800; letter-spacing: 0.04em; color: #b9c6da; }
.row .ico { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; background: #1a2130; flex: none; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.row-main b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-live {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #b7ef27;
  border: 1px solid rgba(74, 227, 165, 0.35);
  border-radius: 5px;
  padding: 2px 5px;
  flex: none;
}
.empty { padding: 26px 14px; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.explorer-foot { padding: 8px; border-top: 1px solid var(--line); }
.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ghost:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.04); }

/* ---------- botones flotantes ---------- */
.toggle.icon-btn {
  position: fixed;
  z-index: 7;
  top: 26px;
  left: 26px;
  display: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn:active { transform: scale(0.94); }

.dice {
  position: fixed;
  z-index: 6;
  right: 26px;
  bottom: 26px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(183, 239, 39, 0.35);
  background: linear-gradient(180deg, rgba(183, 239, 39, 0.2), rgba(183, 239, 39, 0.09));
  color: var(--accent-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(150, 200, 25, 0.18);
  transition: transform 0.15s, box-shadow 0.2s;
}
.dice:hover { transform: translateY(-1px); box-shadow: 0 14px 38px rgba(150, 200, 25, 0.3); }
.dice:active { transform: translateY(0) scale(0.97); }
.dice.spin svg { animation: spin 0.5s ease; }
@keyframes spin { to { transform: rotate(180deg); } }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  padding: 8px 11px;
  max-width: 240px;
  border-radius: 10px;
  background: rgba(8, 11, 19, 0.92);
  border: 1px solid rgba(183, 239, 39, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  transform: translate(14px, -50%);
  transition: opacity 0.12s;
}
.tooltip b { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.tooltip span { display: block; margin-top: 2px; font-size: 11px; color: var(--accent-soft); }

.hint {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: #6d7c93;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: opacity 0.6s;
  pointer-events: none;
}
.hint.gone { opacity: 0; }

/* ---------- reproductor ---------- */
.player {
  position: fixed;
  z-index: 9;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(620px, calc(100vw - 48px));
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(10, 14, 23, 0.86);
  backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--shadow);
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.art-wrap {
  width: 46px; height: 46px;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #1b2434, #0e1420);
  display: grid;
  place-items: center;
}
.art-wrap img { width: 100%; height: 100%; object-fit: cover; display: none; }
.art-wrap img.on { display: block; }
.art-wrap span { font-size: 17px; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; }

.meta { flex: 1; min-width: 0; }
.meta .name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 34px;
  flex: none;
  opacity: 0.5;
  transition: opacity 0.3s;
}
.eq.on { opacity: 1; }
.eq i {
  width: 3.5px;
  height: 4px;
  border-radius: 2px;
  /* degradado suave: oscuro abajo, lima arriba */
  background: linear-gradient(
    to top,
    #232b1d 0%,
    #3b4a2a 30%,
    #6d8f2f 58%,
    var(--accent) 80%,
    var(--accent-soft) 100%
  );
  will-change: height;
}

.play {
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #0d1206;
  box-shadow: 0 6px 20px rgba(183, 239, 39, 0.35);
}
.play:hover { background: #c8ff3f; }

.fav-btn { color: var(--muted); }
.fav-btn.on { color: var(--accent); }
.fav-btn.on svg { fill: var(--accent); }

.row .fav {
  flex: none;
  padding-left: 4px;
  font-size: 13px;
  line-height: 1;
  color: #3a4433;
  transition: color 0.15s;
}
.row .fav.on { color: var(--accent); }
.row:hover .fav { color: #6b7661; }
.row:hover .fav.on { color: var(--accent-soft); }
.flag.fav-flag { color: var(--accent); font-size: 12px; }

.vol { display: flex; align-items: center; gap: 6px; flex: none; }
.vol .icon-btn { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); }
.vol .icon-btn:hover { color: var(--ink); background: none; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 76px;
  height: 3px;
  border-radius: 3px;
  background: #2a3024;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 90, 0.35);
  background: rgba(30, 12, 12, 0.92);
  color: #ffd9cf;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  animation: drop 0.25s ease;
}
@keyframes drop {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- móvil ---------- */
@media (max-width: 780px) {
  .top { padding: 16px; }
  .brand-word { font-size: 26px; }
  .status { display: none; }
  .toggle.icon-btn { display: inline-grid; top: 18px; left: 18px; }
  .brand { margin-left: 46px; }

  .explorer {
    top: 82px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 52dvh;
  }

  .player {
    bottom: 14px;
    width: calc(100vw - 24px);
    gap: 10px;
    padding: 9px 11px;
  }
  .vol, .eq { display: none; }
  .dice {
    right: 12px;
    bottom: 84px;
    padding: 10px;
  }
  .dice span { display: none; }
  .hint { display: none; }
}
