:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #16140f;
  --muted: #6b665b;
  --line: #e2ddd0;
  --accent: #3d2bff;
  --accent-ink: #ffffff;
  --accent-soft: #e9e6ff;
  --ok: #1f8a4c;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(0,0,0,.04), 0 12px 32px -16px rgba(22,20,15,.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111016;
    --surface: #1a1922;
    --ink: #f2efe8;
    --muted: #a19d93;
    --line: #2d2b36;
    --accent: #8f84ff;
    --accent-ink: #0d0c12;
    --accent-soft: #25224a;
    --shadow: 0 12px 32px -16px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 880px; margin: 0 auto; padding: 24px 16px 8px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; }
.steps li span {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); font-size: 12px; font-weight: 600;
}
.steps li.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.steps li.active span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps li.done span { background: var(--ink); color: var(--bg); border-color: var(--ink); }

main { max-width: 880px; margin: 0 auto; padding: 16px 16px 80px; position: relative; }
.panel { animation: in .35s ease both; }
.hidden { display: none !important; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1, h2 {
  font-family: "Instrument Serif", Georgia, serif; font-weight: 400;
  letter-spacing: -.02em; line-height: 1.02; margin: 24px 0 12px;
}
h1 { font-size: clamp(40px, 7vw, 68px); }
h2 { font-size: clamp(32px, 5vw, 46px); }
h1 em, h2 em { color: var(--accent); }
.lead { font-size: 18px; color: var(--muted); max-width: 620px; margin: 0 0 32px; }

/* Typ-Auswahl */
.types { border: 0; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.types legend, .label { font-weight: 600; font-size: 14px; margin-bottom: 10px; display: block; }
.type input { position: absolute; opacity: 0; pointer-events: none; }
.type-card {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 18px; border-radius: var(--radius); background: var(--surface);
  border: 1.5px solid var(--line); cursor: pointer; transition: .15s;
}
.type-card:hover { border-color: var(--muted); }
.type-card svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.type-card small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.type input:checked + .type-card { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow); }
.type input:checked + .type-card svg { color: var(--accent); }
.type input:focus-visible + .type-card { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Felder */
.field { display: block; position: relative; margin-bottom: 20px; }
textarea, select, input[type="text"] {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color .15s;
}
textarea { resize: vertical; min-height: 120px; }
textarea:focus, select:focus, input[type="text"]:focus { outline: none; border-color: var(--accent); }
.counter { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: var(--muted); }
.field.inline select { max-width: 320px; }

/* Buttons */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.actions .primary:only-child { margin-left: auto; }
.btn {
  font: inherit; font-weight: 600; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  padding: 13px 22px; border-radius: 999px; cursor: pointer; transition: transform .1s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: var(--line); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Fragen */
.analysis {
  background: var(--surface); border-left: 3px solid var(--accent); padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 12px;
}
.hint { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.questions { display: grid; gap: 14px; }
.q {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
}
.q-cat { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.q-title { display: block; font-weight: 600; margin: 4px 0 12px; font-size: 17px; }
.q textarea { min-height: 70px; background: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: 14px;
  border: 1.5px solid var(--line); cursor: pointer; transition: .15s; background: var(--bg);
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.q input[type="text"] { background: var(--bg); padding: 10px 14px; font-size: 15px; }

/* Ergebnis */
.result-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.result-meta {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin: 0; box-shadow: var(--shadow);
  font: 14px/1.65 "JetBrains Mono", ui-monospace, monospace;
  white-space: pre-wrap; word-wrap: break-word; min-height: 200px; max-height: 70vh; overflow: auto;
  font-variant-ligatures: none; /* sonst werden z. B. "<!--" oder "->" als Pfeile dargestellt */
}
.result.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Loader & Toast */
.loader { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 80px 0; color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 10; max-width: calc(100% - 32px);
}
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 640px) {
  .types { grid-template-columns: 1fr; }
  .steps li { padding: 4px 6px; font-size: 0; gap: 0; }
  .steps li span { font-size: 12px; }
  .steps li.active { font-size: 13px; gap: 6px; }
  .btn { width: 100%; }
  .result-actions .btn { width: auto; }
}

/* Bereichs-Umschaltung */
.modes {
  display: inline-flex; gap: 4px; padding: 4px; margin: 8px 0 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; max-width: 100%;
}
.mode {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer;
}
.mode.active { background: var(--accent); color: var(--accent-ink); }
.steps .step-label { font-weight: inherit; }

/* Hinweis unter dem Super-Prompt */
.next-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--line);
}
.next-hint p { margin: 0; font-size: 14px; max-width: 560px; }

/* SEO-Formular */
.check { display: flex; align-items: center; gap: 10px; margin: -6px 0 20px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.label small { font-weight: 400; color: var(--muted); }
.seo-form { display: grid; gap: 14px; }
.seo-form fieldset { margin: 0; min-width: 0; }
.seo-form legend { padding: 0; margin-bottom: 12px; float: left; width: 100%; }
.seo-form legend + * { clear: both; }
.analysis:empty { display: none; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cell > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.cell.wide { grid-column: 1 / -1; }
.seo-form input[type="text"], .seo-form textarea { background: var(--bg); padding: 10px 12px; font-size: 15px; min-height: 0; }
.rows { display: grid; gap: 10px; margin-bottom: 10px; }
.row {
  display: grid; grid-template-columns: 1.2fr 1fr 1.6fr auto; gap: 10px; align-items: end;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.row[data-list="services"] { grid-template-columns: 1.2fr 2fr 0.6fr auto; }
.row[data-list="faq"] { grid-template-columns: 1fr 1.6fr auto; }
.row-del {
  width: 36px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line);
  background: transparent; color: var(--muted); font-size: 20px; cursor: pointer;
}
.row-del:hover { color: var(--danger); border-color: var(--danger); }

/* SEO-Dateien */
.seo-files { display: grid; gap: 18px; margin-top: 8px; }
.file-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.file-head strong { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 16px; display: block; }
.file-head small { color: var(--muted); font-size: 13px; }
.file-head .result-actions { margin: 0; }
.file-pre { max-height: 340px; min-height: 0; font-size: 13px; }

@media (max-width: 640px) {
  .modes { display: flex; }
  .mode { flex: 1; padding: 8px 10px; font-size: 13px; }
  .grid, .row, .row[data-list] { grid-template-columns: 1fr; }
  .row-del { width: 100%; }
}
