/* Farben wie in der Android-App (Theme.kt): dunkel mit Koralle und Violett, hell als Gegenstück. */
:root {
  --bg: #0e0b16;
  --surface: #181426;
  --surface-high: #211b33;
  --surface-top: #2b2441;
  --text: #ede8f7;
  --muted: #aaa3c0;
  --primary: #ff6b5e;
  --on-primary: #2a0a06;
  --secondary: #9b8cff;
  --secondary-container: #2e2660;
  --on-secondary-container: #e4dfff;
  --outline: #4a4263;
  --error: #ff8a80;
  --radius: 22px;
  --rail: 220px;
  --player: 380px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbf8ff; --surface: #f1ecfa; --surface-high: #e9e3f5; --surface-top: #e1daf0; --text: #1b1826; --muted: #5d5773;
    --primary: #d9483b; --on-primary: #ffffff; --secondary: #5b4bd6; --secondary-container: #e4dfff;
    --on-secondary-container: #17104a; --outline: #c9c2da; --error: #ba1a1a; color-scheme: light;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }

.app { display: grid; grid-template-columns: var(--rail) 1fr; height: 100vh; height: 100dvh; }
body.has-station .app { grid-template-columns: var(--rail) 1fr var(--player); }

/* Navigation links */
.rail { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-right: 1px solid var(--surface-top); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 12px 20px; font-weight: 800; font-size: 26px; letter-spacing: -.02em; }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.rail button {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font-weight: 600; text-align: left;
}
.rail button:hover { background: var(--surface); color: var(--text); }
.rail button.on { background: var(--secondary-container); color: var(--on-secondary-container); }

/* Inhalt */
main { overflow-y: auto; padding: 24px 32px 120px; outline: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
h1 { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
h2 { margin: 30px 0 12px; font-size: 22px; letter-spacing: -.01em; }
.hint { color: var(--muted); text-align: center; padding: 48px 16px; margin: 0; }
.label { color: var(--muted); font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
.note { color: var(--muted); margin: 6px 0; font-size: 15px; }
.center { text-align: center; justify-content: center; }

.searchbox {
  display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 60px; border-radius: 999px;
  background: var(--surface); color: var(--muted); max-width: 720px;
}
.searchbox:focus-within { outline: 2px solid var(--secondary); }
.searchbox input { flex: 1; border: 0; background: none; outline: none; font-size: 18px; color: var(--text); min-width: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--outline); background: none; font-weight: 600;
  color: var(--text); font-size: 15px;
}
.chip:hover { background: var(--surface); }
.chip.on { background: var(--secondary-container); border-color: transparent; color: var(--on-secondary-container); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 18px; overflow-x: auto; padding-bottom: 6px; }

.card { cursor: pointer; border-radius: var(--radius); min-width: 0; }
.card-art { position: relative; }
.card h3 { margin: 8px 4px 0; font-size: 15px; font-weight: 650; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card p { margin: 2px 4px 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.current h3 { color: var(--primary); }
.card:hover .art { transform: translateY(-2px); box-shadow: 0 10px 28px rgb(0 0 0 / .35); }
.card:focus-visible { outline: 2px solid var(--secondary); }

.art {
  position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h1) 55% 60%), hsl(var(--h2) 72% 38%));
  transition: transform .18s ease, box-shadow .18s ease;
}
.art .initial { color: #fff; font-weight: 900; font-size: 44px; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.art img.loaded { opacity: 1; background: #fff; }
.art img.loaded.small { inset: 25%; width: 50%; height: 50%; border-radius: 18%; padding: 6%; }
.art.has-image .initial { visibility: hidden; }
.art.has-image:has(img.small) .initial { visibility: hidden; }

.fav, .live {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--muted);
}
.fav .icon { width: 19px; height: 19px; }
.fav.on, .icon-button.on { color: var(--primary); }
.live { top: auto; right: auto; bottom: 8px; left: 8px; width: auto; padding: 0 12px; border-radius: 999px; height: 30px; }

.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; margin-right: 8px; vertical-align: -1px; }
.bars i { width: 3px; background: var(--primary); border-radius: 2px; animation: bar .55s ease-in-out infinite alternate; }
.bars i:nth-child(2) { animation-duration: .7s; }
.bars i:nth-child(3) { animation-duration: .45s; }
@keyframes bar { from { height: 25%; } to { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .bars i { animation: none; height: 70%; } }

.spinner { width: 34px; height: 34px; margin: 40px auto; border-radius: 50%; border: 3px solid var(--surface-top); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.error-box { text-align: center; padding: 24px; color: var(--muted); }
.button {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 22px; border-radius: 999px; border: 0;
  background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 650; cursor: pointer;
}
.button.ghost { background: none; color: var(--primary); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.text-button { background: none; border: 0; color: var(--primary); font-weight: 650; padding: 8px 4px; text-decoration: none; }
.text-button:disabled { color: var(--muted); opacity: .6; }

.panel { background: var(--surface); border-radius: 24px; padding: 18px 20px; margin: 0 0 14px; max-width: 760px; }
.panel h2 { margin: 0 0 8px; font-size: 20px; }
.setting { display: flex; align-items: center; gap: 16px; padding: 8px 0; cursor: pointer; }
.setting span { flex: 1; display: flex; flex-direction: column; }
.setting small { color: var(--muted); font-size: 14px; }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--surface-top); border: 2px solid var(--outline); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { transform: translateX(20px); background: var(--on-primary); }

/* Titel */
.songs { list-style: none; margin: 8px 0 0; padding: 0; }
.song { display: flex; align-items: center; gap: 4px; border-radius: 16px; }
.song:hover { background: var(--surface); }
.song-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px; color: inherit; text-decoration: none; }
.small-art { width: 52px; height: 52px; flex: none; border-radius: 12px; }
.small-art .initial { font-size: 20px; }
.song-text { min-width: 0; display: flex; flex-direction: column; }
.song-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-text strong { font-weight: 650; }
.song-text small { color: var(--muted); font-size: 13px; }
.song.current strong { color: var(--primary); }
.star { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); opacity: .45; border-radius: 50%; flex: none; }
.star.on { color: var(--primary); opacity: 1; }
.star:hover { background: var(--surface-high); opacity: 1; }
.open-in { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--muted); text-align: center; cursor: pointer; flex: none; appearance: none; font-weight: 800; }
.open-in:hover { background: var(--surface-high); }
.open-in option { background: var(--surface); color: var(--text); }

/* Player rechts */
.player {
  display: none; overflow-y: auto; padding: 18px 24px 40px; border-left: 1px solid var(--surface-top);
  background: linear-gradient(180deg, var(--glow, transparent), var(--bg) 60%);
}
body.has-station .player { display: block; }
.player-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 600; font-size: 14px; }
.close-player { visibility: hidden; }
.big-art { width: min(100%, 300px); margin: 18px auto 0; border-radius: 34px; box-shadow: 0 18px 50px rgb(0 0 0 / .35); }
.big-art .initial { font-size: 96px; }
.player-name { text-align: center; margin: 22px 0 4px; font-size: 26px; }
.player-status { text-align: center; color: var(--muted); margin: 0; font-size: 17px; }
.player-status.err, small.err { color: var(--error); }
.player-meta { text-align: center; color: var(--muted); opacity: .75; font-size: 13px; margin: 6px 0 0; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 22px 0 8px; }
.controls .icon-button { justify-self: end; margin-right: 22px; }
.icon-button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.icon-button:hover { background: var(--surface); }
.play-big { width: 80px; height: 80px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 40%, transparent); }
.play-big .icon { width: 40px; height: 40px; }
.volume { display: flex; align-items: center; gap: 6px; margin-left: 18px; color: var(--muted); }
.volume input { width: 90px; accent-color: var(--primary); }
.playlist-title { margin: 26px 0 0; font-size: 20px; }

/* Mini-Player (nur auf schmalen Bildschirmen) */
.mini { display: none; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; flex: none; }
.mini-art { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.mini-art .initial { font-size: 20px; }

@media (max-width: 1100px) {
  :root { --player: 330px; --rail: 84px; }
  .rail { padding: 16px 8px; align-items: center; }
  .rail button { flex-direction: column; gap: 4px; padding: 10px 8px; font-size: 12px; width: 76px; text-align: center; border-radius: 18px; }
  .brand span { display: none; }
}

@media (max-width: 760px) {
  .app, body.has-station .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--surface-top); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); }
  .rail .brand { display: none; }
  .rail button { width: auto; flex: 1; }
  main { padding: 16px 16px 110px; }
  h1 { font-size: 34px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
  .row { grid-auto-columns: 130px; }
  body.has-station .player { display: none; }
  body.has-station.player-open .player { display: block; position: fixed; inset: 0; z-index: 20; background: linear-gradient(180deg, var(--glow, transparent), var(--bg) 55%), var(--bg); border: 0; }
  .close-player { visibility: visible; }
  body.has-station .mini {
    display: flex; align-items: center; gap: 8px; position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom));
    background: var(--surface-high); border-radius: 20px; padding: 8px; z-index: 10; box-shadow: 0 8px 26px rgb(0 0 0 / .3);
  }
  .mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; padding: 0; }
  .mini-open span { min-width: 0; display: flex; flex-direction: column; }
  .mini-open strong, .mini-open small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-open small { color: var(--muted); font-size: 13px; }
  .volume input { width: 70px; }
}
