/* =====================================================================
   TT-AI — Design System
   Zwei Themes: "editorial" (Light) und "studio" (Dark)
   ===================================================================== */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Light Mode "Editorial" (Default) ---------- */
:root,
:root[data-theme="editorial"] {
  /* Backgrounds */
  --bg-base:    #FAF8F3;
  --bg-surface: #FFFFFF;
  --bg-subtle:  #F3EFE5;
  --bg-inverse: #1A1A1A;

  /* Text */
  --text-primary:    #1A1A1A;
  --text-secondary:  #5C574E;
  --text-tertiary:   #8C8579;
  --text-quaternary: #B0AA9E;
  --text-inverse:    #FAF8F3;

  /* Borders */
  --border-subtle:  #E5DDC8;
  --border-default: #D6CFC0;
  --border-strong:  #B0AA9E;

  /* Accent — Gold */
  --accent:     #C9A038;
  --accent-hover: #B08A2C;
  --accent-bg:  rgba(201, 160, 56, 0.08);

  /* Brand (Ball orange — nur Logo) */
  --brand: #E84A2F;

  /* Semantic */
  --success:    #5B7A3A;
  --warning:    #B8852A;
  --danger:     #B43A2B;
  --info:       #3D5A7A;
  --success-bg: rgba(91, 122, 58, 0.09);
  --warning-bg: rgba(184, 133, 42, 0.09);
  --danger-bg:  rgba(180, 58, 43,  0.09);
  --info-bg:    rgba(61, 90, 122,  0.09);

  /* Typography */
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Type scale */
  --text-hero:   36px;
  --text-h1:     22px;
  --text-h2:     18px;
  --text-h3:     15px;
  --text-body:   14px;
  --text-small:  13px;
  --text-caption:12px;
  --text-micro:  11px;
  --text-label:  10px;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  /* Component tokens */
  --c-primary:       var(--bg-inverse);
  --c-primary-text:  var(--text-inverse);
  --c-primary-hover: #333;
  --c-focus:         var(--accent);
  --btn-radius:      var(--radius-pill);
  --input-bg:        var(--bg-surface);

  /* Topbar */
  --topbar-bg:     var(--bg-surface);
  --topbar-border: var(--border-subtle);

  /* Canvas drawing (BBox-Tool) */
  --canvas-stroke: #1A1A1A;
  --canvas-fill:   rgba(26, 26, 26, 0.10);
}

/* ---------- Dark Mode "Studio" ---------- */
:root[data-theme="studio"] {
  --bg-base:    #0B0F14;
  --bg-surface: #131922;
  --bg-subtle:  #1A222E;
  --bg-inverse: #FFFFFF;

  --text-primary:    #FFFFFF;
  --text-secondary:  #B6BDC8;
  --text-tertiary:   #8892A0;
  --text-quaternary: #6B7886;
  --text-inverse:    #0B0F14;

  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.20);

  --accent:       #FF5C39;
  --accent-hover: #E63E1F;
  --accent-bg:    rgba(255, 92, 57, 0.10);

  --brand: #FF5C39;

  --success:    #4DD49A;
  --warning:    #FFB454;
  --danger:     #FF6B6B;
  --info:       #6BB3FF;
  --success-bg: rgba(77, 212, 154,  0.10);
  --warning-bg: rgba(255, 180, 84,  0.10);
  --danger-bg:  rgba(255, 107, 107, 0.10);
  --info-bg:    rgba(107, 179, 255, 0.10);

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --text-hero:    36px;
  --text-h1:      22px;
  --text-h2:      18px;
  --text-h3:      15px;
  --text-body:    14px;
  --text-small:   13px;
  --text-caption: 12px;
  --text-micro:   11px;
  --text-label:   10px;

  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  --c-primary:       var(--accent);
  --c-primary-text:  #FFFFFF;
  --c-primary-hover: var(--accent-hover);
  --c-focus:         var(--accent);
  --btn-radius:      var(--radius-md);
  --input-bg:        var(--bg-subtle);

  --topbar-bg:     var(--bg-surface);
  --topbar-border: var(--border-subtle);

  --canvas-stroke: #FF5C39;
  --canvas-fill:   rgba(255, 92, 57, 0.10);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

*:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

html {
  font-size: 16px;
  /* smooth theme transitions */
  transition: background-color 0.15s ease, color 0.15s ease;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  padding: 0 56px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text-primary);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}

.brand-mark::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--brand);
  border-radius: 50%;
  bottom: 0;
  right: 0;
}

.brand-word {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Studio: durchgängig Inter */
:root[data-theme="studio"] .brand-word {
  font-family: var(--font-sans);
  letter-spacing: 0;
}

.topbar-spacer { flex: 1; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.theme-toggle svg { display: block; }

/* ---------- Topbar Nav ---------- */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  margin-right: var(--sp-4);
}

.nav-link {
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.12s;
  position: relative;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text-primary); }

.nav-link.active {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--text-primary);
}

:root[data-theme="studio"] .nav-link.active::after { background: var(--accent); }

/* ---------- Topbar step-pill (mobile only) ---------- */
.topbar-pill {
  display: none;
}

/* editorial (light): show moon → click goes dark */
:root[data-theme="editorial"] .icon-sun  { display: none; }
:root[data-theme="editorial"] .icon-moon { display: block; }
/* studio (dark): show sun → click goes light */
:root[data-theme="studio"] .icon-moon { display: none; }
:root[data-theme="studio"] .icon-sun  { display: block; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 880px;
  margin: var(--sp-8) auto;
  padding: 0 var(--sp-6);
}

.hidden { display: none !important; }

/* ---------- Stepper ---------- */
.steps {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: var(--sp-2);
  margin-bottom: var(--sp-8);
  counter-reset: s;
}

.steps li {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  counter-increment: s;
  transition: color 0.15s;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

/* short divider between steps */
.steps li:not(:last-child)::after {
  content: '';
  width: 28px;
  height: 1.5px;
  margin: 0 var(--sp-3);
  background: var(--border-default);
  flex-shrink: 0;
  transition: background 0.15s;
}

.steps li::before {
  content: counter(s);
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--text-quaternary);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 500;
  border: 1.5px solid var(--border-default);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.steps li.active {
  color: var(--text-primary);
  font-weight: 600;
}

.steps li.active::before {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--bg-inverse);
}

.steps li.done { color: var(--accent); }

.steps li.done::before {
  content: "✓";
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.steps li.done::after { background: var(--accent); }

:root[data-theme="studio"] .steps li.active::before {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- Card ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-8);
}

/* ---------- Hero em (italic serif emphasis in headlines) ---------- */
.hero-em {
  font-style: italic;
  color: var(--accent);
}

/* Step-0 hero — page-level, sits above the card */
.step0-hero {
  padding: var(--sp-8) 0 var(--sp-6);
}

.step0-hero h1 {
  font-size: var(--text-hero);
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}

:root[data-theme="studio"] .step0-hero h1 {
  font-family: var(--font-sans);
  font-size: var(--text-h1);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
}

/* ---------- Hero (Step 0) ---------- */
.hero-eyebrow {
  display: block;
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

:root[data-theme="studio"] .hero-eyebrow {
  display: none;
}

.hero-breadcrumb {
  display: none;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
}

:root[data-theme="studio"] .hero-breadcrumb {
  display: block;
}

.card h1 {
  font-size: var(--text-hero);
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}

:root[data-theme="studio"] .card h1 {
  font-family: var(--font-sans);
  font-size: var(--text-h1);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
}

.card h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin: var(--sp-8) 0 var(--sp-3);
  color: var(--text-primary);
}

.lead {
  font-size: var(--text-h3);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
  max-width: 540px;
  line-height: 1.6;
}

:root[data-theme="studio"] .lead {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-5);
}

/* ---------- Two-column form layout ---------- */
.form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
  align-items: start;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.section-nr {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-small);
  color: var(--accent);
  line-height: 1;
}

:root[data-theme="studio"] .section-nr {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-micro);
  letter-spacing: 0.05em;
}

.section-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ---------- Fieldsets / Blocks (legacy) ---------- */
.block {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
  background: var(--bg-surface);
}

.block legend {
  font-size: var(--text-small);
  font-weight: 600;
  padding: 0 var(--sp-2);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.block-hint {
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
  margin-top: var(--sp-2);
}

.optional {
  font-size: var(--text-micro);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  font-weight: 400;
}

/* ---------- Upload Drop-Zone ---------- */
.filedrop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-10) var(--sp-6);
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-surface);
  text-align: center;
}

.filedrop:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.filedrop.drag {
  border-color: var(--accent);
  background: var(--accent-bg);
}

:root[data-theme="studio"] .filedrop {
  border-color: rgba(255, 92, 57, 0.25);
  background: rgba(255, 92, 57, 0.03);
}

:root[data-theme="studio"] .filedrop:hover {
  border-color: rgba(255, 92, 57, 0.45);
  background: rgba(255, 92, 57, 0.06);
}

:root[data-theme="studio"] .filedrop.drag {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.filedrop-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: var(--sp-1);
}

:root[data-theme="studio"] .filedrop-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  color: var(--accent);
}

.filedrop-text {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-primary);
}

.filedrop-name {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--accent);
}

.filedrop-meta {
  font-size: var(--text-caption);
  color: var(--text-quaternary);
}

.upload-requirements {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-top: var(--sp-3);
  line-height: 1.7;
}

.upload-requirements strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- Upload Pills ---------- */
.upload-pills {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

.upload-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-size: var(--text-micro);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Choice Cards ---------- */
.choice-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.choice {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.choice-box {
  display: block;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  background: var(--bg-surface);
}

/* Icon in choice card */
.choice-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}

.choice-box strong {
  display: block;
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-primary);
}

.choice-box small {
  display: block;
  font-size: var(--text-micro);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.choice input:checked + .choice-box {
  border-color: var(--bg-inverse);
  background: var(--bg-inverse);
}

.choice input:checked + .choice-box .choice-icon {
  background: rgba(201, 160, 56, 0.15);
  color: var(--accent);
}

.choice input:checked + .choice-box strong { color: var(--text-inverse); }
.choice input:checked + .choice-box small  { color: var(--text-inverse); opacity: 0.6; }

.choice input:focus-visible + .choice-box {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

/* Studio: Segmented-Control-Look */
:root[data-theme="studio"] .choice-row {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 2px;
  flex-wrap: nowrap;
}

:root[data-theme="studio"] .choice {
  min-width: unset;
}

:root[data-theme="studio"] .choice-box {
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  padding: var(--sp-2) var(--sp-4);
  text-align: center;
}

:root[data-theme="studio"] .choice-box strong {
  font-size: var(--text-caption);
}

:root[data-theme="studio"] .choice-box small {
  display: none;
}

:root[data-theme="studio"] .choice input:checked + .choice-box {
  background: var(--accent);
  border: none;
}

:root[data-theme="studio"] .choice input:checked + .choice-box strong {
  color: #fff;
}

.inline-warn {
  font-size: var(--text-caption);
  color: var(--warning);
  margin-top: var(--sp-2);
}

:root[data-theme="studio"] .inline-warn {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.01em;
}

/* ---------- Form Inputs ---------- */
.field-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.field {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.field span {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-family: var(--font-sans);
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.field input::placeholder { color: var(--text-quaternary); }

.field input:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ---------- Form Bar (bottom action row in step 0) ---------- */
.form-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) 0 var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--sp-6);
}

.form-bar-hint {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-small);
  color: var(--text-tertiary);
  flex: 1;
  min-width: 0;
}

.form-bar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

.form-bar-actions {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-shrink: 0;
}

:root[data-theme="studio"] .form-bar-hint {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.01em;
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-6);
}

.btn {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 500;
  padding: 10px var(--sp-6);
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s, color 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.btn-primary {
  background: var(--c-primary);
  color: var(--c-primary-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--c-primary-hover);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.form-error {
  font-size: var(--text-caption);
  color: var(--danger);
  margin-top: var(--sp-3);
  text-align: right;
}

/* ---------- Progress / Pipeline (Step 2) ---------- */
.progress-area {
  margin-top: var(--sp-6);
  text-align: center;
}

:root[data-theme="studio"] .progress-area {
  text-align: left;
}

/* --- Donut Ring (Editorial only) --- */
.progress-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-5);
}

:root[data-theme="studio"] .progress-ring-wrap { display: none; }

.progress-ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-subtle);
  stroke-width: 10;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.4s ease;
}

.progress-ring-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.progress-ring-pct {
  font-size: var(--text-h2);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.progress-ring-label {
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* --- Horizontal Bar (Studio only) --- */
.progress {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 0 0 var(--sp-3);
}

:root[data-theme="editorial"] .progress { display: none; }

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s ease;
  border-radius: var(--radius-pill);
}

.progress-msg {
  font-size: var(--text-small);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.progress-time {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-5);
  min-height: 1.4em;
}

:root[data-theme="studio"] .progress-time {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.02em;
  color: var(--text-quaternary);
}

/* --- Pipeline Steps --- */
.pipeline-steps {
  list-style: none;
  display: inline-flex;
  flex-direction: column;
  gap: var(--sp-2);
  text-align: left;
}

:root[data-theme="studio"] .pipeline-steps {
  display: flex;
}

.pipeline-steps li {
  font-size: var(--text-small);
  color: var(--text-quaternary);
  padding-left: 28px;
  position: relative;
  line-height: 1.5;
}

:root[data-theme="studio"] .pipeline-steps li {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.01em;
}

.pipeline-steps li::before {
  content: "○";
  position: absolute;
  left: 4px;
  font-size: 12px;
}

.pipeline-steps li.active {
  color: var(--text-primary);
  font-weight: 500;
}

.pipeline-steps li.active::before {
  content: "◑";
  color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

.pipeline-steps li.done {
  color: var(--success);
}

.pipeline-steps li.done::before {
  content: "●";
  color: var(--success);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Result Summary Chips ---------- */
.result-summary {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.summary-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: var(--sp-1) var(--sp-4);
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.summary-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.summary-chip.warn {
  background: var(--warning-bg);
  border-color: rgba(184, 133, 42, 0.2);
  color: var(--warning);
}

/* ---------- Result Date ---------- */
.result-date {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin: calc(-1 * var(--sp-1)) 0 var(--sp-5);
}

:root[data-theme="studio"] .result-date {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.02em;
}

/* ---------- Result Video ---------- */
.result-video video,
.result-feedback,
.result-metrics { margin-top: var(--sp-2); }

.result-video video {
  width: 100%;
  border-radius: var(--radius-lg);
  background: #000;
  display: block;
}

.video-error {
  font-size: var(--text-small);
  color: var(--warning);
  margin-top: var(--sp-2);
}

.video-error a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Feedback Text ---------- */
.feedback-text {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-6);
  font-size: var(--text-body);
  line-height: 1.65;
}

.feedback-text h2 {
  font-size: var(--text-h3);
  font-weight: 600;
  margin: var(--sp-5) 0 var(--sp-2);
  color: var(--text-primary);
}

.feedback-text h2:first-child { margin-top: 0; }
.feedback-text p { margin-bottom: var(--sp-3); color: var(--text-secondary); }

/* ---------- Metrik-Tabelle ---------- */
table.befund {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}

table.befund th,
table.befund td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}

table.befund th {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--sp-3);
}

table.befund td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-micro);
  font-weight: 500;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.s-ideal { background: var(--success-bg); color: var(--success); }
.s-abw   { background: var(--warning-bg); color: var(--warning); }
.s-warn  { background: var(--bg-subtle);  color: var(--text-tertiary); }
.s-na    { background: var(--bg-subtle);  color: var(--text-quaternary); }

.konf-tag {
  font-size: var(--text-micro);
  color: var(--text-quaternary);
}

.score-pct {
  font-size: var(--text-micro);
  font-weight: 500;
  margin-left: var(--sp-2);
  vertical-align: middle;
}

.score-ideal { color: var(--success); }
.score-abw   { color: var(--warning); }

/* ---------- Radar Chart ---------- */
.result-radar {
  margin-top: var(--sp-8);
}

.radar-wrap {
  max-width: 420px;
  margin: 0 auto;
}

/* ---------- Sparklines ---------- */
.sparkline-cell {
  padding: var(--sp-1) var(--sp-2) !important;
  vertical-align: middle;
}

td.sparkline-cell[data-metrik] {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
td.sparkline-cell[data-metrik]:hover,
td.sparkline-cell[data-metrik]:focus-visible {
  background: var(--bg-subtle);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ---------- Metrik-Detail-Modal ---------- */
.metric-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.metric-modal.hidden { display: none; }

.metric-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.metric-modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.2);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.metric-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
}
.metric-modal-title {
  font-weight: 600;
  font-size: var(--text-body);
  color: var(--text-primary);
}

.metric-modal-body {
  padding: var(--sp-5);
  height: 240px;
}

.metric-modal-stats {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}
.metric-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-stat-val {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.metric-stat-label {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.spark { display: block; overflow: visible; }

.spark-band {
  fill: rgba(91, 122, 58, 0.12);
}

:root[data-theme="studio"] .spark-band {
  fill: rgba(77, 212, 154, 0.10);
}

.spark-line {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.sd-ok  { fill: var(--success); }
.sd-off { fill: var(--warning); }
.spark-empty { font-size: var(--text-micro); color: var(--text-quaternary); }

/* ---------- Befund Hidden / Expandable ---------- */
.befund-hidden {
  margin-top: var(--sp-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.befund-hidden-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  user-select: none;
  list-style: none;
  transition: color 0.12s;
}

.befund-hidden-summary::-webkit-details-marker { display: none; }

.befund-hidden-summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--text-quaternary);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.befund-hidden[open] > .befund-hidden-summary::before { content: "▾"; }

.befund-hidden-summary:hover { color: var(--text-secondary); }

.befund-hidden .befund { margin: 0; }

.befund-muted td,
.befund-muted th { opacity: 0.65; }

.metrics-legend {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.dot-ideal { background: var(--success); }
.dot-abw   { background: var(--warning); }
.dot-warn  { background: var(--text-tertiary); }
.dot-na    { background: var(--text-quaternary); }

/* ---------- Frame Picker (Step 1) ---------- */
.frame-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}

.frame-wrap {
  position: relative;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: var(--bg-subtle);
}

.frame-wrap:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.frame-wrap.marked {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.frame-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.frame-badge {
  position: absolute;
  bottom: var(--sp-2);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: var(--text-micro);
  font-weight: 600;
  padding: 2px var(--sp-3);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  pointer-events: none;
}

.canvas-hint {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin: var(--sp-2) 0 var(--sp-4);
  text-align: center;
}

/* ---------- Frame-Lightbox ---------- */
.fm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fm-overlay.hidden { display: none !important; }

.fm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.fm-box {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-width: min(92vw, 900px);
  max-height: 92vh;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.fm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.fm-title {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--text-primary);
}

.fm-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}

.fm-close:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.fm-canvas-wrap {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: #000;
  cursor: crosshair;
}

.fm-img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 110px);
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.fm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.fm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.fm-hint {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.fm-coords {
  display: none;
}

:root[data-theme="studio"] .fm-coords {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--accent);
  letter-spacing: 0.02em;
}

:root[data-theme="studio"] .fm-hint {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.01em;
}

:root[data-theme="studio"] .canvas-hint {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: 0.01em;
}

:root[data-theme="studio"] .frame-badge {
  font-family: var(--font-mono);
  border-radius: var(--radius-sm);
}

.fm-confirm { flex-shrink: 0; }

/* ---------- Kapitel-Navigation (Step 3) ---------- */
.chapter-bar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}

.chapter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px var(--sp-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  transition: border-color 0.10s, background 0.10s, color 0.10s;
  line-height: 1.4;
}

.chapter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chapter-btn.active {
  background: var(--bg-inverse);
  border-color: var(--bg-inverse);
  color: var(--text-inverse);
}

:root[data-theme="studio"] .chapter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ch-nr { font-size: var(--text-small); font-weight: 600; }
.ch-ts { font-size: var(--text-micro); opacity: 0.7; }

/* ---------- Stroke-Section (äußere details) ---------- */
.stroke-section {
  margin-top: var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stroke-section.hidden { display: none !important; }

.stroke-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
  transition: background 0.12s;
}

.stroke-section-summary::-webkit-details-marker { display: none; }

.stroke-section-summary::after {
  content: "▸";
  font-size: 11px;
  color: var(--text-quaternary);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.stroke-section[open] > .stroke-section-summary::after { content: "▾"; }

.stroke-section-summary:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.stroke-section .chapter-bar  { padding: var(--sp-3) var(--sp-4) var(--sp-2); }
.stroke-section .stroke-panel { padding: var(--sp-2) var(--sp-4) var(--sp-4); }

/* ---------- Stroke Panel ---------- */
.sp-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  font-size: var(--text-small);
  margin-bottom: var(--sp-3);
}

.sp-ts {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.sm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: var(--sp-2);
}

.sm-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  text-align: center;
  transition: border-color 0.12s;
}

.sm-card.s-ideal { border-color: rgba(91, 122, 58, 0.35); }
.sm-card.s-abw   { border-color: rgba(184, 133, 42, 0.35); }
.sm-card.s-warn  { border-color: var(--border-subtle); }

:root[data-theme="studio"] .sm-card.s-ideal { border-color: rgba(77, 212, 154, 0.3); }
:root[data-theme="studio"] .sm-card.s-abw   { border-color: rgba(255, 180, 84, 0.3); }

.sm-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

:root[data-theme="studio"] .sm-val {
  font-family: var(--font-mono);
}

.sm-val small {
  font-size: var(--text-micro);
  color: var(--text-tertiary);
  font-weight: 400;
  margin-left: 2px;
}

.sm-label  {
  font-size: var(--text-micro);
  color: var(--text-secondary);
  margin-top: 3px;
}

.sm-status {
  font-size: var(--text-micro);
  font-weight: 600;
  margin-top: 3px;
}

.sm-card.s-ideal .sm-status { color: var(--success); }
.sm-card.s-abw   .sm-status { color: var(--warning); }
.sm-card.s-warn  .sm-status { color: var(--text-tertiary); }
.sm-card.s-na    .sm-status { color: var(--text-quaternary); }

/* ---------- Hint-Boxen (legacy, falls noch genutzt) ---------- */
.hint {
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-subtle);
}

.hint h3 { font-size: var(--text-body); margin-bottom: 4px; }
.hint p  { font-size: var(--text-small); color: var(--text-secondary); }
.hint-info { border-left-color: var(--info);    background: var(--info-bg); }
.hint-warn { border-left-color: var(--warning); background: var(--warning-bg); }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  font-size: var(--text-micro);
  color: var(--text-quaternary);
  padding: var(--sp-8) var(--sp-6) var(--sp-12);
}

:root[data-theme="studio"] .footer {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- Loading State ---------- */
@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}

.btn-loading::after {
  content: '';
  position: absolute;
  right: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .topbar { padding: 0 var(--sp-5); gap: var(--sp-3); }

  /* Mobile: hide nav links + theme toggle, show step pill */
  .topbar-nav { display: none; }
  .theme-toggle { display: none; }
  .topbar-pill {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    font-size: var(--text-caption);
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .wrap { margin: var(--sp-5) auto; padding: 0 var(--sp-4); }

  /* Stepper: hide on mobile (topbar pill provides context) */
  .steps { display: none; }

  .card {
    padding: var(--sp-5) var(--sp-5);
    border-radius: var(--radius-md);
  }

  /* Headlines */
  .card h1 { font-size: var(--text-h2); }
  :root[data-theme="studio"] .card h1 { font-size: var(--text-h3); }
  .step0-hero { padding: var(--sp-5) 0 var(--sp-4); }
  .step0-hero h1 { font-size: var(--text-h2); }
  :root[data-theme="studio"] .step0-hero h1 { font-size: var(--text-h3); }

  /* Form: single column */
  .form-cols { grid-template-columns: 1fr; gap: var(--sp-5); }

  /* Form bar: stack on mobile */
  .form-bar { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .form-bar-hint { font-size: var(--text-caption); }
  .form-bar-actions { flex-direction: column-reverse; }
  .form-bar-actions .btn { width: 100%; justify-content: center; }

  /* Choice cards */
  .choice-row { flex-direction: column; }
  :root[data-theme="studio"] .choice-row { flex-direction: row; }

  /* Frame picker: min-height ensures 44px touch target */
  .frame-picker { grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
  .frame-wrap { min-height: 44px; }

  /* Lightbox full-screen on mobile */
  .fm-box { max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .fm-footer { flex-wrap: wrap; gap: var(--sp-2); }
  :root[data-theme="studio"] .fm-coords { order: 3; width: 100%; text-align: center; }

  /* Progress donut: smaller on mobile */
  .progress-ring-wrap { width: 80px; height: 80px; margin-bottom: var(--sp-4); }
  .progress-ring-pct  { font-size: var(--text-h3); }
  .progress-ring-label { font-size: 9px; }
  :root[data-theme="editorial"] .pipeline-steps { display: flex; }

  /* Actions: stack buttons full-width */
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; justify-content: center; }

  .sm-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ================================================================
   Frühere Videos (Cookie-User-Liste, Schritt 0)
   ================================================================ */
.prev-videos {
  margin-bottom: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.prev-videos.hidden { display: none; }

.prev-videos-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.prev-videos-head .section-title { margin: 0; }
.prev-videos-hint {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}

.prev-videos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-2);
}

.prev-video-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.prev-video-card:hover,
.prev-video-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  outline: none;
}

.prev-video-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.prev-video-meta {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prev-video-meta em {
  font-style: normal;
  color: var(--text-tertiary);
  font-weight: 400;
}
.prev-video-date {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}
.prev-video-cta {
  color: var(--accent);
  font-size: var(--text-caption);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ================================================================
   Verlauf-Panel
   ================================================================ */
.history-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}
.history-panel.hidden { display: none; }

.history-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.history-panel-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.15);
  animation: panel-slide-in 0.2s ease;
}
@keyframes panel-slide-in {
  from { transform: translateX(32px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.history-panel-title {
  font-size: var(--text-h3);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.history-empty {
  color: var(--text-tertiary);
  font-size: var(--text-caption);
  text-align: center;
  padding: var(--sp-8) 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  transition: border-color 0.12s, background 0.12s;
}
.history-item:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.history-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-item-stroke {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}
.history-item-chips {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-1);
}
.history-chip {
  font-size: var(--text-micro);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 1px var(--sp-2);
}

.btn-sm {
  font-size: var(--text-caption);
  padding: var(--sp-1) var(--sp-3);
  height: auto;
  flex-shrink: 0;
}
