/* ============================ Schrift ============================
   Fredoka, lokal gehostet. Die CSP erlaubt font-src 'self' — von Google
   Fonts direkt zu laden wäre blockiert (und würde die Adresse des Telefons
   an einen Dritten geben).
   Fredoka ist eine Variable Font: EINE Datei trägt alle Gewichte, deshalb
   font-weight als Bereich. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/vendor/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/vendor/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =========================================================================
   trash-tv — Aussehen
   -------------------------------------------------------------------------
   Vorlage ist das Poster aus dem Trash-TV-Reel: heller Lavendel-Grund, pinke
   Wortmarke, Sendungen als bunte Pillen im Monatsraster.

   ZWEI DINGE, DIE HIER ANDERS SIND ALS AUF DEM POSTER, UND WARUM:
   1. Das Poster ist ein Plakat für den großen Bildschirm. Auf 390 px Breite
      passen in eine Tageszelle keine drei beschrifteten Pillen — deshalb
      zeigt das Raster dort nur Punkte, und die Namen stehen in der Tagesliste
      darunter. Ab 560 px werden daraus wieder beschriftete Pillen.
   2. Keine Emoji. Chromium auf dem Pi hat keine Emoji-Schrift (Screenshots
      zeigen leere Kästchen), und die Plattformfarbe trägt dieselbe Information
      verlässlicher.

   CSP: style-src 'self' OHNE unsafe-inline. Es darf also kein style="..." ins
   Markup. Was das Skript über element.style setzt, ist erlaubt (CSSOM fällt
   nicht unter die Regel) — setAttribute('style', ...) und cssText dagegen
   nicht.
   ========================================================================= */

:root {
  /* Grundflächen */
  --bg:        #ece3f8;
  --bg-2:      #f7f0fd;
  --karte:     #ffffff;
  --karte-2:   #faf6ff;
  --rand:      #e0d2f2;
  --rand-satt: #cbb2e8;

  /* Schrift */
  --text:      #2c1b3d;
  --text-hell: #6b5580;
  --text-blass:#9d8bb0;

  /* Akzente — die beiden Pinktöne des Plakats */
  --pink:      #ff2d9b;
  --pink-tief: #d81b7f;
  --pink-zart: #ffe3f3;
  --lila:      #a855f7;
  --lila-tief: #7c3aed;
  --lila-zart: #f0e4ff;

  --heute:     #ffb800;
  --radius:    16px;
  --radius-s:  10px;
  --schatten:  0 2px 10px rgba(90, 40, 130, .09);
  --schatten-h:0 6px 22px rgba(90, 40, 130, .16);

  --font: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  /* Verhindert, dass iOS beim Drehen die Schrift eigenmächtig vergrößert. */
  -webkit-text-size-adjust: 100%;
}

body {
  /* Weicher Verlauf wie auf dem Plakat: oben heller, unten lavendel. */
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 42%, #e4d8f5 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.app {
  max-width: 820px;
  margin: 0 auto;
  /* Auf dem iPhone schiebt das den Inhalt unter der Dynamic Island hervor.
     Die Statusleiste steht auf `black` (nicht translucent) — dieselbe
     Entscheidung wie bei REPZ, wo translucent den Inhalt darunter schob. */
  padding: env(safe-area-inset-top, 0px) 14px calc(90px + env(safe-area-inset-bottom, 0px));
}

/* ============================ Kopf ============================ */

.kopf {
  padding: 18px 2px 12px;
  text-align: center;
}

.marke {
  font-size: clamp(30px, 10vw, 46px);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--pink);
  /* Der weiße Umriss des Plakats. -webkit-text-stroke sitzt mittig auf der
     Kontur und frisst dünne Buchstaben an, deshalb zusätzlich ein weißer
     Schatten nach außen statt eines dickeren Strichs. */
  text-shadow:
     2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
     0 4px 0 rgba(216, 27, 127, .28),
     0 8px 18px rgba(216, 27, 127, .22);
  text-transform: uppercase;
}

.marke .im {
  display: block;
  font-size: .38em;
  color: var(--lila-tief);
  text-transform: lowercase;
  letter-spacing: .06em;
  text-shadow: 1px 1px 0 #fff, -1px 1px 0 #fff, 1px -1px 0 #fff, -1px -1px 0 #fff;
  margin-top: 2px;
}

/* ---- Monatsnavigation ---- */
.monatsleiste {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.mnav {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--karte);
  color: var(--lila-tief);
  box-shadow: var(--schatten);
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.mnav:active { transform: scale(.92); background: var(--lila-zart); }
.mnav svg { width: 20px; height: 20px; }

.monat {
  min-width: 190px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--karte);
  box-shadow: var(--schatten);
  font-size: 17px;
  font-weight: 600;
  color: var(--lila-tief);
  text-align: center;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}
.monat:active { background: var(--lila-zart); }

/* ============================ Umschalter ============================ */

.werkzeuge {
  display: flex;
  gap: 8px;
  margin: 14px 0 10px;
  align-items: center;
}

.seg {
  display: flex;
  background: rgba(255, 255, 255, .75);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--schatten);
  flex: 1;
  min-width: 0;
}

.seg button {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 8px 6px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-hell);
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.seg button.an {
  background: linear-gradient(135deg, var(--pink), var(--lila));
  color: #fff;
  box-shadow: 0 2px 8px rgba(216, 27, 127, .3);
}

/* Herz-Umschalter "nur Favoriten" */
.favschalter {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .75);
  box-shadow: var(--schatten);
  color: var(--text-blass);
  cursor: pointer;
  transition: transform .12s, color .15s, background .15s;
}
.favschalter:active { transform: scale(.9); }
.favschalter.an {
  background: linear-gradient(135deg, var(--pink), var(--lila));
  color: #fff;
}
.favschalter svg { width: 21px; height: 21px; }

/* ============================ Kalender ============================ */

.kalender {
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 10px 8px 8px;
  overflow: hidden;
}

.wochentage {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 6px;
}
.wochentage span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-blass);
  text-transform: uppercase;
  overflow: hidden;
}

.raster {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.tag {
  position: relative;
  min-height: 62px;
  border-radius: var(--radius-s);
  background: var(--karte-2);
  border: 1.5px solid transparent;
  padding: 4px 3px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-family: var(--font);
  transition: background .12s, border-color .12s, transform .1s;
  overflow: hidden;
}
.tag:active { transform: scale(.96); }
.tag.leer { background: transparent; cursor: default; }
.tag.fremd { opacity: .38; }
.tag.heute { border-color: var(--heute); background: #fff9e8; }
.tag.gewaehlt {
  border-color: var(--pink);
  background: var(--pink-zart);
  box-shadow: 0 0 0 3px rgba(255, 45, 155, .13);
}

.tagzahl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-hell);
  line-height: 1;
}
.tag.heute .tagzahl { color: #b07800; }
.tag.gewaehlt .tagzahl { color: var(--pink-tief); }

/* Punkte auf dem Handy, beschriftete Pillen ab 560 px */
.punkte {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5px;
  width: 100%;
}
/* --pc = Plattformfarbe, gesetzt vom Skript als CSS-Variable am Element. */
.punkt {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pc, var(--lila));
  flex: 0 0 auto;
}
.punkt.fav {
  /* Favoriten stechen als Ring hervor — Farbe allein reicht nicht, wenn in
     einer Zelle drei Sendungen derselben Plattform liegen. */
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--pink);
}
.mehr {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-blass);
  line-height: 1;
}

.pillen { display: none; }

@media (min-width: 560px) {
  .tag { min-height: 88px; padding: 5px 4px 4px; }
  .punkte { display: none; }
  .pillen {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }
  .pille {
    font-size: 10px;
    font-weight: 600;
    color: var(--pt, #fff);
    background: var(--pc, var(--lila));
    border-radius: 999px;
    padding: 2.5px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.25;
  }
  .pille.fav { box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--pink); }
  .wochentage span { font-size: 12px; }
}

/* ============================ Tagesliste ============================ */

.tagesliste {
  margin-top: 14px;
}

.tagestitel {
  font-size: 15px;
  font-weight: 600;
  color: var(--lila-tief);
  margin: 0 0 8px 4px;
}

/* ---- Sendungskarte ---- */
.eintrag {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 11px 12px;
  margin-bottom: 8px;
  /* Der farbige Streifen links zeigt die Plattform. */
  border-left: 5px solid var(--pc, var(--lila));
  text-decoration: none;
  color: inherit;
}

.e-zeit {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--lila-tief);
  line-height: 1.15;
}
.e-zeit .ca {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-blass);
  letter-spacing: .03em;
}
.e-zeit.ohne { color: var(--text-blass); font-weight: 600; font-size: 12px; }

.e-mitte { flex: 1 1 auto; min-width: 0; }

.e-titel {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.e-unter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-hell);
  overflow: hidden;
  white-space: nowrap;
}

.chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--lila-zart);
  color: var(--lila-tief);
  font-size: 10.5px;
  font-weight: 600;
  flex: 0 0 auto;
}
.chip.at { background: #ffe8e8; color: #c0392b; }

.e-folge {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Herz an der Karte */
.e-fav {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--text-blass);
  cursor: pointer;
  transition: transform .12s, color .15s;
}
.e-fav:active { transform: scale(.85); }
.e-fav.an { color: var(--pink); }
.e-fav svg { width: 20px; height: 20px; }

/* Knopf, der die App öffnet */
.e-app {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--lila-zart);
  color: var(--lila-tief);
  text-decoration: none;
  transition: transform .12s;
}
.e-app:active { transform: scale(.85); }
.e-app svg { width: 17px; height: 17px; }

/* ============================ Leerzustände ============================ */

.leerhinweis {
  text-align: center;
  padding: 26px 18px;
  color: var(--text-hell);
  font-size: 14px;
  line-height: 1.5;
  background: rgba(255, 255, 255, .6);
  border-radius: var(--radius);
}
.leerhinweis strong { color: var(--lila-tief); display: block; margin-bottom: 4px; font-size: 15px; }

/* ============================ Show-Verwaltung ============================ */

.showkarte {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 5px solid var(--pc, var(--lila));
}

.poster {
  flex: 0 0 auto;
  width: 42px; height: 62px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--lila-zart);
}
.poster.platzhalter { display: grid; place-items: center; }

.s-mitte { flex: 1 1 auto; min-width: 0; }
.s-titel {
  font-size: 14.5px; font-weight: 600; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.s-unter {
  font-size: 11.5px; color: var(--text-hell); margin-top: 3px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.s-naechste { color: var(--pink-tief); font-weight: 600; }

.s-knoepfe { flex: 0 0 auto; display: flex; gap: 2px; }

/* ============================ Suche ============================ */

.suchfeld {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.suchfeld input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--rand);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: var(--font);
  background: var(--karte);
  color: var(--text);
  outline: none;
}
.suchfeld input:focus { border-color: var(--pink); }

.knopf {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  background: linear-gradient(135deg, var(--pink), var(--lila));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(216, 27, 127, .28);
  flex: 0 0 auto;
}
.knopf:active { transform: scale(.96); }
.knopf.still {
  background: var(--karte);
  color: var(--lila-tief);
  box-shadow: var(--schatten);
}
.knopf[disabled] { opacity: .5; cursor: default; }

.knopf-klein {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; background: none;
  border-radius: 50%;
  color: var(--text-blass);
  cursor: pointer;
  transition: transform .12s, color .15s, background .15s;
}
.knopf-klein:active { transform: scale(.85); }
.knopf-klein.an { color: var(--pink); }
.knopf-klein:hover { background: var(--lila-zart); }
.knopf-klein svg { width: 19px; height: 19px; }

/* ============================ Blatt (Modal) ============================ */

.blatt-grund {
  position: fixed;
  inset: 0;
  background: rgba(44, 27, 61, .45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.blatt-grund[hidden] { display: none; }

.blatt {
  background: var(--karte);
  width: 100%;
  max-width: 560px;
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(44, 27, 61, .28);
}

.griff {
  width: 40px; height: 4px;
  background: var(--rand-satt);
  border-radius: 2px;
  margin: 4px auto 12px;
}

.blatt h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.blatt .unterzeile {
  font-size: 13px;
  color: var(--text-hell);
  margin-bottom: 14px;
}

.feld { margin-bottom: 12px; }
.feld label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hell);
  margin-bottom: 4px;
}
.feld input, .feld select {
  width: 100%;
  border: 1.5px solid var(--rand);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font);
  background: var(--karte-2);
  color: var(--text);
  outline: none;
}
.feld input:focus, .feld select:focus { border-color: var(--pink); }
.feld .hinweis { font-size: 11px; color: var(--text-blass); margin-top: 4px; line-height: 1.4; }

.blatt-knoepfe {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.blatt-knoepfe .knopf { flex: 1; }

/* ============================ Meldung ============================ */

.meldung {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--schatten-h);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}
.meldung.da { opacity: 1; transform: translateX(-50%) translateY(0); }
.meldung.fehler { background: #c0392b; }

/* ============================ Fußleiste ============================ */

.fuss {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, .93);
  /* backdrop-filter kostet auf dem Pi nichts (läuft am Telefon), gibt der
     Leiste aber die Tiefe des Plakats. */
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--rand);
  display: flex;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}

.fuss button {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-blass);
  cursor: pointer;
  font-family: var(--font);
  border-radius: 12px;
  transition: color .15s;
}
.fuss button.an { color: var(--pink); }
.fuss button svg { width: 22px; height: 22px; }

/* ============================ Ansichten ============================ */

.ansicht { display: none; }
.ansicht.an { display: block; }

/* ============================ Ladebalken ============================ */

.laden {
  height: 3px;
  background: var(--rand);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0;
}
.laden[hidden] { display: none; }
.laden i {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--pink), var(--lila));
  animation: schieben 1.1s ease-in-out infinite;
}
@keyframes schieben {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Kein Blinken für alle, die das abgestellt haben. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ============================ Anmeldeseite ============================ */

.anmeldeseite { display: grid; place-items: center; min-height: 100vh; }

.anmelde {
  width: 100%;
  max-width: 400px;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}

.anmeldekarte {
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten-h);
  padding: 22px 18px 20px;
  margin-top: 26px;
  text-align: left;
}

.anmeldekarte .knopf { width: 100%; margin-top: 6px; padding: 13px; font-size: 15.5px; }

.anmeldefehler {
  background: #ffe8e8;
  color: #c0392b;
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13.5px;
  margin: 0 0 12px;
  line-height: 1.4;
}
.anmeldefehler[hidden] { display: none; }

/* ---- Blatt: Abschnitte für die Termineingabe ---- */

.trenner {
  border: none;
  border-top: 1px solid var(--rand);
  margin: 18px 0 14px;
}

.abschnitt {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--lila-tief);
}

.hinweis-block {
  font-size: 12px;
  color: var(--text-hell);
  line-height: 1.45;
  margin: 0 0 12px;
}

/* Zwei Felder nebeneinander. minmax(0,1fr) statt 1fr, weil ein date-Feld auf
   iOS eine feste Mindestbreite mitbringt und die Spalte sonst aus dem Blatt
   herausdrückt. */
.feld-reihe {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.feld-reihe .feld { margin-bottom: 12px; }

.knopf.gefahr { color: #c0392b; }
