:root {
  --bg: #101217;
  --panel: #191c23;
  --panel2: #232731;
  --line: #2e3340;
  --text: #f1f2f5;
  --muted: #9aa1b0;
  --accent: #e8a33d;
  --accent-ink: #1a1305;
  --danger: #e5675c;
  --radius: 14px;
  --player-h: 168px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 20px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

/* ---------- Login ---------- */
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-box { text-align: center; width: min(420px, 100%); }
.login-box h1 { font-size: 30px; margin: 0 0 4px; }
.login-box p { color: var(--muted); margin: 0 0 16px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; height: 28px; margin-bottom: 20px; }
.pin-dots span { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-pad button { height: 84px; border-radius: var(--radius); background: var(--panel2); font-size: 32px; font-weight: 600; }
.pin-pad button:active { background: var(--line); }
.pin-pad .ok { background: var(--accent); color: var(--accent-ink); }
.err { color: var(--danger) !important; min-height: 1.4em; margin-top: 14px !important; }

/* ---------- Layout ---------- */
#app { display: flex; flex-direction: column; height: 100%; }
#top { display: flex; align-items: center; gap: 12px; padding: 12px 16px 0; }
.profiles { display: flex; gap: 10px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.profiles::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: 64px; padding: 0 22px 0 8px; border-radius: 32px;
  background: var(--panel2); font-weight: 600; font-size: 22px;
}
.chip.active { background: var(--accent); color: var(--accent-ink); }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; flex: none; }
.chip.active .avatar { box-shadow: 0 0 0 3px var(--accent-ink); }
.icon-btn { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); flex: none; }
.icon-btn svg { width: 30px; height: 30px; }

#tabs { display: flex; gap: 8px; padding: 12px 16px; align-items: center; }
#tabs button { height: 56px; padding: 0 22px; border-radius: 28px; color: var(--muted); font-weight: 600; flex: none; }
#tabs button.active { background: var(--panel2); color: var(--text); }
#search {
  margin-left: auto; height: 56px; min-width: 0; width: 320px; flex: 0 1 320px;
  border-radius: 28px; border: 0; background: var(--panel2); color: var(--text);
  font: inherit; padding: 0 22px;
}
#view { flex: 1; overflow-y: auto; padding: 4px 16px 24px; overscroll-behavior: contain; }
body.has-player #view { padding-bottom: calc(var(--player-h) + 24px); }

h2 { font-size: 24px; margin: 22px 0 12px; }
h2:first-child { margin-top: 6px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- Karten ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 190px; gap: 18px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.card { text-align: left; min-width: 0; }
.card .cover { width: 100%; aspect-ratio: 1; }
.card-title { font-weight: 600; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 18px; }
.card-sub { color: var(--muted); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover {
  border-radius: var(--radius); overflow: hidden; position: relative; background: var(--panel2);
  display: grid; place-items: center; font-weight: 700; font-size: 44px; color: rgba(255,255,255,.85);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.sm { width: 76px; height: 76px; font-size: 26px; border-radius: 10px; flex: none; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: rgba(0,0,0,.45); }
.bar i { display: block; height: 100%; background: var(--accent); }

/* Weiterhören-Hero */
.hero { display: flex; gap: 24px; align-items: center; background: var(--panel); border-radius: 20px; padding: 18px; }
.hero .cover { width: 180px; height: 180px; flex: none; }
.hero-info { min-width: 0; flex: 1; }
.hero-title { font-size: 28px; font-weight: 700; line-height: 1.2; }
.hero-sub { color: var(--muted); margin: 4px 0 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 12px; height: 68px; padding: 0 30px;
  border-radius: 34px; background: var(--panel2); font-weight: 700; font-size: 21px;
}
.btn svg { width: 28px; height: 28px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.warn { background: var(--danger); color: #fff; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; }

/* Profilwahl */
.who { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; margin-top: 16px; }
.who button { background: var(--panel); border-radius: 20px; padding: 24px 12px; display: grid; justify-items: center; gap: 12px; font-size: 22px; font-weight: 600; }
.who .avatar { width: 96px; height: 96px; font-size: 40px; }

/* Segmente */
.seg { display: inline-flex; background: var(--panel); border-radius: 28px; padding: 4px; margin-bottom: 14px; }
.seg button { height: 52px; padding: 0 22px; border-radius: 24px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--panel2); color: var(--text); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar .seg { margin-bottom: 0; }

/* Künstlerliste */
.list { display: grid; gap: 6px; }
.list button { display: flex; justify-content: space-between; align-items: center; min-height: 64px; padding: 0 18px; background: var(--panel); border-radius: 12px; text-align: left; gap: 12px; }

/* Album-Detail */
.detail-head { display: flex; gap: 24px; align-items: flex-end; margin: 6px 0 20px; }
.detail-head .cover { width: 220px; height: 220px; flex: none; }
.detail-head h1 { font-size: 30px; margin: 0 0 4px; line-height: 1.2; }
.back { height: 52px; padding: 0 16px 0 8px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.back svg { width: 28px; height: 28px; }
.tracks { display: grid; gap: 4px; margin-top: 18px; }
.track { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; min-height: 62px; padding: 0 16px 0 8px; border-radius: 10px; text-align: left; gap: 8px; }
.track:nth-child(odd) { background: var(--panel); }
.track .n { color: var(--muted); text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.track .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .d { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 17px; }
.track.current { background: var(--panel2); color: var(--accent); }
.track.current .n { color: var(--accent); }
.track.done .t { color: var(--muted); }

/* ---------- Player ---------- */
#player {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h);
  background: var(--panel); border-top: 1px solid var(--line); padding: 8px 16px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.seek { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek span { min-width: 64px; }
.seek span:last-child { text-align: right; }
.range { flex: 1; height: 44px; -webkit-appearance: none; appearance: none; background: transparent; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--text); }
.range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--line); }
.range::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--text); border: 0; }

/* Lautstärke */
#volPanel {
  position: absolute; right: 16px; bottom: calc(100% + 10px); width: min(480px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 22px 10px 10px;
  background: var(--panel2); border-radius: 44px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
#volPanel .ctl { flex: none; }
#volPanel .range { height: 64px; }
#volPanel .range::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; }
#volPanel .range::-webkit-slider-thumb { width: 38px; height: 38px; margin-top: -14px; }
#volPanel .range::-moz-range-thumb { width: 38px; height: 38px; }
#volVal { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ctl.on { background: var(--panel2); }
.np { display: flex; align-items: center; gap: 16px; flex: 1; min-height: 0; }
.np-meta { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; text-align: left; }
.np-text { min-width: 0; }
.np-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { color: var(--muted); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctrls { display: flex; align-items: center; gap: 6px; flex: none; }
.ctl { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; }
.ctl:active { background: var(--panel2); }
.ctl svg { width: 36px; height: 36px; }
.ctl.play { width: 88px; height: 88px; background: var(--accent); color: var(--accent-ink); }
.ctl.play svg { width: 44px; height: 44px; }
.ctl.speed { font-weight: 700; font-size: 20px; width: 72px; border-radius: 36px; background: var(--panel2); }
.ctl:disabled { opacity: .3; }

/* ---------- Overlay / Toast ---------- */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { background: var(--panel); border-radius: 20px; padding: 24px; width: min(720px, 100%); max-height: 90%; overflow-y: auto; }
.dialog h2 { margin-top: 0; }
.check { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 12px; border-radius: 12px; }
.check:nth-child(odd) { background: var(--panel2); }
.check input { width: 30px; height: 30px; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 18px; }
.field { height: 60px; border-radius: 12px; border: 0; background: var(--panel2); color: var(--text); font: inherit; padding: 0 18px; width: 220px; }
#toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -150%); transition: transform .25s;
  background: var(--text); color: var(--bg); padding: 16px 26px; border-radius: 32px; font-weight: 600; z-index: 20;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { transform: translate(-50%, 0); }

/* ---------- Schmal (Handy) ---------- */
@media (max-width: 760px) {
  body { font-size: 18px; }
  :root { --player-h: 220px; }
  #tabs { flex-wrap: wrap; }
  #search { width: 100%; flex-basis: 100%; margin-left: 0; }
  .np { flex-direction: column; align-items: stretch; gap: 4px; }
  .ctrls { justify-content: space-between; gap: 0; }
  .ctl { width: 46px; height: 46px; }
  .ctl svg { width: 30px; height: 30px; }
  .ctl.play { width: 64px; height: 64px; }
  .ctl.play svg { width: 36px; height: 36px; }
  .ctl.speed { width: 52px; font-size: 16px; }
  #volPanel .ctl { width: 56px; height: 56px; }
  .hero { flex-direction: column; align-items: stretch; }
  .hero .cover { width: 100%; height: auto; aspect-ratio: 1; max-width: 240px; }
  .detail-head { flex-direction: column; align-items: flex-start; }
  .detail-head .cover { width: 180px; height: 180px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .row { grid-auto-columns: 150px; }
}
