@font-face { font-family: Montserrat; font-weight: 900; font-display: block; src: url(/fonts/montserrat-900.woff2) format('woff2'); }
@font-face { font-family: Bricolage; font-weight: 200 800; font-display: swap; src: url(/fonts/bricolage.woff2) format('woff2'); }

:root {
  --paper: #FBF3E8;
  --paper-2: #F5E8D6;
  --card: #FFFBF5;
  --ink: #26170D;
  --ink-2: #6B5442;
  --line: #E9D8C3;
  --tomato: #F0532B;
  --tomato-d: #D23F19;
  --sun: #FFC83A;
  --ok: #2F8F5B;
  --radius: 14px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Bricolage, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 85% -10%, #FFE3C2 0%, transparent 60%), var(--paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--sun); color: var(--ink); }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; border-radius: 8px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 19px; letter-spacing: -0.01em; }
.mark { width: 16px; height: 26px; border-radius: 5px; background: var(--tomato); position: relative; }
.mark::after { content: ''; position: absolute; left: 5px; top: 8px; border-left: 7px solid var(--paper); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.top-file { display: none; align-items: center; gap: 14px; color: var(--ink-2); font-size: 14px; min-width: 0; }
.top-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
body[data-view="edit"] .top-file, body[data-view="analyse"] .top-file { display: flex; }

main > section { display: none; }
body[data-view="start"] .start,
body[data-view="analyse"] .analyse,
body[data-view="edit"] .edit { display: grid; }

/* ---------- Start ---------- */
.start {
  min-height: calc(100vh - 64px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px; align-items: center;
  max-width: 1180px; margin: 0 auto; padding: 48px 32px;
}
.start h1 { font-size: clamp(40px, 4.4vw, 62px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 780; margin: 0 0 24px; text-wrap: balance; }
.start-copy p { font-size: 18px; color: var(--ink-2); max-width: 46ch; margin: 0; }
.drop {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 64px 32px 36px; border-radius: 28px; background: var(--card);
  border: 2px dashed #E2C7A6;
  box-shadow: 0 30px 60px -30px rgba(120, 60, 10, .25);
  transition: transform .4s var(--ease), border-color .2s, background .2s;
}
.drop[data-over="true"] { border-color: var(--tomato); background: #FFF3E6; transform: scale(1.015); }
.drop-icon { width: 46px; height: 46px; color: var(--tomato); margin-bottom: 14px; }
.drop-title { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; margin: 0; }
.drop-sub { color: var(--ink-2); margin: 6px 0 26px; }
.lang { margin-top: 30px; display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.lang select { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 6px 10px; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 28px;
  background: var(--tomato); color: #FFF8F0; font-weight: 680; font-size: 17px;
  box-shadow: 0 10px 24px -10px rgba(208, 63, 25, .7), inset 0 -2px 0 rgba(0,0,0,.12);
  transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.primary:hover { background: var(--tomato-d); transform: translateY(-1px); }
.primary:active { transform: translateY(1px) scale(.99); }
.primary:disabled { opacity: .55; cursor: progress; transform: none; }
.primary svg { width: 20px; height: 20px; }
.primary.wide { width: 100%; }
.ghost { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 14px; color: var(--ink); }
.ghost:hover { border-color: var(--ink-2); }

/* ---------- Analyse ---------- */
.analyse { max-width: 560px; margin: 0 auto; padding: 12vh 24px; align-content: start; }
.analyse h2 { font-size: 34px; letter-spacing: -0.03em; margin: 0 0 8px; font-weight: 760; }
.muted { color: var(--ink-2); margin: 0; }
.small { font-size: 14px; }
.steps { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 4px; }
.steps li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 17px; }
.steps .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.steps .pct { font-variant-numeric: tabular-nums; font-size: 14px; }
.steps li[data-status="run"] { color: var(--ink); font-weight: 600; }
.steps li[data-status="run"] .dot { border-color: var(--tomato); border-right-color: transparent; animation: spin .8s linear infinite; }
.steps li[data-status="done"] { color: var(--ink); }
.steps li[data-status="done"] .dot { background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; border-color: var(--ok); }
.steps li[data-status="fail"] .dot { background: var(--tomato-d); border-color: var(--tomato-d); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bearbeiten ---------- */
.edit { grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - 64px); }
.viewer { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 16px; min-height: 0; }
.phone {
  height: min(calc(100vh - 64px - 150px), 860px); aspect-ratio: 9 / 16;
  border-radius: 26px; overflow: hidden; background: #000;
  box-shadow: 0 40px 80px -30px rgba(80, 35, 0, .45), 0 0 0 8px #241710;
}
.phone canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.transport { display: flex; align-items: center; gap: 12px; width: min(100%, 520px); }
.round { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; transition: transform .2s var(--ease); }
.round:hover { transform: scale(1.06); }
.round svg { width: 22px; height: 22px; }
.round[data-state="play"] .ic-pause, .round[data-state="pause"] .ic-play { display: none; }
.time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-2); min-width: 36px; }
input[type="range"] { flex: 1; accent-color: var(--tomato); height: 24px; }
.summary { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; max-width: 520px; }

.panel { border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.panel-scroll { overflow-y: auto; padding: 8px 24px 24px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.panel-h { font-size: 15px; font-weight: 720; letter-spacing: -0.005em; margin: 26px 0 6px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #F1E4D3; }
.row-l { font-size: 15px; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 5px 10px; font-size: 13.5px; color: var(--ink-2); transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 620; box-shadow: 0 1px 3px rgba(80, 40, 0, .18); }
.swatches button { width: 30px; height: 26px; padding: 0; display: grid; place-items: center; }
.swatches button::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.field { display: grid; gap: 6px; margin-top: 14px; font-size: 15px; }
.field input, .captions input { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 9px 12px; width: 100%; }
.field input:focus, .captions input:focus { border-color: var(--tomato); outline: none; background: #fff; }
.captions { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.captions li { display: grid; grid-template-columns: 46px 1fr; gap: 6px; align-items: center; }
.cap-time { border: 0; background: none; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); padding: 6px 0; text-align: left; }
.cap-time:hover { color: var(--tomato-d); text-decoration: underline; text-underline-offset: 3px; }
.exportbox { padding: 16px 24px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; background: var(--card); }
.ebar { display: flex; align-items: center; gap: 12px; }
.ebar-track { flex: 1; height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.ebar-fill { height: 100%; background: var(--tomato); transform-origin: left; transform: scaleX(0); transition: transform .3s linear; }
.dl { text-align: center; color: var(--tomato-d); font-weight: 600; font-size: 15px; text-underline-offset: 3px; }
.dl .size { color: var(--ink-2); font-weight: 400; }

.error {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 32px)); margin: 0;
  background: var(--ink); color: #FFEFE2; padding: 14px 20px; border-radius: 14px;
  box-shadow: 0 20px 40px -16px rgba(0,0,0,.5);
}

@media (max-width: 900px) {
  .start { grid-template-columns: 1fr; gap: 32px; padding-top: 32px; }
  .edit { grid-template-columns: 1fr; height: auto; }
  .phone { height: auto; width: min(88vw, 420px); }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .exportbox { position: sticky; bottom: 0; }
  .top { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
