/* Lehrerpult – Screen (Beamer-Dashboard) */

/* Schriften für den Screen (screen/fonts.js) – erst geladen, wenn ein Screen sie verwendet */
@font-face { font-family: "Andika"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/screen/andika-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Andika"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/screen/andika-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playwrite DE Grund"; font-style: normal; font-weight: 100 400; font-display: swap; src: url("../fonts/screen/playwrite-de-grund-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/screen/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/screen/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/screen/lexend-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("../fonts/screen/fredoka-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Patrick Hand"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 110%; src: url("../fonts/screen/patrick-hand-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Schoolbell"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/screen/schoolbell-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Comic Neue"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/screen/comic-neue-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Comic Neue"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/screen/comic-neue-latin-700-normal.woff2") format("woff2"); }
/* Ersatz für Schriften, die nicht frei sind (installiert verwendet sie der Screen direkt, siehe screen/fonts.js):
   Berner Basisschrift (Peter Wiegel, OFL) für die Deutschschweizer Basisschrift, Didact Gothic für Century Gothic – etwas
   grösser, damit sie gleich gross wirken wie die übrigen Schriften */
@font-face { font-family: "Berner Basisschrift Screen"; font-style: normal; font-weight: 400 700; font-display: swap; size-adjust: 118%; src: url("../fonts/screen/berner-basisschrift-1.woff2") format("woff2"); }
@font-face { font-family: "Didact Gothic Screen"; font-style: normal; font-weight: 400 700; font-display: swap; size-adjust: 108%; src: url("../fonts/screen/didact-gothic-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("../fonts/screen/literata-latin-wght-normal.woff2") format("woff2-variations"); }

body.screen-mode { overflow: hidden; overscroll-behavior: none; }
.screen-root { position: fixed; inset: 0; }
.screen {
  position: absolute; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none;
  font-family: var(--font); color: #1f2937; background: #222; touch-action: none;
  --w-radius: 16px;
  color-scheme: light;
}
/* Farbthema eines Widgets – alle Widgets verwenden diese Variablen */
.w {
  --w-bg: #ffffff;        /* Hintergrund */
  --w-text: #1f2937;      /* Haupttext */
  --w-muted: #6b7280;     /* Nebentext */
  --w-accent: #4f46e5;    /* Knöpfe, Fortschritt, Hervorhebung */
  --w-accent-text: #ffffff;
  --w-soft: #eef2ff;      /* helle Akzentfläche */
  --w-line: #e5e7eb;      /* Linien, Rahmen, inaktive Flächen */
  --w-surface: #f3f4f6;   /* Knöpfe, Kacheln */
}
.screen-bg { position: absolute; inset: 0; }
.screen-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, var(--bg-dim, 0)); pointer-events: none; }
.screen-bg.bg-dark ~ .scr-top-left .scr-title { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
@keyframes bg-shift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
/* bewegte Hintergründe: jede Ebene rückt um ein Vielfaches ihrer Kachel weiter (nahtlos), die letzte (Verlauf) bleibt */
@keyframes bg-snow { from { background-position: 0 0, 0 0, 0 0, 0 0; } to { background-position: 0 840px, 0 900px, 0 960px, 0 0; } }
@keyframes bg-bubbles { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 0 -1040px, 0 -1080px, 0 0; } }
@keyframes bg-clouds { from { background-position: 0 12%, 0 42%, 0 0; } to { background-position: 900px 12%, 1200px 42%, 0 0; } }
@keyframes bg-stars { from { background-position: 0 0, 0 0, 0 0; } to { background-position: -500px 0, -640px 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .screen-bg, .screen-bg .bg-fade { animation: none !important; } }
/* Diashow: der bisherige Hintergrund blendet aus */
.bg-fade { position: absolute; inset: 0; transition: opacity 1.4s ease; }
.bg-fade.out { opacity: 0; }
/* Schrift des Screens: --font gilt im Board (alle Widgets) und für den Namen oben links */
.board { position: absolute; inset: 0; font-family: var(--font); }
.board-widgets { position: absolute; inset: 0; }

/* Zeichenebene */
.draw-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4000; touch-action: none; }
.screen.drawing .draw-layer { pointer-events: auto; cursor: crosshair; }
.screen.drawing .w { pointer-events: none; }

/* --------------------------------------------------------------- Widgets */

.w {
  position: absolute; display: flex; flex-direction: column; border-radius: var(--w-radius);
  background: var(--w-bg); box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 12px 32px rgba(0,0,0,.16);
  transition: box-shadow .15s;
}
.w.selected { box-shadow: 0 0 0 3px rgba(37, 99, 235, .75), 0 12px 32px rgba(0,0,0,.2); }
.w.dragging { box-shadow: 0 0 0 3px rgba(37, 99, 235, .75), 0 22px 50px rgba(0,0,0,.3); cursor: grabbing; }
.w.dragging, .w.resizing { transition: none; }
.w.transparent { background: transparent; box-shadow: none; }
.w.transparent.selected { box-shadow: 0 0 0 2px rgba(37, 99, 235, .6); }
.w.maximized { border-radius: 0; }

.w-bar {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); height: 34px;
  display: flex; align-items: center; gap: 2px; padding: 0 4px 0 6px;
  background: rgba(255,255,255,.96); border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .15s; cursor: grab; z-index: 2;
  font: 600 13px/1 var(--font); color: #374151; min-width: 150px;
}
.w.bar-below .w-bar { bottom: auto; top: calc(100% + 6px); }
.w:hover .w-bar, .w.selected .w-bar { opacity: 1; pointer-events: auto; }
.w.maximized .w-bar { bottom: auto; top: 8px; left: auto; right: 8px; width: auto; }
.w-grip { color: #9ca3af; display: flex; }
.w-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-spacer { flex: 1; }
.w-btn { border: 0; background: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: #4b5563; cursor: pointer; }
.w-btn:hover { background: #f3f4f6; color: #111827; }
.w-body {
  position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: inherit;
  container-type: size; font-family: var(--font-kids); color: var(--w-text);
}
.w-resize { position: absolute; z-index: 3; }
.w-resize-se { right: -6px; bottom: -6px; width: 22px; height: 22px; cursor: nwse-resize; }
.w-resize-se::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 10px; height: 10px; border-right: 3px solid rgba(37,99,235,.8); border-bottom: 3px solid rgba(37,99,235,.8); border-radius: 0 0 3px 0; opacity: 0; transition: opacity .15s; }
.w:hover .w-resize-se::after, .w.selected .w-resize-se::after { opacity: 1; }
.w-resize-e { right: -5px; top: 12px; bottom: 16px; width: 10px; cursor: ew-resize; }
.w-resize-s { bottom: -5px; left: 12px; right: 16px; height: 10px; cursor: ns-resize; }
.w.maximized .w-resize { display: none; }

/* Hilfsklassen für Widget-Inhalte */
.wc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4cqmin; gap: 3cqmin; }
.wc-fill { position: absolute; inset: 0; display: flex; flex-direction: column; }
.wc-big { font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.wc-controls { display: flex; gap: 2cqmin; flex-wrap: wrap; justify-content: center; align-items: center; }
.wc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 0; border-radius: 999px; padding: .45em 1em; cursor: pointer; font: 600 clamp(13px, 6cqmin, 34px)/1.1 var(--font);
  background: var(--w-surface); color: var(--w-text); transition: background .12s, transform .08s, filter .12s;
}
.wc-btn:hover { filter: brightness(.95); }
.wc-btn:active { transform: scale(.97); }
.wc-btn.primary { background: var(--w-accent); color: var(--w-accent-text); }
.wc-btn.primary:hover { filter: brightness(1.08); }
.wc-btn.danger { background: #fee2e2; color: #b91c1c; }
.wc-btn.round { padding: .45em; aspect-ratio: 1; }
.wc-btn .icon { width: 1.15em; height: 1.15em; }
.wc-empty { color: var(--w-muted); font: 500 clamp(12px, 4cqmin, 22px)/1.4 var(--font); text-align: center; padding: 1em; }
.wc-input { border: 2px solid var(--w-line); border-radius: 12px; padding: .4em .7em; font: inherit; background: var(--w-bg); color: inherit; }
.wc-input:focus { outline: none; border-color: var(--w-accent); }

/* --------------------------------------------------------------- Bedienelemente des Screens */

.scr-top-left, .scr-top-right { position: absolute; top: 14px; display: flex; gap: 8px; align-items: center; z-index: 4500; }
.scr-top-left { left: 14px; }
.scr-top-right { right: 14px; }
.scr-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.92); color: #1f2937; box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; text-decoration: none;
}
.scr-btn:hover { background: #fff; }
.scr-btn:disabled { opacity: .4; cursor: default; }
.scr-btn.sm { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; background: transparent; }
.scr-btn.sm:hover:not(:disabled) { background: #f3f4f6; }
.scr-guest { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.82); color: #1f2937; font: 600 12px/1.2 var(--font); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.scr-guest .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
/* Handy: nur das Symbol, damit Titel und Menü Platz haben */
@media (max-width: 480px) { .scr-guest { padding: 6px; } .scr-guest .lbl { display: none; } }
.scr-title { border: 0; background: none; font: 650 15px/1 var(--font); color: #1f2937; cursor: pointer; padding: 8px 10px; border-radius: 10px; text-shadow: 0 1px 2px rgba(255,255,255,.6); }
.scr-title:hover { background: rgba(255,255,255,.5); }
.scr-pager {
  position: absolute; right: 14px; bottom: 14px; z-index: 4500; display: flex; align-items: center; gap: 2px; padding: 4px;
  background: rgba(255,255,255,.95); border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.scr-page { border: 0; background: none; font: 650 13px/1 var(--font); padding: 8px 8px; border-radius: 8px; cursor: pointer; color: #374151; min-width: 44px; }
.scr-page:hover { background: #f3f4f6; }
/* Ordner des offenen Screens in der Seitenzahl */
/* über der Seitenzahl, damit sie nicht breiter wird (und die Werkzeugleiste nicht überdeckt) */
.scr-folder { position: absolute; right: 0; bottom: calc(100% + 6px); display: inline-flex; align-items: center; gap: 6px; border: 0; background: rgba(255,255,255,.95); box-shadow: 0 2px 10px rgba(0,0,0,.18); padding: 6px 10px; border-radius: 10px; cursor: pointer; font: 650 12px/1 var(--font); color: #374151; max-width: 220px; }
.scr-folder:hover { background: #fff; }
.scr-folder-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.scr-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Handy: nur der Farbpunkt in der Seitenzahl */
@media (max-width: 600px) { .scr-folder { position: static; box-shadow: none; background: none; padding: 8px 6px; } .scr-folder-name { display: none; } }
/* Screens und Ordner */
.sm-wrap { display: flex; flex-direction: column; gap: 12px; }
.sm-folder { border: 1px solid var(--border, #e5e7eb); border-left: 5px solid var(--sm-color, #cbd5e1); border-radius: 12px; padding: 8px 10px; transition: background .15s; }
.sm-folder.loose { border-left-color: var(--border, #e5e7eb); }
.sm-folder.drop { background: var(--accent-soft, #eef2ff); }
.sm-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 34px; }
.sm-fname { overflow-wrap: anywhere; }
.sm-color { width: 24px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; border-radius: 50%; overflow: hidden; }
.sm-color::-webkit-color-swatch-wrapper { padding: 0; }
.sm-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.sm-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.sm-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sm-row { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 2px; border-radius: 8px; background: var(--surface-2, #f9fafb); }
.sm-row.current { box-shadow: inset 0 0 0 2px var(--accent, #4f46e5); }
.sm-grip { color: #9ca3af; cursor: grab; display: flex; flex: none; }
.sm-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 6px 4px; cursor: pointer; }
.sm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sm-select { width: auto; max-width: 160px; min-height: 32px; padding: 4px 8px; }
.sm-empty { padding: 8px 4px 2px; }
@media (max-width: 560px) { .sm-row { flex-wrap: wrap; } .sm-open { flex: 1 1 calc(100% - 30px); } .sm-select { max-width: none; flex: 1; margin-left: 24px; } }
/* Papierkorb */
.tr-list { display: flex; flex-direction: column; gap: 6px; }
.tr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; }
.tr-row > .icon { flex: none; color: var(--text-2, #6b7280); }
.tr-text { flex: 1; min-width: 0; }
.tr-name { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 560px) { .tr-row { flex-wrap: wrap; } .tr-text { flex-basis: calc(100% - 40px); } }

.scr-toolbar-wrap { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4500; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100% - 400px); transition: transform .25s, opacity .25s; }
.scr-toolbar-wrap.hidden { transform: translate(-50%, 140%); opacity: 0; pointer-events: none; }
.scr-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 6px; background: rgba(255,255,255,.97);
  border-radius: 18px; box-shadow: 0 4px 20px rgba(0,0,0,.22); overflow-x: auto; max-width: 100%;
}
.tb-modes { display: flex; flex-direction: column; gap: 2px; padding-right: 2px; }
.tb-mode { width: 34px; height: 30px; border: 0; border-radius: 8px; background: none; color: #6b7280; cursor: pointer; display: grid; place-items: center; }
.tb-mode.active { background: #e0e7ff; color: #3730a3; }
.tb-mode .icon { width: 17px; height: 17px; }
.tb-sep { width: 1px; align-self: stretch; background: #e5e7eb; margin: 4px 4px; }
.tb-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 6px 6px; min-width: 66px;
  border: 0; border-radius: 12px; background: none; cursor: pointer; color: #374151;
}
.tb-item:hover { background: #f3f4f6; }
.tb-item .icon { width: 26px; height: 26px; color: #1f2937; stroke-width: 1.7; }
.tb-item span { font: 550 11px/1.1 var(--font); white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.tb-item.more .icon { color: #4f46e5; }
/* «Mehr» und Rückgängig bleiben sichtbar, auch wenn die Leiste seitlich scrollt; der Schatten deckt rechts den Innenabstand ab */
.tb-item.more { position: sticky; right: 0; background: #fff; box-shadow: 6px 0 0 #fff; }
.tb-hide { border: 0; background: none; color: #9ca3af; cursor: pointer; padding: 6px; border-radius: 8px; align-self: flex-end; }
.tb-hide:hover { color: #374151; background: #f3f4f6; }
.scr-showbar { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 4500; border: 0; background: rgba(255,255,255,.9); border-radius: 12px 12px 0 0; padding: 4px 22px; cursor: pointer; box-shadow: 0 -2px 8px rgba(0,0,0,.15); }

.more-panel {
  position: absolute; z-index: 4600; width: min(560px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto;
  background: #fff; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); padding: 12px 14px;
  animation: modal-in .15s ease-out;
}
.more-group + .more-group { margin-top: 8px; }
.more-label { font: 700 11px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: #9ca3af; padding: 6px 4px; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; }
.more-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 0; background: none; border-radius: 12px; cursor: pointer; color: #374151; font: 550 12px/1.2 var(--font); }
.more-item:hover { background: #f3f4f6; }
.more-item .icon { width: 28px; height: 28px; stroke-width: 1.7; color: #1f2937; }
.more-foot { border-top: 1px solid #f3f4f6; margin-top: 8px; padding-top: 8px; display: flex; justify-content: flex-end; }

/* Kontextmenü (auch ausserhalb des Screens nutzbar) */
.popup-menu { position: fixed; z-index: 10050; min-width: 220px; max-height: 70vh; overflow-y: auto; background: var(--surface, #fff); color: var(--text, #111); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 6px; font-family: var(--font); }
.popup-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: inherit; font-size: 14px; }
.popup-item:hover { background: var(--surface-3, #f3f4f6); }
.popup-item.active { font-weight: 650; }
.popup-item.danger { color: var(--danger, #b91c1c); }
.popup-sep { height: 1px; background: var(--border, #e5e7eb); margin: 5px 4px; }

/* Einstellungs-Panel */
.ws-panel {
  /* über dem Spotlight (6000), damit die Einstellungen auch dort bedienbar sind; nicht über der Werkzeugleiste */
  position: absolute; z-index: 6100; top: 70px; right: 14px; bottom: 110px; width: min(360px, calc(100vw - 28px));
  background: #fff; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); display: flex; flex-direction: column; color: #1f2937;
  animation: panel-in .18s ease-out;
}
@keyframes panel-in { from { transform: translateX(12px); opacity: 0; } }
.ws-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px 18px; border-bottom: 1px solid #f3f4f6; }
.ws-panel-head h3 { font: 650 16px/1.2 var(--font); }
.ws-panel-body { padding: 8px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ws-section { display: flex; flex-direction: column; gap: 8px; }
.ws-title { font: 700 11px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: #9ca3af; margin-top: 10px; }
.ws-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.ws-row > span { color: #374151; }
.ws-switch { font-size: 14px; }
.ws-range { width: 100%; accent-color: #2563eb; }
.ws-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ws-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }
.ws-color.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2563eb; }
.ws-color-input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.ws-seg { display: inline-flex; background: #f3f4f6; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.ws-seg-btn { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font: 550 13px/1 var(--font); color: #4b5563; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.ws-seg-btn.active { background: #fff; color: #111827; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ws-list { display: flex; flex-direction: column; gap: 6px; }
.ws-list-row { display: flex; gap: 6px; align-items: center; }
.ws-list-row .input { min-height: 34px; padding: 6px 10px; }
.ws-panel .input, .ws-panel .select, .ws-panel .textarea { background: #fff; color: #1f2937; border-color: #d1d5db; }

/* Hintergrund-Auswahl */
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-grid.colors { grid-template-columns: repeat(7, 1fr); }
.bg-tile { aspect-ratio: 16 / 10; border-radius: 10px; border: 2px solid rgba(0,0,0,.08); cursor: pointer; position: relative; overflow: hidden; padding: 0; display: flex; align-items: flex-end; }
.bg-tile span { font: 600 11px/1 var(--font); color: #fff; background: rgba(0,0,0,.45); padding: 3px 6px; border-radius: 0 6px 0 0; }
.bg-tile.color { aspect-ratio: 1; border-radius: 50%; }
.bg-tile.active { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb; }
.bg-color-input { width: 100%; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; }
/* Favoriten-Stern auf den Kacheln */
.bg-tile-wrap { position: relative; display: flex; }
.bg-tile-wrap .bg-tile { width: 100%; }
.bg-fav { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font: 14px/1 var(--font); cursor: pointer; padding: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.bg-tile-wrap:hover .bg-fav, .bg-fav:focus-visible, .bg-fav.on { opacity: 1; }
.bg-fav.on { background: #f59e0b; }
@media (pointer: coarse) { .bg-fav { opacity: .85; } }
/* Diashow */
.bg-show { display: flex; flex-direction: column; gap: 6px; }
.bg-show-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.bg-thumb { width: 44px; aspect-ratio: 16 / 10; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); display: block; }
.bg-grid.lib { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.ss-slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ss-slide { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; overflow: hidden; background: var(--surface, #fff); }
.ss-thumb { aspect-ratio: 16 / 10; position: relative; }
.ss-slide-bar { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 8px; }
.ss-num { font: 700 12px/1 var(--font); color: var(--text-2, #6b7280); }
.ss-thumb .ss-name { position: absolute; left: 0; bottom: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11px/1 var(--font); color: #fff; background: rgba(0,0,0,.45); padding: 3px 6px; border-radius: 0 6px 0 0; }
/* Schrift des Screens */
.font-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.font-opt { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; border: 2px solid #e5e7eb; border-radius: 10px; background: #fff; color: #1f2937; padding: 6px 8px; cursor: pointer; }
.font-opt.active { border-color: #2563eb; background: #eff6ff; }
.font-sample { grid-row: span 2; font-size: 24px; line-height: 1; font-weight: 600; }
.font-name { font-size: 14px; font-weight: 600; line-height: 1.2; overflow: hidden; overflow-wrap: anywhere; } /* «Schreib-maschine» trennen statt abschneiden */
.font-note { font: 500 11px/1.25 var(--font); color: #6b7280; }

/* Stift-Leiste */
.scr-penbar { display: flex; }
.pen-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: rgba(255,255,255,.97); border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,.22); flex-wrap: wrap; justify-content: center; }
.pen-bar.compact { padding: 5px 6px; gap: 4px; box-shadow: none; background: rgba(255,255,255,.9); border-radius: 12px; }
.pen-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.pen-color.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2563eb; }
.pen-color.saved { border-style: dashed; }
.pen-custom { width: 26px; height: 26px; border: 2px solid rgba(0,0,0,.15); border-radius: 50%; padding: 0; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); cursor: pointer; overflow: hidden; }
.pen-custom::-webkit-color-swatch-wrapper { padding: 0; }
.pen-custom::-webkit-color-swatch { border: 0; border-radius: 50%; opacity: 0; }
.pen-custom::-moz-color-swatch { border: 0; opacity: 0; }
.pen-size { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pen-size span { display: block; border-radius: 50%; background: #374151; }
.pen-size.active { background: #e0e7ff; }
.pen-tool { border: 0; background: none; height: 32px; min-width: 32px; padding: 0 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: #374151; font: 600 13px/1 var(--font); }
.pen-tool:hover { background: #f3f4f6; }
.pen-tool.active { background: #fee2e2; color: #b91c1c; }
.pen-tool.hl.active { background: #fef9c3; color: #a16207; }
.pen-tool.done { background: #2563eb; color: #fff; }
.pen-sep { width: 1px; height: 24px; background: #e5e7eb; }
.pen-shape-wrap { position: relative; display: inline-flex; }
.pen-tool.shape { padding: 0 4px 0 6px; gap: 0; }
.pen-tool.shape.active { background: #e0e7ff; color: #3730a3; }
.pen-tool.shape .icon.sm { width: 12px; height: 12px; opacity: .6; }
.pen-shapes { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; background: #fff; border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.22); z-index: 5; }
.pen-shapes[hidden] { display: none; }
.pen-shapes .pen-tool.active { background: #e0e7ff; color: #3730a3; }

/* Auswahl-Dialoge (Emoji, Bilder) */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; max-height: 50vh; overflow-y: auto; }
.emoji-btn { font-size: 28px; line-height: 1; padding: 8px 0; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.emoji-btn:hover { background: var(--surface-3, #f3f4f6); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.image-tile { aspect-ratio: 4 / 3; border: 2px solid var(--border, #e5e7eb); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: var(--surface-2, #fafafa); }
.image-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-tile:hover { border-color: var(--accent, #2563eb); }
.image-tile-wrap { position: relative; }
.image-tile-wrap .image-tile { width: 100%; }
.image-del { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .92); color: var(--danger, #dc2626); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: pointer; opacity: 0; transition: opacity .15s; }
.image-tile-wrap:hover .image-del, .image-del:focus-visible { opacity: 1; }
@media (hover: none) { .image-del { opacity: 1; } }
/* eigenes Bild statt Emoji (Checkliste, Routine): so gross wie ein Emoji in der gleichen Schrift */
.w-symbol { display: block; width: 1.2em; height: 1.2em; margin: auto; object-fit: contain; border-radius: .12em; }

/* schmalere Fenster: Leiste ohne Beschriftung, damit sie nicht unter die Seitenzahl rechts läuft */
@media (max-width: 1400px) {
  .tb-item { min-width: 50px; padding: 8px 5px; }
  .tb-item span { display: none; }
}
/* schmalere Bildschirme: Leiste über dem Seitenwähler, fast volle Breite (sonst bleiben nur wenige Hundert Pixel) */
@media (max-width: 1100px) {
  .scr-toolbar-wrap { max-width: calc(100% - 16px); bottom: 64px; }
  .scr-pager { bottom: 10px; right: 10px; }
  .tb-item { min-width: 54px; }
  .tb-item span { display: none; }
}

/* --------------------------------------------------------------- Bühne, Spotlight, Fixieren, Themen */
.stage { position: absolute; inset: 0; }
.board { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.stage.fixed .board { box-shadow: 0 0 0 2px rgba(255,255,255,.55), 0 0 0 9999px rgba(0,0,0,.18); border-radius: 4px; }
.spot-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); z-index: 5900; backdrop-filter: blur(2px); }
.w.spotlight { box-shadow: 0 20px 80px rgba(0,0,0,.45); transition: left .2s, top .2s, width .2s, height .2s; }
.w.spotlight .w-resize { display: none; }
/* Werkzeugleisten von Text und Zeichnung im Spotlight innen (aussen ist kein Platz) */
.w.spotlight .tx-tools.show { top: 8px; left: 8px; transform: none; }
.w.spotlight .zch-tools, .w.spotlight .zch-tools.above { top: auto; bottom: 10px; transform: translateX(-50%); }
/* Meldungen im Screen oben in der Mitte (unten liegen Werkzeugleiste und Seitenzahl) */
.screen-mode .toasts { top: 18px; bottom: auto; right: auto; left: 50%; transform: translateX(-50%); }
/* wenig Rand im Spotlight: die Titelleiste erscheint innen oben rechts */
.w.spotlight .w-bar { bottom: auto; top: 8px; left: auto; right: 8px; width: auto; }
/* Im Spotlight erscheint die Titelleiste nur beim Darüberfahren */
.w.spotlight:not(:hover) .w-bar { opacity: 0; pointer-events: none; }
/* Unsichtbare Brücke über den Spalt, damit die Leiste beim Hinfahren nicht verschwindet */
.w-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 6px; }
.w.bar-below .w-bar::before { top: auto; bottom: 100%; }
.w-lock, .w-pin { display: none; }
.w.locked .w-lock { display: grid; color: #b45309; }
.w.locked .w-resize { display: none; }
.w.locked .w-bar { cursor: default; }
.w.pinned .w-pin { display: flex; color: #4f46e5; margin-left: 4px; }
.w.glass { backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); }
.w.theme-dark .w-body { color: var(--w-text); }
.tb-right { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; padding-left: 2px; }

.theme-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.theme-tile { aspect-ratio: 1; border-radius: 10px; border: 2px solid rgba(0,0,0,.08); cursor: pointer; position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 6px; }
.theme-tile.checker { background: repeating-conic-gradient(#e5e7eb 0 25%, #ffffff 0 50%) 0 0 / 10px 10px; }
.theme-tile .theme-line { width: 80%; height: 4px; border-radius: 4px; background: var(--tt-text); }
.theme-tile .theme-dot { width: 45%; height: 4px; border-radius: 4px; background: var(--tt-accent); }
.theme-tile.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #4f46e5; }
.ws-own { display: flex; flex-direction: column; gap: 10px; }
/* eigene Farbthemen */
.theme-own { position: relative; }
.theme-own .theme-tile { width: 100%; }
.theme-edit { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #d1d5db; background: #fff; color: #374151; font: 600 12px/1 var(--font); cursor: pointer; padding: 0; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.theme-tile.theme-add { background: #f9fafb; border-style: dashed; border-color: #cbd5e1; color: #64748b; font: 600 22px/1 var(--font); align-items: center; justify-content: center; }
.te-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
@media (max-width: 640px) { .te-grid { grid-template-columns: 1fr; } }
.te-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; }
.te-label { font-size: 14px; color: var(--text-2, #4b5563); }
.te-field { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.te-color { width: 40px; height: 36px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.te-hex { width: 96px !important; font-family: ui-monospace, monospace; text-transform: lowercase; }
.te-hex.invalid { border-color: #dc2626; }
.te-pick, .ws-color-pick { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #374151; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ws-color-pick { width: 28px; height: 28px; border-radius: 50%; }
.te-saved { display: flex; gap: 4px; flex-wrap: wrap; }
.te-swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.te-starts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.te-start { border: 2px solid; border-radius: 8px; padding: 6px 10px; font: 600 12px/1 var(--font); cursor: pointer; }
.te-preview-wrap { position: relative; }
.w.te-preview { position: relative; inset: auto; min-height: 170px; padding: 18px; gap: 8px; border-radius: 16px; color: var(--w-text); }
.te-prev-title { font: 700 22px/1.2 var(--font); color: var(--w-text); }
.te-prev-muted { font: 500 14px/1.3 var(--font); color: var(--w-muted); }
.te-prev-row { display: flex; gap: 8px; margin-top: auto; }
.te-prev-btn { background: var(--w-accent); color: var(--w-accent-text); border-radius: 10px; padding: 8px 14px; font: 650 14px/1 var(--font); }
.te-prev-chip { background: var(--w-soft); color: var(--w-text); border: 1px solid var(--w-line); border-radius: 10px; padding: 8px 14px; font: 600 14px/1 var(--font); }
.ws-color.saved { border-style: dashed; }
.ws-color-sep { width: 1px; height: 22px; background: #e5e7eb; margin: 0 2px; }

/* Verschwommen (Taste 1) */
.scr-blur { position: absolute; inset: 0; z-index: 9000; backdrop-filter: blur(28px) saturate(.9); -webkit-backdrop-filter: blur(28px); background: rgba(255,255,255,.18); display: flex; align-items: flex-end; justify-content: center; cursor: pointer; }
.scr-blur-hint { margin-bottom: 30px; font: 600 14px/1 var(--font); color: rgba(0,0,0,.45); background: rgba(255,255,255,.6); padding: 8px 14px; border-radius: 99px; }
.scr-drop { position: absolute; inset: 16px; z-index: 8000; border: 4px dashed rgba(255,255,255,.9); border-radius: 24px; background: rgba(79, 70, 229, .25); display: flex; align-items: center; justify-content: center; gap: 12px; font: 700 28px/1 var(--font); color: #fff; pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.scr-drop .icon { width: 40px; height: 40px; }

/* Vorlagen für neue Screens */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tpl-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 2px solid var(--border, #e5e7eb); border-radius: 14px; background: var(--surface, #fff); color: inherit; cursor: pointer; text-align: left; font: inherit; }
.tpl-tile .icon { width: 26px; height: 26px; color: var(--accent, #4f46e5); }
.tpl-tile span { font-size: .82rem; color: var(--text-2, #6b7280); line-height: 1.35; }
.tpl-tile.active { border-color: var(--accent, #4f46e5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #4f46e5) 20%, transparent); }
.tpl-own { position: relative; }
.tpl-own strong { overflow-wrap: anywhere; }
.tpl-own-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }

/* Beim Verschieben und Grössenändern dürfen eingebettete Seiten die Maus nicht abfangen */
.board-widgets:has(.w.dragging, .w.resizing) iframe { pointer-events: none; }

/* Screen zur Lektion: Fächer in den Screen-Einstellungen, Hinweis beim Lektionsbeginn */
.scr-subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.scr-subject { border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 4px 11px; font: 600 13px/1.3 var(--font); color: #374151; cursor: pointer; }
.scr-subject small { font-weight: 500; color: #9ca3af; }
.scr-subject.on { background: #e0e7ff; border-color: #6366f1; color: #3730a3; }
.scr-lesson-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6000; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px);
  padding: 8px 8px 8px 14px; border-radius: 14px; background: rgba(255,255,255,.97); color: #1f2937; box-shadow: 0 10px 30px rgba(0,0,0,.25); font: 600 14px/1.3 var(--font); }
.scr-lesson-bar > span { min-width: 0; }
