:root {
  --bg: #06060a;
  --gold: #c9a227;
  --gold-hi: #f5e6b8;
  --text: #f2efe6;
  --muted: rgba(242, 239, 230, 0.55);
  --live: #ff3355;
  --glow: rgba(201, 162, 39, 0.35);
  --brand-lime: rgba(165, 220, 80, 0.14);
  --pad-inline: max(clamp(14px, 3.2vmin, 40px), env(safe-area-inset-left, 0px));
  --pad-inline-end: max(clamp(14px, 3.2vmin, 40px), env(safe-area-inset-right, 0px));
  --gap-xl: clamp(20px, 3.5vmin, 40px);
  --gap-lg: clamp(16px, 2.8vmin, 28px);
  --gap-md: clamp(10px, 1.8vmin, 18px);
  --gap-sm: clamp(6px, 1.2vmin, 12px);
  /* Platz für QR + Copyright; brand-mark (unten rechts) orientiert sich daran */
  --foot-h: clamp(140px, 26vmin, 240px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

html,
body {
  margin: 0;
  background: #000;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: manipulation;
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  min-height: 100%;
  min-height: 100dvh;
  max-width: 100vw;
  padding: max(clamp(10px, 1.8vmin, 22px), env(safe-area-inset-top, 0px))
    var(--pad-inline-end)
    max(clamp(8px, 1.5vmin, 20px), env(safe-area-inset-bottom, 0px))
    var(--pad-inline);
  background: radial-gradient(ellipse 100% 70% at 50% 0%, #1a1424 0%, var(--bg) 50%, #020203 100%);
  border: 1px solid rgba(201, 162, 39, 0.12);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5), 0 0 48px var(--glow);
  overflow: hidden;
}

.stage.show-idle {
  background:
    radial-gradient(ellipse 88% 50% at 50% 30%, var(--brand-lime) 0%, transparent 52%),
    radial-gradient(ellipse 100% 70% at 50% 0%, #1a221c 0%, var(--bg) 52%, #020203 100%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.7) 100%);
}

.brand-mark {
  position: absolute;
  z-index: 4;
  right: var(--pad-inline-end);
  bottom: calc(var(--foot-h) + max(8px, env(safe-area-inset-bottom, 0px)) + 6px);
  pointer-events: none;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.45));
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.brand-mark img {
  display: block;
  width: auto;
  height: auto;
  max-height: min(10vmin, 96px);
  max-width: min(14vmin, 120px);
  object-fit: contain;
}

.stage.show-idle .brand-mark {
  opacity: 0;
  visibility: hidden;
}

.stage.show-track .brand-mark {
  opacity: 0.9;
  visibility: visible;
}

.top {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  padding-bottom: var(--gap-md);
  margin-bottom: var(--gap-sm);
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
  min-height: 0;
}

.top-lead {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--gap-md);
  min-width: 0;
  flex: 1 1 auto;
}

.corner-logo {
  flex: 0 0 auto;
  width: clamp(38px, 6vmin, 58px);
  height: clamp(38px, 6vmin, 58px);
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.corner-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-md);
  min-width: 0;
  flex: 0 1 auto;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(15px, 2.5vmin, 30px);
  letter-spacing: 0.16em;
  color: var(--live);
  text-shadow: 0 0 16px rgba(255, 51, 85, 0.55);
}

.live-pulse {
  width: clamp(10px, 1vmin, 14px);
  height: clamp(10px, 1vmin, 14px);
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 12px var(--live);
  animation: blink 1.1s ease-in-out infinite;
}

.top-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: clamp(12px, 2.5vmin, 24px);
  flex-shrink: 0;
}

.clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  min-width: 0;
}

.clock-lbl {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(8px, 1.15vmin, 11px);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.65;
}

.live-clock {
  display: block;
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(15px, 2.7vmin, 26px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--gold-hi);
  text-shadow: 0 0 20px var(--glow);
  white-space: nowrap;
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: clamp(28px, 4vmin, 48px);
  flex-shrink: 0;
}

.eq span {
  width: clamp(4px, 0.55vmin, 8px);
  height: 35%;
  background: linear-gradient(180deg, var(--gold-hi), #6e5a1e);
  border-radius: 2px;
  animation: eq 0.85s ease-in-out infinite;
  box-shadow: 0 0 8px var(--glow);
}

.eq span:nth-child(1) { animation-delay: 0s; }
.eq span:nth-child(2) { animation-delay: 0.12s; }
.eq span:nth-child(3) { animation-delay: 0.05s; }
.eq span:nth-child(4) { animation-delay: 0.18s; }
.eq span:nth-child(5) { animation-delay: 0.09s; }

@keyframes eq {
  0%, 100% { height: 28%; opacity: 0.75; }
  50% { height: 100%; opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Track-Hauptbereich: füllt Platz zwischen Header und Footer */
.main {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.track-layout {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, min(420px, 40vmin, 46%)) minmax(0, 1fr);
  column-gap: var(--gap-xl);
  row-gap: var(--gap-lg);
  align-items: center;
  justify-items: stretch;
  padding-block: var(--gap-sm);
}

.track-layout.no-cover {
  grid-template-columns: 1fr;
  column-gap: 0;
}

.cover-wrap {
  width: 100%;
  max-width: min(100%, 400px);
  justify-self: center;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.track-layout.no-cover .cover-wrap {
  display: none;
}

.cover-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  max-height: min(58dvh, 58vh, 600px);
  border-radius: clamp(6px, 1vmin, 14px);
  overflow: hidden;
  background: linear-gradient(145deg, #2a2435 0%, #121018 100%);
  border: 1px solid rgba(201, 162, 39, 0.32);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

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

.cover-ph {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 40% 35%, rgba(201, 162, 39, 0.16), transparent 55%);
}

.meta {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.meta-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

.meta-inner > .lbl:first-child {
  margin-top: 0;
}

.lbl {
  margin: var(--gap-md) 0 var(--gap-sm);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(11px, 1.55vmin, 18px);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.88;
}

.readable {
  margin: 0 0 var(--gap-md);
  max-width: 100%;
  line-height: 1.22;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.artist {
  font-size: clamp(20px, 4.85vmin, 64px);
  font-weight: 700;
  text-shadow: 0 3px 22px rgba(0, 0, 0, 0.42);
}

.title {
  font-size: clamp(24px, 6vmin, 84px);
  font-weight: 700;
  background: linear-gradient(100deg, var(--gold-hi) 0%, var(--gold) 50%, #7a6220 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 14px rgba(201, 162, 39, 0.22));
}

/* Header: exakt dieselben Klassen wie Songtitel (.title.readable), nur Layout im Balken */
.title.readable.head-now {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.year-line {
  margin: 0 0 var(--gap-md);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(12px, 1.75vmin, 20px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.album {
  margin: 0 0 var(--gap-sm);
  font-size: clamp(13px, 2vmin, 22px);
  color: var(--muted);
  font-style: italic;
}

.duration {
  margin: 0 0 var(--gap-md);
  font-family: ui-monospace, monospace;
  font-size: clamp(12px, 1.75vmin, 20px);
  color: var(--muted);
  letter-spacing: 0.06em;
}

.next-block {
  margin-top: var(--gap-md);
  padding-top: var(--gap-md);
  border-top: 1px solid rgba(201, 162, 39, 0.2);
}

.next-block .lbl {
  margin-top: 0;
}

.lbl--next {
  opacity: 0.62;
  letter-spacing: 0.16em;
}

.next-main {
  margin: 0 0 var(--gap-sm);
  font-size: clamp(16px, 2.95vmin, 38px);
  font-weight: 650;
  color: var(--text);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
}

.next-year-line {
  margin: 0 0 var(--gap-sm);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(11px, 1.45vmin, 16px);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.78;
}

.next-album {
  margin: 0;
  font-size: clamp(12px, 1.85vmin, 20px);
  color: var(--muted);
  font-style: italic;
}

.idle {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--gap-lg) var(--gap-md);
  gap: var(--gap-lg);
}

.idle-logo-wrap {
  flex: 0 1 auto;
  width: min(70vw, 50vmin, 300px);
  max-height: min(30vh, 30vmin, 260px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.idle-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(28vh, 28vmin, 240px);
  object-fit: contain;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.38));
}

.idle-title {
  margin: 0;
  flex: 0 0 auto;
  max-width: 22ch;
  font-size: clamp(24px, 5.8vmin, 80px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.12;
  color: var(--gold-hi);
  text-shadow: 0 0 32px var(--glow);
}

.idle-sub {
  margin: 0;
  flex: 0 0 auto;
  max-width: 36ch;
  font-family: system-ui, sans-serif;
  font-size: clamp(12px, 1.8vmin, 18px);
  color: var(--muted);
  line-height: 1.35;
}

.foot {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  min-height: var(--foot-h);
  padding-top: var(--gap-md);
  border-top: 1px solid rgba(201, 162, 39, 0.12);
  font-family: system-ui, sans-serif;
  font-size: clamp(10px, 1.35vmin, 14px);
  color: var(--muted);
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: var(--gap-sm);
  text-align: center;
}

.foot-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap-lg);
  width: 100%;
}

.foot-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
}

.foot-qr-frame {
  padding: 10px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  line-height: 0;
}

.foot-qr-frame img {
  display: block;
  width: clamp(120px, 24vw, 240px);
  height: auto;
  aspect-ratio: 1;
}

.foot-qr-hint {
  margin: 0;
  max-width: 20rem;
  text-align: center;
  font-size: clamp(11px, 1.45vmin, 15px);
  color: var(--muted);
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.foot-qr-fallback {
  margin: 0;
  max-width: min(100%, 42ch);
  font-size: clamp(9px, 1.15vmin, 12px);
  line-height: 1.35;
  word-break: break-all;
  color: var(--muted);
}

.foot-qr-fallback a {
  color: var(--gold-hi);
}

.foot-copy-wrap {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.copy {
  margin: 0;
  max-width: 100%;
  line-height: 1.35;
  letter-spacing: 0.06em;
  font-size: clamp(10px, 1.3vmin, 14px);
  opacity: 0.92;
  text-align: right;
}

.warn {
  color: #ffb08a;
  letter-spacing: 0.04em;
  max-width: min(100%, 60ch);
  line-height: 1.3;
  align-self: stretch;
}

.warn[hidden] {
  display: none !important;
}

.stage.show-track .idle {
  display: none;
}

.stage.show-track #trackMain {
  display: flex;
}

.stage.show-idle #trackMain {
  display: none;
}

.stage.show-idle .eq span {
  animation: none;
  height: 32%;
  opacity: 0.35;
}

#trackMain[hidden] {
  display: none !important;
}

.idle[hidden] {
  display: none !important;
}

:fullscreen .stage {
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  max-width: none;
  max-height: none;
  border: none;
}

/* Hochformat / schmal: Cover oben, Text darunter, klare Spalte */
@media screen and (max-aspect-ratio: 1/1) {
  .track-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start;
    justify-items: stretch;
    row-gap: var(--gap-lg);
    column-gap: 0;
    overflow: hidden;
  }

  .track-layout.no-cover {
    grid-template-rows: 1fr;
  }

  .cover-wrap {
    max-width: min(88vw, 360px);
    justify-self: center;
  }

  .cover-frame {
    max-height: min(38dvh, 38vh, 400px);
  }

  .meta {
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .meta-inner {
    justify-content: flex-start;
    padding-bottom: var(--gap-md);
  }
}

/* Sehr schmale Fenster (auch Landscape auf kleinem Phone) */
@media screen and (max-width: 520px) {
  .track-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .cover-wrap {
    max-width: min(92vw, 320px);
  }

  .top {
    flex-direction: column;
    align-items: stretch;
  }

  .top-lead {
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
  }

  .top-trail {
    width: 100%;
    justify-content: space-between;
    align-items: flex-end;
  }

  .clock-wrap {
    align-items: flex-start;
    text-align: left;
  }

  .foot-grid {
    flex-direction: column;
    align-items: center;
  }

  .foot-copy-wrap {
    justify-content: center;
  }

  .copy {
    text-align: center;
  }
}

@media screen and (max-height: 480px) {
  .idle-logo-wrap {
    max-height: min(22vh, 160px);
  }

  .idle-logo {
    max-height: min(20vh, 140px);
  }

  .idle-title {
    font-size: clamp(16px, 4vmin, 36px);
  }

  .cover-frame {
    max-height: min(36dvh, 200px);
  }
}

/* Smartphones & kleine Viewports: Seite scrollen, keine abgeschnittenen Inhalte */
@media screen and (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .stage {
    overflow-x: hidden;
    overflow-y: visible;
    min-height: 100dvh;
    min-height: 100svh;
    flex: 1 0 auto;
    padding-bottom: max(clamp(12px, 2vmin, 24px), env(safe-area-inset-bottom, 0px));
  }

  /* „Jetzt Läuft“ im Kopf: auf schmalen Screens nicht riesig */
  .top-lead .title.readable.head-now {
    font-size: clamp(14px, 4.2vw, 34px);
    line-height: 1.1;
  }

  .corner-logo {
    width: clamp(28px, 9vw, 44px);
    height: clamp(28px, 9vw, 44px);
  }

  .brand-mark img {
    max-height: min(9vmin, 72px);
    max-width: min(12vmin, 96px);
  }

  .meta {
    max-height: none;
    overflow: visible;
  }

  .meta-inner {
    overflow-y: visible;
    padding-bottom: var(--gap-md);
  }

  .foot {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }
}

@media screen and (max-width: 900px) and (max-aspect-ratio: 1/1) {
  .track-layout {
    overflow: visible;
  }
}
