:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #14191f;
  --muted: #66727f;
  --line: #e2e7ec;
  --accent: #1f8a70;
  --accent-ink: #ffffff;
  --abort: #9aa5b1;
  --danger: #c0392b;
  --radius: 16px;
  --tabbar-h: 64px;
  --mini-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --card: #1a2129;
    --text: #e8edf2;
    --muted: #8b98a5;
    --line: #2a333d;
    --accent: #3cc49b;
    --accent-ink: #06231b;
    --abort: #56616d;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { fill: currentColor; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
body.has-mini main { padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + var(--safe-b) + 32px); }

.page-head h1 { margin: 8px 0 0; font-size: 1.75rem; letter-spacing: -0.02em; }
.sub { margin: 2px 0 20px; color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; text-align: center; }

/* Liste */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-height: 76px; text-decoration: none; color: inherit;
}
.card.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.card-meta .ok { color: var(--accent); }
.card-off { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.card-off.saved { color: var(--accent); }

/* Player */
.bar { min-height: 44px; display: flex; align-items: center; }
.back { color: var(--accent); text-decoration: none; font-size: 1.05rem; padding: 10px 4px; }
.player { display: flex; flex-direction: column; align-items: center; text-align: center; }
.artwork {
  width: min(56vw, 220px); aspect-ratio: 1; border-radius: 28px; margin: 12px 0 24px;
  display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; letter-spacing: .08em;
  color: var(--accent-ink); background: linear-gradient(145deg, var(--accent), #146b56);
  box-shadow: 0 16px 40px rgb(0 0 0 / .18);
}
.p-title { margin: 0; font-size: 1.35rem; }
.p-counts { margin: 4px 0 24px; color: var(--muted); }

.progress { width: 100%; }
#p-seek { width: 100%; accent-color: var(--accent); height: 32px; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }

.controls { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 20px 0 28px; }
.play {
  width: 80px; height: 80px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
}
.play svg { width: 40px; height: 40px; }
.skip {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
}
.skip small { font-size: .7rem; font-weight: 600; }
.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: block; }

.btn-secondary, .btn-danger {
  min-height: 48px; padding: 0 22px; border-radius: 24px; background: var(--card);
  border: 1px solid var(--line); font-weight: 600;
}
.btn-danger { color: var(--danger); }
.btn-link {
  min-height: 48px; margin-top: 8px; background: none; border: 0; color: var(--accent); font-weight: 600;
}
.btn-link:disabled { color: var(--muted); }

/* Statistik */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .85rem; }
.section-title { margin: 28px 0 10px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.stat-per, .history { list-style: none; margin: 0; padding: 0; }
.stat-per li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.stat-row { display: flex; justify-content: space-between; gap: 8px; }
.stat-row .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row .nums { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nums .ok { color: var(--accent); }
.nums .ab { color: var(--muted); }
.meter { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); margin: 10px 0 6px; }
.meter i { display: block; }
.meter .m-ok { background: var(--accent); }
.meter .m-ab { background: var(--abort); }
.stat-sub { color: var(--muted); font-size: .85rem; }
.history li { display: flex; gap: 10px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.history .h-date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.history .h-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .h-ok { color: var(--accent); }
.history .h-ab { color: var(--muted); }
.stat-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

/* Mini-Player */
.mini {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  max-width: 536px; margin: 0 auto; height: var(--mini-h);
  display: flex; align-items: center; gap: 10px; padding: 0 8px 0 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 30px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .15); text-decoration: none; color: inherit;
}
.mini[hidden] { display: none; }
.mini-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.mini-play {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.mini-play svg { width: 22px; height: 22px; }

/* Tab-Leiste */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600;
}
.tabbar a span { font-size: 1.3rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }

.view[hidden] { display: none; }
a.mini-title { color: inherit; text-decoration: none; display: block; line-height: var(--mini-h); }
