/* ------------------------------------------------------------------
   Das SCUM-Questbuch als Editor.

   Das Buch selbst ist ein Bild aus dem Spiel (assets/questbook.png).
   Der Text wird nicht flach darauf gelegt, sondern mit derselben
   perspektivischen Verzerrung - berechnet aus den vier Blattecken im
   Foto (ECKEN in book.js, per "Ecken justieren" nachstellbar).

   Alles Übrige kommt ebenfalls aus den Spieldateien:
     brush.png     - der Markerstrich hinter den Überschriften
     tier1..4.png  - die Stempel mit der Stufe
     hourglass.png - die Sanduhr beim Zeitlimit
     paper.png     - das leere Blatt für die flache Ansicht
   Die Schrift ist PTMono-Regular, ebenfalls aus dem Pak.

   Das Blatt ist flach 912 x 1192 gross (Originalgröße des Sprites).
   Schriftgröße 19, Zeilenhöhe 28, Textspalte 44 Zeichen - an
   Ingame-Screenshots gemessen, siehe LIMITS.md.
   ------------------------------------------------------------------ */

:root {
  --blatt-b: 912px;
  --blatt-h: 1192px;
  --foto-b: 1750px;
  --foto-h: 899px;

  --fs: 19px;                /* 44 Zeichen = 54 % der Blattbreite */
  --lh: 28px;                /* 32 Zeilen = 75 % der Blatthöhe */
  --spalte: 44ch;

  --tinte: #2a2620;
  --tinte-schwach: #6b6455;
  --gruen: #8fb389;
  --rot: #8d3b2f;
  --skala: 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: #0d0d0f radial-gradient(ellipse at 50% 40%, #201e1b 0%, #08080a 75%);
  color: #ddd;
  font-family: 'ShareTechMono', ui-monospace, monospace;
  overflow: hidden;
}

/* ---------- Kopfleiste ---------- */
#leiste {
  position: fixed; inset: 0 0 auto 0; height: 44px; z-index: 40;
  display: flex; align-items: center; gap: 9px; padding: 0 14px;
  background: #16161a; border-bottom: 1px solid #2c2c32; font-size: 13px;
}
#leiste .marke { font-weight: bold; letter-spacing: 2px; color: #9dbb98; }
#leiste .fuell { flex: 1; }
button.werkzeug {
  background: var(--ui-bg3, #24242a); color: var(--ui-text, #ccc); border: 1px solid var(--ui-rand2, #3a3a42);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  font: 500 12.5px var(--ui-font, inherit);
  transition: background .12s, border-color .12s;
}
button.werkzeug:hover { background: #33333c; border-color: #56566a; }
button.werkzeug.an { background: var(--ui-akzent-dunkel, #3c4a38); border-color: var(--ui-akzent, #7d9b78); color: #e6f0e2; }
#budget { font-size: 12px; color: #8a8a8a; }
#budget.eng  { color: #d8a44a; }
#budget.voll { color: #d8564a; }

/* ---------- Buehne und Buch ---------- */
#buehne { position: absolute; inset: 44px 0 0 0; overflow: hidden; }

#buch {
  position: absolute; left: 50%; top: 50%;
  width: var(--foto-b); height: var(--foto-h);
  transform: translate(-50%, -50%) scale(var(--skala));
  transform-origin: center center;
}
#foto {
  position: absolute; inset: 0; width: 100%; height: 100%;
  user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 30px 60px #000b);
}
#flachpapier { display: none; }

/* flache Ansicht: das Foto weicht dem leeren Blatt, der Text steht gerade */
body.flach #buch { width: 960px; height: 1240px; }
body.flach #foto { display: none; }
body.flach #flachpapier {
  display: block; position: absolute; left: 24px; top: 24px;
  width: var(--blatt-b); height: var(--blatt-h);
  filter: drop-shadow(0 10px 24px #0008);
}

/* ---------- das beschriebene Blatt ---------- */
#blatt {
  position: absolute; left: 0; top: 0; opacity: var(--text-alpha, 1);
  width: var(--blatt-b); height: var(--blatt-h);
  transform-origin: 0 0;
  /* transform kommt aus book.js: die Homographie der vier Blattecken */
}

.inhalt {
  position: absolute; inset: 0;
  padding: var(--rand-oben, 5.5%) 4% 4% var(--rand-links, 9.5%);
  font-family: 'PTMono', ui-monospace, monospace;
  font-size: var(--fs); line-height: var(--lh);
  color: var(--tinte);
}

/* ---------- Titel ---------- */
.titelzeile { text-align: center; width: var(--spalte); }
.titel {
  position: relative; display: inline-block;
  font-size: calc(var(--fs) * 1.5); line-height: 1.3;
  padding: 2px 14px 4px; outline: none; z-index: 1;
}
.titel::before {              /* der Markerstrich liegt HINTER der Schrift */
  content: ''; position: absolute; inset: -2px -8px -4px -8px; z-index: -1;
  background: var(--gruen);
  -webkit-mask: url('assets/brush.png') center/100% 100% no-repeat;
          mask: url('assets/brush.png') center/100% 100% no-repeat;
  mix-blend-mode: multiply;
}
.titel:empty::after { content: 'Titel'; color: #8a8271; }

/* ---------- Zeitlimit ---------- */
.zeit {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: var(--spalte);
  font-size: calc(var(--fs) * .95);
  margin: 6px 0 16px; cursor: pointer;
}
.zeit img { height: calc(var(--fs) * 1.5); opacity: .85; }
.zeit:hover { text-decoration: underline dotted; }

/* ---------- Textbereich: die 32 Zeilen ---------- */
.textfeld { position: relative; }
.spalte { width: var(--spalte); }
.absatz { white-space: pre-wrap; outline: none; word-break: break-word; }
.absatz:empty::before { content: 'Beschreibung ...'; color: #8a8271; }

/* Überschrift auf Markerstrich */
.rubrik {
  position: relative; margin: 18px 0 4px;
  height: calc(var(--lh) * 1.25);
  display: flex; align-items: center;
}
.rubrik .strich {
  position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: var(--strich, 650px); height: var(--lh);   /* eine Zeile hoch, mittig hinter dem Wort */
  background: var(--gruen);
  -webkit-mask: url('assets/brush.png') left center/100% 100% no-repeat;
          mask: url('assets/brush.png') left center/100% 100% no-repeat;
  mix-blend-mode: multiply;
}
.rubrik .wort { position: relative; letter-spacing: 1.5px; }
.rubrik .plus { position: relative; margin-left: 10px; }

.zeile { display: flex; gap: 8px; align-items: flex-start; padding-left: 26px; position: relative; }
.zeile .txt { flex: 1; outline: none; white-space: pre-wrap; word-break: break-word; }
.zeile .griff {                 /* Stift und Kreuz: immer leicht sichtbar, beim Hover deutlich */
  opacity: .55; font-size: 15px; line-height: 1;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--tinte); background: rgba(255,255,255,.6);
  border: 1px solid rgba(42,38,32,.4); border-radius: 50%;
  cursor: pointer; user-select: none;
  transition: opacity .15s, background .15s, color .15s;
  /* rechts neben der Spalte, damit sie dem Text keine Breite wegnehmen */
  position: absolute; top: 2px;
}
.zeile .griff:nth-child(2) { left: calc(100% + 8px); }
.zeile .griff:nth-child(3) { left: calc(100% + 36px); }
.zeile:hover .griff { opacity: 1; }
.zeile .griff:hover { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.zeile .griff:hover:last-child { background: var(--rot); border-color: var(--rot); }
.zeile.aufzaehlung .txt::before { content: "\2022  "; }

.plus {                         /* + hinter AUFGABE und BELOHNUNGEN */
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; vertical-align: -5px;
  border: 2px solid var(--tinte); border-radius: 50%;
  background: rgba(255,255,255,.6);
  color: var(--tinte); cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1;
  transition: background .15s, color .15s;
}
.plus:hover { background: var(--tinte); color: #fff; }

/* ---------- Stufenstempel (die Feder steckt schon im Foto) ---------- */
.stempel {
  position: absolute; left: var(--stempel-x, 40%); bottom: var(--stempel-y, 4%);
  cursor: pointer;
}
.stempel img { height: var(--stempel-g, 118px); }
.stempel:hover img { filter: brightness(1.15); }

/* ---------- Papierkante: was der Spieler nicht mehr sieht ---------- */
#kante {                        /* so breit wie die Textspalte */
  position: absolute; left: 0; width: var(--spalte); height: 0;
  border-top: 2px dashed #b44538; pointer-events: none;
}
#kante::after {                 /* Hinweis mittig über der Linie, ohne Kasten */
  content: 'ab hier sieht der Spieler nichts mehr';
  position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
  font-family: 'ShareTechMono', monospace; font-size: 14px; letter-spacing: .3px;
  color: #b44538; white-space: nowrap;
}
.abgeschnitten { opacity: .3; }

/* ---------- Kalibrierung der vier Blattecken ---------- */
#griffe { position: absolute; inset: 0; z-index: 20; }
.griffpunkt {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border: 2px solid #ff7043; border-radius: 50%;
  background: #ff704333; cursor: grab;
}
.griffpunkt::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; background: #ff7043;
}
.griffpunkt:active { cursor: grabbing; background: #ff7043aa; }
body.kalib #blatt { outline: 1px dashed #ff704388; }

/* ---------- Eichleiste (gleicher Stil wie die Dialoge, Tokens unten) ---------- */
#eichung {
  position: fixed; left: 12px; top: 56px; z-index: 45; width: 300px;
  background: var(--ui-bg); border: 1px solid var(--ui-rand); border-radius: var(--ui-radius);
  box-shadow: 0 24px 60px #000b, 0 0 0 1px #ffffff08 inset;
  font-family: var(--ui-font); font-size: 12.5px; color: var(--ui-text);
  display: flex; flex-direction: column; max-height: calc(100vh - 68px);
}
#eichung[hidden] { display: none; }
#eichung .eichkopf {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--ui-rand);
  font-size: 14px; font-weight: 600; color: var(--ui-text);
}
#eichung .eichkopf::before {
  content: '\1F4D0'; display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px; font-size: 16px;
  background: linear-gradient(160deg, var(--ui-bg3), var(--ui-bg2));
  border: 1px solid var(--ui-rand2);
}
#eichung .eichkopf small { display: block; font-size: 11.5px; font-weight: 400; color: var(--ui-text2); }
#eichung .eichregler { padding: 6px 16px 4px; overflow: auto; }
#eichung label {
  display: grid; grid-template-columns: 1fr 108px 44px; align-items: center;
  gap: 8px; padding: 6px 0; color: var(--ui-text2);
  border-bottom: 1px solid #ffffff08;
}
#eichung label:last-of-type { border-bottom: 0; }
#eichung label span { text-align: right; color: var(--ui-text); font-family: var(--ui-mono); font-size: 11.5px; }
#eichung input[type=range] {
  -webkit-appearance: none; appearance: none; width: 108px; height: 18px;
  background: transparent; margin: 0; cursor: pointer;
}
#eichung input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3a3a44; }
#eichung input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #3a3a44; }
#eichung input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--ui-akzent); border: 2px solid var(--ui-bg); box-shadow: 0 0 0 1px var(--ui-akzent);
}
#eichung input[type=range]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ui-akzent); border: 2px solid var(--ui-bg); box-shadow: 0 0 0 1px var(--ui-akzent);
}
#eichung input[type=range]:focus-visible { outline: none; }
#eichung input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #8fb38955; }
#eichung .eichfuss {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px;
  border-top: 1px solid var(--ui-rand); background: #17171b;
}
#eichung .eichhinweis {
  margin: 0; padding: 0 16px 14px; font-size: 11.5px; line-height: 1.45; color: var(--ui-text3);
  background: #17171b; border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}

/* ==================================================================
   Dialoge
   Ein Baukasten, den book.js zusammensetzt: Kopf mit Symbol, Titel
   und Untertitel; Rumpf mit Abschnitten, Feldern, Schaltern, Chips;
   Fuß mit Knöpfen. Dialoge stapeln sich (die Item-Auswahl liegt über
   dem Aufgaben-Dialog), der untere rückt dabei leicht nach hinten.
   ================================================================== */
:root {
  --ui-font: -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  --ui-mono: 'ShareTechMono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --ui-bg: #1a1a1f;
  --ui-bg2: #212127;
  --ui-bg3: #2a2a31;
  --ui-rand: #34343d;
  --ui-rand2: #45454f;
  --ui-text: #e8e8ec;
  --ui-text2: #a6a6b0;
  --ui-text3: #74747e;
  --ui-akzent: #8fb389;
  --ui-akzent2: #a9cba3;
  --ui-akzent-dunkel: #3d5439;
  --ui-warn: #d8a44a;
  --ui-rot: #d8564a;
  --ui-radius: 12px;
}

#schleier {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: #07070999; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 24px;
  font-family: var(--ui-font); color: var(--ui-text); font-size: 13.5px; line-height: 1.45;
}
#schleier.auf { display: flex; }

.dlg {
  position: absolute;
  display: flex; flex-direction: column;
  width: 640px; max-width: calc(100vw - 48px); max-height: calc(100vh - 72px);
  background: var(--ui-bg); border: 1px solid var(--ui-rand); border-radius: var(--ui-radius);
  box-shadow: 0 30px 80px #000c, 0 0 0 1px #ffffff08 inset;
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.8,.3,1);
}
.dlg.da { opacity: 1; transform: none; }
.dlg.hinten { opacity: .35; transform: scale(.96) translateY(-10px); pointer-events: none; filter: blur(1px); }

.dlg-kopf {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--ui-rand);
}
.dlg-ico {
  flex: none; width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(160deg, var(--ui-bg3), var(--ui-bg2));
  border: 1px solid var(--ui-rand2); box-shadow: 0 2px 6px #0006 inset;
}
.dlg-ico img { height: 32px; }
.dlg-titel { flex: 1; min-width: 0; }
.dlg-titel h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .2px; color: var(--ui-text); }
.dlg-titel p { margin: 3px 0 0; font-size: 12.5px; color: var(--ui-text2); }
.dlg-x {
  flex: none; width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: transparent; color: var(--ui-text3); font-size: 13px; cursor: pointer;
}
.dlg-x:hover { background: var(--ui-bg3); color: var(--ui-text); }

.dlg-body { padding: 8px 20px 18px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.dlg-body > .feld:first-child { margin-top: 12px; }
.dlg-fuss {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--ui-rand);
  background: #17171b; border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}
.dlg-fuss-links, .dlg-fuss-rechts { display: flex; gap: 8px; }

/* ---- Knöpfe ---- */
.knopf {
  font: 500 13px var(--ui-font); padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--ui-rand2); background: var(--ui-bg3); color: var(--ui-text);
  transition: background .12s, border-color .12s, transform .06s;
}
.knopf:hover { background: #33333c; border-color: #56566a; }
.knopf:active { transform: translateY(1px); }
.knopf.primaer { background: var(--ui-akzent); border-color: var(--ui-akzent); color: #10160f; font-weight: 600; }
.knopf.primaer:hover { background: var(--ui-akzent2); border-color: var(--ui-akzent2); }
.knopf.geist { background: transparent; }
.knopf.geist:hover { background: var(--ui-bg3); }
.knopf.gefahr { color: #e98a80; border-color: transparent; }
.knopf.gefahr:hover { background: #3a2422; border-color: #5b3330; color: #f3a79e; }
.knopf.klein { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.knopf.an { background: var(--ui-akzent-dunkel); border-color: var(--ui-akzent); color: #e6f0e2; }
.knopfzeile { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---- Abschnitte, Felder ---- */
.abschnitt { margin-top: 18px; }
.abschnitt .abschnitt { margin-top: 12px; }
.abschnitt h4 {
  margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ui-text3);
}
.abschnitt-hinweis { margin: -2px 0 10px; font-size: 12.5px; color: var(--ui-text2); }
.abschnitt-hinweis b { color: var(--ui-text); font-weight: 600; }

.reihe { display: grid; gap: 12px; align-items: start; margin-top: 4px; }
.feld { margin: 10px 0 0; min-width: 0; }
.feld label { display: block; font-size: 12px; color: var(--ui-text2); margin-bottom: 5px; }
.feld input, .feld select, .feld textarea, .suche, .suche-frei input {
  width: 100%; font: 13.5px var(--ui-font); color: var(--ui-text);
  background: #121216; border: 1px solid var(--ui-rand2); border-radius: 8px;
  padding: 8px 10px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.feld input:focus, .feld select:focus, .feld textarea:focus, .suche:focus, .suche-frei input:focus {
  border-color: var(--ui-akzent); box-shadow: 0 0 0 3px #8fb38933;
}
.feld input::placeholder, .suche::placeholder, .suche-frei input::placeholder { color: var(--ui-text3); }
.feld textarea { resize: vertical; line-height: 1.45; }
.feld select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ui-text2) 50%),
                    linear-gradient(135deg, var(--ui-text2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.feld input[type=number] { -moz-appearance: textfield; }
.feld input[type=number]::-webkit-inner-spin-button { opacity: .5; }
.feld input[type=datetime-local] { color-scheme: dark; }
.mit-einheit { position: relative; }
.mit-einheit .einheit {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--ui-text3); pointer-events: none;
}
.mit-einheit input { padding-right: 34px; }
.mono, .feld .mono { font-family: var(--ui-mono) !important; font-size: 12.5px !important; }
.hinweis { font-size: 11.5px; color: var(--ui-text3); margin-top: 5px; line-height: 1.4; }
.zaehler.zuviel { color: var(--ui-warn); }
.stand { font-size: 13px; color: var(--ui-text); margin: 4px 0 8px; }
.vorschau { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--ui-bg2);
            color: var(--ui-akzent2); font-size: 13px; }

.hinweisbox {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.45;
  white-space: pre-line; border: 1px solid var(--ui-rand); background: var(--ui-bg2); color: var(--ui-text2);
}
.hinweisbox.info { border-color: #2e3d4a; background: #1a2229; color: #a9c1d4; }
.hinweisbox.warn { border-color: #5a4320; background: #2a2114; color: #e8c07a; }
.hinweisbox[hidden] { display: none; }

/* ---- Kippschalter ---- */
.schalter { display: flex; align-items: flex-start; gap: 11px; margin: 12px 0 0; cursor: pointer; user-select: none; }
.schalter input { position: absolute; opacity: 0; width: 0; height: 0; }
.schalter-knopf {
  flex: none; width: 38px; height: 22px; border-radius: 11px; margin-top: 1px;
  background: #3a3a44; border: 1px solid var(--ui-rand2); position: relative; transition: background .15s;
}
.schalter-knopf::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #cfcfd6; transition: transform .15s, background .15s;
}
.schalter input:checked + .schalter-knopf { background: var(--ui-akzent); border-color: var(--ui-akzent); }
.schalter input:checked + .schalter-knopf::after { transform: translateX(16px); background: #10160f; }
.schalter input:focus-visible + .schalter-knopf { box-shadow: 0 0 0 3px #8fb38933; }
.schalter-text { display: flex; flex-direction: column; }
.schalter-label { font-size: 13px; color: var(--ui-text); }
.schalter-text .hinweis { margin-top: 2px; }

/* ---- Tabs, Schnellwahl ---- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--ui-bg2); border-radius: 10px; margin-top: 12px; }
.tab { flex: 1; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent;
       color: var(--ui-text2); font: 500 13px var(--ui-font); cursor: pointer; }
.tab:hover { color: var(--ui-text); }
.tab.an { background: var(--ui-bg3); color: var(--ui-text); box-shadow: 0 1px 3px #0006; }
.schnellwahl { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---- Auswahlkarten ---- */
.wahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.karte {
  background: linear-gradient(170deg, var(--ui-bg3), var(--ui-bg2));
  border: 1px solid var(--ui-rand); border-radius: 12px;
  padding: 18px 12px 14px; text-align: center; cursor: pointer; outline: none;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.karte:hover, .karte:focus-visible { border-color: var(--ui-akzent); transform: translateY(-2px);
  box-shadow: 0 8px 22px #0007, 0 0 0 3px #8fb38922; }
.karte.aktiv { border-color: var(--ui-akzent); background: linear-gradient(170deg, #2e3a2c, #242b23); }
.karte .ico { font-size: 30px; display: block; margin-bottom: 8px; line-height: 1; }
.karte .ico img { height: 44px; }
.karte .name { font-size: 13.5px; font-weight: 600; color: var(--ui-text); }
.karte .info { font-size: 11.5px; color: var(--ui-text2); margin-top: 4px; line-height: 1.35; }

/* ---- Chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 30px; align-items: center; }
.chips-leer { font-size: 12.5px; color: var(--ui-text3); font-style: italic; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--ui-bg3); border: 1px solid var(--ui-rand2); font-family: var(--ui-mono); font-size: 12.5px;
}
.chip.fremd { border-color: #6b4a1e; background: #2e2416; color: #e8c07a; }
.chip-x { border: 0; background: transparent; color: var(--ui-text3); cursor: pointer; font-size: 10px;
          width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }
.chip-x:hover { background: #4a2a28; color: #f3a79e; }

/* ---- Posten (Fetch) ---- */
.posten-liste { display: flex; flex-direction: column; gap: 10px; }
.posten { background: var(--ui-bg2); border: 1px solid var(--ui-rand); border-radius: 10px; padding: 12px 14px 14px; }
.posten-kopf { display: flex; justify-content: space-between; align-items: center; }
.posten-nr { font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--ui-akzent2); }
.posten .feld input, .posten .feld select { background: #121216; }
.posten-liste + .knopf { margin-top: 10px; }

/* ---- Klappe (Erweitert) ---- */
.klappe { margin-top: 12px; border: 1px dashed var(--ui-rand2); border-radius: 9px; }
.klappe summary { cursor: pointer; padding: 8px 12px; font-size: 12.5px; color: var(--ui-text2); list-style: none; }
.klappe summary::-webkit-details-marker { display: none; }
.klappe summary::before { content: '▸'; display: inline-block; width: 14px; transition: transform .12s; }
.klappe[open] summary::before { transform: rotate(90deg); }
.klappe summary:hover { color: var(--ui-text); }
.klappe-inhalt { padding: 0 12px 12px; }

/* ---- Suche / Item-Auswahl ---- */
.suche-kopf { display: flex; gap: 8px; margin-top: 12px; }
.suche { flex: 1; }
.suche-kopf select { width: 200px; font: 13px var(--ui-font); color: var(--ui-text); background: #121216;
  border: 1px solid var(--ui-rand2); border-radius: 8px; padding: 0 10px; }
.suche-zaehler { font-size: 11.5px; color: var(--ui-text3); margin: 8px 0 4px; }
.suche-liste {
  height: 300px; overflow: auto; border: 1px solid var(--ui-rand); border-radius: 9px; background: #141418;
}
.suche-zeile {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer;
  border-bottom: 1px solid #1f1f25; font-size: 13px;
}
.suche-zeile:hover { background: var(--ui-bg2); }
.suche-zeile input { accent-color: var(--ui-akzent); margin: 0; flex: none; }
.suche-zeile .mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suche-meta { display: flex; gap: 5px; flex: none; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: var(--ui-bg3); color: var(--ui-text2); }
.tag.ok { background: #263b26; color: #a9cba3; }
.tag.nein { background: #3a2a22; color: #d9a07a; }
.preis { font-size: 11px; color: var(--ui-text3); font-family: var(--ui-mono); }
.suche-nichts { padding: 24px; text-align: center; color: var(--ui-text3); font-size: 12.5px; }
.suche-frei { display: flex; gap: 8px; margin-top: 10px; }
.suche-frei input { flex: 1; }

/* ---- kleine Bildschirme ---- */
@media (max-width: 720px) {
  .reihe { grid-template-columns: 1fr !important; }
  .dlg { width: 100%; }
  .suche-kopf { flex-direction: column; }
  .suche-kopf select { width: 100%; height: 36px; }
}
