/* WerkBuilt – gemeinsame Gestaltung für Kunden- und Tischlerseite.
   Grundlage: Apple Human Interface Guidelines (Klarheit, Inhalt vor Oberfläche, gleiche Muster).
   Charakter: ruhiger Showroom einer Tischlerei – warme Papier- und Holztöne, Fraunces nur für Überschriften,
   Preise und den Kostenvoranschlag, sonst Systemschrift. Raster 8 px.
   Bewegung kommt aus js/bewegung.js (html.bewegt); bei „Bewegung reduzieren“ bleibt alles still. */

/* ---------- Schriften (lokal, SIL OFL – siehe fonts/Fraunces-OFL.txt) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Farbe: semantisch. --akzent kann ein Betrieb über betrieb.js (akzent) überschreiben, alles andere leitet sich ab. */
  --hintergrund: #f5f0e8;
  --flaeche: #fffdf9;
  --flaeche-tief: #efe8de;          /* Grund von Segmented Controls, Bildflächen */
  --feld: #ffffff;
  --text-primaer: #231c16;          /* 14.8:1 auf --hintergrund */
  --text-sekundaer: #675a4d;        /* 5.9:1 auf --hintergrund, 6.6:1 auf --flaeche */
  --text-platzhalter: #8f8274;
  --akzent: #7a4a22;                /* 7.3:1 auf --flaeche */
  --akzent-auf: #fffaf3;            /* Text auf --akzent */
  --akzent-stark: color-mix(in srgb, var(--akzent) 78%, #000);
  --akzent-flaeche: color-mix(in srgb, var(--akzent) 11%, var(--flaeche));
  --akzent-text: color-mix(in srgb, var(--akzent) 80%, #000);   /* Text auf --akzent-flaeche */
  --fokus: color-mix(in srgb, var(--akzent) 70%, #fff);
  --trenner: #e5dccf;
  --trenner-stark: #d3c5b2;
  --fehler: #a8241c;
  --fehler-flaeche: #fbebe8;
  --erfolg: #2b6a43;
  --erfolg-flaeche: #e5f1e8;
  --warnung: #8f3f14;
  --warnung-flaeche: #fbefe5;
  --messing: #8a6430;               /* 4.7:1 auf --hintergrund */
  --holz-dunkel: #2b231c;           /* Bühne, Fotoflächen */

  /* Schrift */
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --s-titel: 2.125rem;   /* h1 */
  --s-gross: 1.75rem;    /* Preis, Erfolg */
  --s-kopf: 1.375rem;    /* h2, Legenden */
  --s-text: 1.0625rem;   /* Fließtext */
  --s-klein: 0.9375rem;  /* Hinweise, Labels */
  --s-fein: 0.8125rem;   /* Bildunterschriften, Kicker */

  /* Raster 8 px */
  --a1: 0.5rem;   /* 8 */
  --a2: 1rem;     /* 16 */
  --a3: 1.5rem;   /* 24 */
  --a4: 2rem;     /* 32 */
  --a5: 3rem;     /* 48 */
  --a6: 4rem;     /* 64 */
  --rand-seite: clamp(1rem, 4vw, 2rem);
  --breite: 1200px;

  /* Radien (konzentrisch: innen = außen − Abstand) */
  --r-karte: 20px;
  --r-element: 12px;     /* Felder, Knöpfe, Auswahlkarten */
  --r-segment: 10px;     /* Segmented Control außen … */
  --r-segment-innen: 8px; /* … innen bei 2 px Abstand */
  --schatten-weich: 0 1px 2px rgba(43, 35, 28, 0.04), 0 8px 24px -16px rgba(43, 35, 28, 0.16);
  --dauer: 200ms;
  --kurve: cubic-bezier(0.25, 0.1, 0.25, 1);
  --federnd: cubic-bezier(0.2, 0.9, 0.25, 1.15);

  /* von js/kopf.js gesetzt */
  --kopf-hoehe: 0px;
  --kopfzeile-hoehe: 0px;
  --kopf-ausgleich: 0px;
  --preisleiste-hoehe: 88px;

  font-family: var(--ui);
  font-size: 100%;
  color: var(--text-primaer);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html { scroll-padding-top: calc(var(--kopf-hoehe) + var(--a2)); }
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text-primaer);
  font-size: var(--s-text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

[hidden] { display: none !important; }

h1, h2, h3, legend {
  font-family: var(--serif);
  font-optical-sizing: auto;
  color: var(--text-primaer);
  text-wrap: balance;
}
h1 { font-size: var(--s-titel); font-weight: 500; line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--a1); }
h2 { font-size: var(--s-kopf); font-weight: 550; line-height: 1.25; margin: 0 0 var(--a1); }
h3 { font-size: var(--s-text); font-weight: 600; line-height: 1.3; margin: var(--a3) 0 var(--a1); }
p { max-width: 70ch; }

a { color: var(--akzent-text); }

/* ---------- Fokus, Bewegung ---------- */
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ---------- Fester Kopf: Marke + Schrittleiste ---------- */
.kopf-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 24px; pointer-events: none; }

.kopfbereich {
  position: sticky; top: 0; z-index: 40;
  background: var(--flaeche);
  border-bottom: 1px solid var(--trenner);
  padding-top: env(safe-area-inset-top);
  margin-bottom: var(--kopf-ausgleich);
  transition: transform var(--dauer) var(--kurve);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .kopfbereich {
    background: color-mix(in srgb, var(--flaeche) 76%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}
.kopfbereich.nicht-fest { position: relative; margin-bottom: 0; }
.kopfbereich.kopf-weg { transform: translateY(calc(-1 * var(--kopfzeile-hoehe))); }

.kopf-innen {
  max-width: var(--breite); margin: 0 auto;
  padding: var(--a2) max(var(--rand-seite), env(safe-area-inset-right)) var(--a2) max(var(--rand-seite), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: var(--a2);
  transition: padding var(--dauer) var(--kurve);
}
.marke { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.marke-logo { height: 40px; width: auto; max-width: 160px; object-fit: contain; transition: height var(--dauer) var(--kurve); }
.marke-monogramm {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-auf);
  font-family: var(--serif); font-size: 1.25rem; font-weight: 500;
  box-shadow: inset 0 0 0 3px var(--akzent), inset 0 0 0 4px color-mix(in srgb, var(--akzent-auf) 40%, transparent);
  transition: width var(--dauer) var(--kurve), height var(--dauer) var(--kurve), font-size var(--dauer) var(--kurve);
}
.marke-text { display: flex; flex-direction: column; min-width: 0; }
.marke-name {
  font-family: var(--serif); font-size: 1.125rem; font-weight: 550; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.marke-claim {
  font-size: var(--s-fein); color: var(--text-sekundaer); letter-spacing: 0.02em; line-height: 1.4;
  max-height: 1.4em; overflow: hidden;
  transition: max-height var(--dauer) var(--kurve), opacity var(--dauer) var(--kurve);
}
.kopf-produkt { font-size: var(--s-klein); color: var(--text-sekundaer); white-space: nowrap; }
.kopf-rechts { display: flex; align-items: center; gap: var(--a2); flex: none; }
/* Haus-Symbol: zurück zur WerkBuilt-Startseite (index.html) */
.zur-startseite {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-sekundaer); border: 1px solid var(--trenner-stark); background: var(--flaeche);
  transition: color var(--dauer) var(--kurve), border-color var(--dauer) var(--kurve), background-color var(--dauer) var(--kurve);
}
.zur-startseite:hover { color: var(--akzent); border-color: var(--akzent); background: var(--akzent-flaeche); }

/* verdichtet: Claim weg, Logo und Höhe kleiner */
.verdichtet .kopf-innen { padding-top: var(--a1); padding-bottom: var(--a1); }
.verdichtet .marke-logo { height: 32px; }
.verdichtet .marke-monogramm { width: 32px; height: 32px; font-size: 1rem; }
.verdichtet .marke-claim { max-height: 0; opacity: 0; }

/* Schrittleiste */
.schritte ol {
  list-style: none; margin: 0 auto; max-width: var(--breite);
  padding: 0 max(var(--rand-seite), env(safe-area-inset-right)) 0 max(var(--rand-seite), env(safe-area-inset-left));
  display: flex; gap: var(--a1); counter-reset: schritt; position: relative;
}
/* Nummern zählen nur sichtbare Schritte */
.schritte li:not([hidden]) { counter-increment: schritt; display: flex; align-items: center; flex: none; }
.schritte li:not([hidden]) + li:not([hidden])::before {
  content: ""; width: clamp(0.75rem, 3vw, 2.5rem); height: 1px; background: var(--trenner-stark); margin-right: var(--a1);
}
.schritte .nr::before { content: counter(schritt); }
.schritte button {
  display: flex; align-items: center; gap: var(--a1);
  min-height: 48px; background: none; border: 0; padding: 0 0.25rem;
  font: inherit; font-size: var(--s-klein); color: var(--text-sekundaer);
  cursor: pointer; white-space: nowrap; position: relative; border-radius: 8px;
  transition: color var(--dauer) var(--kurve);
}
.schritte button:hover:not(:disabled) { color: var(--text-primaer); }
.schritte .nr {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  font-size: var(--s-fein); font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1px solid var(--trenner-stark); color: var(--text-sekundaer); background: var(--flaeche);
  transition: background var(--dauer) var(--kurve), border-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve);
}
.schritte button[aria-current="step"] { color: var(--text-primaer); font-weight: 600; }
.schritte button[aria-current="step"] .nr { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-auf); }
.schritte button[aria-current="step"]::after {
  content: ""; position: absolute; left: 0.25rem; right: 0.25rem; bottom: 0; height: 2px; border-radius: 1px; background: var(--akzent);
}
.schritte button.erledigt .nr { background: var(--akzent-flaeche); border-color: transparent; color: var(--akzent-text); }
.schritte button:disabled { cursor: not-allowed; opacity: 0.45; }
.schritte button:focus-visible { outline-offset: -2px; }

/* ---------- Grundlayout ---------- */
main {
  flex: 1; width: 100%; max-width: var(--breite); margin: 0 auto;
  padding: var(--a5) max(var(--rand-seite), env(safe-area-inset-right)) var(--a6) max(var(--rand-seite), env(safe-area-inset-left));
}
.schritt { scroll-margin-top: calc(var(--kopf-hoehe) + var(--a2)); }
.schritt-kopf { margin-bottom: var(--a4); max-width: 44rem; }
.kicker {
  margin: 0 0 var(--a1); font-size: var(--s-fein); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--messing); font-variant-numeric: tabular-nums;
}
.einleitung { color: var(--text-sekundaer); margin: 0; font-size: var(--s-text); max-width: 62ch; }

.karte {
  background: var(--flaeche); border: 1px solid var(--trenner);
  border-radius: var(--r-karte);
  padding: var(--a3); margin: 0 0 var(--a2);
}
fieldset.karte { min-width: 0; }
fieldset.karte legend {
  float: left; width: 100%; padding: 0; margin-bottom: var(--a2);
  font-size: var(--s-kopf); font-weight: 550; line-height: 1.25;
}
/* Alle Geschwister nach der gefloateten Legend darunter, auch wenn das erste ausgeblendet ist */
fieldset.karte > legend ~ * { clear: both; }

.tipp { color: var(--text-sekundaer); font-size: var(--s-klein); line-height: 1.45; margin: var(--a1) 0 0; }
.optional, .pflicht {
  font-family: var(--ui); font-weight: 500; font-size: var(--s-fein); letter-spacing: 0;
  margin-left: var(--a1); vertical-align: 0.1em; white-space: nowrap;
}
.optional { color: var(--text-sekundaer); }
.pflicht {
  display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px;
  background: var(--akzent-flaeche); color: var(--akzent-text);
}

/* Hinweise: Farbe nie allein – immer mit Symbol */
.hinweis-wunsch, .hinweis-platz, .hinweis-veraltet, .fehler {
  display: flex; gap: 0.625rem; align-items: flex-start;
  font-size: var(--s-klein); line-height: 1.45; margin: 0 0 var(--a2);
  padding: 0.75rem var(--a2); border-radius: var(--r-element);
}
.hinweis-wunsch::before, .hinweis-platz::before, .hinweis-veraltet::before, .fehler::before {
  flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.05rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; line-height: 1;
}
.hinweis-wunsch { background: var(--akzent-flaeche); color: var(--akzent-text); }
.hinweis-wunsch::before { content: "i"; font-family: var(--serif); font-style: italic; background: var(--akzent); color: var(--akzent-auf); }
.hinweis-platz, .hinweis-veraltet { background: var(--warnung-flaeche); color: var(--warnung); }
.hinweis-platz::before { content: "!"; background: var(--warnung); color: #fff; }
.hinweis-veraltet::before { content: "↻"; background: var(--warnung); color: #fff; }
.fehler { background: var(--fehler-flaeche); color: var(--fehler); margin: var(--a2) 0; }
.fehler::before { content: "!"; background: var(--fehler); color: #fff; }

/* ---------- Knöpfe: primär gefüllt · sekundär getönt (.knopf-leise) · leise als Text (.link-zurueck) ---------- */
.knopf {
  font: inherit; font-size: var(--s-text); font-weight: 600; line-height: 1.25;
  min-height: 48px; padding: 0.75rem 1.25rem; border-radius: var(--r-element);
  border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--a1);
  transition: background-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve),
    transform 150ms var(--kurve), opacity var(--dauer) var(--kurve);
  -webkit-tap-highlight-color: transparent;
}
.knopf:active:not(:disabled) { transform: scale(0.98); }
.knopf:disabled { cursor: not-allowed; opacity: 0.4; }

.knopf-haupt { background: var(--akzent); color: var(--akzent-auf); }
.knopf-haupt:hover:not(:disabled) { background: var(--akzent-stark); }
.knopf-haupt:active:not(:disabled) { background: color-mix(in srgb, var(--akzent) 65%, #000); }

.knopf-leise { background: var(--akzent-flaeche); color: var(--akzent-text); }
.knopf-leise:hover:not(:disabled) { background: color-mix(in srgb, var(--akzent) 17%, var(--flaeche)); }
.knopf-leise:active:not(:disabled) { background: color-mix(in srgb, var(--akzent) 23%, var(--flaeche)); }

.link-zurueck {
  background: none; border: 0; min-height: 44px; padding: 0.5rem 0.25rem; margin: 0;
  font: inherit; font-size: var(--s-klein); font-weight: 500; color: var(--akzent-text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.375rem; border-radius: 8px;
  transition: color var(--dauer) var(--kurve), opacity var(--dauer) var(--kurve);
}
.link-zurueck:hover { color: var(--akzent-stark); text-decoration: underline; text-underline-offset: 3px; }
.link-zurueck:active { opacity: 0.6; }
.link-zurueck:disabled { opacity: 0.4; cursor: not-allowed; }

.aktionen { display: flex; justify-content: flex-end; align-items: center; gap: var(--a2); margin-top: var(--a3); }
.aktionen-zwischen { justify-content: space-between; }

/* ---------- Felder ---------- */
.feld { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: var(--a2); font-size: var(--s-klein); }
.feld > span:first-child { font-weight: 500; color: var(--text-sekundaer); }
.feld input, .feld textarea {
  font: inherit; font-size: var(--s-text); min-height: 44px; padding: 0.625rem 0.75rem;
  border: 1px solid var(--trenner-stark); border-radius: var(--r-element);
  background: var(--feld); color: var(--text-primaer); width: 100%;
  transition: border-color var(--dauer) var(--kurve), box-shadow var(--dauer) var(--kurve);
}
.feld textarea { resize: vertical; line-height: 1.45; }
.feld input::placeholder, .feld textarea::placeholder { color: var(--text-platzhalter); }
.feld input:hover, .feld textarea:hover { border-color: color-mix(in srgb, var(--akzent) 35%, var(--trenner-stark)); }
.feld input:focus, .feld textarea:focus {
  border-color: var(--akzent); outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--akzent) 18%, transparent);
}
.feld input.ungueltig { border-color: var(--fehler); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fehler) 14%, transparent); }
.einheit-feld { display: flex; align-items: center; gap: var(--a1); }
.einheit-feld input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
/* Beispielwert klar als Beispiel erkennbar, nicht als schon eingetragener Wert */
.einheit-feld input::placeholder { font-style: italic; font-size: var(--s-klein); }
.einheit-feld span { color: var(--text-sekundaer); font-size: var(--s-klein); }

.feldreihe { display: flex; align-items: flex-end; gap: 0.75rem; margin-top: var(--a2); }
.feldreihe .feld { flex: 1; min-width: 0; margin-bottom: 0; }
.feldreihe-drei { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mal { padding-bottom: 0.625rem; color: var(--text-sekundaer); }

/* ---------- Schritt 1: Raum ---------- */
.raum-raster { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--a3); align-items: start; }
.raum-masse > :last-child { margin-bottom: 0; }

.upload {
  display: block; position: relative; cursor: pointer; margin-top: var(--a1);
  border: 1.5px dashed var(--trenner-stark); border-radius: var(--r-element);
  background: var(--hintergrund);
  overflow: hidden; transition: border-color var(--dauer) var(--kurve), background-color var(--dauer) var(--kurve);
}
.upload:hover, .upload.ziehen { border-color: var(--akzent); }
.upload.ziehen { background-color: var(--akzent-flaeche); }
.upload:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-leer {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  min-height: clamp(240px, 34vw, 400px); padding: var(--a4) var(--a2); color: var(--text-sekundaer); text-align: center;
  font-size: var(--s-klein);
}
.upload-leer strong { color: var(--text-primaer); font-size: var(--s-text); font-weight: 600; }
.upload-symbol {
  width: 3.5rem; height: 3.5rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--flaeche); color: var(--akzent); margin-bottom: var(--a1);
  box-shadow: var(--schatten-weich);
}
.upload-aktionen { display: flex; flex-wrap: wrap; gap: var(--a1); margin-top: var(--a2); }
.upload-aktionen .knopf { min-height: 44px; padding: 0.5rem var(--a2); font-size: var(--s-klein); }

/* Markierung */
.markier-schritte { list-style: none; margin: var(--a1) 0 var(--a2); padding: 0; display: grid; gap: var(--a1); }
.markier-schritt {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.75rem var(--a2); border-radius: var(--r-element);
  border: 1px solid var(--trenner); background: var(--feld); color: var(--text-sekundaer);
  font-size: var(--s-klein);
  transition: border-color var(--dauer) var(--kurve), background var(--dauer) var(--kurve), color var(--dauer) var(--kurve);
}
.markier-schritt p { margin: 0.125rem 0 0; }
.markier-schritt.aktiv { border-color: var(--akzent); color: var(--text-primaer); box-shadow: inset 0 0 0 1px var(--akzent); }
.markier-schritt.erledigt { background: var(--akzent-flaeche); border-color: transparent; color: var(--akzent-text); }
.markier-nr {
  flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center;
  font-size: var(--s-fein); font-weight: 600; border: 1px solid currentColor;
}
.markier-schritt.aktiv .markier-nr, .markier-schritt.erledigt .markier-nr { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-auf); }
.markier-schritt.erledigt .markier-nr { font-size: 0; }
.markier-schritt.erledigt .markier-nr::before { content: "✓"; font-size: 0.75rem; }
.markier-text { min-width: 0; flex: 1; }
.feld-referenz { margin: 0.75rem 0 0; max-width: 15rem; }
.feld-referenz > span:first-child { color: var(--text-primaer); }

.markier-flaeche {
  position: relative; width: fit-content; max-width: 100%; margin: 0 auto;
  border-radius: var(--r-element); overflow: hidden; background: var(--holz-dunkel);
  /* Tippen und Ziehen auf dem Foto, ohne dass die Seite scrollt oder zoomt */
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: crosshair;
}
.markier-flaeche.fertig { cursor: default; }
/* Nie höher als der sichtbare Bereich unter dem festen Kopf, mit Platz für Anleitung und Status */
.foto-vorschau {
  display: block; max-width: 100%; width: auto; height: auto; pointer-events: none;
  max-height: max(200px, min(560px, calc(100vh - var(--kopf-hoehe) - 10rem)));
  max-height: max(200px, min(560px, calc(100dvh - var(--kopf-hoehe) - 10rem)));
}
.markier-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.markier-svg .griff { pointer-events: all; cursor: grab; fill: transparent; }
.markier-svg .ziehen .griff { cursor: grabbing; }
.markier-svg .ref-linie { stroke: #fff; stroke-width: 3; stroke-dasharray: 8 6; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.markier-svg .ref-punkt { fill: #fff; stroke: var(--messing); stroke-width: 3; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)); }
.markier-svg .etikett-flaeche { fill: rgba(35, 28, 22, 0.82); }
.markier-svg .etikett-text { fill: #fffaf3; font: 600 13px var(--ui); }
.markier-svg .tisch-ring { fill: color-mix(in srgb, var(--akzent) 25%, transparent); stroke: #fff; stroke-width: 2; }
.markier-svg .tisch-kern { fill: var(--akzent); stroke: #fff; stroke-width: 3; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.markier-svg .tisch-symbol { fill: var(--akzent-auf); }
.markier-svg .tisch-etikett { fill: var(--akzent); }
.markier-status { margin: 0.75rem auto 0; font-size: var(--s-klein); color: var(--text-sekundaer); text-align: center; min-height: 1.45em; }

/* Freier Platz (Pflicht) vor den optionalen Angaben */
.karte-pflicht { border-color: var(--trenner-stark); box-shadow: var(--schatten-weich); }

.weitere-angaben { margin: 0; }
.weitere-angaben > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 0 var(--a2); min-height: 56px; padding: 0.75rem var(--a3); border-radius: var(--r-karte);
  border: 1px dashed var(--trenner-stark); color: var(--text-primaer);
  transition: background-color var(--dauer) var(--kurve), border-color var(--dauer) var(--kurve);
}
.weitere-angaben > summary::-webkit-details-marker { display: none; }
.weitere-angaben > summary::after {
  content: ""; grid-column: 2; grid-row: 1 / span 2; width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--text-sekundaer); border-bottom: 2px solid var(--text-sekundaer);
  transform: rotate(45deg) translateY(-2px); transition: transform var(--dauer) var(--kurve);
}
.weitere-angaben[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.weitere-angaben > summary:hover { background: var(--flaeche); border-color: var(--akzent); }
.weitere-titel { font-weight: 600; font-size: var(--s-text); }
.weitere-titel .optional { margin-left: 0.375rem; }
.weitere-text { grid-column: 1; color: var(--text-sekundaer); font-size: var(--s-klein); }
.weitere-angaben[open] > summary { margin-bottom: var(--a2); border-style: solid; border-color: var(--trenner); }
.karte-leise { background: transparent; }
.karte-leise h2 { font-size: var(--s-text); font-family: var(--ui); font-weight: 600; }
.karte-leise h2 .optional { display: none; } /* steht schon im Aufklapper */
.weitere-angaben > .karte:last-child { margin-bottom: 0; }

/* ---------- Schritt 2: Baukasten ---------- */
/* Bild oben in der Mitte, darunter die Optionen als Leiste nebeneinander */
.baukasten { display: flex; flex-direction: column; gap: var(--a3); }
.baukasten-buehne { width: 100%; max-width: 960px; margin-inline: auto; }
@media (min-width: 901px) {
  /* Bild im 16:9-Format, so groß, dass darunter die Optionen noch Platz haben */
  .baukasten-buehne { max-width: min(960px, max(540px, calc((100dvh - var(--kopf-hoehe) - 31rem) * 16 / 9))); }
  .baukasten-buehne .buehne-flaeche { aspect-ratio: 16 / 9; max-height: none; min-height: 0; }
  .baukasten-buehne .buehne { margin-bottom: 0.75rem; }
}

.baukasten-leiste { min-width: 0; }
.leiste-kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--a2); margin-bottom: 0.75rem; }
.leiste-reiter {
  display: flex; gap: 0.375rem; min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding: 2px; margin: -2px; /* Platz für den Fokusrahmen */
}
.leiste-reiter::-webkit-scrollbar { display: none; }
.leiste-reiter button {
  flex: none; font: inherit; font-size: var(--s-klein); font-weight: 500; white-space: nowrap; cursor: pointer;
  min-height: 40px; padding: 0.4rem 0.95rem; border-radius: 999px;
  border: 1px solid var(--trenner-stark); background: var(--flaeche); color: var(--text-sekundaer);
  transition: background-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve), border-color var(--dauer) var(--kurve);
}
.leiste-reiter button:hover { color: var(--text-primaer); border-color: var(--akzent); }
.leiste-reiter button[aria-current="true"] { background: var(--akzent); border-color: var(--akzent); color: #fff; font-weight: 600; }

.leiste-spur { position: relative; }
.baukasten-optionen {
  display: flex; align-items: flex-start; gap: var(--a2);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-behavior: smooth; scroll-padding-inline: 0.25rem;
  padding: 0.25rem 0.25rem var(--a2); margin: -0.25rem -0.25rem 0;
  scrollbar-width: thin; scrollbar-color: var(--trenner-stark) transparent;
}
.baukasten-optionen > .karte { flex: 0 0 min(360px, 84%); margin: 0; scroll-snap-align: start; }
.baukasten-optionen.rad { scroll-snap-type: none; scroll-behavior: auto; } /* beim Mausrad nicht Karte für Karte springen */

/* Wegweiser: fest am unteren Rand, solange die Optionen noch unterhalb des Bildschirms liegen (js/app.js wegweiserAktualisieren) */
.wegweiser {
  position: fixed; z-index: 35; left: 50%; bottom: calc(var(--a3) + env(safe-area-inset-bottom));
  translate: -50% 0; width: max-content; max-width: calc(100% - 2 * var(--a2));
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; justify-content: center;
  padding: 0.5rem 0.5rem 0.5rem 1.125rem; border-radius: 999px;
  background: color-mix(in srgb, var(--holz-dunkel) 92%, transparent); color: #fffaf3;
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 14px 34px -14px rgba(35, 28, 22, 0.6);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity 260ms var(--kurve), transform 260ms var(--kurve);
}
.wegweiser.sichtbar { opacity: 1; transform: none; pointer-events: auto; }
.wegweiser-text {
  display: flex; align-items: center; gap: 0.5rem; min-height: 36px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--s-klein); font-weight: 600; color: inherit; white-space: nowrap;
}
.wegweiser-pfeil { display: inline-block; animation: wegweiser-wippen 1.6s var(--kurve) infinite; }
@keyframes wegweiser-wippen { 0%, 100% { transform: none; } 50% { transform: translateY(3px); } }
.wegweiser-kurz { display: none; }
.wegweiser-ziele { display: flex; gap: 0.375rem; flex-wrap: wrap; justify-content: center; }
.wegweiser-ziele button {
  font: inherit; font-size: var(--s-klein); font-weight: 500; cursor: pointer; white-space: nowrap;
  min-height: 36px; padding: 0.3rem 0.85rem; border-radius: 999px;
  border: 1px solid rgba(255, 250, 243, 0.35); background: rgba(255, 250, 243, 0.1); color: #fffaf3;
  transition: background-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve);
}
.wegweiser-ziele button:hover { background: #fffaf3; color: var(--holz-dunkel); }
@media (prefers-reduced-motion: reduce) { .wegweiser-pfeil { animation: none; } }

/* Pfeile zum Weiterblättern, mit weichem Verlauf am Rand */
.leiste-pfeil {
  position: absolute; top: 7.5rem; z-index: 3; translate: 0 -50%; /* auf Höhe der oberen Kartenhälfte, auch wenn die Karten lang sind */
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--trenner-stark); background: var(--flaeche); color: var(--text-primaer);
  box-shadow: 0 8px 22px -10px rgba(43, 35, 28, 0.45);
  transition: opacity var(--dauer) var(--kurve), scale 150ms var(--kurve), color var(--dauer), border-color var(--dauer);
}
.leiste-pfeil:hover { color: var(--akzent); border-color: var(--akzent); }
.leiste-pfeil:active { scale: 0.94; }
.leiste-pfeil-zurueck { left: -14px; }
.leiste-pfeil-vor { right: -14px; }
.leiste-pfeil:disabled { opacity: 0; pointer-events: none; }
.leiste-spur::before, .leiste-spur::after {
  content: ""; position: absolute; top: 0; bottom: var(--a2); width: 56px; z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity var(--dauer) var(--kurve);
}
.leiste-spur::before { left: 0; background: linear-gradient(90deg, var(--hintergrund), transparent); }
.leiste-spur::after { right: 0; background: linear-gradient(270deg, var(--hintergrund), transparent); }
.leiste-spur.kann-zurueck::before, .leiste-spur.kann-vor::after { opacity: 1; }

/* Eckenradius unter der Form */
.regler-ecken { margin: var(--a2) 0 0; }
.regler-ecken[hidden] { display: none; }

/* Aufklappbare Skizze: Form an den Punkten in Länge und Breite ziehen */
.skizze { margin-top: var(--a2); border-top: 1px solid var(--trenner); padding-top: 0.75rem; }
.skizze > summary {
  display: flex; align-items: center; gap: 0.5rem; min-height: 44px; cursor: pointer; list-style: none;
  font-size: var(--s-klein); font-weight: 600; color: var(--akzent-text);
}
.skizze > summary::-webkit-details-marker { display: none; }
.skizze > summary::after { content: "›"; margin-left: auto; font-size: 1.25rem; transition: rotate var(--dauer) var(--kurve); }
.skizze[open] > summary::after { rotate: 90deg; }
.skizze-svg {
  display: block; width: 100%; height: auto; margin-top: 0.5rem; touch-action: none; user-select: none;
  border-radius: var(--r-element);
  background:
    linear-gradient(rgba(122, 74, 34, 0.07) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(122, 74, 34, 0.07) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--hintergrund);
}
.skizze .tipp { margin-top: 0.5rem; }
.skizze-griff { cursor: grab; outline: none; }
.skizze-griff.zieht { cursor: grabbing; }
.skizze-griff[data-griff="laenge"] { cursor: ew-resize; }
.skizze-griff[data-griff="breite"] { cursor: ns-resize; }
.skizze-griff[data-griff="beide"] { cursor: nwse-resize; }
.skizze-griff .punkt { fill: #fff; stroke: var(--akzent); transition: r 150ms var(--kurve); }
.skizze-griff:hover .punkt, .skizze-griff.zieht .punkt { fill: var(--akzent); }
.skizze-griff:focus-visible .punkt { stroke: var(--fokus); fill: var(--akzent); }

/* ---------- Baukasten angeheftet (große Bildschirme, js/app.js anheftenMessen) ----------
   Der Raum ist so hoch wie der Scrollweg. Darin bleibt .baukasten stehen:
   Startlage: Foto groß links, Ideen-Chat und Preis rechts daneben (zusammen über die ganze Breite).
   --p1 (0 → 1) in zwei Phasen, damit sich nichts überlappt:
     --ga (1 → 0, erste Hälfte): Foto schrumpft in die linke Spalte, Chat und Preis gleiten darunter
       (hinter dem Foto entlang),
     --gb (1 → 0, zweite Hälfte): danach steigen die Optionen rechts daneben hoch.
   --schub: danach ziehen die Karten beim Scrollen nach links hinter das Foto. */
.baukasten-raum.angeheftet { height: var(--raum-hoehe, auto); }
.angeheftet .baukasten {
  --p1: 0; --schub: 0px;
  --ga: clamp(0, 1 - 2 * var(--p1), 1); --gb: clamp(0, 2 - 2 * var(--p1), 1);
  position: sticky; top: var(--kopf-hoehe);
  height: calc(100dvh - var(--kopf-hoehe));
  display: grid; grid-template-columns: var(--wb, 440px) minmax(0, 1fr); column-gap: var(--a3);
  align-items: start; padding-top: var(--a2); overflow: clip;
}
.angeheftet .baukasten-buehne {
  position: relative; z-index: 2; max-width: none; margin: 0;
  /* Foto, Ideen-Chat und Preis passen immer in die Höhe; der Chatverlauf gibt nach */
  display: flex; flex-direction: column; max-height: calc(100dvh - var(--kopf-hoehe) - var(--a2) - 8px);
}
.angeheftet .baukasten-buehne > * { flex: none; }
.angeheftet .baukasten-buehne > .buehne { position: relative; z-index: 1; } /* Chat gleitet beim Scrollen hinter dem Foto entlang */
.angeheftet .baukasten-buehne > .feinschliff { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.angeheftet .feinschliff > * { flex: none; }
.angeheftet .feinschliff > .chat-verlauf { flex: 1 1 auto; min-height: 2.75rem; max-height: none; }
.angeheftet .feinschliff > .extras { flex: 0 1 auto; min-height: 5.75rem; overflow-y: auto; } /* Überschrift + mindestens ein Extra */
.angeheftet .chat-vorschlaege {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0.75rem -0.25rem; padding: 4px 0.25rem;
}
.angeheftet .chat-vorschlaege::-webkit-scrollbar { display: none; }
.angeheftet .chat-vorschlaege button { flex: none; }
/* Kompakt, damit das Foto in der schmalen Spalte möglichst groß bleibt */
.angeheftet .baukasten-buehne { container-type: inline-size; }
.angeheftet .feinschliff > h2 { font-size: 1.1875rem; }
.angeheftet .preisleiste { padding: 0.75rem var(--a2); }
.angeheftet .preis-info { flex: 1; }
.angeheftet .preis-zeile { flex-wrap: nowrap; }
.angeheftet .preis-summe { font-size: var(--s-kopf); white-space: nowrap; }
.angeheftet .feinschliff { padding: var(--a2); }
@container (max-width: 440px) {
  .preisleiste .nur-gross { display: none; }
  .preisleiste .nur-klein { display: inline; }
  .preis-label { display: none; }
  .preis-mwst { font-size: 0.75rem; font-weight: 500; }
  .preis-rahmen { font-size: 0.75rem; white-space: nowrap; }
}
/* Deckfläche: Karten verschwinden unter dem Foto, mit weichem Rand */
.angeheftet .baukasten-buehne::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: calc(-1 * var(--a2) - 1px); bottom: -100vh; left: -50vw; right: calc(-1 * var(--a3) + 2px);
  background: var(--hintergrund);
}
.angeheftet .baukasten-buehne::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: 3.25rem; bottom: -100vh; left: calc(100% + var(--a3) - 2px); width: 48px; /* erst unter den Reitern */
  background: linear-gradient(90deg, var(--hintergrund), transparent);
  opacity: var(--rand, 0);
}
.angeheftet .baukasten-buehne .buehne-flaeche { aspect-ratio: 16 / 9; max-height: none; min-height: 0; }
.angeheftet .baukasten-buehne > .buehne {
  transform-origin: 0 0;
  transform: translateX(calc(var(--ga) * var(--fx, 0px))) scale(calc(1 + var(--ga) * (var(--fs, 1) - 1)));
}
/* Niedrige Bildschirme: linke Spalte kompakt, damit das Anheften erhalten bleibt (Raum bleibt über die Schrittleiste erreichbar) */
.angeheftet.eng .feinschliff > .tipp, .angeheftet.eng .baukasten-buehne > .link-zurueck { display: none; }
.angeheftet.eng .feinschliff { padding: 0.75rem var(--a2); }
.angeheftet.eng .feinschliff > h2 { font-size: 1.0625rem; white-space: nowrap; }
.angeheftet.eng .chat-vorschlaege { margin: 0.5rem -0.25rem; }
/* Bedienelemente auf dem Foto bleiben trotz Vergrößerung in normaler Größe */
.angeheftet .buehne .umschalter { transform-origin: 100% 0; scale: calc(1 / (1 + var(--ga) * (var(--fs, 1) - 1))); }
.angeheftet .buehne .buehne-etikett { transform-origin: 0 100%; scale: calc(1 / (1 + var(--ga) * (var(--fs, 1) - 1))); }
.angeheftet .baukasten-buehne > :not(.buehne) {
  transform: translate(calc(var(--ga) * var(--px, 0px)), calc(var(--ga) * var(--py, 0px)));
}
.angeheftet .baukasten-leiste {
  position: relative; z-index: 1;
  /* bleibt unter Foto und rechter Spalte, bis alles links steht; dann hoch neben das Foto */
  transform: translateY(calc(var(--ga) * var(--lya, 0px) + var(--gb) * var(--ly, 0px)));
}
.angeheftet .baukasten-optionen {
  overflow: visible; scroll-snap-type: none; padding-bottom: 0;
  transform: translateX(calc(-1 * var(--schub)));
}
.angeheftet .baukasten-optionen > .karte {
  max-height: calc(100dvh - var(--kopf-hoehe) - 7.5rem); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--trenner-stark) transparent;
}
.angeheftet .leiste-spur::before { display: none; }
.angeheftet .leiste-pfeil-zurueck { left: 4px; }
.angeheftet .leiste-pfeil-vor { right: 4px; }

/* Bühne */
.buehne { margin: 0 0 var(--a2); }
.buehne-flaeche {
  position: relative; overflow: hidden; isolation: isolate;
  /* so hoch, dass Preisleiste und Knopf unter dem festen Kopf im Bild bleiben */
  aspect-ratio: 4 / 3; min-height: 280px; width: 100%;
  max-height: calc(100vh - var(--kopf-hoehe) - 20rem);
  max-height: calc(100dvh - var(--kopf-hoehe) - 20rem);
  border-radius: var(--r-karte); background: var(--holz-dunkel);
}
/* Unscharfe Fassung des Bildes als Hintergrund, damit Hochformat-Fotos nicht leer wirken */
.buehne-flaeche::before {
  content: ""; position: absolute; inset: -40px; z-index: -1;
  background: var(--buehne-bild, none) center / cover no-repeat;
  filter: blur(28px) brightness(0.6) saturate(1.1);
}
.buehne-bild { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: filter 300ms var(--kurve); }
/* KI-Bild blendet sanft ein (Vorher/Nachher bleibt) */
.buehne-flaeche[data-etikett="Nachher"] .buehne-bild,
.buehne-flaeche[data-etikett="KI-Vorschau"] .buehne-bild { animation: ki-einblenden 700ms var(--kurve); }
@keyframes ki-einblenden {
  from { opacity: 0; transform: scale(1.015); filter: saturate(0.6); }
  to { opacity: 1; transform: none; filter: none; }
}
.buehne-draufsicht {
  position: absolute; inset: 0; display: grid; place-items: center;
  /* Zeichenpapier */
  background:
    linear-gradient(rgba(122, 74, 34, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(122, 74, 34, 0.07) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--flaeche);
}
.draufsicht { width: min(72%, 560px); max-height: 78%; height: auto; display: block; }
.buehne-etikett {
  position: absolute; left: var(--a2); bottom: var(--a2);
  padding: 0.25rem 0.75rem; border-radius: 999px;
  background: rgba(35, 28, 22, 0.6); color: #fffaf3;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-size: var(--s-fein); font-weight: 500;
}
.buehne-flaeche.zeigt-draufsicht .buehne-etikett { background: var(--akzent-flaeche); color: var(--akzent-text); }

/* Segmented Control (Bühne, Tischlerseite) */
.umschalter {
  position: absolute; top: var(--a2); right: var(--a2); display: flex; padding: 2px;
  border-radius: var(--r-segment); background: rgba(226, 216, 202, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.35);
}
.umschalter button {
  font: inherit; font-size: var(--s-fein); font-weight: 500; border: 0; border-radius: var(--r-segment-innen);
  min-height: 36px; min-width: 44px; padding: 0.375rem 0.875rem; background: transparent; color: var(--text-primaer); cursor: pointer;
  transition: background-color var(--dauer) var(--kurve), color var(--dauer) var(--kurve);
}
.umschalter button:hover { color: var(--text-primaer); }
.umschalter button[aria-pressed="true"] { background: var(--flaeche); color: var(--text-primaer); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
/* Treffer bis 44 px, obwohl der Knopf schlanker aussieht */
.umschalter button { position: relative; }
.umschalter button::after { content: ""; position: absolute; inset: -4px 0; }

/* Ladezustand der Bild-KI auf der Bühne */
.buehne-laden {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: var(--a1);
  padding: var(--a3); text-align: center; color: #fffaf3;
  background: rgba(35, 28, 22, 0.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.buehne-flaeche.laedt .buehne-bild { filter: saturate(0.7); }
.laden-kreis {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 3px solid rgba(255, 250, 243, 0.3); border-top-color: #e2c48f;
  animation: drehen 0.9s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }
.laden-text { margin: var(--a1) 0 0; font-family: var(--serif); font-size: var(--s-kopf); }
.laden-zeit { margin: 0; font-size: var(--s-fein); opacity: 0.85; font-variant-numeric: tabular-nums; }

.baukasten-buehne .hinweis-veraltet { margin: 0.75rem 0 0; }
.baukasten-buehne .link-zurueck { margin-top: var(--a1); }

/* Preisleiste */
.preisleiste {
  display: flex; align-items: center; justify-content: space-between; gap: var(--a2);
  background: var(--flaeche); border: 1px solid var(--trenner); border-radius: var(--r-karte);
  padding: var(--a2) var(--a3);
}
.preis-info { display: flex; flex-direction: column; min-width: 0; }
.preis-label { font-size: var(--s-fein); color: var(--text-sekundaer); }
.preis-zeile { display: flex; align-items: baseline; gap: var(--a1); flex-wrap: wrap; }
.preis-summe {
  font-family: var(--serif); font-size: var(--s-gross); font-weight: 550;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums lining-nums; line-height: 1.15;
  transition: color 400ms var(--kurve);
}
.preis-summe.aendert { color: var(--akzent); }
.preis-mwst { font-size: var(--s-fein); font-weight: 600; color: var(--text-primaer); }
.preis-rahmen { font-size: var(--s-fein); color: var(--text-sekundaer); font-variant-numeric: tabular-nums; }
.preisleiste .knopf { flex: none; }
.nur-klein { display: none; }

/* Nur für Screenreader sichtbar */
.nur-vorleser {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Schritt 0: Möbelauswahl aus dem Portfolio */
.moebel-wahl { border: 0; padding: 0; margin: 0; min-width: 0; }
.moebel-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--a2); }
.moebel-karte {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem;
  background: var(--feld); border: 1px solid var(--trenner); border-radius: var(--r-karte);
  padding: var(--a3); min-height: 168px; cursor: pointer;
  transition: border-color var(--dauer) var(--kurve), box-shadow var(--dauer) var(--kurve), transform var(--dauer) var(--kurve);
  -webkit-tap-highlight-color: transparent;
}
.moebel-karte input { position: absolute; opacity: 0; pointer-events: none; }
.moebel-symbol {
  display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: auto;
  border-radius: var(--r-element); background: var(--flaeche-tief); color: var(--text-primaer);
}
.moebel-name { font-size: var(--s-text); font-weight: 600; color: var(--text-primaer); margin-top: var(--a2); }
.moebel-status { font-size: var(--s-fein); color: var(--text-sekundaer); }
.moebel-karte:not(.bald):hover { border-color: var(--trenner-stark); box-shadow: var(--schatten-weich); }
.moebel-karte:not(.bald):active { transform: scale(0.985); }
.moebel-karte:has(input:checked) { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent), var(--schatten-weich); }
.moebel-karte:has(input:checked) .moebel-symbol { background: var(--akzent-flaeche); color: var(--akzent-text); }
.moebel-karte:has(input:checked) .moebel-status { color: var(--akzent-text); font-weight: 600; }
.moebel-karte:has(input:checked)::after {
  content: "✓"; position: absolute; top: var(--a2); right: var(--a2);
  width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-auf); font-size: 0.8125rem; font-weight: 700;
}
.moebel-karte:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
.moebel-karte.bald { cursor: default; background: transparent; border-style: dashed; }
.moebel-karte.bald .moebel-symbol { background: transparent; color: var(--text-sekundaer); opacity: 0.7; }
.moebel-karte.bald .moebel-name { color: var(--text-sekundaer); font-weight: 500; }

/* Auswahl: Grundmuster (Material als Karten mit Maserung) */
.wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
.wahl label {
  position: relative; display: flex; flex-direction: column; gap: 0.125rem;
  background: var(--feld); border: 1px solid var(--trenner); border-radius: var(--r-element);
  padding: 0.75rem var(--a2); cursor: pointer; font-size: var(--s-klein); min-height: 44px;
  transition: border-color var(--dauer) var(--kurve), box-shadow var(--dauer) var(--kurve), background-color var(--dauer) var(--kurve);
  -webkit-tap-highlight-color: transparent;
}
.wahl label:hover { border-color: var(--trenner-stark); }
.wahl label:active { background: var(--hintergrund); }
.wahl input { position: absolute; opacity: 0; pointer-events: none; }
.wahl label:has(input:checked) { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }
.wahl label:has(input:checked)::after {
  content: "✓"; position: absolute; top: 0.5rem; right: 0.5rem;
  width: 1.375rem; height: 1.375rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-auf); font-size: 0.75rem; font-weight: 700;
  box-shadow: 0 0 0 2px var(--feld);
}
.wahl label:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
.wahl label:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.wahl .aufpreis { color: var(--text-sekundaer); font-size: var(--s-fein); font-variant-numeric: tabular-nums; }

/* Material: Karten mit Maserungsfläche. Foto aus assets/materialien/<id>.jpg, sonst CSS-Maserung */
.wahl-material { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.wahl-material label { padding: 0; overflow: hidden; }
.wahl-material label > span:last-child { padding: 0.625rem 0.75rem 0.75rem; font-weight: 500; color: var(--text-primaer); }
.muster {
  display: block; height: 72px;
  --holz-dunkel: color-mix(in srgb, var(--holz, #c69c6d) 78%, #2b1a0c);
  --holz-hell: color-mix(in srgb, var(--holz, #c69c6d) 82%, #fff);
  background-color: var(--holz, #c69c6d);
  background-image:
    var(--muster-bild, none),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.1)),
    repeating-linear-gradient(176deg,
      transparent 0 5px, var(--holz-dunkel) 5px 6px, transparent 6px 13px,
      var(--holz-hell) 13px 15px, transparent 15px 22px, var(--holz-dunkel) 22px 22.6px, transparent 22.6px 31px),
    radial-gradient(ellipse 60% 140% at 30% 120%, var(--holz-dunkel), transparent 60%);
  background-size: cover, auto, auto, auto;
  background-position: center;
  border-bottom: 1px solid var(--trenner);
}
.muster.ohne-maserung { background-image: var(--muster-bild, none), linear-gradient(160deg, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0.06)); }
.muster.mit-foto { background-image: var(--muster-bild); }
/* Zwischenüberschrift je Materialart (nur wenn die Tischlerei mehrere Arten anbietet) */
.wahl-gruppe {
  grid-column: 1 / -1; margin: var(--a1) 0 -0.25rem; font-size: var(--s-fein); font-weight: 600; color: var(--text-sekundaer);
}
.wahl-gruppe:first-child { margin-top: 0; }

/* Segmented Control im iOS-Stil: Form, Oberfläche */
.wahl-segmente {
  display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
  padding: 2px; border-radius: var(--r-segment); background: var(--flaeche-tief);
}
.wahl-segmente label {
  border: 0; border-radius: var(--r-segment-innen); background: transparent; min-height: 44px;
  padding: 0.5rem 0.375rem; align-items: center; justify-content: center; text-align: center;
  color: var(--text-sekundaer); font-weight: 500; line-height: 1.25;
}
.wahl-segmente label:hover { border-color: transparent; color: var(--text-primaer); }
.wahl-segmente label:active { background: color-mix(in srgb, var(--flaeche) 50%, transparent); }
.wahl-segmente label:has(input:checked) {
  background: var(--flaeche); color: var(--text-primaer); font-weight: 600;
  box-shadow: 0 1px 3px rgba(43, 35, 28, 0.14), 0 0 0 0.5px rgba(43, 35, 28, 0.06);
}
.wahl-segmente label:has(input:checked)::after { content: none; }
.wahl-segmente label:has(input:focus-visible) { outline-offset: 0; }
.wahl-segmente .aufpreis { font-weight: 400; }

.wahl-formen label { padding: 0.625rem 0.25rem 0.5rem; hyphens: auto; }
/* Schmale Optionen-Spalte: Formen 2 × 2, damit lange Namen nicht gequetscht werden */
.baukasten-optionen fieldset { container-type: inline-size; }
@container (max-width: 380px) {
  .wahl-formen { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.form-symbol { width: 40px; height: 28px; margin-bottom: 0.25rem; }
.form-symbol * { fill: var(--akzent-flaeche); stroke: var(--text-sekundaer); stroke-width: 1.6; transition: fill var(--dauer), stroke var(--dauer); }
.wahl-formen label:has(input:checked) .form-symbol * { fill: color-mix(in srgb, var(--akzent) 22%, var(--flaeche)); stroke: var(--akzent); }

/* Liste mit Häkchen (Gestell: Namen können lang sein) */
.wahl-liste {
  grid-template-columns: 1fr; gap: 0; border: 1px solid var(--trenner); border-radius: var(--r-element);
  background: var(--feld); overflow: hidden;
}
.wahl-liste label {
  flex-direction: row; justify-content: space-between; align-items: center; gap: var(--a2);
  border: 0; border-radius: 0; min-height: 48px; padding: 0.75rem 2.75rem 0.75rem var(--a2);
  background: transparent; color: var(--text-primaer);
}
.wahl-liste label + label { box-shadow: inset 0 1px 0 var(--trenner); }
.wahl-liste label:hover { background: var(--hintergrund); }
.wahl-liste label:has(input:checked) { box-shadow: none; font-weight: 600; }
.wahl-liste label + label:has(input:checked) { box-shadow: inset 0 1px 0 var(--trenner); }
.wahl-liste label:has(input:checked)::after {
  top: 50%; transform: translateY(-50%); right: var(--a2);
  background: none; color: var(--akzent); font-size: 1rem; box-shadow: none;
}
.wahl-liste label:has(input:focus-visible) { outline-offset: -3px; }

/* Regler */
.regler {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  gap: 0.125rem 0.75rem; margin-bottom: var(--a3);
}
.regler:last-child { margin-bottom: 0; }
.regler label { font-weight: 500; font-size: var(--s-klein); }
.regler output { font-family: var(--serif); font-size: var(--s-kopf); font-weight: 550; font-variant-numeric: tabular-nums lining-nums; }
.regler .grenze { grid-column: 1 / -1; font-size: var(--s-fein); color: var(--text-sekundaer); font-variant-numeric: tabular-nums; }
.regler input[type="range"] {
  grid-column: 1 / -1; width: 100%; margin: var(--a1) 0 0.25rem; height: 28px;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.regler input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--akzent) var(--fuellung, 50%), var(--trenner-stark) var(--fuellung, 50%));
}
.regler input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--trenner-stark); }
.regler input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--akzent); }
.regler input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(43, 35, 28, 0.22);
  transition: transform 150ms var(--kurve);
}
.regler input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
.regler input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(43, 35, 28, 0.22);
}
.regler input[type="range"]:focus-visible { outline: none; }
.regler input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--fokus); }
.regler input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--fokus); }

/* Ideen-Chat (Herzstück, fest unter dem Foto) */
.feinschliff {
  margin: 0 0 0.75rem; padding: var(--a2) var(--a3) var(--a3);
  border-color: color-mix(in srgb, var(--akzent) 45%, var(--trenner));
  box-shadow: 0 10px 28px -18px color-mix(in srgb, var(--akzent) 70%, transparent);
}
.feinschliff > h2 {
  display: flex; align-items: center; gap: 0.5rem; margin: 0;
  font-size: var(--s-kopf); font-weight: 550; line-height: 1.25;
}
.ideen-symbol { color: var(--akzent); font-size: 0.9em; }
.feinschliff > .tipp { margin-top: 0.25rem; }
.chat-verlauf {
  display: flex; flex-direction: column; gap: var(--a1); margin: var(--a2) 0 0.75rem;
  max-height: min(22rem, calc(100vh - var(--kopf-hoehe) - 14rem));
  max-height: min(22rem, calc(100dvh - var(--kopf-hoehe) - 14rem));
  min-height: 8rem; overflow-y: auto; overscroll-behavior: contain;
  scroll-padding: var(--a1);
}
.chat-verlauf:empty { display: none; }
.chat-nachricht {
  max-width: 88%; padding: 0.5rem 0.875rem; border-radius: 18px; font-size: var(--s-klein); line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-kunde { align-self: flex-end; background: var(--akzent); color: var(--akzent-auf); border-bottom-right-radius: 6px; }
.chat-assistent { align-self: flex-start; background: var(--flaeche-tief); color: var(--text-primaer); border-bottom-left-radius: 6px; }
.chat-tippt { color: var(--text-sekundaer); font-style: italic; }
.chat-hinweise { list-style: none; margin: var(--a1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; white-space: normal; }
.chat-hinweise li {
  font-size: var(--s-fein); font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 999px;
  background: var(--flaeche); border: 1px solid var(--trenner-stark); color: var(--akzent-text);
}
.chat-hinweise .art-sonderwunsch { border-style: dashed; }
.chat-hinweise .art-entfernt { color: var(--text-sekundaer); text-decoration: line-through; }
.chat-vorschlaege { display: flex; flex-wrap: wrap; gap: var(--a1); margin: var(--a2) 0; }
.chat-vorschlaege button {
  font: inherit; font-size: var(--s-klein); cursor: pointer; min-height: 36px; padding: 0.375rem 0.875rem; border-radius: 999px;
  border: 1px solid var(--trenner-stark); background: var(--feld); color: var(--akzent-text);
  transition: border-color var(--dauer) var(--kurve), background-color var(--dauer) var(--kurve);
  position: relative;
}
.chat-vorschlaege button::after { content: ""; position: absolute; inset: -4px 0; }
.chat-vorschlaege button:hover { border-color: var(--akzent); }
.chat-vorschlaege button:active { background: var(--akzent-flaeche); }
.chat-code { margin-bottom: 0.75rem; }
.chat-eingabe {
  display: flex; gap: var(--a1); align-items: center; padding: 4px 4px 4px var(--a2);
  border: 1px solid var(--trenner-stark); border-radius: 26px; background: var(--feld);
  transition: border-color var(--dauer) var(--kurve), box-shadow var(--dauer) var(--kurve);
}
.chat-eingabe:focus-within { border-color: var(--akzent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--akzent) 18%, transparent); }
.chat-eingabe input {
  flex: 1; min-width: 0; font: inherit; font-size: var(--s-text); min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--text-primaer);
}
.chat-eingabe input::placeholder { color: var(--text-platzhalter); }
.chat-eingabe input:focus { outline: none; }
/* Senden: getönt, gefüllt sobald Text drinsteht. Innerer Radius = 26 − 4 px Abstand */
.knopf-senden {
  flex: none; width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 22px; font-size: 1.125rem;
  background: var(--akzent-flaeche); color: var(--akzent-text);
}
.chat-eingabe:has(input:not(:placeholder-shown)) .knopf-senden { background: var(--akzent); color: var(--akzent-auf); }
.knopf-senden:hover:not(:disabled) { background: var(--akzent-stark); color: var(--akzent-auf); }
.feinschliff .fehler { margin-top: 0.75rem; }
.extras { margin-top: var(--a2); border-top: 1px solid var(--trenner); padding-top: var(--a2); }
.extras h3 { font-size: var(--s-klein); margin: 0 0 var(--a1); }
.extras-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.extras-liste li { display: flex; align-items: center; gap: 0.75rem; font-size: var(--s-klein); }
.extras-liste .extra-name { flex: 1; min-width: 0; }
.extras-liste .extra-preis { color: var(--text-sekundaer); white-space: nowrap; font-variant-numeric: tabular-nums; }
.extras-liste .auf-anfrage { font-style: italic; }
.extras-liste button {
  flex: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font: inherit; font-size: 1.125rem; line-height: 1;
  border: 0; background: transparent; color: var(--text-sekundaer);
  transition: color var(--dauer) var(--kurve), background-color var(--dauer) var(--kurve);
}
.extras-liste button:hover { color: var(--fehler); background: var(--fehler-flaeche); }

/* ---------- Schritt 4: Bild ---------- */
.bild-raster {
  display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: var(--a4); align-items: start;
}
.bild-buehne .buehne-flaeche {
  max-height: calc(100vh - var(--kopf-hoehe) - 16rem);
  max-height: calc(100dvh - var(--kopf-hoehe) - 16rem);
}
.bild-buehne .buehne { margin: 0; }
.bild-seite h2 { margin-top: 0; }
.bild-knopf { width: 100%; }
.demo-code { margin: 0 0 var(--a2); display: grid; gap: 0.75rem; }
.demo-code .feld { margin: 0; }
.demo-code .tipp { margin: 0; }

/* ---------- Schritt 5: Kostenvoranschlag ---------- */
.kv { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: var(--a2) var(--a3); align-items: start; }
.kv-zusammenfassung { grid-row: span 2; }
.kv-foto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-element); display: block; margin-bottom: var(--a3); background: var(--flaeche-tief); }
.kv-daten { display: grid; grid-template-columns: auto 1fr; gap: var(--a1) var(--a2); margin: 0 0 var(--a3); font-size: var(--s-klein); }
.kv-daten dt { color: var(--text-sekundaer); }
.kv-daten dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv-zusammenfassung .knopf { width: 100%; }

/* Briefstil auf Papier */
.kv-dokument {
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    linear-gradient(var(--akzent), var(--akzent)) top / 100% 4px no-repeat,
    #fffefb;
  box-shadow: var(--schatten-weich);
}
.kv-briefkopf {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--a2);
  padding-bottom: var(--a2); margin-bottom: var(--a1); border-bottom: 1px solid var(--trenner);
}
.kv-briefkopf > div { display: flex; flex-direction: column; gap: 0.125rem; }
.kv-betrieb { font-family: var(--serif); font-size: var(--s-kopf); font-weight: 550; }
.kv-titel { font-family: var(--serif); font-size: var(--s-klein); font-style: italic; color: var(--messing); }
.kv-datum { font-size: var(--s-klein); color: var(--text-sekundaer); white-space: nowrap; font-variant-numeric: tabular-nums; }

.positionen { width: 100%; border-collapse: collapse; font-size: var(--s-klein); }
.positionen th, .positionen td { text-align: left; padding: 0.75rem 0; border-bottom: 1px solid var(--trenner); vertical-align: top; }
.positionen thead th { font-size: var(--s-fein); color: var(--text-sekundaer); font-weight: 500; }
.positionen .betrag { text-align: right; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; padding-left: var(--a2); }
.positionen .detail { display: block; color: var(--text-sekundaer); font-size: var(--s-fein); font-weight: 400; }
.positionen tbody th { font-weight: 500; }
.positionen tfoot th, .positionen tfoot td { border-bottom: 0; }
.positionen .summe th, .positionen .summe td { padding-top: var(--a2); font-weight: 600; }
.positionen .rahmen th, .positionen .rahmen td {
  font-family: var(--serif); font-size: var(--s-kopf); font-weight: 550; color: var(--akzent-text);
  border-top: 1.5px solid var(--text-primaer); padding-top: var(--a2);
}
.positionen .rahmen span { display: block; font-family: var(--ui); font-weight: 400; font-size: var(--s-fein); color: var(--text-sekundaer); }

.sonderliste { margin: 0; padding-left: 1.125rem; font-size: var(--s-klein); }
.sonderliste li { margin-bottom: 0.25rem; }
.sonderliste .auf-anfrage { color: var(--text-sekundaer); font-style: italic; }

.disclaimer {
  margin: var(--a3) 0 0; padding: 0.75rem var(--a2); border-left: 2px solid var(--messing);
  color: var(--text-sekundaer); font-size: var(--s-klein);
  font-family: var(--serif); font-style: italic;
}

.feld-raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--a2); }
.kv-kunde .knopf { width: 100%; margin-top: var(--a1); }

/* Ruhige, wertige Bestätigung */
.erfolg { text-align: center; padding: var(--a5) var(--a3); scroll-margin-top: calc(var(--kopf-hoehe) + var(--a2)); animation: erfolg-ein 500ms var(--kurve); }
.erfolg-symbol {
  display: inline-grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%;
  background: var(--erfolg-flaeche); color: var(--erfolg); font-size: 1.75rem; font-weight: 600; margin-bottom: var(--a2);
  animation: erfolg-symbol 600ms 120ms var(--kurve) both;
}
.erfolg h2 { font-size: var(--s-gross); font-weight: 500; }
.erfolg p { color: var(--text-sekundaer); max-width: 46ch; margin: 0 auto var(--a3); }
@keyframes erfolg-ein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes erfolg-symbol { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

/* ---------- Fuß ---------- */
.fuss {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--a1) var(--a3);
  max-width: var(--breite); width: 100%; margin: 0 auto;
  color: var(--text-sekundaer); font-size: var(--s-fein);
  padding: var(--a3) max(var(--rand-seite), env(safe-area-inset-right)) calc(var(--a3) + env(safe-area-inset-bottom)) max(var(--rand-seite), env(safe-area-inset-left));
  border-top: 1px solid var(--trenner);
}
.fuss-demo a { color: inherit; }
.fuss-powered strong { font-family: var(--serif); font-weight: 600; color: var(--text-primaer); }

/* =====================================================================
   Bewegung und Werkstatt-Details (js/bewegung.js setzt html.bewegt, --fortschritt, --ein)
   Aussehen hell wie auf der Landingpage, Bewegung unverändert aus der Fusion übernommen.
   ===================================================================== */

/* Maßband unter jeder Schrittüberschrift: Millimeter, halbe und ganze Zentimeter */
.schritt-kopf { position: relative; padding-bottom: var(--a3); }
.schritt-kopf::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: min(100%, 26rem); height: 12px;
  background:
    repeating-linear-gradient(90deg, var(--messing) 0 1px, transparent 1px 50px) bottom left / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, var(--messing) 0 1px, transparent 1px 25px) bottom left / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--messing) 60%, transparent) 0 1px, transparent 1px 5px) bottom left / 100% 4px no-repeat,
    linear-gradient(var(--messing), var(--messing)) bottom left / 100% 1px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, #000 60%, transparent);
          mask-image: linear-gradient(90deg, #000 60%, transparent);
  opacity: 0.55;
}

/* Fortschritt als Kupferlinie unter dem Kopf (js/bewegung.js setzt --fortschritt) */
.kopfbereich::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; transform-origin: left;
  transform: scaleX(var(--fortschritt, 0));
  background: linear-gradient(90deg, var(--akzent), #c06a2e);
  transition: transform 700ms var(--federnd);
}

/* Schrittwechsel: Kopf taucht auf, Inhalte gleiten nach. „translate“ statt „transform“, damit sich das
   mit dem Hereingleiten beim Scrollen verträgt; fill-mode backwards hinterlässt keine Verschiebung. */
html.bewegt .schritt-kopf > * { animation: auftauchen 700ms var(--kurve) backwards; }
html.bewegt .schritt-kopf > :nth-child(2) { animation-delay: 90ms; }
html.bewegt .schritt-kopf > :nth-child(3) { animation-delay: 180ms; }
html.bewegt .schritt-kopf::after { animation: massband 900ms var(--kurve) 150ms backwards; }
html.bewegt .schritt > :not(.schritt-kopf) { animation: einfahren 800ms var(--federnd) 160ms backwards; }
html.bewegt .schritt > :not(.schritt-kopf) ~ :not(.schritt-kopf) { animation-delay: 260ms; }
html.bewegt .moebel-raster > * { animation: aufploppen 650ms var(--federnd) backwards; animation-delay: calc(200ms + var(--i, 0) * 70ms); }
.moebel-raster > :nth-child(2) { --i: 1; } .moebel-raster > :nth-child(3) { --i: 2; } .moebel-raster > :nth-child(4) { --i: 3; }
.moebel-raster > :nth-child(5) { --i: 4; } .moebel-raster > :nth-child(6) { --i: 5; } .moebel-raster > :nth-child(7) { --i: 6; }
.moebel-raster > :nth-child(8) { --i: 7; } .moebel-raster > :nth-child(n+9) { --i: 8; }
@media (min-width: 901px) {
  html.bewegt .baukasten-buehne { animation: kippen 1000ms var(--federnd) 120ms backwards; }
  html.bewegt .baukasten-optionen > * { animation: einfahren-rechts 800ms var(--federnd) backwards; }
  html.bewegt .baukasten-optionen > :nth-child(2) { animation-delay: 120ms; }
  html.bewegt .baukasten-optionen > :nth-child(3) { animation-delay: 200ms; }
  html.bewegt .baukasten-optionen > :nth-child(n+4) { animation-delay: 280ms; }
}
@keyframes auftauchen { from { opacity: 0; translate: 0 22px; filter: blur(6px); } }
@keyframes einfahren { from { opacity: 0; translate: 0 64px; scale: 0.97; } }
@keyframes einfahren-rechts { from { opacity: 0; translate: 14vw 30px; rotate: 4deg; } }
@keyframes aufploppen { from { opacity: 0; translate: 0 40px; scale: 0.9; rotate: -3deg; } }
@keyframes kippen { from { opacity: 0; transform: perspective(1400px) translate3d(-10vw, 40px, 0) rotateY(22deg) rotateX(8deg); } }
@keyframes massband { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Karten gleiten beim Scrollen herein (js/bewegung.js setzt --ein und .gleitet, nur solange sie unterwegs sind) */
html.bewegt .gleitet {
  opacity: calc(0.15 + var(--ein, 1) * 0.85);
  transform: translate3d(calc((1 - var(--ein, 1)) * var(--seite, 1) * 9vw), calc((1 - var(--ein, 1)) * 90px), 0)
    rotate(calc((1 - var(--ein, 1)) * var(--seite, 1) * 2.5deg));
}

/* Kicker tippen sich beim Schrittwechsel ein */
html.bewegt .kicker.tippt { display: inline-block; animation: tippen calc(var(--n, 20) * 28ms) steps(var(--n, 20)) both; }
html.bewegt .kicker.tippt::after {
  content: "▌"; margin-left: 0.15em; color: var(--akzent-text);
  animation: blinken 0.9s steps(2, jump-none) 5 forwards;
}
@keyframes tippen { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes blinken { 0% { opacity: 1; } 100% { opacity: 0; } }
.schritt-kopf .kicker { display: inline-block; }

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

/* ---------- Tablet & Handy ---------- */
@media (max-width: 900px) {
  .bild-raster { grid-template-columns: minmax(0, 1fr); }
  .bild-buehne .buehne-flaeche { max-height: calc(100dvh - var(--kopf-hoehe) - 8rem); }
  .raum-raster, .baukasten, .kv { grid-template-columns: minmax(0, 1fr); }
  .baukasten-buehne { position: static; }
  .buehne-flaeche {
    max-height: calc(100vh - var(--kopf-hoehe) - var(--preisleiste-hoehe) - 4rem);
    max-height: calc(100dvh - var(--kopf-hoehe) - var(--preisleiste-hoehe) - 4rem);
  }
  .kv-zusammenfassung { grid-row: auto; }
  /* Einspaltig zuerst der Preis, dann die Auswahl */
  .kv-dokument { order: -1; }
  .kv-foto { aspect-ratio: 16 / 9; }

  /* Preis als feste Leiste unten; der Inhalt bekommt so viel Abstand, dass kein Knopf darunter verschwindet */
  #schritt-2 { padding-bottom: var(--a2); }
  body:has(#schritt-2:not([hidden])) .fuss { padding-bottom: calc(var(--preisleiste-hoehe) + var(--a3)); }
  .preisleiste {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    border-radius: var(--r-karte) var(--r-karte) 0 0; border-width: 1px 0 0;
    padding: 0.75rem max(var(--rand-seite), env(safe-area-inset-right)) calc(0.75rem + env(safe-area-inset-bottom)) max(var(--rand-seite), env(safe-area-inset-left));
    background: color-mix(in srgb, var(--flaeche) 90%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 -8px 24px -16px rgba(43, 35, 28, 0.35);
  }
  /* Wegweiser über der festen Preisleiste; auf dem Handy nur der Sprung zu den Optionen */
  .wegweiser { bottom: calc(var(--preisleiste-hoehe) + 0.75rem + env(safe-area-inset-bottom)); padding-right: 1.125rem; }
  .preis-label { display: none; }
  .preis-summe { font-size: var(--s-kopf); }
  .nur-gross { display: none; }
  .nur-klein { display: inline; }
}

@media (max-width: 700px) {
  :root { --s-titel: 1.75rem; }
  main { padding-top: var(--a4); }
  .kopf-produkt { display: none; }
  .karte { padding: var(--a2); border-radius: 16px; }
  .weitere-angaben > summary { padding: 0.75rem var(--a2); border-radius: 16px; }

  /* Schrittleiste: horizontal scrollbar, der aktive Schritt wird von js/kopf.js ins Bild gerollt */
  .schritte ol { overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
  .schritte ol::-webkit-scrollbar { display: none; }
  .schritte li { scroll-snap-align: center; }
  .schritte li:not([hidden]) + li:not([hidden])::before { width: 1rem; }
}

@media (max-width: 600px) {
  .wegweiser-ziele { display: none; }
  .wegweiser-lang { display: none; }
  .wegweiser-kurz { display: inline; }
  .wegweiser-text { font-size: var(--s-text); }
  .moebel-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .moebel-karte { min-height: 140px; padding: var(--a2); border-radius: var(--r-element); }
  .moebel-symbol { width: 3.25rem; height: 3.25rem; }
  .buehne-flaeche { border-radius: 16px; min-height: 220px; }
  .umschalter { top: var(--a1); right: var(--a1); }
  .umschalter button { padding: 0.375rem 0.75rem; }
  .buehne-etikett { left: var(--a1); bottom: var(--a1); }
  .draufsicht { width: 86%; }

  .wahl-material { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leiste-pfeil { width: 44px; height: 44px; }
  .leiste-pfeil-zurueck { left: 4px; }
  .leiste-pfeil-vor { right: 4px; }
  .wahl-formen .form-symbol { width: 32px; height: 22px; }
  .wahl-formen label { font-size: var(--s-fein); }
  .feld-raster { grid-template-columns: minmax(0, 1fr); }
  .feldreihe-drei { gap: var(--a1); }
  .feldreihe-drei .einheit-feld { gap: 0.25rem; }
  .aktionen { flex-direction: column-reverse; align-items: stretch; }
  .aktionen .knopf { width: 100%; }
  .aktionen-zwischen .link-zurueck { align-self: center; }
  .kv-briefkopf { flex-direction: column; gap: 0.25rem; }
}

/* Handy quer und sehr niedrige Fenster: Kopf scrollt mit (js/kopf.js setzt .nicht-fest und --kopf-hoehe: 0) */
@media (max-height: 520px) {
  .kopfbereich { position: relative; margin-bottom: 0; }
  .baukasten-buehne { position: static; }
}
