:root {
  --bg: #0E1012;
  --surface: #16191C;
  --surface-2: #1E2226;
  --line: #22272C;
  --line-2: #2A2F35;
  --text: #ECEEF0;
  --muted: #A1AAB3;
  --done: #5C646D;
  --accent: #FF6B3D;
  --on-accent: #1A0B05;
  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible, .mini-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

/* ── Kopf ─────────────────────────────────────────────────────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(255,107,61,.6); }
.logo { font: 700 22px/1 var(--display); letter-spacing: -.01em; }
.station {
  font: 500 11px/1 var(--mono); letter-spacing: .08em; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 7px;
}
.upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.upcoming li {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.upcoming li strong { color: var(--text); font-weight: 500; }
.upcoming svg { color: var(--accent); flex: none; }

.banner {
  margin: 16px 28px 0; padding: 12px 16px; border-radius: 10px;
  background: #2A1712; border: 1px solid #5A2A1C; color: #FFD3C4; font-size: 14px;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px;
  padding: 24px 28px 40px; max-width: 1240px; margin: 0 auto; align-items: start;
}
.list-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.list-head h1 { margin: 0; font: 700 18px/1.2 var(--display); }

.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { font-size: 13px; font-weight: 500; color: var(--muted); padding: 6px 12px; border-radius: 7px; }
.segmented button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ── Liste ────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 6px; }
.row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 40px; align-items: center; gap: 14px;
  padding: 10px 10px; border-radius: 10px; cursor: pointer; position: relative;
}
.row:hover { background: rgba(255,255,255,.025); }
.row.current { background: var(--surface-2); }
.row.disabled { cursor: default; }
.row.dim .row-title, .row.dim .row-sub, .row.dim img { opacity: .55; }
.row img { width: 48px; height: 48px; border-radius: 8px; display: block; }
.row-text { min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-sub .mono { font-size: 12px; }
.row-bar { height: 3px; background: var(--line-2); border-radius: 2px; margin-top: 7px; overflow: hidden; display: none; }
.row-bar span { display: block; height: 100%; background: var(--accent); }
.row.dim .row-bar span { background: var(--done); }
.badge { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.badge.new { color: var(--text); background: var(--line-2); border-radius: 6px; padding: 3px 8px; }
.badge.left { color: var(--accent); font-family: var(--mono); }
.badge.rec { color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.badge.failed { color: #E5867A; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
.row-play {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--text);
}
.row.current .row-play { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.row-play .i-pause, .playing .row.current .row-play .i-play { display: none; }
.playing .row.current .row-play .i-pause { display: block; }
.empty { padding: 28px 22px; color: var(--muted); margin: 0; }

/* ── Player ───────────────────────────────────────────────────────── */
.player {
  position: sticky; top: 24px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px;
}
.sheet-bar { display: none; }
.cover { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--bg); }
.cover svg, .cover img { width: 100%; height: 100%; display: block; }
.meta .title { margin: 0; font: 700 21px/1.2 var(--display); }
.meta .date { margin: 4px 0 0; color: var(--muted); }

input[type=range] {
  --pct: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--line-2) var(--pct));
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); margin-top: -5px; border: 0;
}
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; }
.times { display: flex; justify-content: space-between; font: 12px/1 var(--mono); color: var(--muted); margin-top: 4px; }

.transport { display: flex; align-items: center; justify-content: center; gap: 28px; }
.icon-btn { color: var(--text); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.icon-btn:hover { background: var(--surface-2); }
.play-btn {
  width: 68px; height: 68px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: 0 6px 24px rgba(255,107,61,.28);
}
.play-btn:active { transform: scale(.97); }
.i-pause { display: none; }
.playing .play-btn .i-play, .playing .mini-play .i-play { display: none; }
.playing .play-btn .i-pause, .playing .mini-play .i-pause { display: block; }

.extras { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 500; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-2);
  color: var(--muted); min-width: 64px;
}
.chip.on { color: var(--text); border-color: var(--accent); }
#speed { font-family: var(--mono); font-size: 12px; }
.hint { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.hint.error { color: #E5867A; }

/* ── Mini-Player (nur mobil) ──────────────────────────────────────── */
.mini { display: none; }

@media (max-width: 900px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .top { flex-direction: column; align-items: flex-start; padding: 14px 16px 12px; gap: 10px; }
  .upcoming { align-items: flex-start; }
  .upcoming li:not(:first-child) { display: none; }
  .banner { margin: 12px 16px 0; }
  .layout { display: block; padding: 0; }
  .list-panel { background: none; border: 0; border-radius: 0; }
  .list-head { flex-direction: column; align-items: stretch; padding: 14px 16px 10px; border: 0; }
  .segmented { display: flex; }
  .segmented button { flex: 1; padding: 8px; }
  .list { padding: 0 8px; }
  .row { grid-template-columns: 48px minmax(0, 1fr) 40px; padding: 10px 8px; }
  .row .badge-wrap { display: none; }
  .row-bar { display: block; }
  .row-sub .badge { display: inline; }

  .player {
    position: fixed; inset: 0; z-index: 20; border-radius: 0; border: 0; top: 0;
    padding: calc(8px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform 260ms cubic-bezier(.2,.8,.2,1);
    overflow-y: auto; justify-content: center;
  }
  .player.open { transform: none; }
  .player:not(.open) { visibility: hidden; transition: transform 260ms cubic-bezier(.2,.8,.2,1), visibility 0s 260ms; }
  .sheet-bar { display: flex; }
  .cover { width: min(100%, 52vh); margin: 0 auto; }

  .mini {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px;
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 10;
    background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px; text-align: left;
    overflow: hidden;
  }
  .mini[hidden] { display: none; }
  .mini img { width: 44px; height: 44px; border-radius: 6px; display: block; }
  .mini-text { min-width: 0; display: flex; flex-direction: column; }
  .mini-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-time { font: 12px var(--mono); color: var(--muted); }
  .mini-play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
  .mini-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line-2); }
  .mini-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
}

@media (min-width: 901px) {
  .row-sub .badge { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .player, .player:not(.open) { transition: none !important; }
  .pulse { animation: none; }
}
