/* Podcast-Studio — Aufnahme-Editor (Doppelender), Referenz-Look
   Selbst-enthaltend: System-Fonts, Inline-SVG, keine externen Assets. */

:root {
  --bg:        #070a0d;
  --shell:     #0e1319;
  --panel:     #121821;
  --panel-2:   #17202a;
  --raise:     #1f2a35;
  --rail:      #0f151c;
  --stage:     #0a0f14;
  --line:      #232e3a;
  --line-soft: #1a232d;

  --ink:       #eef3f8;
  --ink-dim:   #aeb9c6;
  --muted:     #75828f;
  --faint:     #4b5662;

  --amber:     #f2b02c;   /* Spur „Du" */
  --amber-ink: #1a1204;
  --teal:      #35d6c4;   /* Spur „Gegenüber" */
  --green:     #34d17a;   /* Export / ok */
  --rec:       #ff4038;
  --rec-glow:  rgba(255,64,56,0.5);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  --dl-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v12"/><path d="M7 11l5 5 5-5"/><path d="M4 20h16"/></svg>');
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(820px 460px at 4% -6%, rgba(53,214,196,0.14), transparent 58%),
    radial-gradient(760px 520px at 106% 108%, rgba(53,214,196,0.10), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.5vh, 26px);
  min-height: 100%;
}

#app {
  width: 100%;
  max-width: min(1720px, 95vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
[hidden] { display: none !important; }

/* ---------- Login ---------- */
#login {
  align-self: center;
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0) 120px), var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(22px, 4vw, 32px);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 70px -40px rgba(0,0,0,0.9);
}
.brand-lg { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.brand-lg .mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.brand-lg .mark svg { width: 21px; height: 21px; }
.brand-lg .word { display: flex; flex-direction: column; line-height: 1.05; font-weight: 680; font-size: 20px; letter-spacing: -0.02em; }
.brand-lg .sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 3px; font-weight: 500; }
.login-intro { margin: 0 0 4px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.login-intro b { color: var(--ink-dim); font-weight: 600; }
.field-label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
#login-form, #create-form { display: flex; flex-direction: column; gap: 14px; }
.login-error { margin: 0; font-size: 12px; color: #e2544f; }
.login-hello { margin: 0; font-size: 13.5px; color: var(--muted); }
.linklike { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px; align-self: flex-start; text-decoration: underline; }
.login-copy { margin: 26px 0 0; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--muted); opacity: 0.75; }
#password, #identifier { width: 100%; font-family: var(--mono); font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 15px; transition: border-color .15s, box-shadow .15s; }
#password::placeholder, #identifier::placeholder { color: var(--faint); }
#password:focus, #identifier:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242,176,44,0.16); }
#create, #do-login { appearance: none; cursor: pointer; font: inherit; font-weight: 640; font-size: 15px; color: var(--amber-ink);
  background: linear-gradient(180deg, #ffc247, var(--amber)); border: none; border-radius: 10px; padding: 14px 18px;
  box-shadow: 0 8px 20px -8px rgba(242,176,44,0.6), inset 0 1px 0 rgba(255,255,255,0.35); transition: transform .08s, filter .15s; }
#create:hover, #do-login:hover { filter: brightness(1.05); }
#create:active, #do-login:active { transform: translateY(1px); }
#create:focus-visible, #do-login:focus-visible { outline: 2px solid #ffd77a; outline-offset: 2px; }

/* ---------- Editor-Shell ---------- */
#studio {
  --lane-h: 92px; /* Spurhöhe, per Zoom-Regler justierbar */
  background: var(--shell);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 214px 1fr 268px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "topbar topbar topbar"
    "rail   stage  invite"
    "transport transport transport";
  height: min(74vh, 720px);
  min-height: 480px;
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.9);
}

/* Top-Bar */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .mark { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.topbar .mark svg { width: 17px; height: 17px; }
.proj { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.proj-name { font-size: 14px; font-weight: 620; letter-spacing: -0.01em; }
.proj-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-top: 2px; }
.topbar-spacer { flex: 1; }
.session-pill { display: inline-flex; align-items: center; background: transparent; border: none; padding: 0; }
.session-pill [data-role="session-label"] { display: none; }
.session-pill .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--faint); transition: background .18s, box-shadow .18s; }
.session-pill[data-live="1"] .dot { background: var(--green); box-shadow: 0 0 9px -1px var(--green); }
.btn-ghost {
  appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 560;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px;
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: #34404d; color: var(--ink); }
/* Export = Downloads-Trigger; leer → disabled Look */
.btn-export {
  display: inline-flex; align-items: center; gap: 8px;
  appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 620;
  color: var(--amber-ink); background: linear-gradient(180deg, #ffc247, var(--amber)); border: none; border-radius: 9px; padding: 9px 15px;
  box-shadow: 0 6px 16px -8px rgba(242,176,44,0.6); transition: filter .15s, opacity .15s;
}
.btn-export svg { width: 15px; height: 15px; }
.btn-export:hover { filter: brightness(1.05); }
.btn-export[aria-disabled="true"] { background: var(--raise); color: var(--faint); box-shadow: none; cursor: default; }

/* Linke Spur-Leiste */
.rail {
  grid-area: rail;
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px; border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.add-track {
  appearance: none; font: inherit; font-size: 11px; color: var(--faint);
  background: transparent; border: 1px dashed var(--line); border-radius: 7px; padding: 4px 8px;
  cursor: not-allowed;
}
.rail-track {
  padding: 12px 13px; border-bottom: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 9px;
}
.rt-head { display: flex; align-items: center; gap: 9px; }
.rt-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rail-track[data-who="local"]  .rt-dot { background: var(--amber); }
.rail-track[data-who="remote"] .rt-dot { background: var(--teal); }
.rt-name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.rt-state { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px; }
.rt-state::before { content:""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.rail-track[data-who="local"]  .rt-state[data-live="1"]::before { background: var(--amber); box-shadow: 0 0 6px -1px var(--amber); }
.rail-track[data-who="remote"] .rt-state[data-live="1"]::before { background: var(--teal); box-shadow: 0 0 6px -1px var(--teal); }
.rt-state[data-live="1"] { color: var(--ink-dim); }
.rt-controls { display: flex; align-items: center; gap: 8px; }
.rt-mute {
  appearance: none; cursor: pointer; font: inherit; font-size: 10px; font-weight: 600;
  width: 26px; height: 24px; flex: none;
  color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.rt-mute:hover { color: var(--ink); border-color: #34404d; }
.rt-mute[data-on="1"] { color: var(--rec); border-color: rgba(255,64,56,0.5); background: rgba(255,64,56,0.08); }
/* Range-Slider (Anzeige/Lautstärke) */
.rt-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 3px;
  background: var(--raise); outline: none; cursor: pointer; }
.rt-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--ink); border: 2px solid var(--rail); box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.rt-slider::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--ink); border: 2px solid var(--rail); }

/* Zentrale Timeline */
.stage { grid-area: stage; background: var(--stage); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ruler {
  height: 30px; flex: none; position: relative;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: flex-end;
  background:
    repeating-linear-gradient(90deg, transparent 0 63px, rgba(255,255,255,0.05) 63px 64px);
  padding: 0 0 5px 0;
}
.ruler span {
  position: absolute; bottom: 5px; font-family: var(--mono); font-size: 9px; color: var(--faint);
  transform: translateX(6px);
}
.lanes { flex: 1; position: relative; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 63px, rgba(255,255,255,0.03) 63px 64px); }
.lane-row {
  flex: none; height: var(--lane-h, 92px); position: relative; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; padding: 6px 0; transition: height .12s ease;
}
.lane-tag {
  position: absolute; top: 8px; left: 10px; z-index: 2;
  font-size: 10.5px; font-weight: 600; color: #0a0f14;
  padding: 3px 9px; border-radius: 6px;
}
.lane-row[data-who="local"]  .lane-tag { background: var(--amber); }
.lane-row[data-who="remote"] .lane-tag { background: var(--teal); }
.lane-row canvas { display: block; width: 100%; height: 100%; }
/* Schreibkopf (Playhead) am rechten Rand des Live-Fensters */
.playhead { position: absolute; top: 0; bottom: 0; right: 16%; width: 1.5px; background: rgba(255,255,255,0.55); z-index: 3; pointer-events: none; }
.playhead::before { content:""; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: rgba(255,255,255,0.8); border-bottom: 0; }
/* Spurhöhen-Zoom — sitzt in der linken Spur-Leiste (Rail) */
.rail-zoom {
  margin-top: auto; padding: 12px 13px; border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.rz-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.rz-controls { display: flex; align-items: center; gap: 8px; }
.rz-controls button {
  appearance: none; cursor: pointer; width: 22px; height: 22px; line-height: 1; padding: 0; flex: none;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  color: var(--ink-dim); background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  transition: border-color .12s, color .12s;
}
.rz-controls button:hover { border-color: #34404d; color: var(--ink); }
.rz-controls input[type="range"] { flex: 1; min-width: 0; accent-color: var(--amber); cursor: pointer; }

/* Rechtes Panel */
.invite { grid-area: invite; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; }
.invite-inner { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.card-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal);
}
.card-head svg { width: 15px; height: 15px; }
.invite-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
#guest-link { position: relative; margin: 8px 0 0; display: flex; flex-direction: column; align-items: stretch; gap: 7px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 9px; padding: 11px; padding-right: 34px; }
#guest-link:empty { display: none; }
#guest-link a { min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#guest-link a:hover { color: var(--teal); }
.copy-btn { position: absolute; top: 7px; right: 7px; flex: none; cursor: pointer; color: var(--muted);
  background: var(--raise); border: 1px solid var(--line); border-radius: 6px; padding: 4px; display: inline-flex; align-items: center; justify-content: center; transition: border-color .15s, color .15s; }
.copy-btn:hover { border-color: var(--teal); color: var(--teal); }
.copy-btn svg { width: 12px; height: 12px; }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line-soft); }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #0a0f14; }
.avatar svg { width: 16px; height: 16px; }
.person-name { font-size: 12.5px; font-weight: 560; flex: 1; }
.person-state { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.05em; color: var(--faint); display: inline-flex; align-items: center; gap: 5px; }
.person-state::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.person-state[data-on="1"] { color: var(--green); }
.person-state[data-on="1"]::before { background: var(--green); box-shadow: 0 0 6px -1px var(--green); }
.person-bw { font-family: var(--mono); font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.person-bw:empty { display: none; }
/* Namen umbenennbar (nur der Host bekommt diese Klasse per JS) */
.rt-name.editable, .person-name.editable { cursor: pointer; }
.rt-name.editable:hover, .person-name.editable:hover { text-decoration: underline dotted; text-underline-offset: 3px; color: var(--ink); }

.results-head { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
#downloads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
#downloads:empty { display: none; }
#downloads:empty + .results-empty { display: block; }
.results-empty { display: none; font-size: 11.5px; color: var(--faint); }
#downloads li { display: flex; }
#downloads a { flex: 1; display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12px; color: var(--ink);
  text-decoration: none; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; transition: border-color .15s, background .15s; }
#downloads a::before { content:""; width: 15px; height: 15px; flex: none; background: var(--green);
  -webkit-mask: var(--dl-icon) center / contain no-repeat; mask: var(--dl-icon) center / contain no-repeat; }
#downloads a:hover { border-color: var(--green); background: var(--raise); }

/* Transport-Leiste */
.transport {
  grid-area: transport;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
  padding: 11px 18px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.tp-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.timecode { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 600; letter-spacing: 0.01em; color: var(--muted); transition: color .2s; }
.timecode.live { color: var(--rec); }
.tp-center { display: flex; align-items: center; justify-content: center; gap: 10px; }
#rec { appearance: none; cursor: pointer; font: inherit; font-weight: 640; font-size: 14px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 100px; padding: 12px 24px;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform .08s, border-color .15s, background .15s, box-shadow .2s, color .15s; }
#rec::before { content:""; width: 12px; height: 12px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 9px -1px var(--rec-glow); flex: none; }
#rec:hover { border-color: #34404d; background: var(--raise); }
#rec:active { transform: translateY(1px); }
#rec:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
#rec.recording { color: #fff; background: linear-gradient(180deg, #3a1615, #2a100f); border-color: rgba(255,64,56,0.55);
  box-shadow: 0 0 0 1px rgba(255,64,56,0.25), 0 12px 30px -14px var(--rec-glow); }
#rec.recording::before { background: #fff; border-radius: 2px; box-shadow: 0 0 10px 1px var(--rec-glow); animation: rec-pulse 1.35s ease-in-out infinite; }
@keyframes rec-pulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.45;transform:scale(0.8);} }
#rec:disabled { opacity: .55; cursor: progress; }
/* Monitor-Stummschalter im Transport (spiegelt Gegenüber-Mute) */
.tp-monitor { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.tp-icon-btn { appearance: none; cursor: pointer; width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--ink-dim); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, color .15s; }
.tp-icon-btn:hover { border-color: #34404d; color: var(--ink); }
.tp-icon-btn svg { width: 18px; height: 18px; }
/* Monitor-Popover (Selbst- + Gegenüber-Lautstärke, nur Hören) */
.mon-pop { position: absolute; bottom: calc(100% + 12px); left: 0; z-index: 30;
  width: 340px; max-width: calc(100vw - 32px);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 18px; box-shadow: 0 24px 60px -22px rgba(0,0,0,0.95); }
.mon-row { display: flex; align-items: center; gap: 16px; }
.mon-row label { font-size: 14px; color: var(--ink-dim); width: 96px; flex: none; }
.mon-row input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 6px; border-radius: 4px; background: var(--raise); outline: none; cursor: pointer; margin: 0 2px; }
.mon-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel-2); box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.mon-row input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel-2); }
.mon-hint { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--faint); }
.tp-right { display: flex; align-items: center; justify-content: flex-end; }
#status { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 12.5px; line-height: 1.35; color: var(--ink-dim); text-align: right; justify-content: flex-end; }
#status:empty { display: none; }
#status::before { content:""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(117,130,143,0.12); }
#status[data-tone="ok"] { color: var(--ink); }
#status[data-tone="ok"]::before { background: var(--green); box-shadow: 0 0 8px -1px var(--green); }
#status[data-tone="rec"]::before { background: var(--rec); box-shadow: 0 0 8px -1px var(--rec); animation: rec-pulse 1.35s ease-in-out infinite; }
#status[data-tone="warn"] { color: #f6d38a; }
#status[data-tone="warn"]::before { background: var(--amber); box-shadow: 0 0 8px -1px var(--amber); }
#status[data-tone="err"] { color: #ffb3ae; }
#status[data-tone="err"]::before { background: var(--rec); box-shadow: 0 0 8px -1px var(--rec); }

/* Gast: Einladung weg, ruhiger */
.guest-note { display: none; font-size: 12px; color: var(--muted); }
body[data-role="guest"] .studio-invite { display: none; }
body[data-role="guest"] .guest-note { display: block; }
/* Aufnahme steuert der Host → Gast hat keinen Record-Button */
body[data-role="guest"] #rec { display: none; }
body[data-role="guest"] #close-room { display: none; }

/* ---------- Responsiv ---------- */
@media (max-width: 900px) {
  #studio {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas: "topbar" "stage" "rail" "invite" "transport";
    height: auto;
  }
  .rail { border-right: none; border-top: 1px solid var(--line); flex-direction: row; overflow-x: auto; }
  .rail-head { display: none; }
  .rail-track { border-bottom: none; border-right: 1px solid var(--line-soft); min-width: 190px; }
  .stage { min-height: 300px; }
  .invite { border-left: none; border-top: 1px solid var(--line); }
  .transport { grid-template-columns: 1fr; gap: 12px; }
  .tp-left, .tp-center, .tp-right { justify-content: space-between; }
  #rec { flex: 1; justify-content: center; }
  #status { justify-content: flex-start; text-align: left; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .btn-ghost { display: none; }
  .timecode { font-size: 21px; }
}
/* Fokus-Sichtbarkeit auf allen interaktiven Elementen (WCAG 2.4.7) */
.btn-ghost:focus-visible, .btn-export:focus-visible, .copy-btn:focus-visible,
.rt-mute:focus-visible, .tp-icon-btn:focus-visible, .add-track:focus-visible,
#guest-link a:focus-visible, #downloads a:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
.rt-slider:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* ---------- Modal (Beenden / Name ändern) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,7,10,0.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: modal-fade .14s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0) 90px), var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  box-shadow: 0 40px 90px -40px rgba(0,0,0,0.9);
  display: flex; flex-direction: column; gap: 14px;
  animation: modal-pop .16s ease;
}
@keyframes modal-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 680; letter-spacing: -0.01em; margin: 0; }
.modal-msg { font-size: 13.5px; line-height: 1.55; color: var(--ink-dim); margin: 0; }
.modal-input {
  width: 100%; font-family: var(--mono); font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px;
}
.modal-input::placeholder { color: var(--faint); }
.modal-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242,176,44,0.16); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.modal-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 10px; padding: 11px 18px; border: 1px solid var(--line); background: transparent; color: var(--ink-dim);
  transition: border-color .15s, color .15s, filter .15s;
}
.modal-btn:hover { border-color: #34404d; color: var(--ink); }
.modal-btn.primary { border: none; color: var(--amber-ink); background: linear-gradient(180deg, #ffc247, var(--amber)); font-weight: 640; box-shadow: 0 8px 20px -8px rgba(242,176,44,0.6); }
.modal-btn.primary:hover { filter: brightness(1.05); }
.modal-btn.danger { border: none; color: #fff; background: linear-gradient(180deg, #ff5a52, var(--rec)); font-weight: 640; box-shadow: 0 8px 20px -8px var(--rec-glow); }
.modal-btn.danger:hover { filter: brightness(1.05); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- Regie (Admin /admin) ---------- */
/* Reuses the studio's shell language: dark panels, amber accent, mono eyebrows.
   Signature: each host renders as a "track" row, echoing the recording rail. */

/* Login gate — same card feel as the host login box */
.rg-login {
  width: 100%; max-width: 440px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0) 120px), var(--panel);
  border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(24px, 4vw, 34px);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 70px -40px rgba(0,0,0,0.9);
}
.rg-login .rg-brand { margin-bottom: 4px; }
.rg-login input {
  width: 100%; font-family: var(--mono); font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 15px;
  transition: border-color .15s, box-shadow .15s;
}
.rg-login input::placeholder { color: var(--faint); }
.rg-login input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242,176,44,0.16); }

/* Brand lockup (login + topbar) */
.rg-brand { display: flex; align-items: center; gap: 12px; }
.rg-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.rg-mark svg { width: 19px; height: 19px; }
.rg-name { display: flex; flex-direction: column; line-height: 1.06; font-weight: 680; font-size: 18px; letter-spacing: -0.02em; }
.rg-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* Wide dashboard shell */
.rg-shell {
  width: 100%; max-width: 940px;
  background: var(--shell); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.9);
}
.rg-top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.rg-top .rg-name { font-size: 15px; }
.rg-spacer { flex: 1; }
.rg-admin { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.rg-admin .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px -1px var(--green); }
.rg-ghost {
  appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 560;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px;
  transition: border-color .15s, color .15s;
}
.rg-ghost:hover { border-color: #34404d; color: var(--ink); }

/* Two panes: create (left) + roster (right) */
.rg-grid { display: grid; grid-template-columns: 300px 1fr; align-items: start; }
.rg-create { padding: 26px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.rg-roster { padding: 26px 24px; display: flex; flex-direction: column; gap: 6px; min-height: 320px; }
.rg-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.rg-count { color: var(--amber); }

#a-create { display: flex; flex-direction: column; gap: 11px; margin: 0; }
#a-create input {
  width: 100%; font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px;
  transition: border-color .15s, box-shadow .15s;
}
#a-create input::placeholder { color: var(--faint); }
#a-create input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242,176,44,0.16); }

.rg-primary {
  appearance: none; cursor: pointer; font: inherit; font-weight: 640; font-size: 15px; color: var(--amber-ink);
  background: linear-gradient(180deg, #ffc247, var(--amber)); border: none; border-radius: 10px; padding: 13px 18px;
  box-shadow: 0 8px 20px -8px rgba(242,176,44,0.6), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform .08s, filter .15s; margin-top: 2px;
}
.rg-primary:hover { filter: brightness(1.05); }
.rg-primary:active { transform: translateY(1px); }
.rg-primary:focus-visible { outline: 2px solid #ffd77a; outline-offset: 2px; }
.rg-do-login { width: 100%; }

.rg-msg { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-dim); }
.rg-msg[data-kind="err"] { color: #e2544f; }
.rg-error { margin: 0; font-size: 12.5px; color: #e2544f; }

/* Roster rows — each host as a "track" (echoes .rail-track) */
.rg-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.rg-track {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 11px;
  transition: border-color .15s;
}
.rg-track:hover { border-color: var(--line); }
.rg-tdot { width: 11px; height: 11px; border-radius: 3px; flex: none; background: var(--amber); box-shadow: 0 0 7px -2px var(--amber); }
.rg-tname { font-size: 14px; font-weight: 620; color: var(--ink); }
.rg-temail { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-remove {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 560; flex: none;
  color: var(--muted); background: transparent; border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 11px;
  transition: color .15s, border-color .15s;
}
.rg-remove:hover { color: var(--rec); border-color: rgba(255,64,56,0.5); }
.rg-edit {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 560; flex: none;
  color: var(--muted); background: transparent; border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 11px;
  transition: color .15s, border-color .15s;
}
.rg-edit:hover { color: var(--ink); border-color: #34404d; }
.rg-empty { margin: 10px 0 0; font-size: 13px; color: var(--faint); line-height: 1.5; }

/* Inline-Bearbeiten einer Host-Zeile */
.rg-track.rg-editing { flex-direction: column; align-items: stretch; gap: 10px; }
.rg-editfields { display: flex; flex-direction: column; gap: 8px; }
.rg-editfields input {
  width: 100%; font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
.rg-editfields input::placeholder { color: var(--faint); }
.rg-editfields input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242,176,44,0.16); }
.rg-editactions { display: flex; gap: 8px; align-items: center; }
.rg-save { flex: none; padding: 9px 16px; font-size: 13px; margin-top: 0; }

@media (max-width: 640px) {
  .rg-grid { grid-template-columns: 1fr; }
  .rg-create { border-right: none; border-bottom: 1px solid var(--line); }
}

/* ---------- Nachbearbeitung / Editor-Screen ---------- */
#editor { max-width: 1280px; margin: 0 auto; padding: 24px; width: 100%; }
.editor-head { display: flex; align-items: baseline; gap: 16px; }
.editor-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.editor-head .eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.editor-head .btn-ghost { margin-left: auto; }

/* ---- Multitrack-Editor — folgt dem Studio-Design-System (Tokens, .btn-ghost/.btn-export) ---- */
.editor-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; margin: 10px 0; flex-wrap: wrap; }
/* Werkzeug-Knöpfe = Ghost-Look wie im Studio (Beenden/Bearbeiten) */
.tool-btn { appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 560; color: var(--ink-dim);
  background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; transition: border-color .15s, color .15s; }
.tool-btn:hover:not(:disabled) { border-color: #34404d; color: var(--ink); }
.tool-btn:disabled { opacity: .4; cursor: default; }
.toolbar-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.toolbar-spacer { flex: 1; }
.timeline { position: relative; width: 100%; height: 240px; background: var(--stage); border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.tl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tl-overlay { pointer-events: none; }
.cut-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.cut-row-label { color: var(--muted); font-size: 13px; }
.cut-list { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 0; margin: 0; }
.cut-chip { color: var(--ink-dim); background: rgba(255,64,56,.14); border: 1px solid rgba(255,64,56,.4); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; transition: background .15s, color .15s; }
.cut-chip:hover { background: rgba(255,64,56,.26); color: var(--ink); }
.status-row { display: flex; gap: 16px; min-height: 1.4em; color: var(--ink-dim); font-size: 13px; }

/* Download-Buttons (erscheinen nach dem Mastern) — gleicher Ghost-Look wie .tool-btn */
.dl-area { display: inline-flex; gap: 8px; }
.dl-btn { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font: inherit; font-size: 13px; font-weight: 560;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px;
  transition: border-color .15s, color .15s; }
.dl-btn:hover { border-color: #34404d; color: var(--ink); }

.mute-chip { background: rgba(255,255,255,.06); }
.mute-chip.mute-host { border-color: var(--amber); color: var(--amber); background: rgba(242,176,44,.12); }
.mute-chip.mute-gast { border-color: var(--teal); color: var(--teal); background: rgba(53,214,196,.12); }
.mute-chip:hover { filter: brightness(1.12); }
