/* =========================================================
   stundenplan. — Glas-Design
   Ruhige, fast farblose Oberfläche. Die einzige laute Farbe
   ist --accent (Limette) und gehört den Tests.
   ========================================================= */

:root {
  --bg: #e9e7e2;
  --glow-1: rgb(118 108 255 / 0.45);
  --glow-2: rgb(0 200 175 / 0.32);
  --glow-3: rgb(255 180 120 / 0.40);
  --glow-4: rgb(255 130 185 / 0.38);
  --glass: rgb(255 255 255 / 0.30);
  --glass-strong: rgb(255 255 255 / 0.62);
  --glass-border: rgb(255 255 255 / 0.65);
  --glass-edge: rgb(0 0 0 / 0.07);
  --glass-hi: rgb(255 255 255 / 0.85);
  --rim: linear-gradient(140deg, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0.25) 35%, transparent 60%, rgb(0 0 0 / 0.12));
  --glare: rgb(255 255 255 / 0.8);
  --glare-blend: normal;
  --text: #111214;
  --muted: rgb(17 18 20 / 0.56);
  --faint: rgb(17 18 20 / 0.28);
  --line: rgb(17 18 20 / 0.08);
  --invert-bg: #111214;
  --invert-text: #f4f3ee;
  --accent: #c9f53b;
  --accent-ink: #111214;
  --accent-text: #557200;
  --accent-glow: rgb(170 220 20 / 0.45);
  --danger: #d9473b;
  --warn: #c98200;
  --ok: #2f8f5b;
  --figure: #111214;
  --floor: #4d7a12;
  --shadow: 0 1px 1px rgb(0 0 0 / 0.04), 0 12px 40px -12px rgb(30 30 60 / 0.18);
  --dot-s: 45%;
  --dot-l: 52%;
  --radius: 16px;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07080a;
    --glow-1: rgb(98 92 255 / 0.20);
    --glow-2: rgb(0 190 160 / 0.10);
    --glow-3: rgb(200 255 60 / 0.07);
    --glow-4: rgb(255 90 160 / 0.08);
    --rim: linear-gradient(140deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0.05) 35%, transparent 60%, rgb(255 255 255 / 0.22));
    --glare: rgb(255 255 255 / 0.32);
    --glare-blend: overlay;
    --glass: rgb(255 255 255 / 0.04);
    --glass-strong: rgb(22 23 28 / 0.72);
    --glass-border: rgb(255 255 255 / 0.08);
    --glass-edge: rgb(0 0 0 / 0.4);
    --glass-hi: rgb(255 255 255 / 0.07);
    --text: #f2f1ec;
    --muted: rgb(242 241 236 / 0.55);
    --faint: rgb(242 241 236 / 0.25);
    --line: rgb(255 255 255 / 0.07);
    --invert-bg: #f2f1ec;
    --invert-text: #0a0b0d;
    --accent: #d4ff3a;
    --accent-text: #d4ff3a;
    --accent-glow: rgb(212 255 58 / 0.35);
    --danger: #ff6b5e;
    --warn: #ffb547;
    --ok: #5fd68f;
    --figure: #f4f3ee;
    --floor: #a6d63a;
    --shadow: 0 1px 1px rgb(0 0 0 / 0.3), 0 20px 50px -20px rgb(0 0 0 / 0.7);
    --dot-s: 55%;
    --dot-l: 64%;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #07080a;
  --glow-1: rgb(98 92 255 / 0.20);
  --glow-2: rgb(0 190 160 / 0.10);
  --glow-3: rgb(200 255 60 / 0.07);
  --glow-4: rgb(255 90 160 / 0.08);
  --rim: linear-gradient(140deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0.05) 35%, transparent 60%, rgb(255 255 255 / 0.22));
  --glare: rgb(255 255 255 / 0.32);
  --glare-blend: overlay;
  --glass: rgb(255 255 255 / 0.04);
  --glass-strong: rgb(22 23 28 / 0.72);
  --glass-border: rgb(255 255 255 / 0.08);
  --glass-edge: rgb(0 0 0 / 0.4);
  --glass-hi: rgb(255 255 255 / 0.07);
  --text: #f2f1ec;
  --muted: rgb(242 241 236 / 0.55);
  --faint: rgb(242 241 236 / 0.25);
  --line: rgb(255 255 255 / 0.07);
  --invert-bg: #f2f1ec;
  --invert-text: #0a0b0d;
  --accent: #d4ff3a;
  --accent-text: #d4ff3a;
  --accent-glow: rgb(212 255 58 / 0.35);
  --danger: #ff6b5e;
  --warn: #ffb547;
  --ok: #5fd68f;
  --figure: #f4f3ee;
  --floor: #a6d63a;
  --shadow: 0 1px 1px rgb(0 0 0 / 0.3), 0 20px 50px -20px rgb(0 0 0 / 0.7);
  --dot-s: 55%;
  --dot-l: 64%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
  font: 500 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Farbverläufe und feines Korn hinter dem Glas */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -2;
  background: var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }
.muted { color: var(--muted); }

h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.025em; }

/* ---------- Glas ---------- */

.card, .sidebar, dialog, .picker, .week-nav, .results {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), var(--shadow);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: url(#liquid) blur(22px) saturate(160%);
}
.card { border-radius: 22px; }

/* ---------- Buttons & Felder ---------- */

.btn {
  font: 600 14px var(--font);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s, border-color 0.15s;
}
.btn:hover { background: var(--glass-hi); border-color: var(--faint); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--invert-bg); color: var(--invert-text); border-color: transparent; }
.btn.primary:hover { opacity: 0.88; }
.btn.primary:disabled { opacity: 0.5; cursor: wait; }
.btn.ghost { background: transparent; }
.btn.icon { width: 38px; height: 38px; padding: 0; font-size: 18px; line-height: 1; flex: none; }

.wordmark {
  font: 700 22px/1 var(--display);
  letter-spacing: -0.05em;
}
.wordmark span { color: var(--accent-text); }
.wordmark.big { font-size: 34px; }

/* ---------- Login ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 28px;
}
.login-card h1 { margin: 18px 0 0; font-size: 28px; }
.login-card p { margin: 0; }
.login-card .btn.primary { padding: 13px; font-size: 15px; margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 7px; position: relative; }
.field span { font: 700 11px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.field input, .search {
  font: 500 15px var(--font);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .search:focus { border-color: var(--text); box-shadow: 0 0 0 4px var(--line); }

.results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--glass-strong);
  border-radius: 16px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 10;
}
.results li { padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.results li:hover, .results li.active { background: var(--line); }
.results li small { display: block; color: var(--muted); }
.results li.empty { cursor: default; color: var(--muted); }

.error {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
}
.hint { font-size: 12px; color: var(--muted); text-align: center; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }


/* ---------- App-Rahmen ---------- */

.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  margin: 14px 0 14px 14px;
  border-radius: 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 16px 16px;
  z-index: 30;
}
.sb-head { padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }
.sb-school span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.year-pill {
  align-self: flex-start;
  margin-left: 10px;
  font: 700 11px var(--mono);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; position: relative; }
.nav-blob {
  position: absolute;
  left: 0; right: 0; top: 0;
  border-radius: 14px;
  background: var(--invert-bg);
  box-shadow: 0 8px 24px -8px rgb(0 0 0 / 0.35);
  transition: transform 0.55s cubic-bezier(.34, 1.4, .5, 1), height 0.4s;
  z-index: 0;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--line); color: var(--text); }
.nav a { position: relative; z-index: 1; }
.nav a.active, .nav a.active:hover { background: transparent; color: var(--invert-text); }
.nav svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.sb-foot { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font: 700 14px var(--display);
  background: var(--invert-bg);
  color: var(--invert-text);
}
.sb-actions { display: flex; gap: 6px; }
.sb-actions .ghost { flex: 1; }

.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.35); backdrop-filter: blur(4px); z-index: 25; }
.menu-btn { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 28px 14px;
  flex-wrap: wrap;
  background: linear-gradient(var(--bg) 40%, transparent);
}
.topbar h1 { margin: 0; font-size: 30px; font-weight: 700; }
.view-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.week-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; }
.week-nav .btn { border-color: transparent; background: transparent; }
.week-nav .btn:hover { background: var(--line); }
.week-label { font: 700 12.5px var(--mono); padding: 0 12px 0 6px; white-space: nowrap; color: var(--muted); }

.view { padding: 8px 28px 32px; width: 100%; max-width: 1360px; }

.status { text-align: center; padding: 56px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Fach-Punkt (die einzige Fachfarbe) ---------- */

.sdot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 2px;
  background: hsl(var(--h, 0) var(--dot-s) var(--dot-l));
  flex: none;
}

/* ---------- Stundenplan-Raster ---------- */

.timetable { display: grid; gap: 6px; }

.day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 10px;
  border-radius: 16px;
  position: sticky;
  top: 78px;
  z-index: 4;
}
.day-head small { font: 700 11px var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.day-head b { font: 600 24px/1.1 var(--display); letter-spacing: -0.03em; }
.day-head.today { background: var(--invert-bg); color: var(--invert-text); }
.day-head.today small { color: inherit; opacity: 0.6; }

.time-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding-right: 8px;
  font: 500 10.5px/1.35 var(--mono);
  color: var(--faint);
}
.time-cell b { font: 600 16px var(--display); color: var(--muted); }

.slot { display: flex; gap: 5px; min-height: 64px; min-width: 0; }
.empty-slot { border-radius: var(--radius); border: 1px dashed var(--line); }

.now-line, .now-time { position: relative; pointer-events: none; z-index: 3; }
.now-line span { position: absolute; left: -2px; right: 0; height: 1.5px; background: var(--text); transform: translateY(-1px); }
.now-line span::before {
  content: "";
  position: absolute;
  left: -4px; top: -3.5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text);
}
.now-time span {
  position: absolute;
  right: 4px;
  transform: translateY(-50%);
  background: var(--invert-bg);
  color: var(--invert-text);
  font: 700 10.5px var(--mono);
  padding: 2px 6px;
  border-radius: 6px;
}

.lesson {
  flex: 1;
  min-width: 0;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  position: relative;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.lesson:hover { transform: translateY(-1px); background: var(--glass-hi); }
.lesson .subject { font: 600 14.5px var(--display); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .meta { font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lesson.now { box-shadow: inset 0 0 0 1.5px var(--text), 0 0 0 1px var(--glass-edge); }

.badge {
  align-self: flex-start;
  font: 700 9.5px var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 3px;
  border: 1px solid currentColor;
}

.lesson.cancelled { opacity: 0.55; background: transparent; box-shadow: none; border-style: dashed; border-color: var(--faint); }
.lesson.cancelled .subject { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.lesson.cancelled .badge { color: var(--danger); }

.lesson.irregular { box-shadow: inset 3px 0 0 var(--warn), inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge); }
.lesson.irregular .badge { color: var(--warn); }

.changed { color: var(--warn); font-weight: 700; }

.holiday {
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  font: 600 14px var(--display);
  color: var(--muted);
  border: 1px dashed var(--line);
  background: repeating-linear-gradient(135deg, transparent 0 12px, var(--line) 12px 13px);
}

.tt-status { padding: 8px 0; }

/* ---------- Tests: die einzige laute Farbe ---------- */

.lesson.exam {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  padding-right: 60px;
  box-shadow: 0 0 0 1px var(--accent), 0 10px 30px -8px var(--accent-glow);
}
.lesson.exam:hover { background: var(--accent); filter: brightness(1.04); }
.lesson.exam .meta, .lesson.exam .note { color: rgb(17 18 20 / 0.62); }
.lesson.exam .badge { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.lesson.exam .sdot { background: var(--accent-ink); }
.lesson.exam .figure, .exam-mini.urgent .figure { color: var(--accent-ink); --floor: var(--accent-ink); }
.exam-text { color: var(--accent-text); }

/* ---------- Strichmännchen ---------- */

.figure {
  position: absolute;
  right: 4px;
  bottom: 2px;
  width: 52px;
  height: 52px;
  color: var(--figure);
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  flex: none;
}
.figure.static { position: relative; right: auto; bottom: auto; cursor: default; display: inline-block; }
.figure.mid { width: 76px; height: 76px; }
.figure.big { width: 120px; height: 120px; position: relative; right: auto; bottom: auto; display: inline-block; }
.figure:not(.static):hover { background: rgb(128 128 128 / 0.12); }
.figure:focus-visible { box-shadow: 0 0 0 2px currentColor; }
.figure svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.figure .head, .figure .note { fill: currentColor; stroke: none; }
.figure .floor { stroke: var(--floor); stroke-width: 1.6; }
.figure .prop { stroke-width: 1.5; }
.figure .book { fill: currentColor; fill-opacity: 0.12; }
.figure .cloud { fill: currentColor; stroke: none; opacity: 0.45; }
.figure .rain, .figure .drops { stroke-width: 1.3; opacity: 0.55; }
.figure .rain { animation: rain 1s linear infinite; }
.figure .scribble { stroke-width: 1.3; opacity: 0.6; animation: shake 0.4s steps(2) infinite; }
.figure .zzz { stroke-width: 1.4; opacity: 0.6; animation: float 2.5s ease-in-out infinite; }
.figure .sad { animation: sigh 3s ease-in-out infinite; transform-origin: 50% 100%; }
.figure .happy { opacity: 0; }
.figure .spark { stroke-width: 1.5; }
.figure .happy .spark, .figure .happy .note { stroke: var(--floor); fill: var(--floor); }
.figure .happy .spark { fill: none; }

.figure.cheering .sad { opacity: 0; animation: none; }
.figure.cheering .happy { opacity: 1; animation: jump 0.5s ease-in-out 4 alternate; }

@keyframes sigh { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.95); } }
@keyframes rain { from { transform: translateY(-1px); opacity: 0.6; } to { transform: translateY(2px); opacity: 0; } }
@keyframes jump { from { transform: translateY(0); } to { transform: translateY(-5px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes shake { from { transform: translateX(-0.4px); } to { transform: translateX(0.4px); } }

.bubble {
  --tail: 50%;
  position: absolute;
  z-index: 40;
  max-width: 250px;
  padding: 11px 15px;
  border-radius: 18px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font: 700 14px/1.35 var(--font);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.bubble::after {
  content: "";
  position: absolute;
  left: var(--tail);
  bottom: -7px;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top-color: var(--invert-bg);
}
.bubble.pop { animation: pop 0.25s cubic-bezier(.3, 1.6, .6, 1); transform-origin: var(--tail) 100%; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .figure *, .bubble.pop { animation: none !important; }
}

/* ---------- Heute & Übersicht ---------- */

.hero { margin-bottom: 22px; }
.hero h2 { margin: 0; font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -0.04em; }
.hero p { margin: 6px 0 0; font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.panel { padding: 22px; }
.panel h3 { margin: 0 0 14px; font: 700 11px var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.dash .wide { grid-column: span 2; }
.more { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--muted); }
.more:hover { color: var(--text); }

.next-card { min-height: 170px; position: relative; }
.eyebrow { margin: 0; font: 700 11.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.big-subject { margin: 10px 0 4px; font: 700 34px/1.1 var(--display); letter-spacing: -0.035em; }
.big-subject .sdot { width: 11px; height: 11px; vertical-align: 6px; margin-right: 12px; }
.big-note { font: 700 24px var(--display); letter-spacing: -0.03em; margin: 8px 0; }
.next-card .figure.big { position: absolute; right: 14px; bottom: 10px; width: 92px; height: 92px; }

.day-list { display: flex; flex-direction: column; gap: 8px; }
.row-lesson { flex-direction: row; align-items: center; gap: 16px; width: 100%; padding: 12px 14px; }
.row-lesson .row-time { font: 700 13px/1.3 var(--mono); width: 48px; flex: none; }
.row-lesson .row-time small { color: var(--muted); font-weight: 500; }
.lesson.exam .row-time small { color: rgb(17 18 20 / 0.6); }
.row-lesson .row-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }

.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  position: relative;
  min-height: 56px;
}
.mini-date { display: flex; flex-direction: column; width: 70px; flex: none; }
.mini-date b { font: 700 15px var(--display); }
.mini-date small, .mini-main small { color: var(--muted); font-size: 12px; }
.mini-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.mini-main b::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  background: hsl(var(--h, 0) var(--dot-s) var(--dot-l));
}
.mini-main small { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.exam-mini .mini-date b { color: var(--accent-text); }
.exam-mini.urgent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  padding-right: 58px;
  box-shadow: 0 10px 30px -10px var(--accent-glow);
}
.exam-mini.urgent .mini-date b { color: inherit; }
.exam-mini.urgent small { color: rgb(17 18 20 / 0.62); }
.exam-mini.urgent .mini-main b::before { background: var(--accent-ink); }

.empty-mini { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.empty-mini .figure { width: 64px; height: 64px; }

.news { padding: 12px 0; border-top: 1px solid var(--line); }
.news:first-of-type { border-top: 0; padding-top: 0; }
.news b { font-family: var(--display); }
.news p { margin: 4px 0 0; white-space: pre-wrap; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); transition: transform 0.12s; }
a.stat:hover { transform: translateY(-2px); }
.stat-value { font: 700 42px/1 var(--display); letter-spacing: -0.04em; }
.stat-label { color: var(--muted); font: 700 11px var(--font); letter-spacing: 0.1em; text-transform: uppercase; }
.stat.danger .stat-value { color: var(--danger); }
.stat.warn .stat-value { color: var(--warn); }
.stat.exam { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 14px 40px -12px var(--accent-glow); }
.stat.exam .stat-label { color: rgb(17 18 20 / 0.62); }

.tag {
  display: inline-block;
  font: 700 9.5px var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--faint);
  color: var(--muted);
  vertical-align: middle;
  margin-left: 6px;
}
.tag.cancelled { color: var(--danger); border-color: currentColor; }
.tag.irregular { color: var(--warn); border-color: currentColor; }
.tag.ok { color: var(--ok); border-color: currentColor; }
.tag:empty { display: none; }

/* ---------- Mitteilungen ---------- */

.msg-list { display: flex; flex-direction: column; }
.msg {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 14px 8px;
  cursor: pointer;
  border-radius: 14px;
}
.msg:first-child { border-top: 0; }
.msg:hover { background: var(--line); }
.msg-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 3px; }
.msg-top { display: flex; justify-content: space-between; gap: 8px; }
.msg-top small { color: var(--muted); white-space: nowrap; font: 500 11px var(--mono); }
.msg-subject { font-weight: 500; }
.msg.unread .msg-subject { font-weight: 800; }
.msg.unread .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.msg-preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-body { white-space: pre-wrap; margin: 16px 0; max-height: 60vh; overflow-y: auto; }

/* ---------- Hausaufgaben & Prüfungen ---------- */

.group { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; font: 700 11px var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.group:first-child { margin-top: 0; }
.count { font: 700 11px var(--mono); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); letter-spacing: 0; }

.hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.hw { padding: 18px 20px; }
.hw-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hw-top b { font: 700 15px var(--display); }
.hw-top b::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 2px;
  background: hsl(var(--h, 0) var(--dot-s) var(--dot-l));
}
.hw-top .tag { margin: 0; }
.hw p { margin: 10px 0; white-space: pre-wrap; }

.exam-list { display: flex; flex-direction: column; gap: 10px; }
.exam-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  padding-right: 104px;
  position: relative;
  min-height: 96px;
}
.exam-card.past { opacity: 0.6; padding-right: 18px; min-height: 0; }
.exam-date {
  width: 60px; flex: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 26px -10px var(--accent-glow);
}
.exam-card.past .exam-date { background: var(--line); color: var(--muted); box-shadow: none; }
.exam-date b { font: 700 24px/1.1 var(--display); }
.exam-date span { font: 700 10px var(--font); letter-spacing: 0.12em; text-transform: uppercase; }
.exam-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.exam-main > b { font: 700 18px var(--display); letter-spacing: -0.02em; }
.exam-main small.muted { font: 500 11.5px var(--mono); }
.exam-card .badge { color: var(--accent-text); }
.exam-card.past .badge { color: var(--muted); }
.exam-card .figure { right: 14px; bottom: 10px; }

/* ---------- Weitere Stundenpläne ---------- */

.picker { padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; border-radius: 22px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--line); border-radius: 999px; align-self: flex-start; flex-wrap: wrap; }
.seg button {
  font: 700 13px var(--font);
  border: 0; background: none; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.seg button.active { background: var(--invert-bg); color: var(--invert-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 164px; overflow-y: auto; }
.chip {
  font: 700 12px var(--mono);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
}
.chip:hover { border-color: var(--text); }
.chip.active { background: var(--invert-bg); color: var(--invert-text); border-color: transparent; }
.sub-title { margin: 0 0 14px; font-size: 22px; }
.sub-title:empty { display: none; }

/* ---------- Unbekannte Bereiche ---------- */

.generic { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font: 700 10.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; padding-top: 3px; }
.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Detail-Dialog ---------- */

dialog {
  background: var(--glass-strong);
  color: var(--text);
  border-radius: 26px;
  padding: 28px;
  width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: rgb(0 0 0 / 0.35); backdrop-filter: blur(6px); }
dialog h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 12px; font-size: 26px; }
dialog h2 .dot { width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--h) var(--dot-s) var(--dot-l)); flex: none; }
dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 22px 0; }
dialog dt { color: var(--muted); font: 700 10.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; padding-top: 3px; }
dialog dd { margin: 0; }
dialog form { text-align: right; }

/* ---------- Mobil ---------- */

.day-tabs { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 286px;
    height: auto;
    margin: 10px;
    background: var(--glass-strong);
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.25s cubic-bezier(.2, .8, .2, 1);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block; }
  .dash .wide { grid-column: 1 / -1; }
}

/* =========================================================
   Liquid Glass: Bewegung, Lichtbrechung, Reflexe
   ========================================================= */

.defs { position: absolute; width: 0; height: 0; }

/* Langsam fließende Farbblasen hinter allem Glas */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute;
  width: 62vmax; height: 62vmax;
  border-radius: 46% 54% 58% 42% / 44% 50% 50% 56%;
  filter: blur(70px);
  will-change: transform;
}
.aurora i:nth-child(1) { background: var(--glow-1); left: -18vmax; top: -22vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: var(--glow-2); right: -20vmax; top: -10vmax; animation: drift-b 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: var(--glow-3); left: 25vw; bottom: -30vmax; animation: drift-c 38s ease-in-out infinite alternate; }
.aurora i:nth-child(4) { background: var(--glow-4); right: 5vw; bottom: -15vmax; width: 45vmax; height: 45vmax; animation: drift-d 30s ease-in-out infinite alternate; }
@keyframes drift-d { to { transform: translate(-30vw, -40vh) rotate(-70deg) scale(1.25); border-radius: 60% 40% 45% 55%; } }
@keyframes drift-a { to { transform: translate(22vw, 18vh) rotate(60deg) scale(1.15); border-radius: 58% 42% 46% 54%; } }
@keyframes drift-b { to { transform: translate(-26vw, 30vh) rotate(-50deg) scale(0.9); border-radius: 40% 60% 52% 48%; } }
@keyframes drift-c { to { transform: translate(-18vw, -26vh) rotate(80deg) scale(1.2); border-radius: 52% 48% 40% 60%; } }

/* Leuchtende Glaskante: heller oben links, dunkler unten rechts */
.card, .week-nav, .lesson { position: relative; }
.card::before, .sidebar::before, .week-nav::before, .lesson::before, dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.lesson.cancelled::before { display: none; }

/* Reflex, der dem Zeiger folgt */
.card, .lesson, .btn, .mini, .chip, .nav a, .day-tabs button, .msg { position: relative; }
:is(.card, .lesson, .btn, .mini, .chip, .nav a, .day-tabs button, .msg)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, -40%), var(--glare), transparent 65%);
  mix-blend-mode: var(--glare-blend);
  opacity: 0;
  transition: opacity 0.35s;
}
:is(.card, .lesson, .btn, .mini, .chip, .nav a, .day-tabs button, .msg):hover::after { opacity: 1; }
.lesson.exam::after { background: radial-gradient(180px circle at var(--mx, 50%) var(--my, -40%), rgb(255 255 255 / 0.7), transparent 65%); }

/* Federnde, „flüssige“ Interaktionen */
.btn, .lesson, .chip, .mini, .stat, .seg button, .day-tabs button, .msg, a.stat {
  transition: transform 0.45s cubic-bezier(.34, 1.56, .64, 1), background 0.2s, box-shadow 0.3s, opacity 0.2s;
}
.lesson:hover { transform: translateY(-2px) scale(1.012); }
.lesson:active, .btn:active, .chip:active, .mini:active, .day-tabs button:active, .seg button:active { transform: scale(0.95); transition-duration: 0.12s; }
a.stat:hover, .mini:hover { transform: translateY(-2px); }
.lesson.exam { animation: exam-glow 3.5s ease-in-out infinite; }
@keyframes exam-glow {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), 0 10px 30px -8px var(--accent-glow); }
  50% { box-shadow: 0 0 0 1px var(--accent), 0 14px 42px -6px var(--accent-glow); }
}

/* Ansichten gleiten herein, Karten nacheinander */
.view-box.enter > *, .view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > * {
  animation: rise 0.7s cubic-bezier(.2, .9, .25, 1.05) both;
}
.view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > :nth-child(2) { animation-delay: 0.05s; }
.view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > :nth-child(3) { animation-delay: 0.1s; }
.view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > :nth-child(4) { animation-delay: 0.15s; }
.view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > :nth-child(5) { animation-delay: 0.2s; }
.view-box.enter :is(.dash, .stats, .exam-list, .hw-grid, .mini-list, .generic, .day-list) > :nth-child(n+6) { animation-delay: 0.25s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); filter: blur(8px); } }

/* Wochenwechsel: Tage wischen spaltenweise in Blätterrichtung herein */
.tt-wrap[data-anim] .timetable > [data-day], .tt-wrap[data-anim] .day-head {
  animation: var(--tt-anim) 0.6s cubic-bezier(.2, .9, .25, 1.05) both;
  animation-delay: calc(var(--c, 0) * 45ms);
}
.tt-wrap[data-anim="next"] { --tt-anim: tt-next; }
.tt-wrap[data-anim="prev"] { --tt-anim: tt-prev; }
.tt-wrap[data-anim="fade"] { --tt-anim: rise; }
@keyframes tt-next { from { opacity: 0; transform: translateX(40px) scale(0.97); filter: blur(10px); } }
@keyframes tt-prev { from { opacity: 0; transform: translateX(-40px) scale(0.97); filter: blur(10px); } }

/* Dialog und Seitenleiste am Handy kommen „flüssig“ */
dialog[open] { animation: dlg-in 0.5s cubic-bezier(.34, 1.4, .5, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(0.94); filter: blur(6px); } }

@media (prefers-reduced-motion: reduce) {
  .aurora i, .lesson.exam, .view-box.enter *, .tt-wrap[data-anim] *, dialog[open] { animation: none !important; }
}

/* =========================================================
   Handy-Modus (html.mobile wird per JS automatisch gesetzt)
   ========================================================= */

.tabbar, .sheet, .me-btn { display: none; }

.mobile body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
.mobile .shell { grid-template-columns: minmax(0, 1fr); }
.mobile .sidebar, .mobile .menu-btn { display: none; }

/* Kopfzeile: großer Titel, rechts das Profil */
.mobile .topbar { padding: calc(14px + env(safe-area-inset-top)) 16px 10px; gap: 10px; }
.mobile .topbar h1 { font-size: 30px; flex: 1; min-width: 0; }
.mobile .me-btn { display: grid; border: 0; cursor: pointer; width: 38px; height: 38px; font-size: 15px; }
.mobile .view-tools { width: 100%; margin: 0; }
.mobile .week-nav { width: 100%; justify-content: space-between; }
.mobile .week-label { font-size: 10.5px; padding: 0 10px 0 0; min-width: 0; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; }

/* Inhalt: eine Spalte, Platz für die Tab-Leiste unten */
.mobile .view { padding: 4px 14px calc(108px + env(safe-area-inset-bottom)); }
.mobile .dash, .mobile .hw-grid, .mobile .generic { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.mobile .dash .wide { grid-column: auto; }
.mobile .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mobile .stat { padding: 16px; }
.mobile .stat-value { font-size: 34px; }
.mobile .panel { padding: 18px; }
.mobile .hero { margin-bottom: 16px; }
.mobile .hero h2 { font-size: 32px; }
.mobile .big-subject { font-size: 30px; }
.mobile .seg { align-self: stretch; }
.mobile .seg button { flex: 1; padding: 9px 10px; }
.mobile .exam-card:not(.past) { padding-right: 18px; padding-bottom: 88px; }

/* Stundenplan: ein Tag, wischbar */
.mobile .tt-wrap { touch-action: pan-y; }
.mobile .day-tabs { display: flex; gap: 6px; padding-bottom: 12px; }
.mobile .day-tabs button {
  flex: 1;
  font: 700 10.5px var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 0;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--muted);
  cursor: pointer;
  min-width: 0;
}
.mobile .day-tabs button small { display: block; font: 600 19px var(--display); letter-spacing: -0.02em; color: var(--text); }
.mobile .day-tabs button.active { background: var(--invert-bg); color: var(--invert-text); border-color: transparent; transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.5); }
.mobile .day-tabs button.active small { color: inherit; }
.mobile .day-tabs button.today:not(.active) { border-color: var(--text); }

.mobile .timetable { grid-template-columns: 50px 1fr !important; gap: 7px; }
.mobile .timetable > [data-day]:not(.active-day) { display: none; }
.mobile .timetable > [data-day] { grid-column: 2 !important; }
.mobile .day-head { display: none; }
.mobile .slot { min-height: 70px; }
.mobile .lesson { padding: 12px 14px; }
.mobile .lesson .subject { font-size: 16px; }
.mobile .lesson .meta { font-size: 11.5px; }
.mobile .tt-wrap[data-anim] .timetable > [data-day] { animation-delay: 0s; animation-duration: 0.45s; }

/* Schwebende Tab-Leiste aus Glas */
.mobile .tabbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  height: 66px;
  padding: 6px;
  border-radius: 30px;
  z-index: 20;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), 0 20px 44px -14px rgb(0 0 0 / 0.45);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: url(#liquid) blur(20px) saturate(170%);
}
.mobile .tabbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 700 10.5px var(--font);
  text-decoration: none;
  border-radius: 24px;
  cursor: pointer;
  transition: color 0.25s, transform 0.45s cubic-bezier(.34, 1.56, .64, 1);
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--invert-text); }
.tab:active { transform: scale(0.88); }
.tab-blob {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  border-radius: 24px;
  background: var(--invert-bg);
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.5);
  transition: transform 0.55s cubic-bezier(.34, 1.35, .5, 1), width 0.3s;
  z-index: 0;
}
.tab-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 22px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 800 10px/17px var(--font);
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg), 0 4px 12px -2px var(--accent-glow);
  animation: badge-pop 0.5s cubic-bezier(.34, 1.8, .5, 1);
}
@keyframes badge-pop { from { transform: scale(0); } }

/* „Mehr“-Fenster federt von unten herein */
.mobile .sheet {
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  max-height: 86vh;
  overflow-y: auto;
  padding: 10px 16px calc(22px + env(safe-area-inset-bottom));
  border-radius: 30px 30px 0 0;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 -20px 50px -20px rgb(0 0 0 / 0.5);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.5s cubic-bezier(.34, 1.25, .5, 1), visibility 0s 0.5s;
}
.mobile .sheet.open { transform: none; visibility: visible; transition: transform 0.5s cubic-bezier(.34, 1.25, .5, 1); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--faint); margin: 2px auto 16px; flex: none; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 0 4px 16px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.sheet-me .avatar { width: 44px; height: 44px; font-size: 18px; }
.sheet-me b { display: block; font: 700 17px var(--display); }
.sheet-me small { color: var(--muted); font-size: 12px; }
.sheet-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sheet-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1);
}
.sheet-nav a:active { transform: scale(0.95); }
.sheet-nav a.active { background: var(--invert-bg); color: var(--invert-text); border-color: transparent; }
.sheet-nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; padding: 13px; }
.mobile .scrim { z-index: 30; }

/* Details als Fenster von unten */
.mobile dialog {
  margin: auto 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 30px 30px 0 0;
  padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
}
.mobile dialog[open] { animation: sheet-in 0.5s cubic-bezier(.34, 1.25, .5, 1); }
@keyframes sheet-in { from { transform: translateY(100%); } }
.mobile dialog form .btn { width: 100%; padding: 14px; }

/* Touch-Geräte: kein Maus-Reflex und kein Anheben beim „Hover“ */
@media (hover: none) {
  :is(.card, .lesson, .btn, .mini, .chip, .nav a, .day-tabs button, .msg)::after { display: none; }
  .lesson:hover, a.stat:hover, .mini:hover { transform: none; }
}

/* =========================================================
   Rechtliches
   ========================================================= */

.consent { align-items: flex-start; font-size: 12.5px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.consent input { flex: none; margin-top: 1px; }
.consent a, .hint a { color: var(--text); font-weight: 700; }

.sb-legal, .sheet-legal { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0 6px; font-size: 12px; }
.sheet-legal { justify-content: center; margin-top: 16px; }
.sb-legal a, .sheet-legal a { color: var(--muted); text-decoration: none; }
.sb-legal a:hover, .sheet-legal a:hover { color: var(--text); }

.legal { max-width: 760px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.legal .back { align-self: flex-start; text-decoration: none; }
.legal-card { padding: 30px 32px; }
.legal-card h1 { margin: 0 0 4px; font-size: 30px; }
.legal-card h2 { margin: 26px 0 8px; font-size: 17px; }
.legal-card p, .legal-card li { line-height: 1.6; }
.legal-card ul { padding-left: 20px; margin: 0; }
.legal-card li { margin: 6px 0; }
.legal-card a { color: var(--text); font-weight: 700; }
.missing { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); padding: 0 6px; border-radius: 6px; font-weight: 700; }
@media (max-width: 600px) { .legal-card { padding: 22px 18px; } }

/* Klassenbucheinträge */
.classreg { margin-bottom: 14px; }
.cr-text { white-space: pre-wrap; font-size: 14px; }

/* =========================================================
   Eigene Hausübungen
   ========================================================= */

button.day-head { border: 0; font: inherit; color: inherit; background: transparent; cursor: pointer; position: relative; transition: background 0.2s; }
button.day-head:hover { background: var(--line); }
button.day-head.today:hover { background: var(--invert-bg); }
.hw-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 800 10px/1 var(--font);
}
.day-head .hw-badge { position: absolute; top: 4px; right: 6px; }
.day-hw-btn { display: none; }
.mobile .day-hw-btn:not([hidden]) {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin: -4px 0 12px; padding: 10px 14px;
  border-radius: 16px; border: 1px dashed var(--faint);
  background: var(--glass); color: var(--text);
  font: 700 13px var(--font); cursor: pointer;
}

.hw-day-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.hw-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); }
.hw-item-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hw-item-main span { white-space: pre-wrap; overflow-wrap: anywhere; }
.hw-item.done .hw-item-main { opacity: 0.5; text-decoration: line-through; }
.hw-check {
  flex: none; width: 24px; height: 24px; margin-top: 1px;
  border-radius: 8px; border: 2px solid var(--faint); background: transparent;
  color: var(--accent-ink); font: 900 13px/1 var(--font); cursor: pointer;
}
.hw-check.static { cursor: default; opacity: 0.6; }
.hw-item.done .hw-check { background: var(--accent); border-color: var(--accent); }
.hw-del { flex: none; border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 4px; }
.hw-del:hover { color: var(--danger); }
.hw-add { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.hw-add-row { display: flex; gap: 8px; }
.hw-add select, .hw-add input, .hw-add textarea {
  font: 500 14px var(--font); color: var(--text);
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  min-width: 0; flex: 1;
}
.hw-add textarea { resize: vertical; }
#lesson-hw { width: 100%; margin-bottom: 8px; }

.hw.mine.done { opacity: 0.6; }
.hw.mine.done p { text-decoration: line-through; }
.hw-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hw-actions .tag { margin-left: auto; }
.hw-note { margin: 0 0 16px; }

/* =========================================================
   Lernen: Sketchpad + Lerncoach
   ========================================================= */

.learn { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.learn-switch { display: none; }

.sketch-card { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sketch-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool-group { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--line); }
.tool-group button { border: 0; cursor: pointer; display: grid; place-items: center; transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1); }
.tool-group button:active { transform: scale(0.88); }
.ink { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.4); }
.ink.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.tool, .size { width: 32px; height: 32px; border-radius: 50%; background: transparent; color: var(--text); font-size: 16px; }
.tool.active, .size.active { background: var(--invert-bg); color: var(--invert-text); }
.size i { width: var(--s); height: var(--s); border-radius: 50%; background: currentColor; display: block; }
.pages .page-no { font: 700 12px var(--mono); min-width: 44px; text-align: center; color: var(--muted); }
.send-sketch { margin-left: auto; }

.paper {
  position: relative;
  height: min(68vh, 640px);
  border-radius: 16px;
  overflow: hidden;
  background-color: #fbfaf6;
  background-image:
    linear-gradient(rgb(40 60 120 / 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgb(40 60 120 / 0.09) 1px, transparent 1px);
  background-size: 22px 22px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.paper canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }

.chat-card { display: flex; flex-direction: column; height: calc(min(68vh, 640px) + 66px); padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head b { font: 700 16px var(--display); }
.chat-head small { color: var(--muted); font-size: 12px; }
.coach-avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); font-size: 20px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; line-height: 1.5; font-size: 14.5px; overflow-wrap: anywhere; }
.msg-bubble.coach { align-self: flex-start; background: var(--glass-strong); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-bubble.me { align-self: flex-end; background: var(--invert-bg); color: var(--invert-text); border-bottom-right-radius: 6px; }
.msg-bubble.me .tag { color: inherit; border-color: currentColor; margin: 0 4px 0 0; }
.msg-bubble.error { align-self: center; color: var(--danger); border: 1px solid currentColor; font-size: 13px; }
.msg-bubble.typing { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.msg-bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: dot 1s ease-in-out infinite; }
.msg-bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.msg-bubble.typing i:nth-child(3) { animation-delay: 0.3s; margin-right: 6px; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-4px); opacity: 1; } }
.starters { display: flex; flex-wrap: wrap; gap: 6px; }
.starters .chip { font: 600 12.5px var(--font); }
.chat-attach { display: flex; align-items: center; gap: 10px; margin: 0 12px; padding: 6px 10px; border-radius: 12px; background: var(--line); font-size: 13px; font-weight: 600; }
.chat-attach[hidden] { display: none; }
.chat-attach img { width: 44px; height: 32px; object-fit: cover; border-radius: 6px; background: #fff; }
.chat-attach button { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.chat-form { display: flex; gap: 8px; padding: 12px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: none; font: 500 15px/1.4 var(--font); color: var(--text);
  padding: 11px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass); outline: none;
}
.chat-form textarea:focus { border-color: var(--text); }
.chat-form .btn { width: 44px; height: 44px; padding: 0; flex: none; font-size: 17px; }
.chat-note { margin: 0 16px 12px; font-size: 11px; color: var(--muted); text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 14px; background: var(--invert-bg); color: var(--invert-text);
  font: 700 14px var(--font); box-shadow: var(--shadow); transition: opacity 0.25s, transform 0.35s cubic-bezier(.34, 1.56, .64, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .learn { grid-template-columns: minmax(0, 1fr); }
  .learn-switch { display: inline-flex; justify-self: start; }
  .learn[data-pane="sketch"] .chat-card, .learn[data-pane="chat"] .sketch-card { display: none; }
}
.mobile .paper { height: calc(100vh - 330px - env(safe-area-inset-bottom)); min-height: 320px; }
.mobile .chat-card { height: calc(100vh - 250px - env(safe-area-inset-bottom)); min-height: 380px; }
.mobile .send-sketch { margin-left: 0; width: 100%; }
.mobile .tab { font-size: 9.5px; }
.mobile .tab svg { width: 20px; height: 20px; }
