:root {
  color-scheme: dark;
  --bg: #04130f;
  --bg-soft: #0a2b24;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7fbf7;
  --muted: #a9bbb5;
  --brand: #007765;
  --brand-2: #00b894;
  --gold: #d59c32;
  --gold-2: #f0b84a;
  --danger: #ff3028;
  --container: 1150px;
  --player-height: 74px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.28);
  font-family: "Montserrat", Arial, sans-serif;
}

.theme-light {
  color-scheme: light;
  --bg: #eef3f1;
  --bg-soft: #ffffff;
  --surface: rgba(0, 91, 79, 0.05);
  --surface-strong: rgba(0, 91, 79, 0.1);
  --line: rgba(0, 91, 79, 0.16);
  --text: #082822;
  --muted: #526862;
  --shadow: 0 18px 50px rgba(8, 40, 34, 0.16);
  --shadow-soft: 0 10px 26px rgba(8, 40, 34, 0.12);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  padding-bottom: calc(var(--player-height) + 38px);
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 184, 148, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(213, 156, 50, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, #02100c 100%);
  background-attachment: fixed;
}

.theme-light body,
.theme-light {
  background: var(--bg);
}

.theme-light body {
  background:
    radial-gradient(1100px 560px at 50% -10%, rgba(0, 119, 101, 0.14), transparent 60%),
    linear-gradient(180deg, #f4f8f6 0%, #e7eeeb 100%);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

/* ---------- Fondo: glow + barras de audio ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(600px 300px at 20% 20%, rgba(0, 184, 148, 0.1), transparent 70%);
}

.audio-bars {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 200px;
  z-index: 0;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 0 6px;
  pointer-events: none;
  opacity: 0.28;
  mask-image: linear-gradient(180deg, transparent, #000 75%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 75%);
}

.audio-bars span {
  flex: 1;
  height: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--gold-2), var(--brand-2) 55%, transparent);
  transform: scaleY(0.12);
  transform-origin: bottom;
  transition: transform 220ms ease;
}

body.is-playing .audio-bars span {
  animation: barDance var(--d, 900ms) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0ms);
}

@keyframes barDance {
  from { transform: scaleY(0.1); }
  to { transform: scaleY(1); }
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 5;
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand img {
  width: 104px;
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.theme-light .brand img { filter: none; }

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
  border-color: rgba(213, 156, 50, 0.45);
}

.icon-button .icon, .icon-button svg { width: 22px; height: 22px; fill: currentColor; }
.theme-dark .icon-sun, .theme-light .icon-moon { display: none; }

main { position: relative; z-index: 2; }

/* ---------- Hero ---------- */
.hero {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  min-height: 350px;
  display: grid;
  align-items: center;
  padding: 24px 0 48px;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: clamp(34px, 7vw, 74px);
  align-items: center;
  width: min(900px, 100%);
  margin: 0 auto;
}

.cover-panel {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.18));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 0 1px rgba(213, 156, 50, 0.08), 0 0 60px rgba(0, 184, 148, 0.18);
}

.cover-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.is-playing .cover-panel {
  box-shadow: var(--shadow), 0 0 0 1px rgba(213, 156, 50, 0.25), 0 0 80px rgba(0, 184, 148, 0.3);
}

.social-strip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.social-strip a {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transition: transform 180ms ease, color 180ms ease, background 180ms ease;
}

.social-strip a:hover { color: #fff; background: var(--brand); transform: translateY(-2px); }
.social-strip svg { width: 22px; height: 22px; fill: currentColor; }

.hero-info { min-width: 0; }

.live-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: linear-gradient(120deg, rgba(213, 156, 50, 0.22), rgba(213, 156, 50, 0.08));
  color: var(--gold-2);
  border: 1px solid rgba(213, 156, 50, 0.4);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-badge svg { width: 14px; height: 14px; fill: currentColor; }

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 48, 40, 0.6);
  animation: pulse 1.7s ease-out infinite;
}

@keyframes pulse { to { box-shadow: 0 0 0 9px rgba(255, 48, 40, 0); } }

.hero h1 {
  margin: 0;
  max-width: 660px;
  color: var(--text);
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.marquee-title { display: block; width: min(660px, 100%); overflow: hidden; white-space: nowrap; }
.marquee-track { display: inline-block; min-width: max-content; padding-left: 0; will-change: transform; }
.is-playing .marquee-track { padding-left: 100%; animation: titleMarquee 18s linear infinite; }

@keyframes titleMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

.hero p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 600;
  line-height: 1.35;
}

.hero-actions {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.primary-button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  background: linear-gradient(120deg, var(--gold), var(--gold-2));
  color: #20160a;
  box-shadow: 0 12px 28px rgba(213, 156, 50, 0.35);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 16px 34px rgba(213, 156, 50, 0.45); }
.primary-button svg, .play-square svg { width: 18px; height: 18px; fill: currentColor; }

.stream-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.stream-status span:not(.status-separator) { color: var(--text); }
.status-separator { width: 1px; height: 16px; background: var(--line); }

/* ---------- Historial ---------- */
.history-section {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 8px 0 36px;
}

.section-heading {
  position: relative;
  min-height: 92px;
  display: flex;
  align-items: end;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.section-heading::before {
  content: attr(data-watermark);
  position: absolute;
  left: 0;
  bottom: -8px;
  z-index: -1;
  color: var(--text);
  opacity: 0.1;
  font-size: clamp(54px, 11vw, 100px);
  line-height: 0.86;
  font-weight: 900;
}

.section-heading h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
}

.section-heading span { color: var(--gold-2); }

.history-list { display: grid; gap: 10px; }

.history-item {
  position: relative;
  min-height: 76px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  backdrop-filter: blur(6px);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.history-item:hover {
  transform: translateY(-2px);
  background: var(--surface-strong);
  border-color: rgba(213, 156, 50, 0.35);
}

.history-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--bg-soft);
}

.history-meta { min-width: 0; }

.history-kicker {
  margin-bottom: 4px;
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.history-title, .history-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-title { color: var(--text); font-size: 15px; font-weight: 800; }
.history-artist { margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 600; }
.history-number { color: var(--muted); font-size: 13px; font-weight: 900; opacity: 0.5; }

.history-empty {
  padding: 20px;
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  font-weight: 700;
  text-align: center;
}

/* ---------- Footer + tarjeta Oxira ---------- */
.site-footer {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 8px 0 28px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { width: 64px; height: auto; filter: brightness(0) invert(1); opacity: 0.9; }
.theme-light .footer-brand img { filter: none; }
.footer-brand p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; max-width: 320px; }

.oxira-card {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 184, 148, 0.14), rgba(213, 156, 50, 0.12));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, border-color 180ms ease;
}

.oxira-card:hover { transform: translateY(-2px); border-color: rgba(213, 156, 50, 0.5); }
.oxira-card-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.oxira-card-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-size: 18px; font-weight: 900; letter-spacing: 0.06em; }
.oxira-card-brand svg { width: 20px; height: 20px; fill: var(--gold-2); }
.oxira-dot { color: var(--brand-2); }

/* ---------- Mini player ---------- */
.mini-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: var(--player-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 max(16px, calc((100vw - var(--container)) / 2 + 16px));
  background: linear-gradient(180deg, rgba(6, 37, 31, 0.92), rgba(3, 22, 18, 0.98));
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.4);
}

.theme-light .mini-player {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 246, 0.98));
  color: var(--text);
  border-color: var(--line);
}

.mini-progress {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.mini-progress span {
  display: block;
  width: 34%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-2), var(--gold-2));
  transform: translateX(-100%);
}

.is-playing .mini-progress span { animation: progressMove 2.8s ease-in-out infinite; }

@keyframes progressMove {
  50% { transform: translateX(195%); }
  100% { transform: translateX(395%); }
}

.mini-left, .mini-right { min-width: 0; display: flex; align-items: center; gap: 10px; }
.mini-left { flex: 1; }

.play-square {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #20160a;
  background: linear-gradient(120deg, var(--gold), var(--gold-2));
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(213, 156, 50, 0.35);
  transition: transform 180ms ease, filter 180ms ease;
}

.play-square:hover { transform: translateY(-1px); filter: brightness(1.05); }

.mini-station, .mini-now { min-width: 0; display: grid; gap: 2px; }
.mini-station { min-width: 190px; }

.mini-station strong, .mini-now strong, .mini-station span, .mini-now span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mini-station strong, .mini-now strong { font-size: 13px; font-weight: 900; }
.mini-station span, .mini-now span { color: var(--muted); font-size: 12px; font-weight: 600; }
.theme-dark .mini-station span, .theme-dark .mini-now span { color: rgba(255, 255, 255, 0.6); }

.mini-cover {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mini-cover img { width: 100%; height: 100%; object-fit: cover; }
.mini-now { flex: 1; }

.volume-button { color: currentColor; background: transparent; border: 0; }
.volume-control { width: 120px; display: flex; align-items: center; }
.volume-control input { width: 100%; accent-color: var(--gold); cursor: pointer; }

/* ---------- Redes sociales flotantes (pila) ---------- */
.social-float {
  position: fixed;
  right: 18px;
  bottom: calc(var(--player-height) + 18px);
  z-index: 21;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-fab {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, filter 180ms ease;
  animation: fabIn 320ms ease backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.social-fab:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.06); }
.social-fab svg { width: 28px; height: 28px; fill: currentColor; }

.social-fab--whatsapp { background: #25d366; box-shadow: 0 10px 24px rgba(37, 211, 102, 0.42); }
.social-fab--facebook { background: #1877f2; box-shadow: 0 10px 24px rgba(24, 119, 242, 0.42); }
.social-fab--youtube { background: #ff0000; box-shadow: 0 10px 24px rgba(255, 0, 0, 0.38); }
.social-fab--instagram { background: radial-gradient(circle at 30% 110%, #ffd600, #ff7a00 25%, #ff0069 50%, #d300c5 75%, #7638fa); box-shadow: 0 10px 24px rgba(214, 41, 118, 0.4); }
.social-fab--tiktok { background: #0b0b0b; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); }

@keyframes fabIn {
  from { opacity: 0; transform: translateY(10px) scale(0.8); }
  to { opacity: 1; transform: none; }
}

.install-open .social-float { display: none; }

/* ---------- Instalar PWA ---------- */
.install-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--player-height) + 12px);
  z-index: 30;
}

.install-panel[hidden] { display: none; }

.install-box {
  width: min(520px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(6, 37, 31, 0.96), rgba(3, 22, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
  color: #fff;
}

.install-box img { width: 58px; height: auto; filter: brightness(0) invert(1); }
.install-copy { min-width: 0; display: grid; gap: 2px; }
.install-copy strong, .install-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-copy strong { font-size: 13px; font-weight: 900; }
.install-copy span { color: rgba(255, 255, 255, 0.7); font-size: 12px; font-weight: 600; }

.install-action {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: linear-gradient(120deg, var(--gold), var(--gold-2));
  color: #20160a;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.install-close { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; color: #fff; cursor: pointer; }
.install-close svg { width: 20px; height: 20px; fill: currentColor; }

.is-loading [data-player-icon] svg { animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  :root { --player-height: 72px; }
  body { padding-bottom: calc(var(--player-height) + 30px); }

  .site-header { width: min(var(--container), calc(100% - 28px)); padding-top: 18px; padding-bottom: 8px; }
  .hero, .history-section, .site-footer { width: min(var(--container), calc(100% - 28px)); }
  .hero { padding: 8px 0 26px; }

  .hero-shell { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 20px; }
  .cover-panel { width: min(230px, 74vw); }
  .hero-info { display: grid; justify-items: center; }
  .hero h1 { font-size: clamp(26px, 8.4vw, 34px); }
  .hero p { margin-top: 10px; font-size: 16px; }
  .hero-actions { justify-content: center; margin-top: 18px; }
  .primary-button { width: 100%; max-width: 300px; }

  .history-item { grid-template-columns: 50px minmax(0, 1fr); }
  .history-item img { width: 50px; height: 50px; }
  .history-number { display: none; }

  .footer-inner { justify-content: center; text-align: center; }
  .footer-brand { flex-direction: column; }
  .footer-brand p { max-width: none; }

  .mini-player { padding: 0 12px; }
  .mini-left { width: 100%; }
  .mini-station { min-width: 0; }
  .mini-cover { width: 40px; height: 40px; }
  .mini-right, .volume-button, .volume-control { display: none; }
  .social-float { bottom: calc(var(--player-height) + 70px); }
}

@media (max-width: 560px) {
  .brand img { width: 88px; }
  .section-heading { min-height: 76px; }
  .section-heading::before { font-size: 50px; }
  .mini-station { display: none; }
  .mini-left { gap: 10px; }
  .play-square { width: 44px; height: 44px; }
  .social-float { right: 14px; gap: 8px; }
  .social-fab { width: 48px; height: 48px; }
  .social-fab svg { width: 25px; height: 25px; }
  .install-box { grid-template-columns: 46px minmax(0, 1fr) 84px 28px; gap: 8px; padding: 10px; }
  .install-box img { width: 44px; }
  .install-action { padding: 0 10px; }
  .install-close { width: 28px; }
  .audio-bars { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
