:root {
  --ground:      #F2F6FA;
  --panel:       #FFFFFF;
  --ink:         #1B2A47;
  --ink-soft:    #566379;
  --ink-faint:   #8D97A9;
  --rule:        #DDE5ED;
  --accent:      #E02020;
  --on-accent:   #FFFFFF;
  --warn:        #B45309;
  --warn-bg:     #FEF3C7;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:    #0F1826;
    --panel:     #182334;
    --ink:       #EEF1F7;
    --ink-soft:  #A3AEC2;
    --ink-faint: #6E7B92;
    --rule:      #27364B;
    --accent:    #FF3B3B;
    --on-accent: #FFFFFF;
    --warn:      #FCD34D;
    --warn-bg:   #3A2E12;
  }
}

:root[data-theme="dark"] {
  --ground:    #0F1826;
  --panel:     #182334;
  --ink:       #EEF1F7;
  --ink-soft:  #A3AEC2;
  --ink-faint: #6E7B92;
  --rule:      #27364B;
  --accent:    #FF3B3B;
  --on-accent: #FFFFFF;
  --warn:      #FCD34D;
  --warn-bg:   #3A2E12;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vh, 34px);
  max-width: 1060px;
  margin: 0 auto;
  padding:
    calc(clamp(16px, 2.6vh, 30px) + env(safe-area-inset-top, 0px))
    clamp(20px, 4vw, 48px)
    calc(clamp(16px, 2.6vh, 30px) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.brand img {
  width: clamp(186px, 21vw, 252px);
  height: auto;
  display: block;
}

.brand p {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(11px, 1.15vw, 12.5px);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  text-indent: .28em;
}

.onair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.onair .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: .45;
  transition: opacity .3s ease;
}

body.is-playing .onair .dot {
  animation: breathe 2.6s ease-in-out infinite;
}

@keyframes breathe { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
  min-height: 0;
}

.player {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  padding: clamp(26px, 4vh, 44px) clamp(26px, 3.4vw, 42px);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(27, 42, 71, .04), 0 10px 30px rgba(27, 42, 71, .06);
  min-width: 0;
}

.label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 9px;
}

.track {
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -.02em;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.artist {
  font-size: clamp(14px, 1.5vw, 16px);
  font-weight: 300;
  color: var(--ink-soft);
  margin: 7px 0 0;
  overflow-wrap: anywhere;
}

.transport { display: flex; align-items: center; gap: 18px; }

.play {
  position: relative;
  width: clamp(56px, 6vw, 64px);
  height: clamp(56px, 6vw, 64px);
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(224, 32, 32, .22);
  transition: transform .16s ease, filter .16s ease;
}

.play:hover  { transform: scale(1.04); filter: brightness(1.08); }
.play:active { transform: scale(.98); }
.play svg { width: 21px; height: 21px; fill: currentColor; }

.play .icon-pause { display: none; }
.play[aria-pressed="true"] .icon-play  { display: none; }
.play[aria-pressed="true"] .icon-pause { display: block; }

.play .spinner { display: none; }

.play.is-loading { cursor: wait; }
.play.is-loading .icon-play,
.play.is-loading .icon-pause { visibility: hidden; }

.play.is-loading .spinner {
  display: block;
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: girar .7s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }

.controls { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }

.status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.volume { display: flex; align-items: center; gap: 10px; }

.mute {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}

.mute svg { width: 15px; height: 15px; fill: currentColor; }
.mute .icon-muted { display: none; }
body.is-muted .mute .icon-vol   { display: none; }
body.is-muted .mute .icon-muted { display: block; }
body.is-muted .mute { color: var(--accent); }

input[type="range"] {
  flex: 1; min-width: 0; height: 3px;
  -webkit-appearance: none; appearance: none;
  background: var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.alert {
  margin: 0;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .04em;
}

.recent {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 4px;
}

.recent ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.recent li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  align-items: baseline;
  padding: clamp(9px, 1.5vh, 13px) 0;
  border-top: 1px solid var(--rule);
}

.recent li:last-child { border-bottom: 1px solid var(--rule); }

.recent time {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.rt {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.32;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ra { font-size: 12.5px; font-weight: 300; color: var(--ink-faint); }

.recent-empty {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-faint);
}

.ad-slot {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  min-height: 250px;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  flex-wrap: wrap;
  padding-top: clamp(12px, 2vh, 18px);
  border-top: 1px solid var(--rule);
}

.acciones {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.social {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: color .16s ease, border-color .16s ease;
}

.social:hover,
.social:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.social svg { width: 16px; height: 16px; fill: currentColor; }

button.social {
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.social .icon-ok { display: none; }

.social.copiado { color: var(--accent); border-color: var(--accent); }
.social.copiado .icon-share { display: none; }
.social.copiado .icon-ok    { display: block; }

.legal {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--ink-faint);
  margin: 0;
}

.legal a { color: var(--ink-soft); text-decoration: none; }
.legal a:hover { color: var(--accent); }
.legal .sep { color: var(--rule); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  body.is-playing .onair .dot { animation: none; opacity: 1; }
  .play, .socials a { transition: none; }
  .play.is-loading .spinner { animation-duration: 2s; }
}

@media (max-width: 860px) {
  .main { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .recent { padding-top: 0; }
}

@media (max-width: 460px) {
  .topbar { gap: 11px; }
  .transport { gap: 14px; }
  .foot { justify-content: center; text-align: center; }
  .legal { justify-content: center; }
}
