/* Aufbau und Abstände. Farben und Schriften stehen in theme.css. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.45 var(--schrift-text);
  background: radial-gradient(120% 60% at 80% 0%, var(--hintergrund-2), var(--hintergrund) 70%) fixed;
  background-color: var(--hintergrund);
}
h1, h2, h3 { font-family: var(--schrift-titel); line-height: 1.1; margin: 0; font-weight: 700; }
h1 { font-size: 2.3rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
svg.sym { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app {
  max-width: 30rem;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 16px 130px;
  display: grid;
  gap: 14px;
}
.leise { color: var(--text-leise); }
.stapel { display: grid; gap: 12px; }
.h1-mittel { font-size: 1.9rem; }

/* ---------- Kopf der Startseite mit Henry ---------- */
.kopf {
  position: relative;
  min-height: 170px;
  padding-right: 128px;
  display: grid;
  align-content: start;
  gap: 6px;
  margin-bottom: 4px;
}
.kopf__henry { position: absolute; right: 0; top: 4px; width: 128px; }
.kopf__spruch { font-family: var(--schrift-titel); font-style: italic; font-size: 1.1rem; color: var(--text-leise); margin-top: 10px; line-height: 1.5; }
.datumzeile { opacity: .85; font-size: .95rem; }

/* ---------- Karten ---------- */
.karte {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-karte);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.karte__mitte { flex: 1; min-width: 0; display: grid; gap: 2px; }
.karte__label { font-size: .9rem; color: var(--text-leise); }
.karte__titel { font-family: var(--schrift-titel); font-size: 1.35rem; font-weight: 700; color: var(--mint); }
.karte__titel--hell { color: var(--text); font-size: 1.15rem; }
.karte__sub { color: var(--text-leise); font-size: .95rem; }
.kachel {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-klein);
  background: var(--flaeche-hell);
  border: 1px solid var(--linie);
  color: var(--text);
}
.kachel svg.sym { width: 28px; height: 28px; }
.pfeil {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--flaeche-hell);
  color: var(--text);
}
.pfeil svg.sym { width: 18px; height: 18px; }

.karte--orange { background: var(--orange-flaeche); border-color: rgba(239, 167, 91, .18); }
.karte--orange .kachel { background: rgba(239, 167, 91, .14); border-color: rgba(239, 167, 91, .25); color: var(--orange); }
.karte--orange .karte__titel { color: var(--orange); font-size: 1.1rem; }
.karte--leer { box-shadow: none; border-style: dashed; }

.marke {
  display: inline-block;
  font: 600 .72rem var(--schrift-text);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(149, 213, 149, .14);
  color: var(--mint);
  margin-left: 6px;
  vertical-align: 3px;
}

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--mint);
  color: var(--auf-mint);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
}
.knopf--breit { width: 100%; justify-content: space-between; padding: 0 8px 0 26px; }
.knopf--breit .pfeil { background: rgba(10, 29, 21, .12); color: var(--auf-mint); }
.knopf--leise { background: var(--flaeche-hell); color: var(--text); border: 1px solid var(--linie); }
.knopf--gefahr { background: transparent; color: var(--orange); border: 1px solid rgba(239, 167, 91, .5); }
.knopf--klein { min-height: 42px; padding: 0 18px; font-size: .95rem; }
.zeile { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.zeile--ende { justify-content: space-between; }

/* Pillen: Wochentage, Umschalter */
.pillen { display: flex; gap: 8px; }
.pille {
  flex: 1;
  min-height: 44px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--flaeche-hell);
  color: var(--text-leise);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--linie);
}
.pille.aktiv { background: var(--mint); color: var(--auf-mint); border-color: var(--mint); }

/* ---------- Stundenplan ---------- */
.stunden { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.stunde {
  display: grid;
  grid-template-columns: 3.2rem 4px 28px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-karte);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
}
.stunde__balken { width: 4px; height: 36px; border-radius: 2px; }
.stunde__fach { font-family: var(--schrift-titel); font-weight: 700; font-size: 1.15rem; }
.stunde__raum { display: block; font: .85rem var(--schrift-text); color: var(--text-leise); }
.stunde.jetzt { background: var(--flaeche-hell); border-color: var(--mint); }
.stunde .pfeil-klein { width: 18px; height: 18px; color: var(--text-leise); }

/* ---------- Klassenarbeit-Karte (Lernen) ---------- */
.arbeit {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-karte);
  padding: 18px;
  display: grid;
  gap: 14px;
}
.arbeit__kopf { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: inherit; }
.arbeit__fach { font-family: var(--schrift-titel); font-size: 1.4rem; font-weight: 700; }
.arbeit__info { display: grid; gap: 4px; flex: 1; min-width: 0; }
.arbeit__datum { display: flex; align-items: center; gap: 8px; opacity: .9; }
.arbeit__datum svg.sym { width: 18px; height: 18px; }
.arbeit__trenner { height: 1px; background: var(--linie); }
.arbeit__zeile { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.arbeit__zeile .orange { color: var(--orange); }
.arbeit__zeile .rest { margin-left: auto; color: var(--text-leise); font-size: .9rem; text-align: right; white-space: nowrap; }
.arbeit.vorbei { opacity: .6; }
.bald { color: var(--orange); font-weight: 600; }

/* ---------- Hausaufgaben ---------- */
.aufgaben { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.aufgabe {
  display: flex; align-items: center; gap: 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-karte);
  padding: 14px 16px;
}
.aufgabe__text { flex: 1; min-width: 0; display: grid; gap: 2px; text-decoration: none; color: inherit; }
.aufgabe__fach { font-family: var(--schrift-titel); font-weight: 700; }
.aufgabe.fertig .aufgabe__text { opacity: .5; }
.aufgabe.fertig .aufgabe__was { text-decoration: line-through; }
.haken {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--mint);
  background: transparent;
  display: grid; place-items: center;
  color: var(--auf-mint);
  cursor: pointer;
  padding: 0;
}
.haken svg.sym { width: 16px; height: 16px; stroke-width: 2.6; opacity: 0; }
.haken[aria-pressed=true] { background: var(--mint); }
.haken[aria-pressed=true] svg.sym { opacity: 1; }
.haken:disabled { opacity: .5; cursor: default; }

/* ---------- Unterlagen ---------- */
.ablage {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 28px 16px;
  border: 2px dashed rgba(149, 213, 149, .35);
  border-radius: var(--radius-karte);
  background: var(--flaeche);
  cursor: pointer;
}
.ablage svg.sym { width: 36px; height: 36px; color: var(--mint); }
.ablage.drueber { border-color: var(--mint); background: var(--flaeche-hell); }
.vorschau img { width: 100%; border-radius: var(--radius-karte); border: 1px solid var(--linie); display: block; }
mark { background: rgba(149, 213, 149, .25); color: var(--text); border-radius: 3px; padding: 0 2px; }
/* Auf dem Handy gibt es "Foto aufnehmen", am Rechner reicht das Ablagefeld */
@media (hover: hover) and (pointer: fine) { #kamera-knopf { display: none; } }

/* ---------- Henry spricht ---------- */
.henry-sagt { display: flex; align-items: flex-end; justify-content: flex-end; margin-top: 6px; }
.blase {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 22px 22px 6px 22px;
  padding: 14px 18px;
  font-family: var(--schrift-titel);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 40px;
  margin-right: 8px;
  max-width: 60%;
}
.henry-sagt img { width: 96px; }
.henry-gross { width: 150px; margin: 0 auto; display: block; }

/* ---------- Formulare ---------- */
.formular { display: grid; gap: 18px; }
.feld { display: grid; gap: 8px; }
.feld > span { font-weight: 600; font-size: .95rem; }
fieldset.feld { border: 0; padding: 0; margin: 0; }
input[type=text], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  background: var(--flaeche);
}
textarea { min-height: 110px; resize: vertical; }
select option { background: var(--flaeche); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  border: 1px solid var(--linie);
  background: var(--flaeche-hell);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip:has(input:checked) { background: var(--mint); color: var(--auf-mint); border-color: var(--mint); font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid var(--mint); outline-offset: 2px; }

.tafel {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-karte);
  padding: 18px;
  display: grid;
  gap: 12px;
}
.stoff { white-space: pre-wrap; }
.liste-einfach { list-style: none; margin: 0; padding: 0; display: grid; }
.liste-einfach li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--linie); }
.liste-einfach li:last-child { border-bottom: 0; }
.idee.fertig span { text-decoration: line-through; color: var(--text-leise); }
.idee input { width: 22px; height: 22px; accent-color: var(--mint); flex: none; }
.idee span { flex: 1; }
.loesch { border: 0; background: none; color: var(--text-leise); cursor: pointer; padding: 6px 8px; font-size: 1rem; }
details > summary { cursor: pointer; color: var(--text-leise); padding: 6px 0; }
details[open] > summary { margin-bottom: 10px; }
.zurueck { color: var(--text-leise); text-decoration: none; }

/* ---------- Chat ---------- */
.klein { font-size: .85rem; }
.chat-kopf { display: flex; align-items: center; gap: 12px; }
.chat-kopf img { width: 52px; height: 52px; }
.chat-kopf h1 { flex: 1; }
.chat { display: grid; gap: 12px; }
.nachricht { max-width: 88%; line-height: 1.5; }
.nachricht.ich {
  justify-self: end;
  background: var(--mint); color: var(--auf-mint);
  padding: 10px 14px; border-radius: 18px 18px 6px 18px;
}
.nachricht.henry { display: flex; gap: 8px; align-items: flex-start; justify-self: start; }
.nachricht.henry > img { width: 34px; height: 34px; flex: none; margin-top: 2px; }
.nachricht.henry > div {
  background: var(--flaeche); border: 1px solid var(--linie);
  padding: 10px 14px; border-radius: 18px 18px 18px 6px; min-width: 0;
}
.nachricht p { margin: 0 0 8px; }
.nachricht p:last-child { margin-bottom: 0; }
.nachricht ul { margin: 0 0 8px; padding-left: 20px; }
.quellen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quelle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; text-decoration: none; color: var(--mint);
  border: 1px solid var(--linie); border-radius: 999px; padding: 4px 10px;
}
.quelle svg.sym { width: 14px; height: 14px; }
.denkt { display: flex; gap: 5px; padding: 14px 16px !important; }
.denkt span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-leise); animation: denken 1s infinite ease-in-out; }
.denkt span:nth-child(2) { animation-delay: .15s; }
.denkt span:nth-child(3) { animation-delay: .3s; }
@keyframes denken { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .denkt span { animation: none; } }
.chat-eingabe {
  position: sticky;
  bottom: calc(86px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px; margin: 0 -8px;
  background: var(--hintergrund);
  border-radius: 26px;
}
.chat-eingabe textarea { min-height: 50px; max-height: 160px; border-radius: 24px; padding: 13px 18px; resize: none; }
.chat-eingabe .knopf { width: 50px; min-height: 50px; padding: 0; flex: none; }
.chat-eingabe .knopf:disabled, .chat-eingabe textarea:disabled { opacity: .5; }

/* ---------- Henry als Knopf ---------- */
.henry-knopf {
  position: fixed;
  z-index: 9;
  width: 60px; height: 60px;
  padding: 6px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  background: var(--flaeche-hell);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  cursor: grab;
  touch-action: none;          /* sonst scrollt die Seite beim Ziehen */
  transition: left .2s ease, top .2s ease;
}
.henry-knopf img { width: 100%; height: 100%; display: block; pointer-events: none; }
.henry-knopf.zieht { transition: none; cursor: grabbing; transform: scale(1.08); }
@media (prefers-reduced-motion: reduce) { .henry-knopf { transition: none; } }
.schalter { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.schalter input { width: 22px; height: 22px; accent-color: var(--mint); }

/* ---------- Reiter unten ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  background: rgba(12, 31, 24, .96);
  border-top: 1px solid var(--linie);
  border-radius: 22px 22px 0 0;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(8px);
}
.tabs a {
  flex: 1;
  max-width: 7.5rem;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 4px;
  color: var(--text-leise);
  text-decoration: none;
  font-size: .85rem;
}
.tabs a svg.sym { width: 28px; height: 28px; }
.tabs a.aktiv { color: var(--mint); font-weight: 600; }

.meldung, .update {
  position: fixed;
  left: 16px; right: 16px;
  max-width: 28rem;
  margin: 0 auto;
  border-radius: var(--radius-klein);
  padding: 12px 16px;
  z-index: 10;
}
.meldung { bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--text); color: var(--hintergrund); }
.update {
  top: calc(12px + env(safe-area-inset-top));
  background: var(--flaeche-hell);
  border: 1px solid var(--mint);
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
}

.anmelden { min-height: 86vh; align-content: center; gap: 22px; }
.anmelden h1, .anmelden .leise { text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .app > * { animation: rein .3s ease-out both; }
  .app > *:nth-child(2) { animation-delay: .04s; }
  .app > *:nth-child(3) { animation-delay: .08s; }
  .app > *:nth-child(4) { animation-delay: .12s; }
  @keyframes rein { from { opacity: 0; transform: translateY(8px); } }
}
