/* =========================================================
   Podcast Studio – dunkles Grau, tiefes Lila, knalliges Pink
   Effekte bewusst sparsam: Verläufe und Schatten sind statisch,
   bewegt wird nur mit transform/opacity (läuft auf der Grafikkarte).
   ========================================================= */

:root {
  /* Grundflächen – Grau mit leichtem Lilastich, damit die Akzente sitzen */
  --bg: #141317;
  --bg-elev: #1a1820;
  --surface: #201d28;
  --surface-2: #2a2634;
  --border: #37323f;
  --border-soft: #2c2835;

  /* Schrift */
  --text: #f3f1f7;
  --muted: #a39cb2;

  /* Akzente */
  --purple: #7c3aed;
  --purple-deep: #4c1d95;
  --purple-soft: rgba(124, 58, 237, 0.16);
  --pink: #ff2d8f;
  --pink-soft: rgba(255, 45, 143, 0.14);

  /* Von der Anwendung erwartete Namen */
  --primary: var(--purple);
  --primary-hover: #8b5cf6;
  --danger: #ff4d6d;
  --success: #34d399;
  --warn: #fbbf24;
  --warn-soft: #33261a;

  --grad: linear-gradient(135deg, var(--purple) 0%, var(--pink) 100%);
  --radius: 16px;
  --radius-sm: 11px;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --glow-purple: 0 6px 22px rgba(124, 58, 237, .38);
  --glow-pink: 0 6px 22px rgba(255, 45, 143, .34);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Statischer Farbschimmer im Hintergrund – wird einmal gezeichnet, kostet nichts */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(700px 380px at 12% -8%, rgba(124, 58, 237, .20), transparent 65%),
    radial-gradient(560px 320px at 92% 4%, rgba(255, 45, 143, .13), transparent 62%);
}

body.center {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

a { color: var(--pink); text-underline-offset: 3px; }
a:hover { color: #ff5ba7; }

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: .9rem; }
.success { color: var(--success); }

/* ---------- Layout ---------- */
.app {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom));
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(20, 19, 23, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  max-width: 660px;
  margin: 0 auto;
}

header.topbar h1 {
  font-size: 1.7rem;
  margin: 0;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header.topbar .logo { font-size: 1.9rem; }
/* Marke ist zugleich der Weg zurück zur Startseite. */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  background: none;
  border: none;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .15s;
}
.topbar-left:hover { background: var(--surface); }
.topbar-left:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand .tagline {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Menü ---------- */
.menu-wrap { position: relative; flex: none; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 218px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform-origin: top right;
  animation: menuIn .14s ease-out;
}
@keyframes menuIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .menu { animation: none; } }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger { color: var(--danger); }

/* ---------- Karten ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.login-card {
  width: 100%;
  max-width: 370px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Feiner Farbstreifen am oberen Rand */
.login-card::before,
.recorder::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad);
}
.login-card .logo { font-size: 3rem; }
.login-card h1 {
  margin: 10px 0 4px;
  font-size: 1.5rem;
  letter-spacing: -.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .08s ease, background .15s, border-color .15s, box-shadow .2s;
}
.btn:hover { border-color: #453e52; }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.btn.primary {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: var(--glow-purple);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: var(--glow-pink); }

.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 77, 109, .1); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { width: auto; padding: 9px 14px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: 100%; }

/* ---------- Formulare ---------- */
label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
  font-size: .84rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }

/* Kurz aufleuchten, wenn ein Feld von außen neu befüllt wurde – etwa nach
   „↻ Text". Sonst bleibt unklar, ob überhaupt etwas passiert ist. */
.blitz { animation: blitz 1.2s ease-out; }
@keyframes blitz {
  0%   { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255,45,143,.35); }
  100% { border-color: var(--border); box-shadow: 0 0 0 0 rgba(255,45,143,0); }
}
input[type="file"] { color: var(--muted); font-size: .9rem; }
input[type="file"]::file-selector-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 13px;
  margin-right: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--purple); }
input[type="checkbox"] { accent-color: var(--pink); }
input[type="range"] { accent-color: var(--pink); }
.field-hint { font-size: .82rem; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* ---------- Aufnahme ---------- */
.recorder { text-align: center; padding: 26px 18px; position: relative; overflow: hidden; }
.rec-btn {
  width: 104px; height: 104px;
  border-radius: 50%;
  border: none;
  background: var(--grad);
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  margin: 10px auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-purple);
  transition: transform .1s, box-shadow .25s;
}
.rec-btn:hover { transform: scale(1.03); }
.rec-btn:active { transform: scale(.97); }
.rec-btn.recording { background: var(--danger); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 77, 109, .5); }
  70%  { box-shadow: 0 0 0 20px rgba(255, 77, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
}
@media (prefers-reduced-motion: reduce) { .rec-btn.recording { animation: none; } }

.timer {
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: .02em;
  margin: 14px 0 4px;
}

.divider {
  border-top: 1px solid var(--border-soft);
  text-align: center;
  margin: 24px 0;
  line-height: 0;
}
.divider span {
  background: var(--bg);
  padding: 0 14px;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- Folgenliste ---------- */
.episode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform .12s ease, border-color .15s, background .15s;
}
.episode:hover { transform: translateX(3px); border-color: var(--purple); background: var(--surface-2); }
.episode:active { transform: translateX(1px); }
.episode h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 650; }
.episode .meta { font-size: .8rem; color: var(--muted); }

.badge {
  font-size: .68rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.processing { background: rgba(251,191,36,.14); color: var(--warn); border-color: rgba(251,191,36,.3); }
.badge.draft      { background: var(--purple-soft); color: #b794f6; border-color: rgba(124,58,237,.35); }
.badge.published  { background: var(--pink-soft); color: #ff7ab8; border-color: rgba(255,45,143,.35); }
/* Geplant: veröffentlicht, aber noch nicht im Feed. Bewusst eine eigene Farbe —
   als Entwurf gefärbt war nicht zu unterscheiden, ob die Folge schon draußen ist. */
.badge.geplant    { background: rgba(56,189,248,.14); color: #7dd3fc; border-color: rgba(56,189,248,.35); }
.badge.error      { background: rgba(255,77,109,.14); color: var(--danger); border-color: rgba(255,77,109,.35); }

/* ---------- Fortschrittsbalken ---------- */
.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--grad);
  border-radius: 99px;
  transition: width .3s ease;
}
/* Ohne bekannten Anteil: wandernder Streifen statt stehendem Balken */
.progress-fill.indeterminate {
  width: 38%;
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill.indeterminate { animation: none; width: 100%; opacity: .5; }
}

/* Schrittliste während der Verarbeitung */
.steps {
  list-style: none;
  margin: 16px 0 6px;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: .92rem;
}
.steps li { color: var(--muted); display: flex; align-items: center; gap: 9px; }
.steps li.fertig { color: var(--success); }
.steps li.aktiv { color: var(--text); font-weight: 600; }

/* ---------- Kopfzeile der Folgenliste ---------- */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 4px 12px;
}
.list-tools { display: flex; gap: 8px; }

/* ---------- Jahres-Gruppen ---------- */
details.jahr {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  margin-bottom: 10px;
  overflow: hidden;
}
details.jahr > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-weight: 600;
  transition: background .12s;
}
details.jahr > summary::-webkit-details-marker { display: none; }
details.jahr > summary:hover { background: var(--surface-2); }

/* Pfeil, dreht sich beim Aufklappen */
details.jahr > summary::before {
  content: '▸';
  color: var(--pink);
  font-size: .9rem;
  transition: transform .15s ease;
}
details.jahr[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  details.jahr > summary::before { transition: none; }
}

.jahr-zahl {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.jahr-anzahl {
  margin-left: auto;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
}
.jahr-inhalt { padding: 4px 10px 10px; }
.jahr-inhalt .episode:last-child { margin-bottom: 0; }

/* Interne Folgennummer – nur in der eigenen Übersicht, nicht im RSS-Feed */
.epnum {
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* ---------- Sonstiges ---------- */
.spinner {
  display: inline-block;
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,.2);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--purple);
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  z-index: 50;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--glow-purple);
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.hidden { display: none !important; }

h2.section {
  font-size: 1.02rem;
  margin: 24px 4px 12px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.back {
  background: none;
  border: none;
  color: var(--pink);
  font-size: .95rem;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 6px;
}
.back:hover { color: #ff5ba7; }

audio {
  width: 100%;
  margin-top: 10px;
  border-radius: var(--radius-sm);
}

details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
details > summary:hover { color: var(--text); }

img { max-width: 100%; }

/* Auswahl in Podcast-Lila/Pink */
::selection { background: var(--pink); color: #fff; }

/* Schlanke Bildlaufleisten */
* { scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
