:root {
  --bg: #12101a;
  --bg2: #1b1826;
  --bg3: #241f33;
  --fg: #eeE9f5;
  --muted: #9d94b3;
  --line: #322b45;
  --accent: #b98cff;
  --accent2: #7c5cff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
  --player-h: 92px;
}

* { box-sizing: border-box; }

/* Wichtig: eigene display-Regeln (grid/flex) ueberschreiben sonst [hidden]! */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.muted { color: var(--muted); }
.error { color: var(--err); }
.spacer { flex: 1; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  display: grid;
  gap: 12px;
}
.login-card .logo { font-size: 44px; line-height: 1; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: .3px; }
.login-card p { margin: 0; }
.login-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--fg);
  font-size: 17px;
}
.login-card input:focus { outline: 2px solid var(--accent2); outline-offset: 1px; }

button.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  color: #17121f;
  border: 0;
  border-radius: 10px;
  padding: 13px 14px;
  font-weight: 650;
}

/* ---------- Shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(18, 16, 26, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tab {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
}
.tab.active { background: var(--bg3); color: var(--fg); }

button.icon {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  font-size: 17px;
}
button.icon:hover { border-color: var(--accent2); }
button.icon.big { font-size: 20px; min-width: 52px; }

.status {
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--line);
  font-size: 14px;
}
.status.ok { border-color: #2f6b46; }
.status.warn { border-color: #6b5a2f; }
.status.err { border-color: #6b3030; }

main {
  padding: 12px 12px calc(var(--player-h) + 24px);
  display: grid;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
}

h2.view-title { margin: 4px 2px 0; font-size: 20px; }

/* ---------- Cards ---------- */
.card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.card .art {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg3);
}
.card .body { min-width: 0; display: grid; gap: 3px; }
.card .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card .actions { display: grid; gap: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg3);
  color: var(--muted);
}
.badge.new { background: #3b2a63; color: #d9c6ff; }
.badge.done { background: #23422f; color: #b6f0c9; }
.badge.err { background: #4a2525; color: #ffc9c9; }

.big-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  display: grid;
  gap: 12px;
  justify-items: center;
}

/* ---------- Episode list ---------- */
.ep {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}
.ep:last-child { border-bottom: 0; }
.ep .t { font-weight: 600; }
.ep .m { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ep.played .t { color: var(--muted); font-weight: 500; }
.ep .row { display: flex; gap: 6px; }
.ep .desc { color: var(--muted); font-size: 13px; margin-top: 6px; display: none; }
.ep.open .desc { display: block; }
.list-wrap {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.progress {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.progress > i { display: block; height: 100%; background: var(--accent); }

/* ---------- Suche ---------- */
.searchbar { display: flex; gap: 8px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.searchbar input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--fg);
  font-size: 16px;
}
.searchbar input:focus { outline: 2px solid var(--accent2); outline-offset: 1px; }

/* ---------- Player ---------- */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(27, 24, 38, .97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.pl-art { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--bg3); flex: none; }
.pl-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pl-head { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.pl-title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-feed { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 40%; }
.pl-seek { width: 100%; }
.pl-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.pl-side { opacity: .8; }
.pl-buttons { display: flex; gap: 6px; align-items: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 16px);
  transform: translateX(-50%);
  z-index: 20;
  background: #2d2740;
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
}
.toast.err { background: #3d2226; border-color: #6b3030; }
.toast.ok { background: #1f3529; border-color: #2f6b46; }

@media (max-width: 560px) {
  .card { grid-template-columns: 60px 1fr; }
  .card .art { width: 60px; height: 60px; }
  .card .actions { grid-column: 1 / -1; grid-auto-flow: column; justify-content: end; }
  .pl-buttons button:not(.big) { display: none; }
  :root { --player-h: 96px; }
}
