/* Klassentafel – Gestaltung. Alle Maße beziehen sich auf eine 1920×1080-Fläche;
   die App skaliert automatisch auf größere Bildschirme (z. B. 4K). */

@font-face {
  font-family: 'Quicksand';
  src: url('../fonts/quicksand.woff2') format('woff2');
  font-weight: 300 700;
  font-display: block;
}

:root {
  --ink: #1f2937;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --bg: #ffffff;
  --soft: #f3f4f6;
  --accent: #5b5bd6;
  --accent-soft: #eef0ff;
  --danger: #dc2626;
  --shadow: 0 6px 24px rgba(17, 24, 39, 0.12), 0 1px 3px rgba(17, 24, 39, 0.08);
  --radius: 16px;
  --sidebar-w: 470px;
  /* Für Themes (siehe Ordner app/themes) */
  --panel: #ffffff;          /* Flächen: Leisten, Widgets, Dialoge, Knöpfe */
  --on-accent: #ffffff;      /* Schrift auf Akzentfarbe */
  --chip: rgba(255, 255, 255, .85);
  --sidebar-bg: var(--bg);
  --sidebar-border: 4px solid var(--ink);
  --font: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  --font-display: var(--font); /* Überschriften, Timer, Uhr */
  --ring-flash: #fef08a;
  --start-bg: #f6f7fb;
  --start-dots: #d4d7de;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input, select { font: inherit; color: inherit; }
.ic { width: 1em; height: 1em; display: block; flex: none; }
.ic.small { width: .7em; height: .7em; display: inline-block; vertical-align: middle; }

/* ---------- Grundlayout ---------- */
/* Die Seitenleiste liegt ÜBER der Tafel (die Tafel ist immer bildschirmbreit).
   --sb-space = Platz, den die Seitenleiste gerade rechts belegt (0 = ausgeblendet). */
#app { position: relative; width: 100vw; height: 100vh; overflow: hidden; --sb-space: var(--sidebar-w); }
#app.sb-hidden { --sb-space: 0px; }
#stage { position: absolute; inset: 0; overflow: hidden; }
#board { position: absolute; inset: 0; }
#canvas-wrap { position: absolute; inset: 0; touch-action: none; }
#theme-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#theme-deco i { display: none; } /* Themes blenden hier Verzierungen ein */
#widget-layer { position: absolute; inset: 0; pointer-events: none; }

#sidebar {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 40;
  width: var(--sidebar-w);
  transition: transform .3s ease;
  border-left: var(--sidebar-border);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 22px 14px 26px;
}
#app.sb-hidden #sidebar { transform: translateX(100%); }
/* Lasche am linken Rand der Seitenleiste: ein-/ausblenden */
#sb-toggle {
  position: absolute; z-index: 41; top: 50%; right: var(--sb-space);
  width: 40px; height: 96px; margin-top: -48px;
  border: 0; border-radius: 16px 0 0 16px;
  background: var(--panel); box-shadow: var(--shadow); color: var(--ink-2);
  display: grid; place-items: center; font-size: 26px;
  transition: right .3s ease;
}
#sb-toggle:hover { color: var(--ink); background: var(--soft); }
.sb-slot { position: relative; container-type: size; border-radius: 14px; }
.sb-timer { height: 240px; flex: none; }
.sb-schedule { flex: 1; min-height: 0; }
.sb-clock { height: 120px; flex: none; }

/* ---------- Knöpfe allgemein ---------- */
.icon-btn {
  width: 48px; height: 48px;
  border: 0; border-radius: 12px;
  background: transparent;
  display: inline-grid; place-items: center;
  font-size: 24px;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--soft); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.float { background: var(--panel); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 18px; font-weight: 600;
  min-height: 48px;
}
.btn .ic { font-size: 20px; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.big { font-size: 22px; padding: 14px 26px; min-height: 60px; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.round-btn {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--panel);
  display: grid; place-items: center; font-size: 20px;
}
.round-btn.dark { background: var(--ink); color: var(--on-accent); }

/* ---------- Kopfzeile, Vollbild, Seiten ---------- */
#topbar {
  position: absolute; top: 14px; left: 14px;
  display: flex; align-items: center; gap: 12px; z-index: 30;
}
.board-name {
  border: 0; background: var(--chip);
  border-radius: 10px; padding: 8px 14px;
  font-size: 18px; font-weight: 600; color: var(--ink-2);
  max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-name:empty { display: none; }
.save-status { font-size: 14px; color: var(--muted); }
.save-status.err { color: var(--danger); font-weight: 700; }
#fullscreen-btn { position: absolute; top: 18px; right: calc(14px + var(--sb-space)); z-index: 30; transition: right .3s ease; }

#pager {
  position: absolute; right: calc(76px + var(--sb-space)); top: 14px; z-index: 30; transition: right .3s ease;
  display: flex; align-items: center; gap: 2px;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 4px;
}
.page-label { border: 0; background: transparent; font-size: 18px; font-weight: 700; padding: 8px 10px; min-width: 64px; border-radius: 10px; }
.page-label:hover { background: var(--soft); }

/* ---------- Werkzeugleiste ---------- */
#toolbar {
  position: absolute; left: calc((100% - var(--sb-space)) / 2); bottom: 14px; transform: translateX(-50%);
  z-index: 30; transition: left .3s ease;
  display: flex; align-items: center; gap: 6px;
  background: var(--panel); border-radius: 20px; box-shadow: var(--shadow);
  padding: 8px 12px;
}
.tb-group { display: flex; align-items: center; gap: 4px; }
.tb-group.dim { opacity: .3; pointer-events: none; }
.tb-sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 6px; }
.tb-btn {
  width: 70px; height: 70px;
  border: 0; border-radius: 14px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--ink);
}
.tb-btn .ic { font-size: 30px; }
.tb-btn span { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tb-btn:hover { background: var(--soft); }
/* Mit eingeblendeter Seitenleiste ist weniger Platz: Knöpfe etwas schmaler */
#app:not(.sb-hidden) .tb-btn { width: 64px; }
#app:not(.sb-hidden) .tb-btn span { font-size: 11px; }
#app:not(.sb-hidden) .tb-sep { margin: 6px 3px; }
.tb-btn.active { background: var(--accent-soft); color: var(--accent); }
.tb-btn.active span { color: var(--accent); }

.swatch {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--panel); background: var(--c);
  box-shadow: 0 0 0 1px var(--line-2);
}
.swatch.active { box-shadow: 0 0 0 3px var(--accent); }
.width-btn {
  width: 46px; height: 46px; border: 0; border-radius: 12px; background: transparent;
  display: grid; place-items: center; color: var(--ink);
}
.width-btn i { display: block; border-radius: 50%; }
.width-btn.active { background: var(--accent-soft); }
.tb-group.colors { gap: 2px; }
.colors .swatch { width: 34px; height: 34px; }
/* Farbrad-Knopf: Regenbogen-Ring, innen die eigene Farbe */
.swatch.wheel {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  display: grid; place-items: center; padding: 0;
}
.swatch.wheel i { width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: 0 0 0 2px var(--panel); }

/* Werkzeugleiste ausblenden: Knopf am rechten Ende, Lasche unten in der Mitte */
.tb-hide {
  width: 36px; height: 70px; margin-left: 2px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 26px;
}
.tb-hide:hover { background: var(--soft); color: var(--ink); }
#toolbar { transition: left .3s ease, transform .3s ease, opacity .3s ease; }
#app.tb-hidden #toolbar { transform: translate(-50%, calc(100% + 30px)); opacity: 0; pointer-events: none; }
#tb-toggle {
  position: absolute; z-index: 31; bottom: 0; left: calc((100% - var(--sb-space)) / 2);
  transform: translate(-50%, 100%); transition: transform .3s ease, left .3s ease;
  display: flex; align-items: center; gap: 8px;
  height: 54px; padding: 0 20px; border: 0; border-radius: 16px 16px 0 0;
  background: var(--panel); box-shadow: var(--shadow); color: var(--ink-2);
  font-size: 24px; font-weight: 600; touch-action: manipulation;
}
#tb-toggle span { font-size: 16px; }
#tb-toggle .tb-cur { font-size: 24px; margin-left: 4px; }
#tb-toggle:hover { color: var(--ink); background: var(--soft); }
#app.tb-hidden #tb-toggle { transform: translate(-50%, 0); }

/* ---------- Auswahl-Leiste ---------- */
#selbar {
  position: absolute; z-index: 25;
  display: flex; gap: 2px;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 4px;
}
#selbar[hidden] { display: none; }
.sel-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--line-2); }

/* Farbwähler (Farbrad) */
.cpick { display: flex; flex-direction: column; gap: 10px; width: 280px; padding: 6px; }
.cp-head, .menu-head { font-size: 17px; font-weight: 700; padding: 2px 4px; }
.menu-head { padding: 8px 8px 6px; color: var(--ink-2); }
.cp-row { display: flex; flex-wrap: wrap; gap: 5px; }
.cp-row .swatch { width: 32px; height: 32px; }
.cp-wheel { position: relative; width: 240px; height: 240px; margin: 0 auto; touch-action: none; cursor: crosshair; }
.cp-wheel canvas { width: 240px; height: 240px; display: block; }
.cp-dark { position: absolute; inset: 0; border-radius: 50%; background: #000; pointer-events: none; }
.cp-knob {
  position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4); pointer-events: none;
}
.cp-light { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.cp-light input { width: 100%; height: 34px; accent-color: var(--accent); }
.cp-foot { display: flex; align-items: center; gap: 10px; }
.cp-prev { width: 44px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); }
.cp-foot code { font-size: 15px; color: var(--ink-2); }
.cp-recent-wrap { display: flex; flex-direction: column; gap: 4px; }
.cp-recent-wrap[hidden] { display: none; }
.look-menu .tabs { flex-direction: row; margin-bottom: 8px; }
.look-menu .tabs button { padding: 10px 14px; font-size: 17px; }
.add-menu .menu-item { padding: 10px 14px; }

/* ---------- Popover & Menüs ---------- */
.popover {
  position: fixed; z-index: 500;
  background: var(--panel); border-radius: 16px; box-shadow: 0 12px 40px rgba(17, 24, 39, .2);
  padding: 8px;
}
.menu { display: flex; flex-direction: column; min-width: 220px; }
.menu.grid { display: grid; grid-template-columns: repeat(3, 110px); gap: 6px; min-width: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; text-align: left;
  font-size: 18px; font-weight: 600; padding: 12px 14px; border-radius: 10px;
}
.menu-item .ic { font-size: 22px; }
.menu-item:hover { background: var(--soft); }
.menu-item.danger { color: var(--danger); }
.menu-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px solid transparent; background: var(--soft); border-radius: 12px;
  padding: 12px 6px; font-size: 13px; font-weight: 600;
}
.menu-tile .ic { font-size: 30px; }
.menu-tile.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
/* Design-Menü (Themes) */
.menu.themes { width: 560px; padding: 6px; }
.th-head { font-size: 20px; font-weight: 700; padding: 6px 8px 10px; font-family: var(--font-display); }
.th-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-tile {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left;
  border: 3px solid transparent; background: var(--soft); border-radius: 14px; padding: 10px;
}
.theme-tile.active { border-color: var(--accent); }
.th-prev {
  position: relative; display: block; height: 120px; border-radius: 8px; overflow: hidden;
  background: var(--tafel); border: 2px solid var(--rand);
}
.th-prev b { position: absolute; left: 14px; top: 10px; font-size: 34px; font-style: normal; color: #2b1a0e; }
.th-prev em { position: absolute; right: 0; top: 0; bottom: 0; width: 26%; background: var(--leiste); border-left: 3px double var(--rand); }
.th-prev u { position: absolute; left: 18%; bottom: 8px; width: 40%; height: 14px; border-radius: 7px; background: var(--leiste); border: 2px solid var(--rand); }
.th-prev u::after { content: ''; position: absolute; left: 10%; top: 3px; width: 8px; height: 4px; border-radius: 2px; background: var(--akzent); }
.th-name { font-size: 19px; font-weight: 700; margin-top: 4px; }
.th-desc { font-size: 14px; color: var(--muted); line-height: 1.25; }
.menu.themes .hint { margin: 10px 6px 4px; font-size: 14px; }
.bg-prev { width: 64px; height: 44px; border-radius: 6px; border: 1px solid var(--line-2); display: block; }

/* ---------- Frei platzierte Widgets ---------- */
.fw {
  position: absolute; pointer-events: auto;
  background: var(--panel); border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.fw-content { position: absolute; inset: 0; padding: 16px 24px; container-type: size; border-radius: 20px; overflow: hidden; }
.fw-h {
  position: absolute; width: 46px; height: 46px; z-index: 2;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--panel);
  display: grid; place-items: center; font-size: 20px; color: var(--ink-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  opacity: 0; pointer-events: none; transform: scale(.5);
  transition: opacity .15s, transform .15s;
  touch-action: none;
}
/* Ecken nur sichtbar, wenn das Widget angetippt (ausgewählt) ist */
.fw.active { outline: 3px solid var(--accent); outline-offset: 3px; }
.fw.active .fw-h { opacity: 1; pointer-events: auto; transform: none; }
.fw-h.tl { top: -18px; left: -18px; cursor: move; }
.fw-h.tr { top: -18px; right: -18px; color: var(--danger); }
.fw-h.br { bottom: -18px; right: -18px; cursor: nwse-resize; }
.fw-h.bl { bottom: -18px; left: -18px; }
.fw.dragging { box-shadow: 0 16px 48px rgba(17, 24, 39, .25); }

/* Ablauf-Signal */
.ringing { animation: ring 0.6s ease-in-out infinite; }
@keyframes ring {
  0%, 100% { background-color: var(--panel); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { background-color: var(--ring-flash); box-shadow: 0 0 0 10px rgba(245, 158, 11, .55); }
}

/* ---------- Widget: Timer ---------- */
.w-timer { height: 100%; display: flex; flex-direction: column; }
.w-title {
  border: 0; background: transparent; padding: 0; text-align: left;
  font-family: var(--font-display);
  font-size: clamp(16px, 12cqh, 34px); font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 3cqw; }
.t-ring { height: min(60cqh, 30cqw); width: min(60cqh, 30cqw); flex: none; transform: rotate(-90deg); }
.t-ring circle { fill: none; stroke-width: 7; }
.t-ring-bg { stroke: var(--line); }
.t-ring-fg { stroke: var(--ink); stroke-dasharray: 100; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.t-digits { font-family: var(--font-display); display: flex; align-items: center; font-size: min(34cqh, 15cqw); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.t-col { display: flex; flex-direction: column; align-items: center; }
.t-dig { width: .6em; text-align: center; }
.t-sep { padding: 0 .02em; transform: translateY(-.05em); }
.t-adj {
  border: 0; background: transparent; color: var(--ink-2);
  font-size: max(16px, .3em); padding: .12em .2em; border-radius: 8px;
}
.t-adj:hover { background: var(--soft); }
.running .t-adj { visibility: hidden; }
.t-ctrl { display: flex; flex-direction: column; gap: 12px; flex: none; }
.t-ctrl .round-btn { width: min(52px, 22cqh); height: min(52px, 22cqh); font-size: min(20px, 9cqh); }

/* ---------- Widget: Stundenplan ---------- */
.w-schedule { height: 100%; display: flex; flex-direction: column; }
.s-head { display: flex; align-items: center; justify-content: center; position: relative; padding-bottom: 6px; }
.s-day {
  border: 0; background: transparent; border-radius: 12px; padding: 4px 12px;
  font-family: var(--font-display);
  font-size: clamp(20px, 7cqw, 34px); font-weight: 700;
  display: inline-flex; align-items: baseline; gap: 10px;
}
.s-day small { font-size: .55em; color: var(--muted); font-weight: 600; }
.s-day:hover { background: var(--soft); }
.s-edit { position: absolute; right: -8px; top: 50%; transform: translateY(-50%); opacity: .5; }
.s-edit:hover { opacity: 1; }
.s-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.s-empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 18px; }
.s-row {
  flex: 1 1 0; min-height: 0; max-height: 118px;
  display: grid; grid-template-columns: minmax(48px, 17cqw) 1fr 36px; align-items: center; gap: 12px;
  border-top: 1px solid var(--line); padding: 4px 6px;
  border-radius: 12px;
}
.s-row:first-child { border-top-color: transparent; }
.s-row.current { background: var(--accent-soft); border-top-color: transparent; }
.s-row.current + .s-row { border-top-color: transparent; }
.s-ic { display: grid; place-items: center; height: 100%; min-height: 0; }
.subj-ic { font-family: 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: clamp(30px, 12cqw, 60px); line-height: 1; }
img.subj-ic, .subj-ic.sym { width: clamp(36px, 14cqw, 72px); height: clamp(36px, 14cqw, 72px); object-fit: contain; }
.s-name { font-size: clamp(18px, 6.2cqw, 30px); font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-bar-row { display: flex; align-items: center; gap: 10px; font-size: clamp(17px, 5.6cqw, 26px); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); margin-top: 4px; }
.s-bar { flex: 1; min-width: 24px; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.s-bar > div { height: 100%; background: var(--ink); border-radius: 4px; }
.s-row.current .s-bar > div { background: var(--accent); }
.s-check { font-size: 28px; color: var(--ink); }
.s-row.done { color: var(--ink-2); }

/* ---------- Widget: Uhr ---------- */
.w-clock { height: 100%; display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
.c-time { font-family: var(--font-display); font-size: min(58cqh, 24cqw); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.c-date { font-size: min(17cqh, 7cqw); color: var(--muted); font-weight: 600; margin-top: .3em; }
.c-date:empty { display: none; }

/* Dunkler Hintergrund (Tafelgrün): Bedienelemente bleiben hell */
.dark-bg ~ #topbar .board-name { background: var(--chip); }

/* ---------- Dialoge ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(17, 24, 39, .35);
  display: grid; place-items: center;
}
.modal {
  background: var(--panel); border-radius: 22px; box-shadow: 0 24px 80px rgba(0, 0, 0, .3);
  width: min(560px, 92vw); max-height: 90vh; display: flex; flex-direction: column;
}
.modal.wide { width: min(1100px, 94vw); height: min(820px, 90vh); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px 28px; }
.modal-head h2 { margin: 0; font-size: 26px; font-family: var(--font-display); }
.modal-body { padding: 10px 28px; overflow: auto; flex: 1; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 16px; color: var(--ink-2); }
.field input[type=text], .field input[type=number] {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font-size: 20px; color: var(--ink);
  user-select: text;
}
.field.inline { flex-direction: row; align-items: center; gap: 14px; }
.field.inline input[type=number] { width: 120px; }
.field.inline input[type=range] { width: 260px; }
.hint { color: var(--muted); font-size: 15px; }

/* Einstellungen */
.settings { display: grid; grid-template-columns: 250px 1fr; gap: 24px; height: 100%; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0; background: transparent; border-radius: 12px; padding: 14px 14px; font-size: 18px; font-weight: 600;
}
.tabs button .ic { font-size: 22px; }
.tabs button.active { background: var(--accent-soft); color: var(--accent); }
.tab-body { min-width: 0; }
.seg { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.seg button, .day-pick button {
  border: 1px solid var(--line-2); background: var(--panel); border-radius: 12px; padding: 10px 16px; font-size: 17px; font-weight: 600;
}
.seg button.active, .day-pick button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.plan-row, .subj-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.plan-row select {
  flex: 1; min-width: 0; font-size: 18px; padding: 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel);
}
.plan-row input[type=time] { font-size: 18px; padding: 8px; border: 1px solid var(--line-2); border-radius: 10px; }
.pr-ic { width: 48px; display: grid; place-items: center; }
.pr-ic .subj-ic { font-size: 34px; }
.pr-ic img.subj-ic, .pr-ic .subj-ic.sym { width: 40px; height: 40px; }
.add-row, .add-subj { margin-top: 14px; }
.subj-row input { flex: 1; font-size: 19px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; user-select: text; }
.icon-pick { width: 64px; height: 56px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); display: grid; place-items: center; }
.icon-pick .subj-ic { font-size: 34px; }
.icon-pick img.subj-ic, .icon-pick .subj-ic.sym { width: 42px; height: 42px; }
.icon-grid-wrap { width: 470px; }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 8px; }
.icon-grid button {
  border: 0; background: transparent; border-radius: 10px; height: 52px;
  font-size: 32px; font-family: 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.icon-grid button:hover { background: var(--soft); }
.file-btn { width: 100%; justify-content: center; }

.pen-test .pad {
  height: 220px; border: 2px dashed var(--line-2); border-radius: 16px; background: var(--soft);
  display: grid; place-items: center; touch-action: none; margin: 10px 0;
}
.pen-test .pad.erasing { background: #fee2e2; border-color: var(--danger); }
.pad-info { font-size: 17px; color: var(--ink-2); pointer-events: none; text-align: center; padding: 0 20px; }
.pen-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.pen-vals { margin: 12px 0; font-size: 18px; }

/* ---------- Startbildschirm ---------- */
.start {
  position: fixed; inset: 0; z-index: 100;
  background-color: var(--start-bg);
  background-image: radial-gradient(circle, var(--start-dots) 1.5px, transparent 1.9px);
  background-size: 28px 28px;
  overflow: auto;
}
.start-inner { max-width: 1500px; margin: 0 auto; padding: 50px 60px; }
.start-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.start-head h1 { font-family: var(--font-display); font-size: 52px; margin: 0; letter-spacing: -.5px; }
.start-actions { display: flex; gap: 12px; }
.start-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 30px; align-items: start; }
.card { background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); padding: 28px 32px; }
.card h2 { font-family: var(--font-display); margin: 0 0 6px; font-size: 30px; }
.muted { color: var(--muted); font-size: 17px; }
.day-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0 6px; }
.day-pick button { padding: 18px 4px; font-size: 18px; }
.nb-create { width: 100%; justify-content: center; margin-top: 8px; }
.board-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; max-height: 66vh; overflow: auto; }
.board-row { display: flex; align-items: center; gap: 8px; border-radius: 14px; }
.board-row:hover { background: var(--soft); }
.br-open {
  flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px; border-radius: 14px;
}
.br-name { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-meta { font-size: 15px; color: var(--muted); }

/* ---------- Hinweis ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px); opacity: 0;
  background: var(--ink); color: var(--on-accent); padding: 12px 22px; border-radius: 12px; font-size: 18px; z-index: 400;
  transition: all .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Symbol-Auswahl */
.ip-search { display: flex; gap: 10px; margin-bottom: 12px; }
.ip-search input { flex: 1; font-size: 20px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; user-select: text; }
.ip-search select { font-size: 17px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.ip-results { min-height: 200px; }
.icon-grid.img { grid-template-columns: repeat(10, 1fr); max-height: 460px; overflow: auto; }
.icon-grid.img button { height: 76px; }
.icon-grid.img img { width: 56px; height: 56px; }
.ip-file { padding: 30px 0; }
.ipick .seg button { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Widget: Lautstärke-Ampel ---------- */
.w-noise { height: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; gap: 10px 14px; }
.w-noise.nobar { grid-template-columns: 1fr; }
.w-noise.nobar .n-bar { display: none; }
.n-light {
  justify-self: center; height: 100%; aspect-ratio: 0.42; max-width: 100%;
  background: #1f2937; border-radius: 9999px / 22%; padding: 7% 9%;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
}
.lamp { height: 28%; aspect-ratio: 1; flex: none; border-radius: 50%; background: #374151; transition: background .25s, box-shadow .25s; }
[data-c=r] .lamp.r { background: #ef4444; box-shadow: 0 0 30px 6px rgba(239, 68, 68, .7); }
[data-c=y] .lamp.y { background: #facc15; box-shadow: 0 0 30px 6px rgba(250, 204, 21, .7); }
[data-c=g] .lamp.g { background: #22c55e; box-shadow: 0 0 30px 6px rgba(34, 197, 94, .7); }
.off .lamp { background: #374151 !important; box-shadow: none !important; }
.n-bar { position: relative; width: 22px; height: 100%; background: var(--line); border-radius: 11px; overflow: hidden; }
.n-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--ink-2); transition: height .08s linear; }
.n-bar .mk { position: absolute; left: 0; right: 0; height: 3px; }
.mk.y { background: #eab308; } .mk.r { background: #ef4444; }
.n-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.n-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-power { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; background: var(--soft); display: grid; place-items: center; font-size: 16px; color: #16a34a; }
.off .n-power { color: var(--muted); }
.noise-set p { margin-top: 0; }
.ns-meter { position: relative; height: 26px; background: var(--line); border-radius: 13px; overflow: hidden; margin: 14px 0; }
.ns-fill { height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }
.ns-meter .mk { position: absolute; top: 0; bottom: 0; width: 3px; }
.ns-row { display: flex; align-items: center; gap: 14px; }
.ns-l { width: 70px; }

/* ---------- Widget: Webseite ---------- */
.fw[data-type=web] .fw-content { padding: 0; }
.w-web { height: 100%; display: flex; flex-direction: column; }
.web-bar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--soft); flex: none; }
.web-bar .icon-btn { width: 42px; height: 42px; font-size: 20px; }
.web-title { flex: 1; min-width: 0; padding: 0 10px; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.web-body { flex: 1; min-height: 0; position: relative; }
.web-body webview, .web-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Vollbild im Widget: Leiste weg, Seite bis zum Rand; kleiner Knopf zum Beenden */
.w-web.fs .web-bar { display: none; }
.web-fs-exit {
  display: none; position: absolute; top: 8px; right: 8px; z-index: 5;
  align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px;
  border: 0; background: rgba(17, 24, 39, .55); color: #fff; font: 600 14px var(--font);
  opacity: .35; transition: opacity .2s; cursor: pointer;
}
.web-fs-exit svg { width: 18px; height: 18px; }
.w-web.fs .web-fs-exit { display: inline-flex; }
.w-web.fs:hover .web-fs-exit, .web-fs-exit:hover, .web-fs-exit:focus-visible { opacity: 1; }
.web-setup { padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; overflow: auto; height: 100%; }
.ws-row { display: flex; gap: 10px; }
.ws-row input { flex: 1; font-size: 20px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; user-select: text; }
.ws-quick { display: flex; flex-wrap: wrap; gap: 8px; }

/* Schutzfläche beim Verschieben/Größe ändern (liegt auch über Webseiten) */
.drag-shield { position: fixed; inset: 0; z-index: 1000; touch-action: none; }
body.fw-dragging webview, body.fw-dragging iframe { pointer-events: none; }

/* Timer: Kopfzeile mit Optionen-Knopf (Seitenleiste) */
.t-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t-head .w-title { flex: 1; min-width: 0; }
.t-opts { width: 40px; height: 40px; font-size: 20px; opacity: .55; flex: none; }
.t-opts:hover { opacity: 1; }
.t-opt-time { display: flex; align-items: center; gap: 10px; }
.t-opt-time input { width: 110px; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; font-size: 22px; color: var(--ink); user-select: text; }
.t-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- PDF-Widget ---------- */
.fw[data-type=pdf] .fw-content { padding: 0; }
.w-pdf { height: 100%; display: flex; flex-direction: column; }
.pdf-page { min-width: 64px; text-align: center; font-weight: 700; font-size: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pdf-body { flex: 1; min-height: 0; position: relative; background: var(--soft); }
.pdf-scroll { position: absolute; inset: 0; overflow: auto; display: grid; place-items: start center; padding: 8px; touch-action: pan-x pan-y; }
.pdf-scroll canvas { display: block; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); margin: auto; }
.pdf-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--ink-2); }
.pdf-msg[hidden], .pdf-scroll[hidden] { display: none; }

/* ---------- Einfügen ---------- */
#board.drop-target::after {
  content: 'Hier ablegen'; position: absolute; inset: 12px; z-index: 50; pointer-events: none;
  display: grid; place-items: center; font: 700 32px var(--font-display); color: var(--accent);
  border: 4px dashed var(--accent); border-radius: 24px; background: color-mix(in srgb, var(--accent) 8%, transparent);
}
label.menu-item { cursor: pointer; }
.menu-hint { margin: 6px 10px 2px; max-width: 300px; font-size: 13px; }
.pen-vals .warn, .warn { color: #b45309; background: #fef3c7; border-radius: 10px; padding: 8px 12px; margin: 8px 0 0; font-size: 15px; }
.store-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 14px 0; background: var(--soft); }
.store-box h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 18px; }
.store-box h3 svg { width: 22px; height: 22px; }
.store-path { word-break: break-all; margin: 4px 0 10px; }
.store-path .warn { display: block; }
.store-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }

/* ---------- Fach-Symbole (passend zum Design) ----------
   Standard = Symbole des klassischen Designs. Ein Theme kann sie in seiner theme.css
   mit eigenen Bildern überschreiben (gleiche data-sym-Namen). */
.subj-ic.sym { display: inline-block; background: center / contain no-repeat; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.sym-grid button { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font: 600 14px var(--font); color: var(--ink-2); }
.sym-grid button:hover { background: var(--soft); }
.sym-grid .subj-ic.sym { width: 64px; height: 64px; }
.subj-ic[data-sym=deutsch] { background-image: url('../themes/klassisch/symbole/deutsch.svg'); }
.subj-ic[data-sym=mathe] { background-image: url('../themes/klassisch/symbole/mathe.svg'); }
.subj-ic[data-sym=hsu] { background-image: url('../themes/klassisch/symbole/hsu.svg'); }
.subj-ic[data-sym=sport] { background-image: url('../themes/klassisch/symbole/sport.svg'); }
.subj-ic[data-sym=werken] { background-image: url('../themes/klassisch/symbole/werken.svg'); }
.subj-ic[data-sym=kunst] { background-image: url('../themes/klassisch/symbole/kunst.svg'); }
.subj-ic[data-sym=musik] { background-image: url('../themes/klassisch/symbole/musik.svg'); }
.subj-ic[data-sym=englisch] { background-image: url('../themes/klassisch/symbole/englisch.svg'); }
.subj-ic[data-sym=religion] { background-image: url('../themes/klassisch/symbole/religion.svg'); }
.subj-ic[data-sym=lesen] { background-image: url('../themes/klassisch/symbole/lesen.svg'); }
.subj-ic[data-sym=computer] { background-image: url('../themes/klassisch/symbole/computer.svg'); }
.subj-ic[data-sym=pause] { background-image: url('../themes/klassisch/symbole/pause.svg'); }
.subj-ic[data-sym=klassenrat] { background-image: url('../themes/klassisch/symbole/klassenrat.svg'); }
.subj-ic[data-sym=stern] { background-image: url('../themes/klassisch/symbole/stern.svg'); }

/* ---------- Widget: Rätsel des Tages ---------- */
.field.check input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; }
.field textarea { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 20px; color: var(--ink); resize: vertical; user-select: text; }
.fw[data-type=raetsel] { background: transparent; border-color: transparent; box-shadow: none; }
.fw[data-type=raetsel] .fw-content { padding: 0; overflow: visible; }
.w-raetsel {
  height: 100%; display: grid; grid-template-rows: auto 1fr auto;
  padding: 1cqh 3.5cqw 1.5cqh;
  --wood: #a9774f; --wood-2: #c79a6c; --slate: #3e525b; --chalk: #f4f1e8;
}
.w-raetsel.drop .r-slate { outline: 5px dashed var(--chalk); outline-offset: -14px; }
.r-title {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  font-size: min(8.5cqh, 5.4cqw); line-height: 1.1; color: var(--ink);
  transform: rotate(-2.5deg); transform-origin: left bottom; margin: 0 0 -.15em 1cqw; position: relative; z-index: 1;
}
.w-raetsel.no-title .r-title { display: none; }
.r-board {
  position: relative; min-height: 0; transform: rotate(-2.5deg);
  border-radius: 1.2cqw; padding: max(10px, 2.2cqw);
  background: linear-gradient(135deg, var(--wood-2), var(--wood) 45%, #8d5e3b);
  box-shadow: 0 1.5cqh 3cqh rgba(0, 0, 0, .28), inset 0 0 0 2px rgba(255, 255, 255, .18), inset 0 0 1.2cqw rgba(0, 0, 0, .25);
}
.r-slate {
  position: relative; height: 100%; overflow: hidden; border-radius: .4cqw;
  background: radial-gradient(ellipse at 35% 30%, #4a6069, var(--slate) 70%);
  box-shadow: inset 0 0 2cqw rgba(0, 0, 0, .45);
  display: grid; place-items: center; color: var(--chalk);
}
.r-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.fw.active .r-img { cursor: grab; }
.r-text {
  padding: 4cqh 6cqw; text-align: center; font-weight: 600; line-height: 1.3;
  font-size: min(9cqh, 5.6cqw); text-shadow: 0 0 1px rgba(255, 255, 255, .6); opacity: .95;
}
.r-empty { text-align: center; padding: 20px; }
.r-empty p { margin: 0 0 18px; font-size: min(6cqh, 3.6cqw); font-weight: 700; opacity: .9; }
.r-empty small { font-size: .65em; font-weight: 600; opacity: .8; }
.r-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.r-empty .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: var(--chalk); }
.r-empty .btn:hover { background: rgba(255, 255, 255, .22); }
.r-chalk {
  position: absolute; right: 7%; bottom: max(3px, .6cqw); width: 9%; height: max(8px, 1.5cqw); border-radius: 3px;
  background: linear-gradient(#ffffff, #dcdcdc); transform: rotate(-14deg); box-shadow: 0 2px 3px rgba(0, 0, 0, .3);
}
.r-chalk.c2 { right: 6%; bottom: max(1px, .1cqw); width: 8%; background: linear-gradient(#f7c6c0, #e8a39a); transform: rotate(-4deg); }
.r-solution {
  position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%); max-width: 90%;
  background: rgba(30, 41, 46, .92); border: 2px dashed rgba(244, 241, 232, .6); border-radius: 14px;
  padding: 1.2cqh 3cqw; text-align: center; font-size: min(7cqh, 4.4cqw); font-weight: 700; color: #fde68a;
}
.r-solution small { display: block; font-size: .45em; letter-spacing: .1em; text-transform: uppercase; color: var(--chalk); opacity: .75; }
.r-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 2.2cqh; transform: rotate(-2.5deg); }
.r-caption { font-family: var(--font-display); font-weight: 700; font-size: min(4.6cqh, 2.9cqw); color: var(--ink); }
.r-caption:empty { display: none; }
.r-sol-btn { border: 2px solid var(--ink); background: var(--panel); border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: 16px; }
.r-sol-btn[hidden] { display: none; }
.r-settings .r-set-img { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.r-settings .r-btns { justify-content: flex-start; }
.r-settings .r-fit { margin-top: 4px; }

/* ---------- Web-Version: Tafel-Ordner wählen/freigeben ---------- */
.web-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--soft, #f3f3f7); }
.web-gate-box { max-width: 640px; padding: 40px 48px; border-radius: 20px; background: var(--panel, #fff); box-shadow: 0 10px 40px rgba(0,0,0,.15); display: flex; flex-direction: column; gap: 16px; text-align: center; font-size: 20px; }
.web-gate-box h1 { margin: 0; font-family: var(--font-display, inherit); font-size: 40px; }
.web-gate-box p { margin: 0; line-height: 1.45; }
.web-gate-box .hint { font-size: 15px; opacity: .75; }
