:root {
  color-scheme: dark;
  --ink: #080b10;
  --panel: #10151b;
  --line: #33404b;
  --muted: #9ca8b1;
  --paper: #eef1e7;
  --cyan: #75d5da;
  --red: #ff5548;
  --green: #69d59a;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--ink);
  color: var(--paper);
  font-family: "Courier New", Courier, monospace;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: .26;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px);
}

.now-playing-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.module-heading p,
.module-code,
.status-label {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.now-playing {
  border: 1px solid var(--line);
  background: rgba(16, 21, 27, .91);
  box-shadow: 10px 10px 0 rgba(255, 85, 72, .06);
}

.recent-signals {
  margin-top: 22px;
  border: 1px solid var(--line);
  background: rgba(16, 21, 27, .91);
}

.module-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 0 18px;
}

.module-heading { border-bottom: 1px solid var(--line); }
.module-code { margin-left: auto; color: var(--cyan); }

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}

.track-panel {
  display: grid;
  grid-template-columns: minmax(190px, 280px) 1fr;
  gap: clamp(24px, 5vw, 54px);
  align-items: center;
  padding: clamp(20px, 5vw, 48px);
}

.artwork-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #19232d;
  border: 1px solid #61707e;
  box-shadow: 8px 8px 0 #040506;
}

#album-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #19232d;
}

.artwork-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--red);
  font-family: Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(135deg, #1f2b35, #07090d);
}

/* The visual fallback must not cover a successfully loaded live image. */
.artwork-fallback[hidden] {
  display: none;
}

.track-details { min-width: 0; }
.status-label { color: var(--green); font-weight: 700; }

.artist {
  margin: 18px 0 4px;
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  font-weight: 700;
}

h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Arial, sans-serif;
  font-size: clamp(1.8rem, 4.25vw, 3.6rem);
  letter-spacing: -.055em;
  line-height: .94;
}

.album { min-height: 1.2em; margin: 18px 0 26px; color: var(--muted); }

.listen-link {
  display: inline-block;
  border: 1px solid var(--red);
  color: var(--paper);
  background: transparent;
  font: inherit;
  font-size: .78rem;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
}

.listen-link { padding: 12px 15px; }
.listen-link:hover,
.listen-link:focus-visible { background: var(--red); color: var(--ink); outline: none; }

.recent-track-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-track {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(51, 64, 75, .7);
}

.recent-track:last-child { border-bottom: 0; }

.recent-time {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
}

.recent-buy {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.recent-buy:hover,
.recent-buy:focus-visible {
  opacity: .78;
  outline: none;
}

.recent-art {
  position: relative;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #19232d;
}

.recent-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-art-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--red);
  font-family: Arial, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1f2b35, #07090d);
}

.recent-art.is-missing-art {
  width: 2px;
  height: 40px;
  border: 0;
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 85, 72, .45);
}

.recent-art.is-missing-art .recent-art-fallback { display: none; }

.recent-copy { min-width: 0; }
.recent-artist,
.recent-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-artist { color: var(--cyan); font-size: .82rem; font-weight: 700; }
.recent-title { margin-top: 4px; color: var(--paper); font-family: Arial, sans-serif; font-size: 1rem; font-weight: 700; }

.recent-track-empty {
  padding: 20px 18px;
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 620px) {
  .now-playing-shell { width: min(100% - 22px, 1040px); padding: 18px 0; }
  .track-panel { grid-template-columns: 1fr; }
  .artwork-frame { width: min(100%, 340px); }
  .recent-track { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 11px; padding: 10px 14px; }
  .recent-art { width: 44px; height: 44px; }
  .recent-art.is-missing-art { width: 2px; height: 36px; }
  .recent-time { grid-column: 2 / -1; }
}
