/* ═══════════════════════════════════════════════════════════════════════════
   XnD – Der Begleiter · Ergänzung zu xnd.css
   Formularteile der Arbeitsblätter. Farben, Räume, Wegweiser, Blatt und Tipp kommen aus xnd.css.
   Eingabefelder haben mindestens 16 px Schrift – sonst zoomt iPhone-Safari beim Antippen hinein.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Licht je Schritt */
html[data-raum="versprechen"]  { --ton: 268; --hx: 24%; --hy: 22%; }
html[data-raum="dramaturgie"]  { --ton: 250; --hx: 76%; --hy: 68%; }
html[data-raum="grundfassung"] { --ton: 215; --hx: 28%; --hy: 72%; }
html[data-raum="schichten"]    { --ton: 300; --hx: 74%; --hy: 22%; }
html[data-raum="teile"]        { --ton: 318; --hx: 24%; --hy: 20%; }
html[data-raum="pruefung"]     { --ton: 195; --hx: 76%; --hy: 72%; }
html[data-raum="weglassen"]    { --ton: 235; --hx: 26%; --hy: 26%; }
html[data-raum="bauplan"]      { --ton: 165; --hx: 72%; --hy: 24%; }

/* Räume mit Arbeitsblatt dürfen höher sein als der Bildschirm und beginnen oben. */
.raum:has(.blatt-form) { align-items: start; }
.raum--auftakt:has(.blatt-form), .raum--urheber:has(.blatt-form) { align-items: center; }
.raum:has(.blatt-form) .raum__innen { align-items: start; }
@media (min-width: 901px) {
  .raum:has(.blatt-form) .raum__text { position: sticky; top: clamp(5.5rem, 12vh, 7.5rem); }
}

.fertig { max-width: 33rem; padding-left: 1rem; border-left: 3px solid var(--licht); font-size: .98rem; line-height: 1.5; color: var(--leise); }
.fertig strong { color: var(--tinte); font-weight: 660; }

/* Stand eines Schritts neben dem Kicker */
.stand-marke { display: inline-flex; align-items: center; gap: .35rem; margin-left: .2rem; padding: .22rem .6rem; border-radius: 99px; border: 1px solid var(--linie-stark); font-size: .64rem; letter-spacing: .12em; color: var(--leise); }
.stand-marke:empty { display: none; }
.stand-marke.ist-fertig { border-color: var(--licht); color: var(--tinte); background: color-mix(in oklab, var(--licht) 22%, transparent); }

/* Arbeitsblatt */
.blatt-form { display: grid; gap: 1.1rem; }
.blatt-form > .wege { margin-top: .1rem; }
.feld { display: grid; gap: .35rem; }
.feld > span { font-size: .84rem; font-weight: 640; color: var(--leise); }
.feld input, .feld textarea, .posten__kopf input {
  width: 100%; min-height: 2.9rem; padding: .7rem .9rem;
  border: 1.5px solid var(--linie-stark); border-radius: .9rem;
  background: var(--flaeche); color: var(--tinte);
  font: 400 1rem/1.45 var(--sans);
  transition: border-color .2s, box-shadow .2s;
}
.feld textarea { display: block; resize: vertical; overflow: hidden; field-sizing: content; min-height: 2.9rem; }
.feld input::placeholder, .feld textarea::placeholder, .posten__kopf input::placeholder { color: color-mix(in oklab, var(--leise) 72%, transparent); }
.feld input:focus, .feld textarea:focus, .posten__kopf input:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--akzent) 24%, transparent); }
.versprechen-satz { font-size: clamp(1.1rem, 1.6vw, 1.3rem); }
.versprechen-satz.ist-leer { color: var(--leise); }

/* Listen: Räume, Schichten, Teile, Aufgaben, Urteile */
.liste { display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.liste:empty { display: none; }
.posten { display: grid; gap: .7rem; padding: .9rem; border: 1px solid var(--linie); border-radius: 1.2rem; background: color-mix(in oklab, var(--flaeche) 70%, transparent); }
.posten__kopf { display: flex; align-items: center; gap: .6rem; }
.posten__kopf input { flex: 1; min-width: 0; font-weight: 640; }
.posten__nr { display: grid; place-items: center; flex: none; width: 2.15rem; height: 2.15rem; border-radius: 50%; background: var(--akzent); color: var(--auf-akzent); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.posten__titel { flex: 1; min-width: 0; font-weight: 660; overflow-wrap: anywhere; }
.posten__art { flex: none; font-size: .66rem; font-weight: 680; letter-spacing: .13em; text-transform: uppercase; color: var(--leise); }
.posten__tun { display: flex; flex: none; gap: .15rem; }
.posten__tun button { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--leise); transition: background .2s, color .2s; }
.posten__tun button:hover { background: var(--akzent-weich); color: var(--akzent); }
.posten__tun button:disabled { opacity: .3; pointer-events: none; }
.posten .schalter { justify-self: start; }
.posten.ist-weg { border-style: dashed; }
.posten.ist-weg .posten__titel { text-decoration: line-through; color: var(--leise); }

/* Abhaken */
.haken-liste { display: grid; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.haken-liste--zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem 1rem; }
.haken { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; min-height: 2.75rem; padding: .55rem 0; cursor: pointer; line-height: 1.4; }
.haken input { appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; margin: 0; border: 1.5px solid var(--linie-stark); border-radius: .45rem; background: var(--flaeche); cursor: pointer; transition: background .2s, border-color .2s; }
.haken input::after { content: ""; width: .75rem; height: .4rem; margin-top: -.15rem; border: solid var(--auf-akzent); border-width: 0 0 2.5px 2.5px; rotate: -45deg; scale: 0; transition: scale .2s var(--weich); }
.haken input:checked { background: var(--akzent); border-color: var(--akzent); }
.haken input:checked::after { scale: 1; }
html:not(.js) .haken { cursor: default; }

/* Stand der sieben Schritte im Bauplan */
.stand { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.stand li { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px solid var(--linie); }
.stand li:last-child { border-bottom: 0; }
.stand b { font-size: .72rem; font-variant-numeric: tabular-nums; color: var(--leise); }
.stand a { font-weight: 640; text-decoration: none; }
.stand a:hover { color: var(--akzent); }
.stand span { font-size: .8rem; color: var(--leise); text-align: right; }
.stand .ist-fertig span { color: var(--tinte); font-weight: 640; }
.stand .ist-fertig span::before { content: ""; display: inline-block; width: .5rem; height: .5rem; margin-right: .4rem; border-radius: 50%; background: var(--licht); }

.datei-knopf { position: relative; cursor: pointer; }
.datei-knopf input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.datei-knopf:focus-within { outline: 3px solid var(--akzent); outline-offset: 3px; }
[data-tu="leeren"].ist-scharf, [data-tu="beispiel"].ist-scharf { border-color: #c2410c; color: #c2410c; }

@media (max-width: 700px) {
  .haken-liste--zwei { grid-template-columns: minmax(0, 1fr); }
  /* Schmal: Name in der ersten Zeile, die Knöpfe rücken darunter nach rechts. */
  .posten { min-width: 0; }
  .posten__kopf { flex-wrap: wrap; }
  .posten__kopf input { flex: 1 1 8rem; }
  .posten__tun { margin-left: auto; }
  .posten { padding: .8rem; }
  .stand li { grid-template-columns: auto 1fr; }
  .stand span { grid-column: 2; text-align: left; }
}
@media (max-width: 420px) {
  .posten .schalter { display: grid; width: 100%; border-radius: 1.1rem; }
  .posten .schalter button { border-radius: .9rem; text-align: left; }
  .posten__tun button { width: 2.5rem; }
}

@media print {
  .blatt-form { display: block; }
  .haken input { border: .3mm solid #000; }
}

/* Zugeklappte Einträge zeigen nur ihren Namen; Teile und Urteile zeigen ihr Begründungsfeld erst nach der Wahl. */
.posten.ist-zu > .feld { display: none; }
.posten__tun [data-tu="klapp"] svg { transition: rotate .3s var(--weich); }
.posten__tun [data-tu="klapp"][aria-expanded="true"] svg { rotate: 180deg; }
.posten--teil { gap: .5rem; padding: .7rem .9rem; }
.posten--teil:not(.hat-wahl) > .feld { display: none; }
.posten--teil .posten__kopf input { min-height: 2.5rem; padding: .35rem .5rem; margin-left: -.5rem; border-color: transparent; background: transparent; }
.posten--teil .posten__kopf input:hover { border-color: var(--linie-stark); }
.posten--teil .posten__kopf input:focus { background: var(--flaeche); }
.wege .datei-knopf { align-self: stretch; }

/* Solange auf dem Smartphone getippt wird, weicht die Leiste unten – sie läge sonst über dem Feld. */
@media not ((min-width: 1024px) and (hover: hover)) {
  body:has(main :is(input[type="text"], textarea):focus) .leiste { opacity: 0; pointer-events: none; }
}

/* Vorschritt „Bestand" – klappt nur auf, wenn es einen Vorgänger gibt */
.bestand { padding: 0 .9rem; border: 1px dashed var(--linie-stark); border-radius: 1rem; }
.bestand summary { display: flex; align-items: center; gap: .6rem; min-height: 2.9rem; cursor: pointer; list-style: none; font-size: .92rem; font-weight: 640; }
.bestand summary::-webkit-details-marker { display: none; }
.bestand summary::before { content: "+"; flex: none; width: 1.1rem; color: var(--akzent); font-weight: 700; font-size: 1.1rem; text-align: center; }
.bestand[open] summary::before { content: "–"; }
.bestand[open] { padding-bottom: .9rem; }
.bestand > :not(summary) + :not(summary), .bestand > summary + * { margin-top: .7rem; }

/* Auswahlfeld (Zielschritt eines vorgemerkten Einfalls) – wie die anderen Felder, mit eigenem Pfeil */
.feld select {
  width: 100%; min-height: 2.9rem; padding: .7rem 2.6rem .7rem .9rem;
  border: 1.5px solid var(--linie-stark); border-radius: .9rem;
  background-color: var(--flaeche); background-repeat: no-repeat;
  background-image: linear-gradient(45deg, transparent 50%, var(--leise) 50%), linear-gradient(-45deg, transparent 50%, var(--leise) 50%);
  background-size: .45rem .45rem, .45rem .45rem; background-position: right 1.35rem center, right .9rem center;
  color: var(--tinte); font: 400 1rem/1.45 var(--sans);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.feld select:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--akzent) 24%, transparent); }

/* Vorgemerkt: der Weg zum Blatt in jedem Schritt, die Wiedervorlage oben auf der Tafel, die ganze Liste im Blatt */
.merk { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: 0; }
.merk__zahl { font-size: .8rem; color: var(--leise); }
.merk__zahl:empty { display: none; }
.tiefer--klein { gap: .55rem; min-height: 2.5rem; padding: .25rem 1rem .25rem .3rem; font-size: .88rem; }
.tiefer--klein svg { width: 1.95rem; height: 1.95rem; padding: .42rem; }
.vorgelegt { display: grid; gap: .7rem; padding: .9rem; border: 1.5px solid var(--akzent); border-radius: 1.2rem; background: var(--akzent-weich); }
.vorgelegt[hidden] { display: none; }
.posten--vorgelegt { background: var(--flaeche); }
.posten--vorgelegt .posten__titel { font-family: var(--lese); font-weight: 400; font-size: 1.02rem; line-height: 1.45; }
.merkliste { margin-top: 2rem; padding-top: 1.6rem; border-top: 1px solid var(--linie); font-family: var(--sans); }
.merkliste .knopf { justify-self: start; }
.posten__art:empty { display: none; }
