/* Prompt-Generator – Styling. System-Fonts, keine externen Ressourcen. */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1a1d23;
  --muted: #555d6b;
  --border: #d5dae1;
  --border-strong: #7b8494;
  --primary: #1d4ed8;
  --primary-contrast: #ffffff;
  --primary-soft: #e3ebfd;
  --focus: #b45309;
  --success: #166534;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn-soft: #fef3c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --surface-2: #232830;
    --text: #e8eaee;
    --muted: #a3abb8;
    --border: #343b46;
    --border-strong: #6b7483;
    --primary: #7aa2ff;
    --primary-contrast: #0b1020;
    --primary-soft: #1e2a44;
    --focus: #fbbf24;
    --success: #4ade80;
    --success-soft: #12301d;
    --danger: #f87171;
    --danger-soft: #3a1616;
    --warn-soft: #3a2e0e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.55; color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }

.wrap { width: min(100% - 2rem, 1440px); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem; background: var(--primary); color: var(--primary-contrast); border-radius: var(--radius); font-weight: 600; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

/* Kopfbereich */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.app-header .wrap { padding-block: 1.25rem; }
.app-header h1 { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); line-height: 1.2; }
.app-header p { margin: 0.25rem 0 0; color: var(--muted); }
.app-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.app-header__reset { flex: none; }
.noscript { padding: 1rem; margin-top: 1rem; background: var(--warn-soft); border-radius: var(--radius); }

/* Grundlayout */
.layout { display: grid; gap: 1.5rem; padding-block: 1.5rem 4rem; }
.wizard { min-width: 0; }

/* Fortschritt */
.progress ol { list-style: none; margin: 0; padding: 0 0 0.5rem; display: flex; gap: 0.375rem; overflow-x: auto; scrollbar-width: thin; }
.progress__step { display: inline-flex; align-items: center; gap: 0.375rem; min-height: 44px; padding: 0.375rem 0.75rem; white-space: nowrap; font: inherit; font-size: 0.85rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.progress__step:hover { border-color: var(--primary); }
.progress__step[aria-current="step"] { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.progress__step.is-done:not([aria-current])::after { content: "✓"; color: var(--success); font-weight: 700; }
.progress__bar { height: 4px; margin: 0.75rem 0 1.25rem; overflow: hidden; background: var(--surface-2); border-radius: 2px; }
.progress__bar span { display: block; width: 0; height: 100%; background: var(--primary); transition: width 0.25s ease; }

/* Schritte */
.step { padding: clamp(1rem, 0.5rem + 2vw, 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.step h2 { margin: 0 0 0.25rem; font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem); line-height: 1.25; }
.step h2:focus { outline: none; }
.step h2:focus-visible { outline: 3px solid var(--focus); }
.step__count { display: block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.step__intro { margin: 0 0 1.5rem; color: var(--muted); }

/* Felder */
.field { margin: 0 0 1.5rem; }
.field > label, .field__title { display: block; margin: 0 0 0.35rem; font-size: 1rem; font-weight: 600; }
.required { color: var(--danger); }
.help { margin: 0.1rem 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.error { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--danger); }
.error:empty { display: none; }
input[type="text"], textarea, select { width: 100%; min-height: 44px; padding: 0.6rem 0.75rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; }
textarea { resize: vertical; }
input[type="text"]:hover, textarea:hover, select:hover { border-color: var(--muted); }
[aria-invalid="true"] { border-color: var(--danger) !important; background: var(--danger-soft); }

.group { margin: 0; padding: 0; border: 0; min-width: 0; }
.group > legend { margin-bottom: 0.35rem; padding: 0; font-weight: 600; }
.options { display: grid; gap: 0.25rem 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.options--inline { display: flex; flex-wrap: wrap; }
.option { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.option input { flex: none; width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--primary); }
.option label { cursor: pointer; }
.other { margin-top: 0.5rem; }
.other label { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; }
.subgroup { margin: 0 0 0.75rem; padding: 0.5rem 0.9rem 0.25rem; border: 1px solid var(--border); border-radius: 8px; }
.subgroup legend { padding: 0 0.25rem; font-weight: 600; }

/* Schalter */
.toggle { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.toggle label { cursor: pointer; }
.toggle input { appearance: none; position: relative; flex: none; width: 2.6rem; height: 1.5rem; margin: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: background 0.2s; }
.toggle input::before { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.1rem; height: 1.1rem; background: #ffffff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked { background: var(--primary); }
.toggle input:checked::before { transform: translateX(1.1rem); }

/* Farben */
.field--color { display: inline-block; width: min(100%, 15rem); margin-right: 1rem; vertical-align: top; }
.color-input { display: flex; align-items: center; gap: 0.5rem; }
.color-input input[type="color"] { flex: none; width: 3rem; height: 44px; padding: 0.2rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.palettes { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); }
.palette { position: relative; }
.palette input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.palette label { display: flex; flex-direction: column; gap: 0.35rem; height: 100%; padding: 0.6rem; background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.palette input:checked + label { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.palette input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.palette__swatches { display: flex; height: 2rem; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; }
.palette__swatches span { flex: 1; }
.palette__name { font-size: 0.9rem; font-weight: 600; }
.palette__mood { font-size: 0.8rem; color: var(--muted); }

/* Kontrast */
.contrast__list { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.contrast__item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; }
.contrast__sample { display: inline-grid; place-items: center; width: 2.75rem; height: 2rem; font-weight: 700; border: 1px solid var(--border); border-radius: 6px; }
.contrast__label { flex: 1; min-width: 12rem; }
.contrast__ratio { font-weight: 600; font-variant-numeric: tabular-nums; }
.badge { padding: 0.15rem 0.5rem; font-size: 0.8rem; font-weight: 700; border-radius: 999px; }
.badge--AAA, .badge--AA { color: var(--success); background: var(--success-soft); }
.badge--fail { color: var(--danger); background: var(--danger-soft); }

/* Seiten und Kontakt */
.pages, .contacts { display: grid; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.page-row, .contact-row { display: grid; grid-template-columns: minmax(12rem, 16rem) 1fr auto; gap: 0.25rem 1rem; align-items: center; }
.page-row:not(.page-row--custom):not(:has(input[type="checkbox"]:checked)) .page-row__note { display: none; }
.contact-row:not(:has(input[type="checkbox"]:checked)) .contact-row__value { display: none; }
.page-row__label { padding-left: 1.75rem; font-weight: 500; }
.page-add { margin-top: 0.75rem; }
.page-add label { display: block; margin-bottom: 0.35rem; font-weight: 600; }
.page-add__row { display: flex; gap: 0.5rem; }
.page-add__row input { flex: 1; }
@media (max-width: 600px) {
  .page-row, .contact-row { grid-template-columns: 1fr auto; }
  .page-row__note, .contact-row__value { grid-column: 1 / -1; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; padding: 0.55rem 1.1rem; font: inherit; font-weight: 600; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { color: var(--primary-contrast); background: var(--primary); border-color: var(--primary); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--danger); }
.btn-icon { min-width: 44px; min-height: 44px; font-size: 1.4rem; line-height: 1; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.btn-icon:hover { color: var(--danger); border-color: var(--border); }
.link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0; font: inherit; font-weight: 600; color: var(--primary); text-decoration: underline; background: none; border: 0; cursor: pointer; }
/* Fusszeile mit dezentem Beispiel-Button */
.app-footer { border-top: 1px solid var(--border); }
.app-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.75rem; padding-block: 1rem 2rem; font-size: 0.85rem; color: var(--muted); }
.app-footer__example { font-weight: 400; color: var(--muted); }
.app-footer__example:hover { color: var(--primary); }
.step-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.preview-toggle { width: 100%; margin-top: 1rem; }

/* Ergebnis */
.result-text { min-height: 24rem; font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.status { margin: 0.75rem 0 0; font-weight: 600; color: var(--success); }
.status:empty { display: none; }
.status--error { color: var(--danger); }
.notice { margin-bottom: 1rem; padding: 0.75rem 1rem; background: var(--warn-soft); border-radius: 8px; }
.notice p { margin: 0; }
.notice--error { background: var(--danger-soft); }
.preview__hint { margin-right: auto; font-size: 0.8rem; color: var(--muted); }
.hint { font-size: 0.9rem; color: var(--muted); }

/* Vorschau */
.preview { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.preview__head { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.preview__head h2 { margin: 0; font-size: 1.05rem; }
.preview__stats { margin-left: auto; font-size: 0.8rem; color: var(--muted); }
.preview__body { flex: 1; margin: 0; padding: 1rem; overflow: auto; font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); }
.preview__foot { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; padding: 0.75rem 1rem; border-top: 1px solid var(--border); }

@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 42%); align-items: start; }
  .progress ol { flex-wrap: wrap; overflow: visible; }
  .preview { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); }
  .preview-toggle, .preview__close { display: none; }
}

@media (max-width: 1023.98px) {
  .preview { display: none; }
  .preview.is-open { display: flex; position: fixed; inset: 0; z-index: 50; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
