/* =====================================================================
   lab - werkzeuge/labanimation2d/app.css
   labAnimation2D: 2D-Animator Bild fuer Bild.
   Farben nur ueber Variablen aus css/colors.css (AGENTS.md §5).
   Ansicht-Farben, die app.js auf die Leinwand malt (Zwiebel-Haut,
   Raster, Griffe, Einrast-Hilfslinien), stehen als dokumentierte
   Variablen auf der Buehne - app.js liest sie mit getComputedStyle.
   ===================================================================== */

/* ---------- Ansicht-Farben der App (liest app.js) ---------- */
.lab_an2_ganz {
  --lab_an2_blatt_weiss: #FFFFFF;        /* Vorgabe-Hintergrund neuer Projekte (Papier bleibt hell, wie OCR-Papier) */
  --lab_an2_onion_vor: #D84315;          /* fruehere Bilder (rot) */
  --lab_an2_onion_nach: #1E88E5;         /* spaetere Bilder (blau) */
  --lab_an2_raster: #D5DBD8;             /* Rasterlinien */
  --lab_an2_mitte: #9DB8D6;              /* gestrichelte Mittel-Linien */
  --lab_an2_griff: #2E7D32;              /* Auswahl-Rahmen und Griffe (Akzent) */
  --lab_an2_griff_fuell: #FFFFFF;
  --lab_an2_griff_seite: #CDE5CF;
  --lab_an2_einrast: #C62828;            /* Einrast-Hilfslinien beim Verschieben */
  --lab_an2_ameisen_hell: #FFFFFF;       /* marschierende Ameisen: heller Strich */
  --lab_an2_ameisen_dunkel: #1A1C1A;     /* ... über dunkler Basislinie (beide Modi) */
  --lab_an2_schach_a: #E8EBE9;           /* Schachbrett hinter durchsichtigen Stellen */
  --lab_an2_schach_b: #F6F8F7;
  --lab_an2_stiftfarbe: #D32F2F;         /* Vorgabe-Zeichenfarbe (Nutzerinhalt, wie im Bild-Editor) */
}

/* ---------- Vollhoehe: die App fuellt das Fenster (AGENTS.md §5.7) ---------- */
.lab_an2_haupt {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  padding-top: 0.4rem;
  padding-bottom: 0.6rem;
}

.lab_an2_ganz {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
}

.lab_an2_flex { flex: 1 1 auto; }

.lab_an2_trenner {
  width: 1px;
  align-self: stretch;
  margin: 0.15rem 0.25rem;
  background: var(--lab-border-color);
}

/* ---------- Menüleiste (Muster: LabImageEdit) ---------- */
.lab_an2_menueleiste {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-wrap: wrap;
  margin: 0 0 0.35rem;
  padding: 0.25rem 0.45rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 10px;
  box-shadow: var(--lab-shadow-1);
}

.lab_an2_menu { position: relative; }

/* lab-Marke: Kolben + Schriftzug, Verweis zurück zur Werkzeug-Übersicht
   (der Plattform-Kopf ist auf dieser Seite ausgeblendet) */
.lab_an2_marke {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem 0.22rem 0.35rem;
  margin-right: 0.35rem;
  border-right: 1px solid var(--lab-border-color);
  border-radius: 7px 0 0 7px;
  color: var(--blk-color);
  text-decoration: none;
}

.lab_an2_marke img { display: block; }

.lab_an2_marke_text {
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.lab_an2_marke_zusatz {
  font-family: var(--lab-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey600-color);
  margin-left: 0.1rem;
}

.lab_an2_marke:hover { background: var(--alt-div-hover-color); }

.lab_an2_menu_titel {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--blk-color);
  cursor: pointer;
  white-space: nowrap;
}

.lab_an2_menu_titel:hover,
.lab_an2_menu_titel.lab_an2_menu_offen {
  background: var(--alt-div-hover-color);
}

.lab_an2_menu_liste {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  z-index: 40;
  min-width: 16rem;
  display: flex;
  flex-direction: column;
  padding: 0.3rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 10px;
  box-shadow: var(--lab-shadow-2);
}

.lab_an2_menu_eintrag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--blk-color);
  cursor: pointer;
  white-space: nowrap;
}

.lab_an2_menu_eintrag:hover:not(:disabled) { background: var(--alt-div-hover-color); }
.lab_an2_menu_eintrag:disabled { opacity: 0.45; cursor: default; }

a.lab_an2_menu_eintrag { text-decoration: none; }
.lab_an2_menu_gruppe { display: contents; }

.lab_an2_menu_kuerzel {
  font-family: var(--lab-mono);
  font-size: 0.74rem;
  color: var(--grey600-color);
}

.lab_an2_menu_trenner {
  height: 1px;
  margin: 0.25rem 0.4rem;
  background: var(--lab-border-color);
}

/* ---------- Arbeit: Werkzeuge | Buehne | Panel ---------- */
.lab_an2_arbeit {
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  padding: 0.4rem;
  min-height: 0;
  flex: 1 1 auto;
  background: var(--ct-color);
  border: var(--lab-border);
  border-bottom: 0;
}

/* Werkzeugspalte rechts andockbar (Ansicht-Menü) */
.lab_an2_arbeit.lab_an2_leiste_rechts { flex-direction: row-reverse; }

/* Werkzeugspalte */
.lab_an2_werkzeuge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.25rem;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 10px;
  overflow-y: auto;
}

.lab_an2_wk {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--blk-color);
  cursor: pointer;
}

.lab_an2_wk:hover { background: var(--alt-div-hover-color); }

.lab_an2_wk[aria-pressed="true"] {
  background: var(--bt-color);
  color: var(--bt-f-color);
  border-color: var(--bt-color);
}

.lab_an2_wk_trenner {
  width: 1.6rem;
  height: 1px;
  margin: 0.2rem 0;
  background: var(--lab-border-color);
}

/* Buehne mit Blatt */
.lab_an2_buehne {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  overflow: auto;
  background: var(--bd-color);
  border: var(--lab-border);
  border-radius: 10px;
}

/* [hidden] muss gegen display:grid gewinnen (Nachfrage-/Hilfe-Dialoge) */
.lab_an2_dialog[hidden] { display: none; }

.lab_an2_blatt_huelle {
  margin: auto;
  padding: 1rem;
  width: fit-content;
  min-width: 100%;
  box-sizing: border-box;
}

.lab_an2_blatt_huelle canvas {
  display: block;
  touch-action: none;   /* Zeichnen am Touch: die Seite darf nicht mitscrollen */
  background-color: var(--lab_an2_schach_b);
  background-image:
    linear-gradient(45deg, var(--lab_an2_schach_a) 25%, transparent 25%,
                    transparent 75%, var(--lab_an2_schach_a) 75%),
    linear-gradient(45deg, var(--lab_an2_schach_a) 25%, transparent 25%,
                    transparent 75%, var(--lab_an2_schach_a) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  box-shadow: var(--lab-shadow-2);
}

/* Deckendes Blatt (Hintergrund Weiß/Schwarz): kein Schachbrett noetig */
.lab_an2_blatt_huelle.is_deckend canvas { background-image: none; }

/* Panel rechts */
.lab_an2_panel {
  width: 15.5rem;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
  overflow-y: auto;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 10px;
  padding: 0.4rem;
}

.lab_an2_panel_kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem;
}

.lab_an2_panel_titel {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey600-color);
}

.lab_an2_bildnummer { font-size: 0.78rem; color: var(--grey600-color); }

.lab_an2_panel_aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.lab_an2_ebenenliste {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 4rem;
}

.lab_an2_ebene {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.3rem;
  border: var(--lab-border);
  border-radius: 8px;
  background: var(--ct-color);
  cursor: pointer;
}

.lab_an2_ebene_is_aktiv {
  border-color: var(--bt-color);
  box-shadow: inset 0 0 0 1px var(--bt-color);
}

/* Mehrfachauswahl (Strg-/Umschalt-Klick) und Gruppen-Mitglieder */
.lab_an2_ebene_is_markiert { border-style: dashed; }

.lab_an2_ebene_is_gruppe {
  box-shadow: inset 2px 0 0 var(--bt-color);
  padding-left: 0.45rem;
}

.lab_an2_ebene_is_gruppe.lab_an2_ebene_is_aktiv {
  box-shadow: inset 0 0 0 1px var(--bt-color), inset 2px 0 0 var(--bt-color);
}

/* Vorschau-Kachel: der Inhalt der Ebene auf der Blattfläche */
.lab_an2_ebene_bild {
  width: 28px;
  height: 21px;
  flex: 0 0 auto;
  border: var(--lab-border);
  border-radius: 4px;
  background-color: var(--lab_an2_schach_b);
  background-image:
    linear-gradient(45deg, var(--lab_an2_schach_a) 25%, transparent 25%,
                    transparent 75%, var(--lab_an2_schach_a) 75%),
    linear-gradient(45deg, var(--lab_an2_schach_a) 25%, transparent 25%,
                    transparent 75%, var(--lab_an2_schach_a) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.lab_an2_ebene_is_lasso_zieht { outline: 2px dashed var(--bt-color); outline-offset: -2px; }

.lab_an2_ebene_klein {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blk-color);
  cursor: pointer;
}

.lab_an2_ebene_klein:hover { background: var(--alt-div-hover-color); }

.lab_an2_ebene_name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.lab_an2_ebene_deck {
  width: 2.8rem;
  flex: 0 0 auto;
  accent-color: var(--bt-color);
}

.lab_an2_ebene_hoch_unten {
  display: flex;
  flex-direction: column;
}

/* Eigenschaften */
.lab_an2_eigenschaften {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: var(--lab-border);
  padding-top: 0.4rem;
}

.lab_an2_gruppe_titel {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey600-color);
  margin: 0.15rem 0 0;
}

.lab_an2_felder_reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.lab_an2_felder_reihe label { font-size: 0.8rem; color: var(--grey600-color); }

.lab_an2_felder_reihe input[type="number"] {
  width: 4.2rem;
  min-width: 0;
  padding: 0.22rem 0.35rem;
}

/* Mischmodus-Auswahl im Ebenen-Panel ( volle Panelbreite ) */
.lab_an2_misch_select {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  padding: 0.2rem 0.3rem;
}

.lab_an2_vorlage_reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.lab_an2_vorlage_reihe input[type="range"] {
  width: 100%;
  accent-color: var(--bt-color);
}

/* ---------- Werkzeug-Optionen ---------- */
.lab_an2_optionen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-bottom: 0;
  font-size: 0.85rem;
}

.lab_an2_optionen label { color: var(--grey600-color); }

.lab_an2_optionen input[type="range"] { accent-color: var(--bt-color); width: 9rem; }

.lab_an2_druck_label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.lab_an2_druck_label input { accent-color: var(--bt-color); }

.lab_an2_optionen_trenner {
  width: 1px;
  align-self: stretch;
  margin: 0.1rem 0.2rem;
  background: var(--lab-border-color);
}

/* Name des aktiven Werkzeugs am Anfang der Options-Zeile */
.lab_an2_optionen_name {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bt-color);
  min-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab_an2_optionen select {
  max-width: 11rem;
  font-size: 0.82rem;
  padding: 0.18rem 0.3rem;
}

/* Hinweistext in der Options-Zeile (Kopierstempel) */
.lab_an2_opt_hinweis {
  font-size: 0.78rem;
  color: var(--grey600-color);
}

.lab_an2_kacheln_reihe {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.lab_an2_formen_kacheln {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* Gruppe in der Optionen-Zeile (Härte, Abwedeln-Modus, Weich-Modus) */
.lab_an2_opt_zeile {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.lab_an2_opt_zeile label { color: var(--grey600-color); }

.lab_an2_opt_zeile output { font-size: 0.78rem; color: var(--grey600-color); }

.lab_an2_opt_zeile input[type="range"] { width: 6rem; }

/* Modus-Knöpfe mit Text (Abwedeln/Nachbelichten, Weich/Schärfen) */
.lab_an2_kachel_text {
  width: auto;
  height: 1.9rem;
  padding: 0 0.5rem;
  font-size: 0.78rem;
}

/* Radios im Übergang-Dialog: untereinander, Text neben der Wahl */
.lab_an2_radio_reihe {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.lab_an2_radio_reihe label {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.lab_an2_radio_reihe input { margin-top: 0.15rem; accent-color: var(--bt-color); }

.lab_an2_kachel {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--lab-border-color);
  border-radius: 6px;
  background: var(--div-color);
  color: var(--blk-color);
  cursor: pointer;
}

.lab_an2_kachel[aria-pressed="true"] {
  background: var(--bt-color);
  color: var(--bt-f-color);
  border-color: var(--bt-color);
}

.lab_an2_kachel_rand {
  display: inline-flex;
  align-items: center;
  width: auto;
  gap: 0.25rem;
  padding: 0 0.45rem;
  font-size: 0.8rem;
}

.lab_an2_kachel_rand input { accent-color: var(--bt-color); }

/* ---------- Zeitachse ---------- */
.lab_an2_zeit {
  display: flex;
  flex-direction: column;
  background: var(--ct-color);
  border: var(--lab-border);
  border-bottom: 0;
}

.lab_an2_zeit_leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-bottom: var(--lab-border);
}

.lab_an2_zeit_leiste label { font-size: 0.8rem; color: var(--grey600-color); }

.lab_an2_zeit_leiste input[type="number"] { width: 3.6rem; padding: 0.22rem 0.3rem; }

.lab_an2_zeit_leiste input[type="range"] { width: 6.5rem; accent-color: var(--bt-color); }

.lab_an2_zeit_fuellung_huelle {
  flex: 1 1 6rem;
  height: 0.45rem;
  min-width: 4rem;
  border-radius: 999px;
  background: var(--div-color);
  border: var(--lab-border);
  overflow: hidden;
}

.lab_an2_zeit_fuellung {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bt-color);
}

.lab_an2_zeit_laufzeit { font-size: 0.8rem; color: var(--grey600-color); }

/* Schleifen-Knopf im Zeit-Balken: steht nur da, wenn eine Schleife gesetzt ist */
.lab_an2_schleife_knopf {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--bt-color);
  background: color-mix(in srgb, var(--bt-color) 12%, transparent);
  color: var(--bt-color);
  cursor: pointer;
  white-space: nowrap;
}

.lab_an2_schleife_knopf:hover { background: color-mix(in srgb, var(--bt-color) 22%, transparent); }

.lab_an2_schleife_knopf[hidden] { display: none; }

/* Bild-Vorschauen */
.lab_an2_thumbs {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 6.4rem;
  align-items: stretch;
}

.lab_an2_thumb {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.25rem;
  border: 2px solid var(--lab-border-color);
  border-radius: 8px;
  background: var(--div-color);
  cursor: pointer;
}

.lab_an2_thumb_is_aktiv {
  border-color: var(--bt-color);
  box-shadow: 0 0 0 1px var(--bt-color);
}

/* Mehrfachauswahl auf der Zeitachse (Strg-/Umschalt-Klick) */
.lab_an2_thumb_is_markiert {
  border-color: var(--bt-color);
  border-style: dashed;
}

.lab_an2_thumb_is_markiert.lab_an2_thumb_is_aktiv {
  border-style: solid;
}

/* Schleifen-Bereich: die Bilder, die beim Abspielen laufen (Bild-Menü) */
.lab_an2_thumb_in_schleife {
  background: color-mix(in srgb, var(--bt-color) 10%, var(--div-color));
  box-shadow: inset 0 0 0 1px var(--bt-color);
}

.lab_an2_thumb_in_schleife .lab_an2_thumb_nummer {
  color: var(--bt-color);
}

.lab_an2_thumb_is_zieht { outline: 2px dashed var(--bt-color); outline-offset: 1px; }

.lab_an2_thumb canvas {
  display: block;
  width: 84px;
  height: 63px;
  background-color: var(--lab_an2_schach_b);
  border-radius: 4px;
}

.lab_an2_thumb_dauer {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.72rem;
  padding: 0.08rem 0.2rem;
  border: var(--lab-border);
  border-radius: 4px;
  background: var(--ct-color);
  color: var(--blk-color);
}

.lab_an2_thumb_nummer {
  font-size: 0.7rem;
  color: var(--grey600-color);
  font-family: var(--lab-mono);
}

/* ---------- Statuszeile ---------- */
.lab_an2_status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 0 0 10px 10px;
  font-size: 0.82rem;
  color: var(--grey600-color);
  min-height: 2.2rem;
}

.lab_an2_status_hinweis {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab_an2_status_hinweis.is_warn { color: var(--red600-color); }

.lab_an2_zeiger { white-space: nowrap; }

.lab_an2_zoom { white-space: nowrap; min-width: 3.6rem; text-align: center; }

.lab_an2_zoom_weg {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--lab-border-color);
  border-radius: 6px;
  background: var(--div-color);
  color: var(--blk-color);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.lab_an2_zoom_weg:hover { background: var(--alt-div-hover-color); }

/* ---------- Dialoge (keine Browser-Dialoge, AGENTS.md §2) ---------- */
.lab_an2_dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--blk-color) 40%, transparent);
  padding: 1rem;
}

.lab_an2_dialog_kasten {
  width: min(30rem, 100%);
  max-height: min(46rem, 100%);
  overflow-y: auto;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 12px;
  box-shadow: var(--lab-shadow-2);
}

.lab_an2_dialog_kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-bottom: var(--lab-border);
}

.lab_an2_dialog_kopf h2 {
  font-size: 1rem;
  margin: 0;
}

.lab_an2_dialog_koerper {
  padding: 0.7rem 0.8rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.lab_an2_dialog_fuss {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  padding-top: 0.3rem;
}

.lab_an2_neu_warnung { margin: 0; font-size: 0.88rem; }

.lab_an2_neu_warnung.is_leer { color: var(--grey600-color); }

.lab_an2_neu_reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.lab_an2_neu_reihe label { color: var(--grey600-color); font-size: 0.85rem; }

.lab_an2_neu_reihe input[type="number"] { width: 5rem; }

.lab_an2_laden_warnungen {
  margin: 0;
  font-size: 0.85rem;
  color: var(--grey600-color);
  white-space: pre-line;
}

.lab_an2_hilfe_tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.lab_an2_hilfe_tabelle th,
.lab_an2_hilfe_tabelle td {
  text-align: left;
  vertical-align: top;
  padding: 0.28rem 0.4rem;
  border-bottom: var(--lab-border);
}

.lab_an2_hilfe_tabelle th {
  font-family: var(--lab-mono);
  font-size: 0.76rem;
  white-space: nowrap;
  color: var(--bt-color);
  font-weight: 600;
}

.lab_an2_hilfe_tabelle tr:last-child th,
.lab_an2_hilfe_tabelle tr:last-child td { border-bottom: 0; }

/* ---------- Kontextmenü (Ebenen und Zeitachse) ---------- */
.lab_an2_kontext {
  position: fixed;
  z-index: 55;
  min-width: 13rem;
  max-width: min(20rem, calc(100vw - 1rem));
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 10px;
  box-shadow: var(--lab-shadow-2);
}

.lab_an2_kontext[hidden] { display: none; }

.lab_an2_kontext_eintrag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.32rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blk-color);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.lab_an2_kontext_eintrag:hover:not(:disabled),
.lab_an2_kontext_eintrag:focus-visible {
  background: var(--alt-div-hover-color);
  outline: none;
}

.lab_an2_kontext_eintrag:disabled {
  color: var(--grey600-color);
  opacity: 0.6;
  cursor: default;
}

.lab_an2_kontext_kuerzel {
  font-family: var(--lab-mono);
  font-size: 0.7rem;
  color: var(--grey600-color);
  white-space: nowrap;
}

.lab_an2_kontext_trenner {
  height: 1px;
  margin: 0.2rem 0.4rem;
  background: var(--lab-border-color);
}

/* ---------- Schwebender Text-Editor (Text-Werkzeug) ---------- */
.lab_an2_texteditor {
  position: fixed;
  z-index: 56;          /* über dem Kontextmenü, unter dem Toast */
  width: min(22rem, calc(100vw - 1rem));
  padding: 0.3rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 10px;
  box-shadow: var(--lab-shadow-2);
}

.lab_an2_texteditor[hidden] { display: none; }

.lab_an2_texteditor textarea {
  width: 100%;
  resize: vertical;
  min-height: 3.2rem;
  padding: 0.4rem 0.5rem;
  background: var(--div-color);
  color: var(--blk-color);
  border: var(--lab-border);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.3;
}

.lab_an2_texteditor_tipp {
  margin: 0.3rem 0.15rem 0.05rem;
  font-size: 0.72rem;
  color: var(--grey600-color);
}

/* ---------- Toast ---------- */
.lab_an2_toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: var(--blk-color);
  color: var(--ct-color);
  font-size: 0.88rem;
  box-shadow: var(--lab-shadow-2);
  opacity: 0;
  transform: translateY(0.4rem);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.lab_an2_toast_is_zeigen { opacity: 1; transform: translateY(0); }

/* ---------- Handy: Spalten stapeln (Fallstrick: Buehne nicht quetschen) ---------- */
@media (max-width: 900px) {
  .lab_an2_arbeit {
    flex-direction: column;
  }

  /* Seite scrollt senkrecht, die Buehne bekommt eine feste Mindesthoehe
     - flex 1 1 auto wuerde sie sonst auf Briefmarkengroesse quetschen. */
  .lab_an2_ganz { height: auto; }

  .lab_an2_haupt { padding-bottom: 0.6rem; }

  .lab_an2_werkzeuge {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .lab_an2_wk_trenner {
    width: 1px;
    height: 1.6rem;
    margin: 0 0.2rem;
    align-self: center;
  }

  .lab_an2_buehne {
    flex: 0 0 auto;
    min-height: 44vh;
  }

  .lab_an2_blatt_huelle canvas {
    /* Inline-Mass aus zoomAnwenden ueberschreiben: am Handy passt sich
       das Blatt der Breite an, die Hoehe folgt im Seitenverhaeltnis. */
    max-width: 100% !important;
    height: auto !important;
  }

  .lab_an2_panel {
    width: 100%;
    overflow-y: visible;
  }

  .lab_an2_thumb canvas { width: 72px; height: 54px; }

  .lab_an2_status { flex-wrap: wrap; }
}

/* Groessere Touch-Ziele bei Zeigereingabe (Muster aus LabVectorDraw) */
@media (pointer: coarse) {
  .lab_an2_wk { width: 2.9rem; height: 2.9rem; }
  .lab_an2_ebene_klein { width: 2.2rem; height: 2.2rem; }
  .lab_an2_kachel { width: 2.3rem; height: 2.3rem; }
}
