/* LinkedIn-Autopost - Review-Oberflaeche.
 *
 * Dasselbe Designsystem wie crybot und collector, aus denselben Gruenden:
 * eine Seite, die man kurz vom Handy aus aufruft, um einen Entwurf zu pruefen.
 *
 * 1. env(safe-area-inset-*) ueberall, falls vom Homescreen gestartet.
 * 2. Kein Zurueck-Knopf noetig -- eine Seite, klar gegliedert.
 * 3. Daumen, nicht Maus. Nichts Antippbares unter 44 px.
 * 4. Keine Web-Fonts, keine Bibliotheken.
 */

:root {
  --grund: #0E1621;
  --karte: #16212E;
  --karte-rand: #223141;
  --tinte: #E8EDF2;
  --leise: #8A9AAB;
  --linie: #33455A;
  --auf: #2FBF71;
  --ab: #E5654F;
  --warn: #E8B23A;
  --radius: 16px;
}

* { box-sizing: border-box; }

html {
  background: var(--grund);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--grund);
  color: var(--tinte);
  font: 400 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  /* Lange Wörter ohne Leerzeichen (Dateinamen, URLs, API-Fehlermeldungen)
     umbrechen statt die Seite zu verbreitern - sonst ließ sich auf dem
     Handy nach rechts ins Leere scrollen. break-word statt anywhere:
     anywhere zerteilte auch kurze Wörter neben langen Nachbarn ("Stat us",
     "Abmeld en"), weil es die Mindestbreite von Flex-Elementen senkt. */
  overflow-wrap: break-word;
}

.huelle {
  max-width: 640px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + 28px)
    calc(env(safe-area-inset-left, 0px) + 16px);
}

/* --- Kopf ----------------------------------------------------------------- */
.kopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.kopf h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.2px; }
.marke { display: flex; align-items: center; gap: 11px; }
.marke-icon { border-radius: 8px; display: block; }
.unter { margin: 1px 0 0; font-size: 12.5px; color: var(--leise); }
.kopf-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.abmelden {
  font-size: 12px; color: var(--leise); text-decoration: none; white-space: nowrap; overflow-wrap: normal;
  border-bottom: 1px dotted currentColor; line-height: 1.4;
}

/* --- Banner (Hinweis/Fehler) ----------------------------------------------- */
.hinweis, .fehler {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 11px; font-size: 14px;
}
.hinweis { background: rgba(47, 191, 113, .14); color: var(--auf); }
.fehler { background: rgba(229, 101, 79, .14); color: var(--ab); }

/* --- Karten ----------------------------------------------------------------- */
.karte {
  background: var(--karte);
  border: 1px solid var(--karte-rand);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
h2 {
  margin: 28px 0 10px; font-size: 13px; font-weight: 600;
  letter-spacing: .4px; text-transform: uppercase; color: var(--leise);
}
h2:first-child { margin-top: 0; }
h3.unterabschnitt {
  margin: 18px 0 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .3px; color: var(--leise);
}
h3.unterabschnitt:first-child { margin-top: 0; }

.leise { color: var(--leise); }
.auf { color: var(--auf); }
.ab { color: var(--ab); }
.leer { text-align: center; padding: 24px 16px; color: var(--leise); font-size: 14px; }

/* --- Pillen (Status/Marken) -------------------------------------------------- */
.pille {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .2px;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.pille--aktiv { background: rgba(47, 191, 113, .16); color: var(--auf); }
.pille--leise { background: rgba(138, 154, 171, .16); color: var(--leise); }
.pille--warn  { background: rgba(232, 178, 58, .16); color: var(--warn); }
.pille--ab    { background: rgba(229, 101, 79, .16); color: var(--ab); }

/* --- Anstehende Posts -------------------------------------------------------- */
.gruppe-meta { margin: 0 0 12px; font-size: 12.5px; color: var(--leise); }

.varianten { display: grid; gap: 12px; }
.variante {
  border: 1px solid var(--karte-rand); border-radius: 12px; padding: 12px;
}
.variante--aktiv { border-color: var(--auf); }
.var-kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 600;
}

.variante textarea {
  font: inherit; font-size: 15px; line-height: 1.45; width: 100%;
  background: var(--grund); color: var(--tinte);
  border: 1px solid var(--karte-rand); border-radius: 10px;
  padding: 10px 11px; resize: vertical; min-height: 140px;
}
.variante textarea:focus { outline: none; border-color: var(--auf); }
.variante textarea[readonly] { color: var(--leise); }

.zaehler {
  margin-top: 6px; font-size: 12px; color: var(--leise);
  font-variant-numeric: tabular-nums; text-align: right;
}
.zaehler--ueber { color: var(--ab); font-weight: 600; }

.begruendung {
  margin: 8px 0 0; font-size: 12.5px; color: var(--leise); font-style: italic;
}

.variante .knopf--klein { margin-top: 10px; }

.aktionen { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.aktionen form { flex: 1; min-width: 110px; }

/* --- Knoepfe ----------------------------------------------------------------- */
.knopf {
  font: inherit; font-size: 15px; font-weight: 600; min-height: 44px;
  width: 100%; border: 0; border-radius: 11px; cursor: pointer;
  background: var(--auf); color: #08130C; padding: 0 14px;
}
.knopf--klein { min-height: 38px; font-size: 14px; width: auto; }
.knopf--sekundaer {
  background: none; border: 1px solid var(--karte-rand); color: var(--tinte);
}
.knopf--weg { background: rgba(229, 101, 79, .16); color: var(--ab); }

/* --- Listen (Archiv, Themen, Stilanker) --------------------------------------- */
.liste { display: flex; flex-direction: column; }
.zeile {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--karte-rand);
  font-size: 14px;
}
.zeile:last-child { border-bottom: 0; }
.zeile-text { min-width: 0; overflow-wrap: anywhere; }
.zeile-meta { font-size: 12px; color: var(--leise); margin-top: 2px; }
.verbotsliste { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.verbotsliste li { margin-bottom: 4px; }

.st { border-bottom: 1px solid var(--karte-rand); }
.st:last-of-type { border-bottom: 0; }
.st > summary {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 2px; cursor: pointer; list-style: none;
  min-height: 44px; font-size: 14px;
}
.st > summary::-webkit-details-marker { display: none; }
.st-inhalt { padding: 0 2px 14px; font-size: 13.5px; color: var(--leise); white-space: pre-wrap; }
.st-inhalt a { color: var(--tinte); }

/* --- Formulare (Anlegen) ------------------------------------------------------ */
.neu { margin-top: 4px; }
.neu > summary {
  cursor: pointer; list-style: none; font-size: 13px; font-weight: 600;
  letter-spacing: .4px; text-transform: uppercase; color: var(--leise);
  padding: 6px 0;
}
.neu > summary::-webkit-details-marker { display: none; }
.neu > summary::after { content: " +"; color: var(--auf); }
.neu[open] > summary::after { content: " -"; }

.formular { margin-top: 12px; display: grid; gap: 10px; }
.formular label { display: grid; gap: 4px; font-size: 12px; color: var(--leise); }
.formular input, .formular textarea, .formular select {
  font: inherit; font-size: 17px; width: 100%;
  background: var(--grund); color: var(--tinte);
  border: 1px solid var(--karte-rand); border-radius: 10px; padding: 9px 11px;
}
.formular input:focus, .formular textarea:focus, .formular select:focus { outline: none; border-color: var(--auf); }
/* Safari gibt select (längste Option) und input[type=file] eine Mindestbreite
   aus ihrem Inhalt und ignoriert dabei width: 100% - die Seite ließ sich
   dadurch nach rechts scrollen. Im Grid-Label erst min-width: 0 erlaubt das Schrumpfen. */
.formular label > * { min-width: 0; max-width: 100%; }
.formular textarea { min-height: 90px; resize: vertical; }

/* --- Chips (Feed-Suchbegriffe) ------------------------------------------------ */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px;
  border-radius: 10px; padding: 2px;
  outline: 2px dashed transparent; outline-offset: 4px;
  transition: outline-color .15s, background-color .15s;
}
.chips--ziel { outline-color: var(--auf); background: rgba(47, 191, 113, .08); }
.chips-platzhalter { margin: 0; padding: 8px 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--karte-rand); border-radius: 999px;
  padding: 3px 3px 3px 11px; font-size: 13px;
}
.chip span { white-space: nowrap; }
.chip-griff { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.chip-wird-gezogen { opacity: .35; }
.chip-geist {
  position: fixed; z-index: 1000; pointer-events: none;
  padding: 6px 14px; border-radius: 999px;
  background: var(--auf); color: #08130C; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35); white-space: nowrap;
}
.chip-x {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 2px;
  background: none; border: 0; border-radius: 50%;
  color: var(--leise); font-size: 15px; line-height: 1; cursor: pointer;
}
.chip-x:hover { background: rgba(229, 101, 79, .16); color: var(--ab); }
.chip-gesperrt { opacity: .6; }
.chip-sperre { margin-left: 6px; font-size: 11px; color: var(--leise); }

/* --- Zeilen mit Label/Wert (Token, Quote) ------------------------------------- */
.zeilen-info { display: grid; gap: 8px; }
.zeilen-info .zeile { font-size: 14.5px; }

/* --- Anmeldung ----------------------------------------------------------------- */
.anmeldung { max-width: 340px; margin: 0 auto; text-align: center; padding-top: 12vh; }
.anmeldung h1 { font-size: 24px; margin: 0; }
.anmeldeformular { display: grid; gap: 6px; margin-top: 26px; text-align: left; }
.anmeldeformular input {
  font: inherit; font-size: 17px;
  background: var(--karte); color: var(--tinte);
  border: 1px solid var(--karte-rand); border-radius: 11px;
  padding: 12px 13px; margin-bottom: 8px; width: 100%;
}
.anmeldeformular input:focus { outline: none; border-color: var(--auf); }
.anmeldeformular button {
  font: inherit; font-weight: 600; font-size: 17px;
  background: var(--auf); color: #08130C;
  border: 0; border-radius: 11px; padding: 13px; margin-top: 6px;
  min-height: 48px; cursor: pointer;
}
.anmeldefehler { min-height: 20px; margin-top: 12px; font-size: 13.5px; color: var(--ab); }

/* --- Stop-Seite (Veto-Link) ------------------------------------------------------ */
.stop-seite {
  max-width: 340px; margin: 0 auto; text-align: center; padding-top: 25vh;
  font-size: 16px;
}
.stop-seite form { margin-top: 18px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em; background: var(--grund);
  padding: 1px 5px; border-radius: 5px;
}

/* --- Reiter (LinkedIn / Instagram) ------------------------------------------------ */
.reiter {
  display: flex; gap: 4px; margin: -4px 0 18px; padding: 4px;
  background: var(--karte); border: 1px solid var(--karte-rand); border-radius: 13px;
}
.reiter-knopf {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 40px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  color: var(--leise); text-decoration: none;
}
.reiter-knopf--aktiv { background: var(--karte-rand); color: var(--tinte); }

/* --- Bilderpool --------------------------------------------------------------------- */
.bild > summary { justify-content: flex-start; }
.bild-vorschau {
  width: 56px; height: 56px; object-fit: cover; border-radius: 9px;
  flex: none; background: var(--grund);
}
.bild .zeile-text { flex: 1; }
.bild-pillen { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.bild-inhalt { padding: 0 2px 16px; }
.bild-gross { display: block; width: 100%; max-width: 360px; border-radius: 12px; }
.bild-inhalt .aktionen { margin-top: 6px; }

.auswahl {
  border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 14px;
}
.auswahl legend { font-size: 12px; color: var(--leise); padding: 0; margin-bottom: 4px; }
.formular .auswahl label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--tinte); min-height: 32px; }
.formular .auswahl input { width: auto; }
.formular input[type="file"] { font-size: 15px; }
.knopf:disabled { opacity: .6; cursor: progress; }
/* Verbrauchte Bilder: schon auf Instagram, stehen am Ende des Pools und
   treten optisch zurück. Beim Aufklappen wieder voll sichtbar. */
.bild--verbraucht:not([open]) > summary { opacity: .45; filter: grayscale(1); }

/* --- Pull-to-Refresh (pull.js, nur als Web-App vom Home-Bildschirm) --------- */
.ptr-anzeige {
  position: fixed; top: -2rem; left: 50%; z-index: 100;
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--karte); border: 1px solid var(--karte-rand);
  color: var(--leise); font-size: 1.1rem; opacity: 0;
  transform: translate(-50%, 0); transition: transform .2s, opacity .2s; pointer-events: none;
}
/* Folgt dem Finger direkt; die Transition animiert nur das Zurückschnappen. */
.ptr-anzeige.zieht { transition: none; }
.ptr-anzeige.bereit, .ptr-anzeige.laedt { color: var(--auf); border-color: var(--auf); }
.ptr-anzeige.laedt { animation: ptr-drehen .8s linear infinite; }
@keyframes ptr-drehen {
  from { transform: translate(-50%, 60px) rotate(0deg); }
  to { transform: translate(-50%, 60px) rotate(360deg); }
}
.thema-sperre > summary { cursor: pointer; list-style: none; text-decoration: underline dotted; display: inline-block; margin-top: 2px; }
.thema-sperre > summary::-webkit-details-marker { display: none; }
/* Zusatzangabe als eigene Zeile unter dem Titel (z. B. Fakten einer Kategorie). */
.zeile-unter { display: block; }
