/* Hörwerkstatt – Podcast-Studio für Kinder
   Design v3 „Studio Deck": Die App ist ein Audiogerät.
   Neutrale warme Flächen, Farbe nur als Funktion
   (Rot = Aufnahme, Grün = Wiedergabe, Rollenfarben = Personen). */

:root {
  /* Werkstatt-Flächen: warm, ruhig, hell */
  --chassis:      #F5F5F7;
  --chassis-deep: #E9E9EE;
  --panel:        #FFFFFF;
  --panel-soft:   #FAFAFC;
  --display:      #1D1D1F;

  /* Text */
  --ink:          #1D1D1F;
  --ink-soft:     #6E6E73;
  --ink-faint:    #AEAEB2;
  --line-col:     #E3E3E8;
  --accent-soft:  #EAF2FD;
  --success-soft: #E4F2EF;
  --display-text: #1D1D1F;
  --display-mint: #0A5D53;
  --display-rec:  #F2473F;

  /* Semantik */
  --rec:          #F2473F;
  --rec-deep:     #D93730;
  --play:         #0E7569;
  --play-deep:    #0A5D53;
  --success:      #0E7569;
  --error:        #B3302B;
  --accent:       #0864C8;
  --accent-deep:  #0650A0;
  --key-dark:     #1D1D1F;

  /* Typo: Rundschrift nur für markante Titel, Systemschrift für Lesetext */
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Quicksand, system-ui, sans-serif;
  --fs-display: clamp(2.25rem, 6vw, 4.25rem);
  --fs-title:   clamp(1.35rem, 2.5vw, 1.75rem);
  --fs-lead:    1.125rem;
  --fs-body:    1rem;
  --fs-label:   .875rem;
  --fs-micro:   .75rem;
  --fs-timer:   clamp(2rem, 8vw, 3.5rem);

  /* Raster */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px;
  --r-s: 10px; --r-m: 16px; --r-l: 24px; --r-xl: 32px;

  /* Ruhige, subtile Tiefe statt harter 3D-Kanten */
  --e-key:     0 2px 4px rgba(23,37,43,.12), 0 6px 14px rgba(23,37,43,.08);
  --e-key-col: 0 2px 4px rgba(23,37,43,.12), 0 6px 14px rgba(23,37,43,.08);
  --e-panel:   0 1px 2px rgba(23,37,43,.06), 0 10px 30px rgba(23,37,43,.07);
  --e-float:   0 16px 50px rgba(23,37,43,.16);
  --e-well:    inset 0 1px 4px rgba(23,37,43,.10);
  --shadow-focus: 0 0 0 4px rgba(37,99,169,.28);
  --line:      1px solid var(--line-col);

  /* Motion-Tokens */
  --ease-pop:   cubic-bezier(.2, .8, .2, 1);
  --ease-swift: cubic-bezier(.3, 0, .8, .4);
  --ease-back:  cubic-bezier(.2, .9, .3, 1.2);
  --t-fast: 140ms; --t-med: 240ms; --t-slow: 420ms;

  --control-h: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }

body {
  font-family: var(--font);
  background: var(--chassis);
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

.screen {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 20px max(14px, env(safe-area-inset-bottom));
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; letter-spacing: -.2px; font-family: var(--font-round); }
h2 { display: flex; align-items: center; gap: 10px; }

/* Sichtbarer Fokus für ALLE interaktiven Elemente (Tastatur) */
:where(button, a, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-s);
}

/* Icons */
.ic { width: 24px; height: 24px; flex: 0 0 auto; }
.ic-sm { width: 20px; height: 20px; }
.ic-logo { width: 52px; height: 52px; }
.ic-mic, .ic-stop { width: 44px; height: 44px; }

.micro-label {
  font-size: var(--fs-label); font-weight: 600;
  color: var(--ink-soft);
}

/* ── Animationen ─────────────────────────────────── */
@keyframes pop-in {
  from { transform: scale(.94) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-out { to { transform: scale(.96) translateY(8px); opacity: 0; } }
@keyframes rec-ring {
  0%   { transform: scale(.9);  opacity: .8; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes time-tick { 0% { transform: scale(1.06); } 30% { transform: scale(1); } }
@keyframes dot-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes count-zoom {
  0%   { transform: scale(.4);  opacity: 0; }
  30%  { transform: scale(1.06); opacity: 1; }
  75%  { transform: scale(1);    opacity: 1; }
  100% { transform: scale(.9);   opacity: 0; }
}
@keyframes clip-land { from { transform: scale(.6); } 60% { transform: scale(1.06); } to { transform: scale(1); } }
@keyframes success-ring {
  0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; }
}
@keyframes toast-in {
  from { transform: translateX(-50%) translateY(24px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@keyframes toast-out { to { transform: translateX(-50%) translateY(16px); opacity: 0; } }
@keyframes led-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Tasten (Buttons) ────────────────────────────── */
.btn {
  font: inherit; font-weight: 700; font-size: var(--fs-body);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-col);
  border-radius: var(--r-m);
  box-shadow: var(--e-key);
  padding: 12px 18px;
  min-height: var(--control-h);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, filter var(--t-fast) ease;
}
.btn:active { transform: scale(.97); filter: brightness(.95); }
.btn:disabled {
  background: var(--chassis-deep); color: var(--ink-faint);
  box-shadow: none; transform: none; cursor: default;
}
.btn-small { min-height: 48px; padding: 8px 14px; font-size: .95rem; }
.btn-wide { width: 100%; margin-top: var(--sp-4); font-size: var(--fs-lead); min-height: 56px; }
.btn-primary { background: var(--key-dark); color: #fff; border-color: transparent; box-shadow: var(--e-key-col); min-height: 56px; }
.btn-play    { background: var(--play);     color: #fff; border-color: transparent; box-shadow: var(--e-key-col); }
.btn-accent  { background: var(--accent);   color: #fff; border-color: transparent; box-shadow: var(--e-key-col); }
.btn-danger  { background: transparent; color: var(--error); border: 1.5px solid var(--error); box-shadow: none; }
#confirm-yes.btn-danger { background: var(--error); color: #fff; border-color: transparent; box-shadow: var(--e-key-col); }
.btn-rec     { background: var(--rec);      color: #fff; border-color: transparent; box-shadow: var(--e-key-col); }
.btn.pressed { transform: translateY(2px); box-shadow: none; background: var(--play-deep); }

.link-btn {
  font: inherit; font-size: .95rem; font-weight: 600;
  background: none; border: none; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; padding: 10px; min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-s);
}
.link-btn:active { color: var(--ink); }
.file-btn { position: relative; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--shadow-focus); }

/* ── Startbildschirm: Hero ───────────────────────── */
.start-head { text-align: center; padding: var(--sp-6) 0 var(--sp-5); }
.logo-badge {
  width: 84px; height: 84px; margin: 0 auto var(--sp-4);
  background: var(--rec); color: #fff;
  border-radius: 26px;
  box-shadow: 0 8px 24px rgba(242,71,63,.3);
  display: flex; align-items: center; justify-content: center;
}
.start-head h1 { font-size: var(--fs-display); font-weight: 800; }
.wordmark-wave { display: block; margin: 6px auto 0; color: var(--accent); width: 120px; height: 18px; }
.tagline { color: var(--ink-soft); font-weight: 500; font-family: var(--font); margin: var(--sp-2) auto 0; max-width: 34ch; line-height: 1.5; }
.hero-cta { margin-top: var(--sp-5); font-size: var(--fs-lead); min-height: 60px; padding: 14px 28px; }
.trust-line {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: var(--sp-4);
  color: var(--ink-soft); font-weight: 600; font-size: var(--fs-label);
}
.trust-line .ic { width: 18px; height: 18px; }
.projects-heading { font-size: var(--fs-title); margin: var(--sp-4) 4px var(--sp-2); }

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-1) var(--sp-5);
}
.project-list { display: contents; }

.project-card {
  font: inherit; font-weight: 700; color: var(--ink);
  background: var(--panel);
  border: none;
  border-radius: var(--r-l);
  box-shadow: var(--e-panel);
  min-height: 216px;
  padding: var(--sp-4);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  position: relative;
  transition: transform var(--t-fast) ease;
}
.project-card:active { transform: scale(.97); }
.project-new {
  background: none;
  border: 2px dashed rgba(35,40,45,.45);
  box-shadow: none;
  font-size: var(--fs-lead);
  color: var(--ink-soft);
}
.new-plus {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--key-dark); color: #fff;
  box-shadow: var(--e-key-col);
  display: flex; align-items: center; justify-content: center;
}
.project-open {
  font: inherit; color: inherit; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  width: 100%; padding: 0;
}
.project-cover {
  width: 108px; height: 108px; object-fit: cover;
  border-radius: var(--r-l);
  background: var(--panel-soft);
  box-shadow: var(--e-well);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
}
.project-title { font-size: 1.05rem; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.project-meta { font-size: var(--fs-label); font-weight: 500; color: var(--ink-soft); }
.project-delete {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: var(--panel-soft);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease;
}
.project-delete .ic { width: 20px; height: 20px; }
.project-delete:active { transform: scale(.9); color: var(--error); }
.start-foot { margin-top: auto; text-align: center; }

/* ── Studio: Kopfzeile ───────────────────────────── */
.topbar { display: flex; align-items: center; gap: var(--sp-4); padding-bottom: var(--sp-3); }
.name-input {
  font: inherit; font-weight: 800; font-size: 1.25rem; color: var(--ink);
  flex: 1; min-width: 0; height: 48px;
  background: transparent;
  border: none; border-bottom: 2px dashed rgba(35,40,45,.45);
  padding: 6px 4px;
}
.name-input:focus { outline: none; border-bottom: 2px solid var(--accent); }
.save-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-label); font-weight: 600;
  color: var(--play-deep); white-space: nowrap;
  background: var(--success-soft);
  border-radius: 999px;
  padding: 6px 14px;
}
.save-state .ic { width: 16px; height: 16px; }
.save-state.dirty { background: var(--chassis-deep); color: var(--ink-soft); }
.save-state.dirty .ic { display: none; }
.save-state .led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
}
.save-state.dirty .led { background: #C8930A; animation: led-pulse 1.2s ease-in-out infinite; }

/* ── Studio: Aufnahme-Deck ───────────────────────── */
.rec-panel {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-4);
  background: var(--panel);
  border-radius: var(--r-xl);
  box-shadow: var(--e-panel);
  padding: var(--sp-5);
  align-items: center;
}
.rec-pads {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
}
.rec-hint { margin: 0; color: var(--ink-soft); font-weight: 600; font-size: var(--fs-body); text-align: center; }

.rec-btn {
  width: 118px; height: 118px; border-radius: 50%;
  background: var(--rec); color: #fff;
  border: none;
  box-shadow: 0 4px 0 var(--rec-deep), 0 10px 24px rgba(242,71,63,.35);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
  position: relative;
}
.rec-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rec-deep), 0 4px 10px rgba(242,71,63,.3); }
.rec-btn .ic-stop { display: none; }
.rec-btn.recording .ic-mic { display: none; }
.rec-btn.recording .ic-stop { display: block; }
.rec-btn::after, .role-rec-btn::after {
  content: ""; position: absolute; inset: -7px;
  border-radius: 50%;
  border: 4px solid var(--rec);
  border-color: inherit;
  opacity: 0; transform: scale(1);
  pointer-events: none;
}
.rec-btn.recording::after, .role-rec-btn.recording::after {
  border-color: currentColor;
  animation: rec-ring 1.4s var(--ease-swift) infinite;
}

/* Rollen-Pads */
.role-rec-row {
  display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-5);
  justify-content: center;
}
.role-rec { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; }
.role-rec-btn {
  width: 84px; height: 84px; border-radius: 50%;
  border: none; color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.28), 0 8px 18px rgba(35,40,45,.2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, opacity var(--t-fast) ease;
  position: relative;
}
.role-rec-btn .ic-mic, .role-rec-btn .ic-stop { width: 36px; height: 36px; }
.role-rec-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.28); }
.role-rec-btn .ic-stop { display: none; }
.role-rec-btn.recording .ic-mic { display: none; }
.role-rec-btn.recording .ic-stop { display: block; }
.role-rec-btn:disabled { opacity: .35; cursor: default; transform: none; }
.role-rec-name {
  font-weight: 700; font-size: var(--fs-label); text-align: center;
  max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Studio-Display */
.display {
  background: var(--panel-soft);
  border-radius: var(--r-l);
  box-shadow: none;
  padding: var(--sp-4) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3);
  min-height: 150px;
  justify-content: center;
}
.display-label {
  font-size: var(--fs-label); font-weight: 600;
  color: var(--display-mint);
}
.display-label.rec { color: var(--display-rec); }
.display-row { display: flex; align-items: center; gap: var(--sp-3); }
.rec-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--display-rec);
  animation: dot-blink 1s steps(1) infinite;
}
.rec-time {
  font-size: var(--fs-timer); font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--display-text);
}
.rec-time.recording { color: var(--display-rec); animation: time-tick 1s steps(1) infinite; }
.rec-time.paused { color: var(--display-text); animation: dot-blink 1s steps(1) infinite; }
.pause-btn {
  margin-left: auto;
  width: 48px; height: 48px; border-radius: var(--r-m);
  border: 1.5px solid rgba(34,34,34,.35);
  background: none; color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.pause-btn:active { transform: scale(.92); background: rgba(34,34,34,.08); }
.pause-btn .ic { width: 22px; height: 22px; }

.level-meter { display: flex; gap: 5px; height: 36px; align-items: flex-end; }
.level-meter i {
  flex: 1; border-radius: 5px;
  background: var(--line-col);
  height: 18%;
  transition: height .09s ease-out, background .09s ease-out;
}
.level-meter i.on  { background: var(--play); }
.level-meter i.hot { background: var(--display-rec); }

/* ── Studio: Timeline ────────────────────────────── */
.timeline-area {
  background: var(--panel);
  border-radius: var(--r-l);
  box-shadow: var(--e-panel);
  padding: var(--sp-4) var(--sp-4);
  margin-top: var(--sp-4);
  flex: 1;
  min-height: 190px;
  display: flex; flex-direction: column;
}
.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.timeline-head h2 { font-size: var(--fs-title); }
.timeline-tools { display: flex; align-items: center; gap: var(--sp-4); }
.total-dur { font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.timeline {
  position: relative;
  display: flex; gap: var(--sp-4); align-items: flex-start;
  overflow-x: auto;
  padding: var(--sp-4) var(--sp-1) var(--sp-3);
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.timeline::before {
  content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); top: 84px;
  height: 1px; background: var(--line-col);
  pointer-events: none;
}
.timeline-empty {
  color: var(--ink-soft); font-weight: 600;
  align-self: center; text-align: left; width: 100%;
  max-width: 460px; margin: 0 auto;
  padding: var(--sp-3) 0;
  line-height: 1.7; font-size: 1.05rem;
}
.timeline-empty ol { margin: var(--sp-2) 0 0; padding-left: 24px; }
.timeline-empty li { margin: 2px 0; }

.clip-card {
  font: inherit; text-align: left; color: var(--ink);
  flex: 0 0 152px;
  background: var(--panel-soft);
  border: 2px solid transparent;
  border-radius: var(--r-l);
  box-shadow: var(--e-key);
  padding: var(--sp-3);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  scroll-snap-align: start;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  transition: transform var(--t-med) var(--ease-pop), outline-color var(--t-fast) ease;
}
.clip-card:active { transform: scale(.96); }
.clip-card.playing {
  outline: 3px solid var(--play); outline-offset: 2px;
  transform: translateY(-4px) scale(1.02);
}
.clip-card.just-added::before, .clip-card.first::before {
  content: ""; position: absolute; inset: -4px; border-radius: var(--r-xl);
  border: 3px solid var(--play); pointer-events: none;
  animation: success-ring .8s var(--ease-swift) both;
}
.clip-idx {
  position: absolute; top: -9px; left: -7px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--key-dark); color: #fff;
  font-size: var(--fs-label); font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(35,40,45,.3);
}
.clip-type { color: var(--ink-soft); }
.clip-type .ic { width: 20px; height: 20px; }
.clip-title {
  font-weight: 700; font-size: var(--fs-label);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.clip-len { font-size: var(--fs-micro); font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.clip-wave-mini { width: 100%; height: 26px; }
.clip-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: var(--play);
  border-radius: 0 0 var(--r-l) var(--r-l);
  transform: scaleX(0); transform-origin: left;
  opacity: 0; pointer-events: none;
  transition: transform .22s linear;
}
.clip-card.playing .clip-progress { opacity: 1; }
.clip-add {
  flex: 0 0 78px;
  min-height: 148px;
  border: 2px dashed rgba(35,40,45,.45);
  border-radius: var(--r-l);
  background: none; cursor: pointer;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.clip-add:active { transform: scale(.95); color: var(--accent); border-color: var(--accent); }

/* Flug-Geist (Aufnahme → Timeline) */
.fly-ghost {
  position: fixed; z-index: 80; width: 52px; height: 52px;
  border-radius: 50%; background: var(--rec); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(35,40,45,.3); pointer-events: none;
  will-change: transform;
}
.fly-ghost .ic { width: 26px; height: 26px; }

/* Vorschlag 3 „Ein Held": Werkzeuge ruhig und weiß, Farbe nur für
   Aufnehmen (Koralle) und Anhören/Speichern (Petrol) */
#btn-export.btn-primary:not(:disabled) { background: var(--play); }

/* ── Studio: Fußtasten (große Icons für Kinder) ──── */
.bottombar { display: flex; gap: var(--sp-4); padding-top: var(--sp-4); }
.bottombar .btn { flex: 1; font-size: var(--fs-body); min-height: 64px; gap: 10px; }
.bottombar .btn .ic { width: 30px; height: 30px; }

/* ── Schnipsel ziehen (Drag & Drop) ──────────────── */
.clip-card.dragging {
  transition: none;
  z-index: 10;
  box-shadow: 0 14px 30px rgba(35, 40, 45, .35);
  opacity: .95;
  cursor: grabbing;
}

/* ── „So geht's": Bild-Anleitung ─────────────────── */
.step-strip {
  display: flex; align-items: center; justify-content: center;
  gap: var(--sp-3); flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.step-strip .step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: var(--fs-label);
}
.step-arrow { color: var(--ink-faint); display: flex; }
.step-icon {
  position: relative;
  width: 64px; height: 64px; border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.22);
  flex: 0 0 64px;
}
.step-icon .ic { width: 30px; height: 30px; }
.step-icon i {
  position: absolute; top: -4px; left: -4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--panel); color: var(--ink);
  font-style: normal; font-weight: 800; font-size: var(--fs-micro);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(35,40,45,.3);
}
.timeline-empty .step-strip { margin-top: var(--sp-2); }
.timeline::before {
  content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); top: 84px;
  height: 1px; background: var(--line-col);
  pointer-events: none;
}
.timeline-empty { text-align: center; }
.timeline-empty .btn { margin-top: var(--sp-3); }

.intro-card { width: min(520px, 100%); }
.intro-steps { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0; }
.intro-step {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--panel);
  border-radius: var(--r-l);
  box-shadow: var(--e-key);
  padding: var(--sp-3) var(--sp-4);
}
.intro-step p { margin: 0; font-weight: 700; font-size: var(--fs-body); line-height: 1.5; }

/* ── Phasen-Anzeige (Aufnehmen → Gestalten → Fertig) ── */
.phase-steps {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-2) 0 var(--sp-3);
  flex-wrap: wrap;
}
.phase-step {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-label); font-weight: 600;
  color: var(--ink-faint);
  padding: 6px 12px; border-radius: 999px;
}
.phase-step .ic { width: 16px; height: 16px; }
.phase-step.done { color: var(--play); }
.phase-step.current { background: var(--panel); color: var(--ink); box-shadow: var(--e-key); font-weight: 700; }
.phase-sep { color: var(--ink-faint); display: flex; }
.phase-sep .ic { width: 14px; height: 14px; }

/* ── Coach-Marks (kurzes Onboarding am Ort der Handlung) ── */
.coach {
  position: fixed; z-index: 65;
  max-width: 300px;
  background: #222; color: #fff;
  border-radius: var(--r-l);
  padding: var(--sp-4);
  box-shadow: 0 16px 40px rgba(34,34,34,.4);
  animation: pop-in .25s var(--ease-pop);
}
.coach p { margin: 0 0 var(--sp-3); font-weight: 600; line-height: 1.5; font-size: var(--fs-body); }
.coach-row { display: flex; gap: var(--sp-2); justify-content: space-between; align-items: center; }
.coach-skip {
  font: inherit; font-weight: 600; font-size: var(--fs-label);
  background: none; border: none; color: #fff; opacity: .75;
  min-height: 44px; padding: 8px 10px; cursor: pointer;
}
.coach-next {
  font: inherit; font-weight: 700; font-size: var(--fs-label);
  background: var(--play); border: none; color: #fff;
  border-radius: var(--r-m); min-height: 44px; padding: 8px 18px; cursor: pointer;
}
.coach::before {
  content: ""; position: absolute; top: -7px; left: var(--coach-arrow, 32px);
  width: 14px; height: 14px; background: #222;
  transform: rotate(45deg);
}
.coach.below::before { top: auto; bottom: -7px; }

/* Planungsimpuls */
.plan-details { width: 100%; max-width: 420px; margin-top: var(--sp-2); }
.plan-details summary {
  cursor: pointer; font-weight: 600; font-size: var(--fs-label); color: var(--ink-soft);
  min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  list-style: none;
}
.plan-details summary::-webkit-details-marker { display: none; }
.plan-details[open] summary { color: var(--ink); }
.plan-box {
  background: #F2F2F7; border-radius: var(--r-m);
  padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-2);
  font-size: var(--fs-body); line-height: 1.7; color: var(--ink);
  text-align: left;
}

/* ── Countdown ───────────────────────────────────── */
.countdown {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(34, 34, 34, .94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-4);
  animation: fade-in .2s ease;
  cursor: pointer;
}
.countdown span#countdown-num {
  font-size: 9rem; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
  animation: count-zoom .9s var(--ease-pop) both;
}
.countdown-hint {
  margin: 0; color: var(--display-text); opacity: .7;
  font-weight: 600; font-size: var(--fs-body);
}

/* ── Modals ──────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 35, 40, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fade-in .18s ease;
}
.modal-card {
  background: var(--chassis);
  border-radius: var(--r-l);
  box-shadow: var(--e-float);
  width: min(680px, 100%);
  max-height: min(88dvh, 820px);
  overflow-y: auto;
  padding: var(--sp-5);
  -webkit-overflow-scrolling: touch;
  animation: pop-in .28s var(--ease-pop);
}
.modal.closing { animation: fade-out .16s var(--ease-swift) both; }
.modal.closing .modal-card { animation: pop-out .16s var(--ease-swift) both; }
.modal-small { width: min(420px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.modal-head h2 { font-size: var(--fs-title); }
.modal-close {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%;
  border: none; background: var(--panel);
  box-shadow: var(--e-key);
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease;
}
.modal-close .ic { width: 20px; height: 20px; }
.modal-close:active { transform: translateY(2px); box-shadow: none; }
.modal-foot {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  margin-top: var(--sp-4);
}
.hint-txt { font-size: 1.05rem; color: var(--ink-soft); font-weight: 600; margin: 6px 0; line-height: 1.6; }

/* Sounds */
.tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.tab {
  font: inherit; font-weight: 700; font-size: var(--fs-body);
  padding: 10px 18px; min-height: 48px;
  border: var(--line); border-radius: var(--r-m);
  background: var(--panel); color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform var(--t-fast) ease;
}
.tab:active { transform: translateY(2px); }
.tab.active { background: var(--accent); color: #fff; border-color: transparent; box-shadow: var(--e-key-col); }
.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--sp-3);
}
.sound-card {
  background: var(--panel);
  border-radius: var(--r-l);
  box-shadow: var(--e-key);
  padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch;
}
.sound-name { font-weight: 700; font-size: var(--fs-label); display: flex; gap: 8px; align-items: center; }
.sound-name .em { font-size: 1.35rem; }
.sound-name .pikto { width: 34px; height: 34px; object-fit: contain; }
.sound-btns { display: flex; gap: var(--sp-2); width: 100%; }
.sound-btns .btn { flex: 1; min-height: 46px; padding: 6px 10px; font-size: var(--fs-label); }
.sound-btns .btn .ic { width: 18px; height: 18px; }

/* Clip-Editor */
.clip-name-input { font-size: var(--fs-lead); flex: 1; }
.wave-wrap {
  position: relative;
  background: var(--panel);
  border-radius: var(--r-l);
  height: 150px;
  overflow: hidden;
  touch-action: none;
  margin-top: 6px;
  box-shadow: var(--e-well);
}
#clip-wave { width: 100%; height: 100%; display: block; }
.trim-handle {
  position: absolute; top: 0; bottom: 0;
  width: 44px; margin-left: -22px;
  cursor: ew-resize;
  display: flex; align-items: center; justify-content: center;
}
.trim-handle span {
  display: block; width: 14px; height: 74%;
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: var(--r-s);
  box-shadow: 0 2px 8px rgba(14, 116, 144, .45);
  transition: transform var(--t-fast) ease;
}
.trim-handle.grabbed span { transform: scaleX(1.3); }
.trim-handle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--r-s); }
.play-cursor {
  position: absolute; top: 0; bottom: 0; width: 3px;
  background: var(--play); z-index: 2;
  border-radius: 2px;
}
.clip-row {
  display: flex; align-items: center; gap: var(--sp-4);
  margin-top: var(--sp-4); flex-wrap: wrap;
  min-height: 46px;
}
.clip-dur { font-weight: 800; font-variant-numeric: tabular-nums; }
.clip-pos { font-weight: 700; font-size: var(--fs-label); color: var(--ink-soft); flex: 1; text-align: center; }
.clip-gain-row { gap: var(--sp-3); }
.clip-gain-row input { flex: 1; accent-color: var(--accent); height: 44px; min-width: 160px; }
.clip-actions { justify-content: space-between; }

/* Rollen-Verwaltung */
.role-list { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0 var(--sp-4); }
.role-row { display: flex; align-items: center; gap: var(--sp-3); }
.role-color-btn {
  width: var(--control-h); height: var(--control-h); flex: 0 0 var(--control-h);
  border-radius: 50%;
  border: 4px solid var(--panel);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform var(--t-fast) ease;
}
.role-color-btn:active { transform: scale(.9); }
.role-color-btn {
  color: #fff; font-weight: 800; font-size: 1.15rem; font-family: var(--font-round);
  display: flex; align-items: center; justify-content: center;
}
.role-row .text-input { flex: 1; min-width: 0; margin-top: 0; }
.suggest-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.suggest-chip {
  font: inherit; font-weight: 600; font-size: var(--fs-label);
  background: var(--panel-soft); color: var(--ink);
  border: var(--line); border-radius: 999px;
  min-height: 44px; padding: 8px 16px; cursor: pointer;
}
.suggest-chip:active { transform: scale(.96); }
.timeline-empty .empty-wave { width: 140px; height: 22px; color: var(--ink-faint); margin-bottom: var(--sp-2); }
.role-del {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 50%;
  border: none; background: var(--panel);
  box-shadow: var(--e-key);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast) ease;
}
.role-del .ic { width: 20px; height: 20px; }
.role-del:active { transform: translateY(2px); box-shadow: none; color: var(--error); }

/* Rollen-Chips im Clip-Editor */
.role-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: 6px 0 2px; }
.role-chip {
  font: inherit; font-weight: 700; font-size: var(--fs-label);
  color: #fff;
  border: none; border-radius: var(--r-m);
  padding: 8px 16px; min-height: 44px;
  cursor: pointer;
  opacity: .45;
  transition: opacity var(--t-fast) ease, transform var(--t-fast) ease;
}
.role-chip:active { transform: translateY(2px); }
.role-chip.active { opacity: 1; box-shadow: var(--e-key-col); }

/* Titelbild */
.cover-layout { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.cover-preview {
  width: 230px; height: 230px;
  border-radius: var(--r-l);
  background: var(--panel);
  box-shadow: var(--e-panel);
  flex: 0 0 auto;
}
.cover-tools { flex: 1; min-width: 220px; }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: var(--sp-2); margin: var(--sp-2) 0;
}
.emoji-grid button {
  font-size: 1.7rem; min-height: 52px;
  background: var(--panel); border: 2px solid transparent; border-radius: var(--r-m);
  box-shadow: var(--e-key);
  cursor: pointer;
  transition: transform var(--t-fast) ease;
}
.emoji-grid button:active { transform: translateY(2px); box-shadow: none; }
.emoji-grid button.active { border-color: var(--accent); background: var(--accent-soft); }
.color-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.color-row button {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 2px 0 rgba(0,0,0,.22);
  cursor: pointer;
  transition: transform var(--t-fast) ease;
}
.color-row button:active { transform: scale(.9); }
.color-row button.active { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Folge speichern */
.export-layout {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.export-cover {
  width: 130px; height: 130px; object-fit: cover;
  border-radius: var(--r-l);
  background: var(--panel);
  box-shadow: var(--e-panel);
}
.export-fields { display: flex; flex-direction: column; gap: var(--sp-3); font-weight: 700; font-size: var(--fs-label); }
.text-input {
  font: inherit; font-weight: 600; font-size: var(--fs-body); color: var(--ink);
  width: 100%; margin-top: 6px;
  height: var(--control-h);
  background: var(--panel);
  border: 2px solid transparent;
  border-radius: var(--r-m);
  box-shadow: var(--e-well);
  padding: 0 14px;
}
.text-input:focus { outline: none; border-color: var(--accent); }
.text-input::placeholder { color: var(--ink-soft); }
.progress {
  height: 22px; margin-top: var(--sp-4);
  border-radius: 999px;
  background: var(--chassis-deep);
  box-shadow: var(--e-well);
  overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: var(--play);
  transition: width .15s linear;
}
.export-stage { text-align: center; margin-top: var(--sp-2); }
#export-download:not([hidden]) { animation: clip-land .45s var(--ease-back); position: relative; }
#export-download:not([hidden])::after {
  content: ""; position: absolute; inset: -5px; border-radius: var(--r-l);
  border: 3px solid var(--play);
  animation: success-ring .8s .2s var(--ease-swift) both;
  pointer-events: none;
}

/* Info */
.modal-text .info-body { -webkit-user-select: text; user-select: text; }
.info-body h3 { margin: var(--sp-4) 0 var(--sp-1); font-size: 1.05rem; }
.info-body p { margin: var(--sp-1) 0 var(--sp-2); line-height: 1.55; font-size: .95rem; }

/* Bestätigen + Toast */
.confirm-msg { font-weight: 700; font-size: var(--fs-lead); text-align: center; margin: var(--sp-3) 0 var(--sp-4); line-height: 1.5; }
.confirm-row { display: flex; gap: var(--sp-3); }
.confirm-row .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  background: #222; color: #fff;
  font-weight: 700; font-size: var(--fs-body);
  padding: 12px 20px;
  border-radius: var(--r-l);
  box-shadow: 0 12px 30px rgba(30, 35, 40, .4);
  animation: toast-in .28s var(--ease-pop);
  max-width: 90vw; text-align: center;
  display: flex; align-items: center; gap: var(--sp-3);
}
.toast.hiding { animation: toast-out .2s var(--ease-swift) both; }
.toast-action {
  font: inherit; font-weight: 800;
  background: none; border: 1.5px solid rgba(237,241,244,.4);
  border-radius: var(--r-s);
  color: var(--display-mint);
  padding: 8px 14px; min-height: 44px;
  cursor: pointer;
}
.toast-action:active { background: rgba(237,241,244,.12); }

/* ── Responsiv ───────────────────────────────────── */
@media (max-width: 900px) {
  .rec-panel { grid-template-columns: 1fr; }
  .display { min-height: 128px; }
}
@media (max-width: 640px) {
  /* Feste Aktionsleiste: genau EINE Hauptaktion, Werkzeuge kompakt daneben */
  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    margin: 0;
    padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom));
    background: rgba(245, 245, 247, .96);
    border-top: var(--line);
    gap: var(--sp-2);
  }
  .bottombar .btn {
    flex-direction: column; gap: 2px;
    min-height: 56px; padding: 6px 8px;
    font-size: .72rem; font-weight: 600;
    flex: 1;
    box-shadow: none;
  }
  .bottombar .btn .ic { width: 24px; height: 24px; }
  .bottombar .btn-primary {
    flex: 1.6;
    font-size: .8rem; font-weight: 700;
    box-shadow: var(--e-key-col);
  }
  #screen-studio { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* Topbar: Name bekommt eine eigene volle Zeile */
  .topbar { flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
  .name-input { order: 3; flex-basis: 100%; height: 44px; font-size: 1.1rem; }
  .save-state { margin-left: auto; }
  /* Phasen kompakter, Pfeile enger */
  .phase-steps { gap: 2px; }
  .phase-step { padding: 6px 8px; font-size: .78rem; gap: 4px; }
  .phase-sep .ic { width: 12px; height: 12px; }
  .rec-btn { width: 100px; height: 100px; }
  .rec-panel { padding: var(--sp-4); }
  .display { min-height: 96px; padding: var(--sp-3) var(--sp-4); }
  .export-layout { grid-template-columns: 1fr; }
  .export-cover { margin: 0 auto; }
  .clip-pos { order: -1; flex-basis: 100%; }

  /* Modale werden zu Bottom Sheets */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 28px 28px 0 0;
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
  }
  .modal-card::before {
    content: ""; display: block;
    width: 44px; height: 5px; border-radius: 999px;
    background: var(--line-col);
    margin: 0 auto var(--sp-3);
  }
}

/* Handy im Querformat (wenig Höhe): Aufnahme und Anzeige nebeneinander, alles kompakter */
@media (max-height: 520px) {
  .rec-panel { grid-template-columns: 1fr 240px; padding: var(--sp-3) var(--sp-4); }
  .rec-btn, .role-rec-btn { width: 84px; height: 84px; }
  .display { min-height: 84px; padding: var(--sp-2) var(--sp-3); }
  .rec-time { font-size: 2.2rem; }
  .start-head { padding: var(--sp-3) 0; }
}

/* ── Reduzierte Bewegung: Bewegung aus, Zustand bleibt ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .rec-btn.recording { box-shadow: 0 0 0 6px rgba(242,71,63,.4), 0 4px 0 var(--rec-deep); }
  .role-rec-btn.recording { box-shadow: 0 0 0 6px rgba(35,40,45,.35), 0 4px 0 rgba(0,0,0,.28); }
  .rec-dot { animation: none; }
  .clip-card.playing { transform: none; outline-width: 4px; }
  .fly-ghost { display: none; }
  .clip-progress { transition: none; }
  /* Countdown-Ziffer muss ohne Animation sichtbar bleiben */
  .countdown span#countdown-num { animation: none !important; opacity: 1; transform: none; }
}
