:root {
  --y: #f8b600;
  --y2: #ffcc01;
  --ink: #050505;
  --fg: #f5f5f2;
  --muted: rgba(245, 245, 242, .62);
  --glass: rgba(14, 14, 14, .55);
  --line: rgba(255, 255, 255, .1);
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }

/* ---------- Fondo ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #000 url(/assets/poster.jpg?v=2) center 30% / cover no-repeat; }
.bg__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.bg__shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(248, 182, 0, .14), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.25) 28%, rgba(0,0,0,.35) 48%, rgba(0,0,0,.88) 72%, #000 100%);
}
.bg__grain {
  position: absolute; inset: -50%;
  opacity: .09; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}

/* ---------- Layout ---------- */
.app {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  max-width: 480px; margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 16px calc(14px + var(--safe-b));
  display: flex; flex-direction: column;
}

/* ---------- Top ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top__right { display: flex; align-items: center; gap: 8px; }

.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 10px; border-radius: 999px;
  background: rgba(0,0,0,.5); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 700; font-size: 12px; letter-spacing: .14em;
}
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: #777; }
.live[data-state="on"] .live__dot { background: #ff2d2d; box-shadow: 0 0 0 0 rgba(255,45,45,.7); animation: pulse 1.6s infinite; }
.live[data-state="off"] .live__dot { background: #666; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255,45,45,0); } 100% { box-shadow: 0 0 0 0 rgba(255,45,45,0); } }

.listeners {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px;
  background: rgba(0,0,0,.5); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.listeners svg { width: 15px; height: 15px; fill: var(--y); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--y); color: #000;
  font-weight: 700; font-size: 13px;
  transition: transform .15s ease;
}
.chip svg { width: 16px; height: 16px; }
.chip:active { transform: scale(.95); }

/* ---------- Hero ---------- */
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 0 10px; min-height: 230px; }
.logo-wrap { position: relative; width: min(46vw, 210px); aspect-ratio: 1; transition: transform .08s linear; }
.logo-wrap::before {
  content: ""; position: absolute; inset: 8%;
  background: radial-gradient(circle, rgba(248,182,0,.45), transparent 65%);
  filter: blur(26px); opacity: .55; transition: opacity .4s;
}
body.is-playing .logo-wrap::before { opacity: 1; }
.logo {
  position: relative; width: 100%; height: 100%; object-fit: contain;
  border-radius: 22%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-6px) rotate(-1deg); } }
.tagline {
  margin: 18px 0 0; font-family: var(--display); font-size: clamp(22px, 7vw, 30px);
  text-transform: uppercase; letter-spacing: .04em; line-height: 1;
  text-shadow: 0 2px 20px rgba(0,0,0,.8);
}
.tagline span { color: var(--y); }

/* ---------- Player ---------- */
.player {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
  overflow: hidden;
}
.player::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--y), transparent);
  opacity: .35; transition: opacity .4s;
}
.player[data-playing="true"]::before { opacity: 1; }

.viz { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 55%; pointer-events: none; opacity: .5; }

.np { position: relative; display: flex; align-items: center; gap: 14px; }
.art { position: relative; flex: none; width: 74px; height: 74px; border-radius: 18px; overflow: hidden; background: #000; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art__ring { position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }

.np__meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.np__label { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--y); }
.marquee { overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
.marquee__inner { display: inline-block; font-family: var(--display); font-size: 26px; line-height: 1.15; text-transform: uppercase; letter-spacing: .01em; }
.marquee.is-scrolling .marquee__inner { padding-right: 48px; animation: marquee var(--dur, 10s) linear infinite; }
@keyframes marquee { 0%, 12% { transform: translateX(0); } 100% { transform: translateX(var(--shift, -50%)); } }
.np__artist { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 20px 6px 8px; }
.ctl {
  position: relative; width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  transition: background .2s, transform .15s, color .2s;
}
.ctl svg { width: 22px; height: 22px; }
.ctl:active { transform: scale(.92); }
.ctl.is-on { color: var(--y); border-color: rgba(248,182,0,.5); }
.ctl__badge {
  position: absolute; top: -4px; right: -6px;
  min-width: 22px; padding: 2px 5px; border-radius: 999px;
  background: var(--y); color: #000; font-size: 10px; font-weight: 700; line-height: 1.2;
}

.play {
  position: relative; width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--y); color: #000;
  box-shadow: 0 10px 30px rgba(248,182,0,.35), inset 0 -4px 0 rgba(0,0,0,.15);
  transition: transform .18s cubic-bezier(.3,1.6,.5,1);
}
.play:active { transform: scale(.92); }
.play svg { width: 36px; height: 36px; fill: currentColor; grid-area: 1 / 1; transition: opacity .2s, transform .25s; }
.play .i-play { transform: translateX(2px); }
.play .i-stop { opacity: 0; transform: scale(.4); }
.player[data-playing="true"] .play .i-play { opacity: 0; transform: scale(.4); }
.player[data-playing="true"] .play .i-stop { opacity: 1; transform: none; }
.play__glow {
  position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid rgba(248,182,0,.5); opacity: 0;
}
.player[data-playing="true"] .play__glow { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.spinner {
  grid-area: 1 / 1; width: 100%; height: 100%; border-radius: 50%;
  border: 3px solid transparent; border-top-color: #000; opacity: 0;
}
.player[data-loading="true"] .spinner { opacity: 1; animation: spin .8s linear infinite; }
.player[data-loading="true"] .play svg { opacity: 0 !important; }
@keyframes spin { to { transform: rotate(360deg); } }

.vol { position: relative; display: flex; align-items: center; gap: 12px; margin: 14px 4px 0; }
.vol__btn { width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); }
.vol__btn svg { width: 22px; height: 22px; fill: currentColor; }
.vol__btn.is-muted .vol__waves { opacity: 0; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 28px; background: transparent;
  --p: 100%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 9px;
  background: linear-gradient(90deg, var(--y) var(--p), rgba(255,255,255,.15) var(--p));
}
input[type=range]::-moz-range-track { height: 5px; border-radius: 9px; background: rgba(255,255,255,.15); }
input[type=range]::-moz-range-progress { height: 5px; border-radius: 9px; background: var(--y); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; }

.history { position: relative; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.history summary { cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.history summary::-webkit-details-marker { display: none; }
.history summary::after { content: "+"; color: var(--y); font-size: 16px; line-height: 1; }
.history[open] summary::after { content: "–"; }
.history ol { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.history li { display: flex; gap: 10px; font-size: 14px; }
.history li time { flex: none; color: var(--y); font-variant-numeric: tabular-nums; width: 42px; }
.history li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history li em { font-style: normal; color: var(--muted); }

/* ---------- Footer / overlays ---------- */
.foot { display: flex; justify-content: center; gap: 8px; margin-top: 14px; font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: .06em; }

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + var(--safe-b)); background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet__card { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 22px; border-radius: 24px; background: #141414; border: 1px solid var(--line); animation: up .3s cubic-bezier(.2,1,.3,1); }
.sheet__card img { border-radius: 14px; }
.sheet__card p { margin: 0; line-height: 1.5; color: var(--muted); }
.sheet__card strong { color: var(--fg); font-size: 17px; }
.inline-i { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: #3b9cff; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; background: var(--fg); color: #000;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: opacity .25s, transform .25s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Pantallas bajas */
@media (max-height: 680px) {
  .logo-wrap { width: min(34vw, 150px); }
  .tagline { margin-top: 12px; font-size: 22px; }
  .play { width: 76px; height: 76px; }
  .controls { margin-top: 14px; }
}
/* Escritorio */
@media (min-width: 900px) {
  .bg__video { object-position: 50% 22%; }
  .bg__shade { background:
    radial-gradient(40% 55% at 50% 45%, rgba(0,0,0,.7), transparent 100%),
    radial-gradient(120% 60% at 50% 0%, rgba(248,182,0,.14), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.35) 40%, rgba(0,0,0,.88) 80%, #000 100%); }
  .app { justify-content: center; }
  .hero { flex: none; padding: 30px 0 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
