:root {
  --bg: #121212;
  --panel: #181818;
  --row: transparent;
  --row-hover: #1a1a1a;
  --row-on: #282828;
  --border: #2a2a2a;
  --text: #ffffff;
  --muted: #b3b3b3;
  --accent: #1ed760;
  --accent-dim: #1db954;
  --warm: #e8a54b;
  --green: #1ed760;
  --danger: #e35d6a;
  --mini-h: 68px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}
html { overscroll-behavior: none; }
body {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid transparent;
  background: #2a2a2a;
  border-radius: 12px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .12s ease, filter .15s ease, background-color .15s ease, opacity .15s ease;
}
button:active { transform: scale(.94); }
@media (hover: hover) {
  button:hover { filter: brightness(1.08); }
}
button.ghost { background: transparent; border-color: #333; }
.hidden { display: none !important; }
.ico {
  width: 1em;
  height: 1em;
  fill: currentColor;
  display: block;
  pointer-events: none;
}

#app {
  height: 100dvh;
  position: relative;
  min-height: 0;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  overflow: hidden;
}

/* Schermen: home ligt onder, de detailpagina schuift er vanaf rechts overheen */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.screen-sub {
  z-index: 5;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility .3s;
  visibility: hidden;
  box-shadow: -12px 0 30px rgba(0,0,0,.4);
}
.screen-sub.open { transform: translateX(0); visibility: visible; }
.sub-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(6px + var(--safe-t)) 12px 6px;
}
.sub-title {
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
.sub-title.show { opacity: 1; transform: none; }

/* Home */
.home-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 24px;
}
body.has-mini .home-scroll { padding-bottom: calc(var(--mini-h) + 24px + var(--safe-b)); }
.greet { margin: 6px 0 12px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sec-title { margin: 22px 0 10px; font-size: 17px; font-weight: 800; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 10px 0 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff14;
  text-align: left;
  overflow: hidden;
}
.quick:active { background: #ffffff22; transform: none; }
.quick-art {
  width: 52px; height: 56px;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(145deg, #e8a54b, #8a4b12);
  background-size: cover; background-position: center;
}
.quick-art.has-img span { display: none; }
.quick-art.fav { background: linear-gradient(145deg, #4c3fd6, #8b7cf5); color: #fff; font-size: 24px; }
.quick-text { min-width: 0; display: grid; gap: 2px; }
.quick-text strong { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-text span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.album-card {
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 10px;
}
.album-card:active { transform: scale(.97); }
.album-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(160deg, #f0c674 0%, #c4783a 42%, #5a2e10 100%);
  background-size: cover; background-position: center;
  display: grid; place-items: center;
  font-size: 48px;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  margin-bottom: 6px;
}
.album-art.has-img span { display: none; }
.album-card strong {
  font-size: 14px; font-weight: 700; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.album-card span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-scroll code { font: 12px ui-monospace, Menlo, monospace; background: #ffffff14; padding: 1px 5px; border-radius: 4px; }

/* Detailpagina-hero (album / oefenlijst) */
.coll-hero {
  padding: 4px 8px 12px;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.coll-cover {
  width: min(56vw, 230px);
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(160deg, #f0c674 0%, #c4783a 42%, #5a2e10 100%);
  background-size: cover; background-position: center;
  display: grid; place-items: center;
  font-size: 64px;
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
  margin-bottom: 8px;
}
.coll-cover.fav { background: linear-gradient(145deg, #4c3fd6, #8b7cf5); color: #fff; }
.coll-hero h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; max-width: 100%; }
.coll-sub { margin: 0; color: var(--muted); font-size: 13px; }
.coll-actions {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}
.play-big {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #102010;
  font-weight: 800;
  font-size: 14px;
}
.play-big .ico { font-size: 22px; }
.coll-actions #search { margin: 0; min-width: 0; }

.top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-t)) 16px 10px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(145deg, #e8a54b, #8a4b12);
}
h1 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.install-btn .ico { font-size: 18px; }

.rip-banner, .info-banner {
  flex: 0 0 auto;
  position: relative;
  margin: 0 16px 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #2a2114;
  border: 1px solid #5a4420;
  color: var(--warm);
  font-size: 13px;
  line-height: 1.45;
}
.info-banner {
  background: #13211a;
  border-color: #1db95455;
  color: #e8f5ec;
  padding-right: 44px;
}
.info-banner strong { color: #fff; }
.info-banner code {
  font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #ffffff14;
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}
.info-banner ol { margin: 6px 0 0; padding-left: 18px; }
.info-banner li { margin: 2px 0; }
.info-banner .kbd {
  display: inline-block;
  border: 1px solid #ffffff33;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.6;
  background: #ffffff0f;
}
.info-close {
  position: absolute;
  top: 6px; right: 6px;
  width: 34px; height: 34px;
  border: 0; background: transparent;
  display: grid; place-items: center;
  color: #fff; font-size: 18px; border-radius: 50%;
}

#search {
  width: 100%;
  padding: 11px 14px;
  border-radius: 999px;
  border: 0;
  background: #242424;
  margin-bottom: 10px;
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px; /* <16px zoomt iOS in bij focus */
  outline: none;
}
#search::-webkit-search-decoration { -webkit-appearance: none; }
#search:focus { box-shadow: 0 0 0 2px #ffffff33; }
.list-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 12px;
  scroll-padding-top: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
body.has-mini .list-wrap {
  padding-bottom: calc(var(--mini-h) + 18px + var(--safe-b));
}
.top-spacer { width: 44px; }
.track-list { list-style: none; margin: 0; padding: 0 6px 8px; }
.track-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 44px;
  gap: 8px;
  align-items: center;
  padding: 8px 0 8px 8px;
  border-radius: 8px;
  min-height: 56px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
.track-list li:active { background: var(--row-hover); }
@media (hover: hover) {
  .track-list li:hover { background: var(--row-hover); }
}
.track-list li.active { background: var(--row-on); }
.track-list li.active .t-title { color: var(--accent); }
.num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.t-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dur { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.star {
  width: 44px; height: 44px;
  border: 0; background: transparent;
  display: grid; place-items: center;
  font-size: 20px; color: var(--muted);
  border-radius: 50%;
}
.star:active { transform: scale(.85); background: transparent; }
.star.on { color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* Mini bar — altijd zichtbaar onderaan, zoals Spotify */
.mini-bar {
  position: fixed;
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  bottom: calc(8px + var(--safe-b));
  height: var(--mini-h);
  background: #2a241c;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 44px 44px;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 10px 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  z-index: 20;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.mini-bar:active { filter: brightness(1.06); }
.mini-art {
  width: 48px; height: 48px; border-radius: 6px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(145deg, #e8a54b, #8a4b12);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.mini-art.has-img span { display: none; }
.mini-text { min-width: 0; }
.mini-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-album { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-play {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #fff; color: #111;
  display: grid; place-items: center;
  font-size: 22px;
}
.icon-ghost {
  width: 44px; height: 44px;
  border: 0; background: transparent;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  color: #fff;
}
.icon-ghost:active { background: #ffffff14; }
.icon-ghost.on { color: var(--accent); }
.mini-progress {
  position: absolute;
  left: 10px; right: 10px; bottom: 4px;
  height: 3px;
  background: #ffffff22;
  border-radius: 99px;
  overflow: hidden;
}
.mini-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
}

/* Full-screen now playing */
.now-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  transform: translateY(110%);
  transition: transform .34s cubic-bezier(.2,.8,.2,1);
  color: #fff;
  background: var(--bg);
  overscroll-behavior: contain;
  touch-action: pan-y;
  will-change: transform;
  visibility: hidden;
  transition-property: transform, visibility;
}
.now-screen.open {
  transform: translateY(0);
  visibility: visible;
}
.now-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, #8a5a22 0%, #3a2412 38%, #121212 78%);
  z-index: 0;
}
.now-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-t)) calc(22px + var(--safe-r)) calc(18px + var(--safe-b)) calc(22px + var(--safe-l));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.now-top {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-bottom: 4px;
}
.now-close { font-size: 28px; }
.now-playing-label { text-align: center; min-width: 0; }
.now-playing-label span {
  display: block;
  font-size: 10px;
  letter-spacing: .14em;
  color: #ffffffcc;
}
.now-playing-label strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* De hoes krimpt mee met de beschikbare hoogte (kleine telefoons),
   i.p.v. over de titel heen te vallen. */
.now-cover-wrap {
  flex: 1 1 0;
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 10px 0 14px;
  container-type: size;
}
.now-cover {
  --cover-ratio: 1;                            /* breedte/hoogte van de hoes (JS zet 'm) */
  width: min(86vw, 380px);                    /* fallback zonder container-units */
  width: min(86vw, 380px, calc((100cqh - 24px) * var(--cover-ratio)));
  aspect-ratio: var(--cover-ratio);
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(160deg, #f0c674 0%, #c4783a 42%, #5a2e10 100%);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  display: grid;
  place-items: center;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.now-cover.has-img .cover-img { display: block; }
.now-cover.has-img .cover-emoji { display: none; }
.now-cover.has-img .cover-num {
  background: rgba(0,0,0,.55);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: clamp(12px, 5cqh, 16px);
  opacity: 1;
  backdrop-filter: blur(4px);
}
.cover-emoji { font-size: 88px; font-size: clamp(40px, 28cqh, 88px); filter: drop-shadow(0 8px 16px rgba(0,0,0,.3)); }
.cover-num {
  position: absolute;
  bottom: 5%;
  right: 6%;
  font-size: 28px;
  font-size: clamp(16px, 9cqh, 28px);
  font-weight: 800;
  opacity: .85;
}

.now-meta { flex: 0 0 auto; margin-bottom: 8px; min-width: 0; }
.now-meta h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-meta p {
  margin: 4px 0 0;
  color: #d8d8d8;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sliders: dunne track + dikke duim + ruime tik-zone */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  touch-action: pan-y; /* verticaal scrollen blijft mogelijk, horizontaal = slepen */
  --p: 0%;
  --track: #ffffff33;
  --fill: #fff;
  cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(var(--fill), var(--fill)) 0 0 / var(--p) 100% no-repeat, var(--track);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fill); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.now-seek { flex: 0 0 auto; margin-bottom: 2px; }
.seek-row { position: relative; }
.ab-band {
  position: absolute;
  top: 13px;
  height: 6px;
  background: #1ed76088;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}
#seek { position: relative; z-index: 1; }
.ab-marks { position: relative; height: 0; pointer-events: none; }
.ab-marks i {
  position: absolute;
  top: -24px;
  width: 3px;
  height: 14px;
  margin-left: -1px;
  background: var(--accent);
  border-radius: 2px;
}
.ab-marks i::after {
  content: attr(data-label);
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  color: var(--accent);
}
.times {
  display: flex;
  justify-content: space-between;
  color: #cfcfcf;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-top: -4px;
}
.loop-count { color: var(--accent); font-weight: 700; }

.now-transport {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0 12px;
}
.now-play {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #111;
  display: grid; place-items: center;
  font-size: 34px;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.skip { font-size: 32px; width: 52px; height: 52px; }
.skip-sm { font-size: 14px; font-weight: 700; color: #ddd; width: 48px; height: 48px; border-radius: 50%; }

.now-tools {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #ffffff18;
  border: 0;
}
.pill .ico { font-size: 17px; }
.pill.on {
  background: var(--accent);
  color: #102010;
  font-weight: 800;
}
.pill.ghost { color: #ddd; background: transparent; border: 1px solid #ffffff2a; }
.speed-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.speed-row span, .speed-row strong { font-size: 13px; color: #ddd; }
.speed-row strong { min-width: 3.4em; text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.speed-row input { flex: 1; }
.hint { flex: 0 0 auto; margin: 0; color: #b3b3b3; font-size: 11px; line-height: 1.4; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--mini-h) + 24px + var(--safe-b));
  transform: translate(-50%, 12px);
  background: #f5f5f5;
  color: #111;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.now-open .toast { bottom: calc(150px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  .now-screen, button, .toast { transition: none; }
}

@media (max-height: 620px) {
  .hint { display: none; }
  .now-play { width: 60px; height: 60px; font-size: 28px; }
  .now-meta h2 { font-size: 19px; }
}

@media (min-width: 760px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid #222;
    border-right: 1px solid #222;
  }
  .mini-bar {
    left: 50%;
    right: auto;
    width: calc(480px - 16px);
    transform: translateX(-50%);
  }
  .now-screen {
    left: 50%;
    width: 480px;
    margin-left: -240px;
  }
}
