/* ===== Stift-Editor (lm-editor/src/ink/ink-editor.js) ===== */
body.ink-open { overflow: hidden; }
.ink-overlay {
  /* Unter der Tab-Leiste der Arbeitsfläche (Gastgeber setzt --lm-ws-top), sonst ganz oben. */
  position: fixed; inset: 0; top: var(--lm-ws-top, 0px); z-index: 2000;
  display: flex; flex-direction: column;
  background: #e2e8f0;
  /* Kein Zoomen der ganzen Seite – sonst rutscht die Leiste aus dem Bild (iPad). */
  touch-action: pan-x pan-y;
  /* Ziehen und langes Drücken markieren keinen Text und öffnen kein Menü (iPad). */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.ink-overlay .ink-text { -webkit-user-select: text; user-select: text; }
/* „hidden“ gilt im Editor immer – auch gegen display: inline-flex der Knöpfe und Gruppen. */
.ink-overlay [hidden] { display: none !important; }
.ink-toolbar {
  display: flex; align-items: center; gap: 4px 10px;
  padding: 6px 10px;
  /* Passt immer auf die Breite: Was nicht passt, steht im ⋯-Menü (fitToolbar) – nie seitlich scrollen. */
  flex-wrap: nowrap; overflow: hidden;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.ink-toolbar::-webkit-scrollbar { display: none; }
/* 💡 Lösung: immer rechts sichtbar, auch wenn die Leiste scrollt. */
.ink-solution-group { margin-left: auto; position: sticky; right: 0; z-index: 2; background: inherit; padding-left: 6px; }
.ink-solution .sol-switch { font-size: 0.8rem; }
.ink-solution .sol-switch button { padding: 4px 8px; }
.ink-title { font-weight: 600; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ink-group { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.ink-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0; /* Fingergröße */
  border: none; border-radius: 10px;
  background: transparent; color: var(--text-primary);
  font-size: 1rem; cursor: pointer; touch-action: manipulation;
}
.ink-btn:hover { background: var(--bg-primary); }
.ink-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.ink-btn.active { background: var(--accent-light); color: var(--accent); }
/* Speichern: Punkt = noch nicht gespeichert, grün = eben gespeichert. */
.ink-save { position: relative; }
.ink-save.ink-dirty::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #ea580c; }
.ink-save.ink-saved { color: #16a34a; background: #dcfce7; }
.ink-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Textmarker gelb gefüllt: So unterscheidet er sich auf einen Blick vom Radierer. */
[data-tool="marker"] .ink-icon { fill: #fde047; }
/* Leuchtstift: roter Punkt in der Mitte, die Strahlen zeichnet das Symbol. */
[data-tool="laser"] .ink-icon { background: radial-gradient(circle, #dc2626 0 4px, transparent 4.5px); }
.ink-sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; flex: 0 0 auto; }
.ink-bg-select { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-primary); padding: 0 6px; margin: 0 2px; }
.ink-status { margin-left: auto; flex: none; width: 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); white-space: nowrap; overflow: hidden; } /* feste Breite: die Leiste rutscht nicht */
/* Unter der Leiste, schwebend: Einstellungen des gewählten Werkzeugs. */
.ink-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ink-subbar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 4px;
  /* Eine Zeile, nie scrollen: Überzähliges steht unter ⋯ (fitSubbar). */
  max-width: calc(100% - 20px); flex-wrap: nowrap; overflow: hidden;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}
.ink-subbar::-webkit-scrollbar { display: none; }
.ink-width i { display: block; width: 26px; height: var(--h); border-radius: 3px; background: currentColor; }
.ink-tsize { font: inherit; font-size: 0.85rem; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--border, #ccc); background: var(--bg-secondary, #fff); color: inherit; }
.ink-color { min-width: 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--c); margin: 0 3px; }
.ink-color:hover { background: var(--c); filter: brightness(0.92); }
.ink-btn.ink-color.active { background: var(--c); box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent); }
.ink-shape-kind, .ink-dash { font-size: 1.05rem; min-width: 30px; }
/* Gezeichnete Symbole der Einstellungsleiste: so groß, wie der Knopf erlaubt, kräftiger Strich, volle Textfarbe. */
.ink-sub-icon { width: 26px; height: 26px; stroke-width: 2.3; }
.ink-sub-dot { stroke-width: 3.4; }
.ink-sub-karo, .ink-sub-linien { stroke-width: 1.9; }
.ink-shape-kind.active, .ink-dash.active, .ink-pattern.active, .ink-width.active { box-shadow: inset 0 0 0 2px var(--accent); }
.ink-fill { min-width: 24px; width: 24px; height: 24px; border-radius: 5px; background: var(--c); border: 1px solid #94a3b8; margin: 0 2px; }
.ink-fill:hover { background: var(--c); filter: brightness(0.95); }
.ink-btn.ink-fill.active { background: var(--c); box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent); }
.ink-fill-none { background: linear-gradient(to top right, #fff calc(50% - 1px), #dc2626 50%, #fff calc(50% + 1px)); }
.ink-fill-none:hover, .ink-btn.ink-fill-none.active { background: linear-gradient(to top right, #fff calc(50% - 1px), #dc2626 50%, #fff calc(50% + 1px)); }
.ink-opacity { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 0.82rem; white-space: nowrap; }
.ink-opacity input[type="range"] { width: 90px; }
.ink-op-num { width: 4.2em; font: inherit; padding: 1px 3px; }
.ink-opacity.ink-muted { opacity: 0.5; }
.ink-labeled { gap: 6px; padding: 0 12px; color: #dc2626; font-weight: 600; }
/* Erklärungen stehen im Tooltip der Werkzeuge und in der Hilfe – nicht in der Leiste. */
.ink-subhint { display: none !important; }
.ink-close { color: var(--text-secondary); }
.ink-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
/* Mit der Maus: Scrollleiste immer sichtbar (auch wo das System sie sonst ausblendet, z. B. macOS). */
@media (any-pointer: fine) {
  .ink-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
  .ink-scroll::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.55); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
}
.ink-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 64px 12px 12px; min-width: min-content; }
.ink-page { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
.ink-bg, .ink-svg, .ink-texts, .ink-top { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Anfasser über allem (auch über dem Geodreieck); getroffen wird rechnerisch. */
.ink-top { z-index: 4; pointer-events: none; overflow: visible; }
/* Der Finger scrollt, außer er greift eine Auswahl (holdStylus, bindInput). Mit „Finger schreibt“ arbeitet er, zwei Finger scrollen. */
.ink-page { touch-action: pan-x pan-y; }
.ink-finger-writes.ink-tool-lock .ink-page { touch-action: none; }
/* Stift-Gerät: Der Editor scrollt mit dem Finger selbst (ohne Schwung) – ein Handballen schiebt das Blatt nicht weg. */
.ink-pen-device .ink-page { touch-action: none; }
.ink-btn.ink-finger-on { position: relative; }
.ink-btn.ink-finger-on::after { content: '☝️'; position: absolute; right: -2px; bottom: -3px; font-size: 11px; line-height: 1; }
.ink-finger-hint { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: #1e293b; color: #fff; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.ink-finger-hint[hidden] { display: none; }
.ink-finger-hint button { border: none; border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; touch-action: manipulation; }
.ink-finger-hint-on { background: #3b82f6; color: #fff; font-weight: 600; }
.ink-finger-hint-close { background: transparent; color: #fff; }
/* Scrollleiste für den Finger – die des Browsers lässt sich auf dem iPad nicht greifen. */
.ink-touchbar { display: none; position: absolute; right: 0; bottom: 0; width: 32px; z-index: 15; touch-action: none; cursor: pointer; }
.ink-touchbar-thumb { position: absolute; top: 0; right: 3px; width: 12px; border-radius: 6px; background: rgba(71, 85, 105, 0.65); }
@media (any-pointer: coarse) { .ink-touchbar { display: block; } }
.ink-touchbar[hidden] { display: none; }
/* 📌 Seite festgestellt: nichts scrollt, weder Stift noch Finger. */
.ink-svg { overflow: visible; }
.ink-marker { mix-blend-mode: multiply; opacity: 0.55; }
.ink-sel-rect { fill: rgba(59, 130, 246, 0.08); stroke: #3b82f6; stroke-width: 0.8; stroke-dasharray: 4 3; }
.ink-sel-box { fill: none; stroke: #3b82f6; stroke-width: 1; stroke-dasharray: 5 3; }
.ink-svg .ink-selected { filter: drop-shadow(0 0 1.5px #3b82f6); }
.ink-handle { fill: #fff; stroke: #3b82f6; stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: move; }
/* Formen (ink-shapes.js): Dreh-Anfasser, Eckpunkte, Vorschau beim Zeichnen */
.ink-rot-handle { fill: #3b82f6; cursor: grab; }
.ink-rot-line { stroke: #3b82f6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ink-vertex { fill: #fff; cursor: crosshair; }
.ink-shape-live { pointer-events: none; opacity: 0.85; }
.ink-shape-text-edit { position: absolute; z-index: 5; box-sizing: border-box; padding: 2px 4px; text-align: center; resize: none; overflow: hidden;
  font-family: 'LM Sans', 'Liberation Sans', Arial, sans-serif; line-height: 1.25; background: rgba(255, 255, 255, 0.85); border: 1.5px dashed #3b82f6; border-radius: 4px; outline: none; }
.ink-shape-text { pointer-events: none; user-select: none; }
/* Leuchtstift: rote Leuchtspur mit hellem Kern, verblasst von selbst (ink-editor.js laserTick) */
.ink-laser { pointer-events: none; }
.ink-laser-glow { fill: none; stroke: rgba(255, 30, 30, 0.7); stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: blur(3px); }
.ink-laser-core { fill: none; stroke: #ff2a2a; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 4px #ff0000); }
.ink-laser-dot { fill: #ef4444; filter: drop-shadow(0 0 6px #ef4444) drop-shadow(0 0 2px #fff); }
.ink-overlay.ink-tool-laser .ink-page { cursor: none; }
.ink-text {
  position: absolute; min-width: 2em; max-width: 70%;
  padding: 1px 3px; line-height: 1.3; white-space: pre-wrap; outline: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-radius: 3px;
}
.ink-overlay:not(.ink-tool-text) .ink-text { pointer-events: none; }
.ink-tool-text .ink-text { pointer-events: auto; outline: 1px dashed #94a3b8; background: rgba(255, 255, 255, 0.6); cursor: text; }
.ink-tool-text .ink-text:focus { outline: 1.5px solid var(--accent); }
.ink-text.ink-selected { outline: 1.5px dashed #3b82f6; }
/* Textfläche: 1 Punkt der Ebene = 1 pt, gesetzt wie im Dokument. */
.ink-rich { position: absolute; pointer-events: none; transform-origin: 50% 50%; }
.ink-rich-inner { font-family: 'LM Sans', 'Liberation Sans', Arial, sans-serif; font-size: 11pt; line-height: 1.15; color: #1e293b; text-align: left; }
.ink-rich > .ink-rich-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; transform: scale(calc(var(--z) * 0.75)); }
.ink-rich-inner .docspec { margin: 0; padding: 0; max-width: none; width: auto; line-height: 1.15; overflow-wrap: break-word; }
.ink-rich-inner .docspec > :first-child, .ink-rich-inner .docspec > .ds-b:first-child > :first-child { margin-top: 0; }
.ink-rich-inner .docspec > :last-child, .ink-rich-inner .docspec > .ds-b:last-child > :last-child { margin-bottom: 0; }
.ink-rich-edit { position: absolute; z-index: 5; width: 38px; height: 38px; margin: 14px 0 0 -52px; border: 1px solid #3b82f6; border-radius: 8px; background: #fff; font-size: 16px; line-height: 1; cursor: pointer; touch-action: manipulation; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.ink-sel-grabs { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ink-sel-grabs > div { position: absolute; pointer-events: auto; touch-action: none; }
.ink-text-editing .ink-sel-grabs, .ink-text-editing .ink-handles, .ink-text-editing .ink-sel-box, .ink-text-editing .ink-rich-edit { display: none; }
.ink-block-sel { outline: 2px solid #3b82f6; outline-offset: 2px; border-radius: 3px; }
.ink-block-drop { position: absolute; left: 3%; right: 3%; height: 3px; margin-top: -1px; border-radius: 2px; background: #3b82f6; z-index: 6; pointer-events: none; }
.ink-notice { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 24px); padding: 8px 12px; border-radius: 10px; background: #92400e; color: #fff; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.ink-notice[hidden] { display: none; }
/* Text bearbeiten direkt auf dem Blatt: Formatleiste fest unter der Werkzeugleiste, die Werkzeuge ruhen. */
.ink-rich-editor { position: absolute; top: 52px; left: 0; right: 0; z-index: 30; display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; background: var(--bg-secondary, #fff); color: var(--text-primary, #1e293b); border-bottom: 1px solid var(--border, #e2e8f0); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); -webkit-user-select: text; user-select: text; }
.ink-rich-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ink-rich-status { flex: 1; min-width: 40px; font-size: 0.85rem; color: var(--text-secondary, #64748b); }
.ink-rich-editor .ds-pm-toolbar { margin: 0; flex-wrap: wrap; }
.ink-text-editing .ink-toolbar { pointer-events: none; opacity: 0.35; }
.ink-text-editing .ink-subbar, .ink-text-editing .ink-insert-mark, .ink-text-editing .ink-karo-handle, .ink-text-editing .ink-touchbar { display: none !important; }
.ink-text-editing .ink-pages { padding-top: 150px; }
.ink-text-editing .ink-page { touch-action: pan-x pan-y !important; }
.ink-rich-inline-free { position: absolute; z-index: 5; }
/* Die Knöpfe an einem Baustein: groß genug für Stift und Finger. */
.ink-rich-inline .ds-wbar { top: -42px; left: auto; right: 8px; }
.ink-rich-inline .ds-wbar button { min-width: 38px; min-height: 38px; font-size: 18px; touch-action: manipulation; }
.ink-rich-inline { -webkit-user-select: text; user-select: text; }
.ink-rich-inline .ds-pm-box { margin: 0; }
.ink-rich-inline .ds-pm-surface .ProseMirror { min-height: 1.5em; padding: 0; overflow-wrap: break-word; word-break: normal; }
.ink-rich-inline .ds-pm-surface .ProseMirror > p { margin: 0 0 0.6em; }
.ink-rich-inline .ds-pm-surface { height: auto; min-height: 1.5em; overflow: visible; padding: 0; border: none; border-radius: 0; background: transparent; outline: 2px solid #3b82f6; outline-offset: 3px; font: inherit; color: inherit; line-height: inherit; }
.ink-rich-inline-free .ds-pm-surface { background: #fff; }
/* Tabellen füllen die Textfläche, außer sie haben eine eigene Breite – auch sonst wären die Zellen kaum zu treffen. */
.ink-rich-inner table:not([style*="width"]) { width: 100%; }
.ink-rich-md .import-modules-card { width: min(720px, 92vw); }
.ink-rich-markdown { width: 100%; height: 45vh; padding: 10px; font-family: ui-monospace, monospace; font-size: 14px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; resize: vertical; }
.ink-tool-text .ink-page { cursor: text; }
@media (max-width: 900px) {
  .ink-title { display: none; }
}
/* Geodreieck (js/ink/ink-ruler.js): nur das Dreieck nimmt Eingaben an –
   daneben scrollt der Finger weiter, und der Stift zeichnet. */
.ink-ruler {
  position: absolute; z-index: 3;
  transform-origin: 50% 100%;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  touch-action: none; cursor: move;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.ink-ruler svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ink-ruler .ir-body { fill: rgba(225, 240, 250, 0.55); stroke: #2b2a29; stroke-width: 0.4; }
.ink-ruler .ir-grid { stroke: rgba(43, 42, 41, 0.18); stroke-width: 0.15; }
.ink-ruler .ir-grid-cm { stroke: rgba(43, 42, 41, 0.32); }
.ink-ruler .ir-tick { stroke: #2b2a29; stroke-width: 0.17; }
.ink-ruler .ir-num { fill: #2b2a29; text-anchor: middle; font-family: Arial, sans-serif; }
.ink-ruler .ir-num-in { fill: #6b7280; }
.ink-ruler .ir-arc { fill: none; stroke: #ffed00; stroke-width: 4.5; opacity: 0.85; }
.ink-ruler .ir-center { fill: none; stroke: #2b2a29; stroke-width: 0.25; }
.ink-ruler .ir-handle circle { fill: #fff; stroke: var(--accent, #3b82f6); stroke-width: 0.8; }
.ink-ruler .ir-handle text { fill: var(--accent, #3b82f6); text-anchor: middle; font-family: Arial, sans-serif; }
.ink-ruler [data-handle="rotate"] { cursor: grab; }
.ink-ruler [data-handle="resize"] { cursor: nwse-resize; }
.ink-ruler .ir-angle { fill: #1e293b; text-anchor: middle; font-weight: 700; font-family: Arial, sans-serif; }
/* Hintergrund „Dokument“: das Blatt als HTML unter der Zeichenebene. Die
   Zeichenebene lässt Zeiger durch – der Editor fängt sie am Blatt ab, außer
   beim Bedienen (Quizze) und beim Finger, solange er nicht zeichnet. */
.ink-paper-host { position: absolute; left: 0; top: 0; }
.ink-paper-mode .ink-svg, .ink-paper-mode .ink-texts { pointer-events: none; }
.ink-overlay .ink-paper-host input, .ink-overlay .ink-paper-host textarea { -webkit-user-select: text; user-select: text; }
/* Schreibfeld: unten die Höhe (immer), mit „Auswählen“ rechts die Breite, an der Ecke beides, oben das Muster. */
.ink-karo-handle {
  position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center; touch-action: none;
}
.ink-karo-handle span { border-radius: 3px; background: #3b82f6; opacity: 0.75; box-shadow: 0 0 0 2px #fff; }
.ink-karo-h { left: 50%; bottom: -10px; transform: translateX(-50%); width: 56px; height: 20px; cursor: ns-resize; }
.ink-karo-h span { width: 36px; height: 6px; }
.ink-karo-w { right: -10px; top: 50%; transform: translateY(-50%); width: 20px; height: 56px; cursor: ew-resize; }
.ink-karo-w span { width: 6px; height: 36px; }
.ink-karo-c { right: -11px; bottom: -11px; width: 22px; height: 22px; cursor: nwse-resize; }
.ink-karo-c span { width: 12px; height: 12px; border-radius: 3px; }
.ink-karo-tools {
  position: absolute; right: 4px; top: 4px; z-index: 2; display: flex; gap: 2px; padding: 2px;
  border-radius: 8px; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}
.ink-karo-tools button {
  min-width: 28px; height: 26px; border: none; border-radius: 6px; background: transparent;
  color: #1e293b; font-size: 15px; cursor: pointer; touch-action: manipulation;
}
.ink-karo-tools button.active { background: #dbeafe; color: #2563eb; }
.ink-karo-w, .ink-karo-c, .ink-karo-tools { display: none; }
.ink-tool-select .ink-karo-w, .ink-tool-select .ink-karo-c, .ink-tool-select .ink-karo-tools { display: flex; }
.ink-action { color: var(--accent); white-space: nowrap; flex: 0 0 auto; font-size: 18px; }
.ink-action.ink-labeled { font-size: inherit; margin-right: 4px; }
/* Titel klein am rechten Rand neben 💡 – er nimmt keinen Platz in der Mitte der Leiste ein. */
.ink-title { flex: 0 1 auto; min-width: 6ch; max-width: 28ch; font-weight: 500; font-size: 0.85em; color: var(--text-secondary); }
.ink-title + .ink-solution-group { margin-left: 4px; }

/* ===== Drucken (printPaper): nur die Kopie des Blatts, Ränder über @page ===== */
.ink-print-sheet { display: none; }
.ink-print-sheet .ds-b { position: relative; }
.ink-print-sheet .lm-paper { position: relative; }
.ink-print-layer { position: absolute; top: 0; overflow: visible; pointer-events: none; }
.ink-print-free { left: 0; } /* Beschriftung ohne Baustein: Ursprung am Satzspiegel, links um den Rand verschoben (inkSvgFor) */
.ink-print-marker { mix-blend-mode: multiply; opacity: 0.55; }
@media print {
  body.ink-printing > *:not(.ink-print-sheet) { display: none !important; }
  body.ink-printing { background: #fff !important; margin: 0; overflow: visible !important; }
  body.ink-printing .ink-print-sheet { display: block; }
  /* Oben, unten und links setzt @page die Ränder (auf jeder Seite); rechts ist es
     Innenabstand – dort darf die Beschriftung bis zur Papierkante reichen. */
  .ink-print-sheet .lm-paper { width: auto; min-height: 0; padding: 0 2cm 0 0; box-shadow: none; }
  .ink-print-layer { overflow: hidden; }
  .ink-print-sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Nicht zerreißen: Felder, Bilder, Formeln, Tabellen, Code, Quizze; Überschrift bleibt beim Folgenden. */
  .ink-print-sheet [data-btype="karo"], .ink-print-sheet [data-btype="image"], .ink-print-sheet [data-btype="formula"],
  .ink-print-sheet [data-btype="table"], .ink-print-sheet [data-btype="code"], .ink-print-sheet [data-btype="quiz"],
  .ink-print-sheet [data-btype="spacer"] { break-inside: avoid; }
  .ink-print-sheet h2, .ink-print-sheet h3, .ink-print-sheet h4 { break-after: avoid; }
  .ink-print-sheet .ds-pagebreak-mark { break-after: page; border: 0; margin: 0; height: 0; overflow: hidden; }
  .ink-print-sheet .ds-autobreak { display: none; }
  /* Im Quiz nichts zum Klicken; die Fragen bleiben. */
  .ink-print-sheet .ds-quiz button.btn-sm, .ink-print-sheet .ds-quiz-size, .ink-print-sheet .ds-actions, .ink-print-sheet .ds-solutions-toggle { display: none !important; }
}

/* Seitenumbruch im Blatt: am Bildschirm eine gestrichelte Linie (wie in der Vorschau), im Druck nur der Umbruch. */
.lm-paper .ds-pagebreak-mark { border-top: 1px dashed #94a3b8; margin: 1.2em 0; text-align: center; line-height: 0; }
.lm-paper .ds-pagebreak-mark span { background: #fff; color: #64748b; font-size: 9pt; padding: 0 8px; }

/* Unsichtbares Schreibfeld: beim Beschriften gestrichelt angedeutet, im Druck nicht. */
.ink-paper-host .ds-karo-frei { outline: 1px dashed rgba(100, 116, 139, 0.35); outline-offset: -1px; }

/* ⊕ zum Einfügen zwischen den Bausteinen: groß genug für den Finger, sichtbar nur ein kleiner Punkt. */
.ink-paper-host .lm-paper { position: relative; }
/* Was breiter ist als das Blatt (Leiste einer HTML-App, vergrößertes Quiz), schiebt das Blatt nicht seitlich hin und her. */
.ink-paper-host .lm-paper { overflow-x: clip; }
/* Beschriftung der Lehrkraft unter der eigenen (Schüler, nur zum Ansehen) hängt an ihrem Baustein. */
.ink-paper-host .ds-b { position: relative; }
.ink-teacher-layer { pointer-events: none; }
.ink-insert-mark {
  position: absolute; left: 0.55cm; width: 30px; height: 30px; margin-top: -15px; padding: 0;
  display: flex; align-items: center; justify-content: center; z-index: 3;
  border: none; background: transparent; cursor: pointer; touch-action: manipulation;
}
.ink-insert-mark span {
  display: flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%;
  background: #e0ecff; color: #3b82f6; font: 700 12px/1 Arial, sans-serif; opacity: 0.55;
  box-shadow: 0 0 0 1px #bfd4f6;
}
.ink-insert-mark:hover span, .ink-insert-mark:focus-visible span { opacity: 1; background: #3b82f6; color: #fff; }
/* Griff zum Verschieben eines Bausteins: nur mit Pfeil und Bereich, groß genug für Finger und Stift. */
.ink-block-grip {
  position: absolute; left: 1.45cm; width: 30px; height: 34px; margin-top: -17px; display: none;
  align-items: center; justify-content: center; z-index: 3; border-radius: 6px;
  color: #3b82f6; font: 700 18px/1 Arial, sans-serif; opacity: 0.6; cursor: grab; touch-action: none; user-select: none;
}
.ink-tool-select .ink-block-grip { display: flex; }
.ink-block-grip[hidden], .ink-text-editing .ink-block-grip, .ink-tool-area .ink-block-grip { display: none !important; }
.ink-block-grip:hover, .ink-block-sel ~ .ink-block-grip:hover { opacity: 1; background: #e0ecff; }
@media print { .ink-insert-mark, .ink-block-grip { display: none; } }

/* Beschriftung in der gewöhnlichen Ansicht (ink-view.js): das Blatt wie im Editor, verkleinert auf die Breite. */
.ink-view { margin: 0 auto; max-width: max-content; }
.ink-view .lm-paper { position: relative; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18); }
.ink-view .ds-b { position: relative; }
.ink-view .ds-karo-frei { outline: 1px dashed rgba(100, 116, 139, 0.35); outline-offset: -1px; }

/* ⋯-Menü: ausgelagerte Knöpfe sind in der Leiste weg, im Menü da. */
.ink-toolbar .ink-ovf { display: none !important; }
.ink-bar-more { margin-left: auto; flex: 0 0 auto; }
.ink-solution-group + .ink-bar-more { margin-left: 0; }
.ink-title { flex: 0 1 auto; min-width: 0; }

/* Seitenleiste (▤): links neben dem Blatt, Seite antippen springt hin. */
.ink-pages-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: 260px; z-index: 25;
  display: flex; flex-direction: column;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  box-shadow: 4px 0 14px rgba(15, 23, 42, 0.08);
}
.ink-pages-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
.ink-pages-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.ink-page-entry {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; min-height: 52px;
  padding: 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-primary); color: var(--text-primary); text-align: left; cursor: pointer; touch-action: manipulation;
  font: inherit; font-size: 0.9rem;
}
.ink-page-entry.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.ink-page-no { flex: 0 0 auto; min-width: 1.8em; height: 1.8em; border-radius: 6px; background: var(--accent-light); color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.ink-page-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ink-page-titles span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ink-page-titles span:first-child { font-weight: 600; }
.ink-page-empty { color: var(--text-secondary); font-weight: 400 !important; }
/* Breiter Bildschirm: Das Blatt rückt zur Seite. Schmal (Hochformat): Die Leiste liegt darüber. */
@media (min-width: 900px) {
  .ink-pages-open .ink-scroll { margin-left: 260px; }
}

/* iPad und andere Touch-Geräte: größere Symbole, kleinere Lücken, Knöpfe in Fingergröße. */
@media (pointer: coarse) {
  .ink-toolbar { gap: 2px 4px; padding: 4px 6px; }
  .ink-toolbar .ink-group { gap: 0; }
  .ink-toolbar .ink-btn { min-width: 46px; height: 46px; border-radius: 12px; }
  .ink-toolbar .ink-icon { width: 28px; height: 28px; stroke-width: 1.6; }
  .ink-toolbar .ink-sep { margin: 0 3px; height: 28px; }
  .ink-toolbar .ink-bg-select { height: 40px; }
}

/* Einstellungsleiste: ausgelagerte Gruppen; das Feld unter ⋯ zeigt sie (umbrechend, nicht scrollend). */
.ink-subbar .ink-ovf { display: none !important; }
.ink-sub-more { flex: 0 0 auto; }
.ink-sub-pop {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 21;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
  max-width: calc(100% - 20px); padding: 8px 12px; border-radius: 16px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}
@media (pointer: coarse) {
  .ink-subbar { padding: 4px 8px; gap: 2px; }
  .ink-subbar .ink-btn:not(.ink-color):not(.ink-fill), .ink-sub-pop .ink-btn:not(.ink-color):not(.ink-fill) { min-width: 44px; height: 44px; }
  .ink-btn.ink-fill { min-width: 30px; width: 30px; height: 30px; }
  .ink-btn.ink-color { min-width: 34px; width: 34px; height: 34px; }
}
.ink-sub-pop .ink-group { flex-wrap: wrap; justify-content: center; row-gap: 6px; max-width: 100%; }

/* Vierter Farbknopf: gewählte Zusatzfarbe mit ▾ – ohne Zusatzfarbe ein Farbkreis. Darunter klappen die übrigen Farben aus. */
.ink-btn.ink-swatch-pick { position: relative; }
.ink-btn.ink-swatch-pick.ink-pick-empty { background: conic-gradient(#dc2626, #ea580c, #ca8a04, #16a34a, #0891b2, #2563eb, #9333ea, #db2777, #dc2626); }
.ink-btn.ink-swatch-pick.ink-pick-empty:hover { background: conic-gradient(#dc2626, #ea580c, #ca8a04, #16a34a, #0891b2, #2563eb, #9333ea, #db2777, #dc2626); filter: brightness(0.95); }
.ink-btn.ink-swatch-pick::after {
  content: '▾'; position: absolute; right: -5px; bottom: -5px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg-secondary); color: var(--text-primary); font-size: 10px; line-height: 15px; text-align: center;
  box-shadow: 0 0 0 1px var(--border);
}
.ink-swatches {
  position: absolute; z-index: 40; display: grid; grid-template-columns: repeat(4, auto); gap: 8px;
  padding: 10px; border-radius: 14px; background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}
.ink-swatches .ink-btn.ink-color { margin: 0; }
.ink-swatches .ink-btn.ink-color { box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.55); }
.ink-swatches .ink-btn.ink-color.active { box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.55), 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent); }

/* Seitenleiste des Gastgebers (Lernbegleitung): schmal, links neben dem Blatt. */
.ink-side {
  position: absolute; left: 0; top: 0; bottom: 0; width: 230px; z-index: 22; overflow-y: auto;
  padding: 10px; background: var(--bg-secondary); border-right: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.ink-side-open .ink-scroll { margin-left: 230px; }
@media (max-width: 700px) { .ink-side { width: 170px; } .ink-side-open .ink-scroll { margin-left: 170px; } }

/* Bereich (▭ mit Strichlinie): Leiste darüber – 📷 und, mit Auswahl, Ausschneiden, Kopieren, Löschen, ⋯. */
.ink-area-bar {
  position: absolute; z-index: 30; display: flex; align-items: center; gap: 2px; padding: 4px 8px;
  border-radius: 999px; background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18); touch-action: manipulation;
}
.ink-area-bar .ink-btn { min-width: 44px; height: 44px; }
.ink-area-bar .ink-icon { width: 26px; height: 26px; }
.ink-shot-dialog { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45); padding: 16px; }
.ink-shot-card { max-width: min(720px, 100%); max-height: 100%; overflow: auto; background: var(--bg-secondary); border-radius: 16px; padding: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3); }
.ink-shot-card img { display: block; max-width: 100%; max-height: 55vh; margin: 0 auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.ink-shot-note { min-height: 1.2em; margin: 8px 0 4px; font-size: 0.9rem; color: var(--text-secondary); text-align: center; }
.ink-shot-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ink-shot-actions > * {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary); font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none;
}
/* Bild einfügen: „Einfügen aus  📁 Dateien  🖼 Fotos“ neben den Feld-Mustern */
.ink-insert-from { gap: 4px; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--border); }
.ink-from-label { font-size: 0.82rem; white-space: nowrap; color: var(--text-secondary); }
.ink-btn.ink-from { width: auto; min-width: 0; padding: 0 10px; gap: 4px; font-size: 0.85rem; white-space: nowrap; }

/* Statusanzeige: Symbol statt Emoji, Erklärung im Tooltip. */
.ink-status .ink-icon { width: 22px; height: 22px; color: var(--text-secondary, #475569); }
.ink-status.ink-status-warn .ink-icon { color: #d97706; }

/* Wörter zum Ziehen (Drag the Words) neben dem Blatt (dockBank in ink-editor.js): rechts wie die
   Lernbegleitung links; das Blatt rückt zur Seite und passt sich an die übrige Breite an. */
.ink-bank-side {
  position: absolute; right: 0; top: 0; bottom: 0; width: 260px; z-index: 22; overflow-y: auto;
  padding: 56px 10px 10px; background: var(--bg-secondary); border-left: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.ink-has-bank .ink-scroll { margin-right: 260px; }
.ink-bank-head { font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); margin: 0 2px 8px; }
.ink-bank-side .dtw-word-bank {
  position: static; max-height: none; overflow: visible; box-shadow: none;
  border: none; background: none; padding: 0; align-content: flex-start;
}

/* Zoom wie bei der HTML-App: aktuelle Größe, Klick = 100 % (zwischen ↔ und +). */
.ink-zoom-pct { min-width: 52px; padding: 0 6px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
/* Handy: Knöpfe etwas schmaler, damit Werkzeuge, ↔ und Zoom in eine Zeile passen. */
@media (pointer: coarse) and (max-width: 500px) {
  .ink-toolbar .ink-btn { min-width: 40px; height: 42px; }
  .ink-toolbar .ink-icon { width: 25px; height: 25px; }
  .ink-toolbar .ink-zoom-pct { min-width: 42px; padding: 0 2px; font-size: 0.78rem; }
  .ink-toolbar .ink-status:empty { display: none; }
}
