/*
 * Oberfläche der Verwaltungs-App. Nüchtern wie der Web-Admin, nicht wie die
 * Anzeige: hier wird gearbeitet, nicht präsentiert.
 *
 * Große Touch-Ziele, Safe-Area für Geräte mit Aussparung, hell und dunkel.
 */

:root {
  /* Die Farben der Anzeige (public/assets/css/display.css): Nachthimmel,
     Smaragd, Gold. Hier hell gewendet, damit sich auf dem Telefon arbeiten
     laesst; der Himmel bleibt im Kopf. */
  --nacht: #011F1B;
  --smaragd: #024D40;
  --gold: #B49E68;
  --gold-hell: #EBCF8F;

  --grund: #EDF2F0;
  --papier: #ffffff;
  --papier-2: #F3F7F5;
  --linie: #D3DFDA;
  --text: #0E201C;
  --text-leise: #56675F;
  --marke: #024D40;
  --marke-druck: #013A30;
  --marke-text: #ffffff;
  --akzent: #8C7740;
  --ok: #0F6B4F;
  --warnung: #8A5A00;
  --fehler: #A12A2E;
  --radius: 16px;
  --radius-klein: 12px;

  --f-titel: 'El Messiri', 'Palatino', serif;
  --f-text: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Im Dunkeln wird die ganze App zur Nacht der Anzeige, Gold wird die
       Handlungsfarbe. */
    --grund: #011F1B;
    --papier: #062B25;
    --papier-2: #0A352E;
    --linie: #18463C;
    --text: #EEF4F1;
    --text-leise: #9DB5AC;
    --marke: #B49E68;
    --marke-druck: #9C8853;
    --marke-text: #011F1B;
    --akzent: #EBCF8F;
    --ok: #5FD0A8;
    --warnung: #E7BC62;
    --fehler: #F08F92;
  }
}

@font-face {
  font-family: 'El Messiri';
  src: url('fonts/elmessiri-var.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibmplexsans-var.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

* { box-sizing: border-box; }

/* Die WebView reicht seit Punkt 15 bis an alle Raender (contentInset "never"
   in capacitor.config.json). Vorher blieb unten ein weisser Streifen in der
   Farbe der WebView stehen, weil iOS den Bereich unter der Home-Leiste
   ausserhalb der Seite liess. Die Abstaende kommen jetzt allein aus
   env(safe-area-inset-*), oben im Kopf und unten im Inhalt. */
html {
  min-height: 100%;
  background: var(--grund);
}

html, body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.5 var(--f-text);
  -webkit-text-size-adjust: 100%;
}

.kopf {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--marke);
  color: var(--marke-text);
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
}

/* Eigene Zuruecktaste, weil die Taste auf Android die App beendet: Capacitor
   leitet sie gar nicht erst in die WebView (geprueft, Punkt 10). */
.zurueck {
  background: none;
  border: 0;
  color: inherit;
  font-size: 1.8rem;
  line-height: 1;
  padding: 0 10px 4px 0;
  margin-left: -6px;
  cursor: pointer;
}

.zurueck[hidden] {
  display: none;
}

.kopf h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.inhalt {
  padding: 16px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
  max-width: 640px;
  margin: 0 auto;
}

.karte {
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 18px;
}

.karte h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.hinweis {
  margin: 0 0 16px;
  color: var(--text-leise);
  font-size: 0.92rem;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

input[type="url"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  /* 17px: darunter zoomt iOS beim Hineintippen in das Feld. Gilt fuer JEDES
     Feld, nicht nur fuer die Adresse. */
  font-size: 17px;
  padding: 13px 14px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--papier);
  color: var(--text);
}

input[type="url"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--marke);
  outline-offset: 1px;
}

.knopf {
  margin-top: 14px;
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--marke-text);
  background: var(--marke);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.knopf:disabled {
  opacity: 0.6;
}

/* display: block sticht das hidden-Attribut aus, deshalb muss hidden hier
   ausdruecklich gewinnen. Sonst steht vor der ersten Pruefung ein leerer
   Kasten auf dem Bildschirm (im Screenshot aufgefallen). */
.ergebnis[hidden] {
  display: none;
}

.ergebnis {
  display: block;
  margin-top: 18px;
  padding: 14px;
  border-radius: 10px;
  background: var(--papier-2);
  border-left: 4px solid var(--linie);
  font-size: 0.95rem;
}

.ergebnis[data-art="ok"]       { border-left-color: var(--ok); }
.ergebnis[data-art="warnung"]  { border-left-color: var(--warnung); }
.ergebnis[data-art="fehler"]   { border-left-color: var(--fehler); }

.ergebnis h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.ergebnis dl,
.karte dl {
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.9rem;
}

.ergebnis dt,
.karte dt { color: var(--text-leise); }

.ergebnis dd,
.karte dd { margin: 0; }

.ergebnis p { margin: 0; }
.ergebnis .quelle {
  margin-top: 10px;
  color: var(--text-leise);
  font-size: 0.82rem;
  word-break: break-all;
}

/* --- Ansichten ---------------------------------------------------------- */

/* hidden muss gegen display gewinnen, sonst steht beim Start alles
   untereinander auf dem Bildschirm. Dieselbe Falle wie bei .ergebnis. */
.ansicht[hidden] {
  display: none;
}

.ansicht {
  display: block;
}

/* --- Liste der Instanzen ------------------------------------------------ */

.instanzzeile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--papier);
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  font: inherit;
  cursor: pointer;
}

.instanzzeile:active {
  background: var(--papier-2);
}

.instanzzeile .text {
  flex: 1;
  min-width: 0;
}

.instanzzeile .name {
  font-weight: 600;
}

.instanzzeile .unten {
  color: var(--text-leise);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.punkt {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-leise);
}

.punkt[data-stand="angemeldet"] {
  background: var(--ok);
}

.leer {
  color: var(--text-leise);
  text-align: center;
  padding: 28px 8px;
}

/* --- Kleinteile --------------------------------------------------------- */

.hinweis.klein {
  font-size: 0.82rem;
  margin: 6px 0 16px;
}

.knopf.zweitrangig {
  background: none;
  color: var(--marke);
  border: 1px solid var(--linie);
}

.knopf.gefahr {
  background: none;
  color: var(--fehler);
  border: 1px solid var(--linie);
}

.stand {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-leise);
}

.feldfehler {
  color: var(--fehler);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

/* --- Gebetszeiten ------------------------------------------------------- */

/* Eine Zeile der Liste: Datumsbereich oben, die sechs Zeiten darunter. */
.zeitraumzeile {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--papier);
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  font: inherit;
  cursor: pointer;
}

.zeitraumzeile:active {
  background: var(--papier-2);
}

/* Der gerade gueltige Zeitraum. Das ist der, den die Anzeige zeigt. */
.zeitraumzeile[data-aktuell="ja"] {
  border-left: 4px solid var(--ok);
}

.zeitraumzeile .bereich {
  font-weight: 600;
}

.zeitraumzeile .zeiten {
  margin-top: 4px;
  color: var(--text-leise);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.marke-aktuell {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ok);
  color: var(--marke-text);
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* Die sechs Zeitfelder. Zwei Spalten, damit auf einem Telefon nichts
   abgeschnitten wird und der Daumen trifft. */
.zeitgitter {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
  margin-top: 4px;
}

.zeitgitter label {
  margin-bottom: 4px;
}

/* Datum und Zeit sind von Haus aus unterschiedlich breit. Ohne das steht in
   jeder Zelle eine andere Feldbreite. */
.zeitgitter input[type="time"] {
  width: 100%;
}

.knopfreihe {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* .knopf ist sonst immer width:100%; in einer Reihe teilen sie sich den Platz. */
.knopfreihe .knopf {
  margin-top: 0;
  flex: 1;
}

/* Hinweis des Servers nach dem Speichern, etwa zu Ueberschneidungen. */
.warnungen {
  margin: 10px 0 0;
  padding-left: 18px;
}

.warnungen li {
  margin-bottom: 4px;
}

/* --- Slides ------------------------------------------------------------- */

.slidezeile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

/* Der anklickbare Teil, damit die Pfeile daneben nicht mit ausloesen. */
.slidezeile .oeffnen {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.slidezeile .kopf {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: none;
  color: inherit;
  padding: 0;
}

.slidezeile .titel {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.slidezeile .art {
  flex: 0 0 auto;
  color: var(--text-leise);
  font-size: 0.78rem;
}

.slidezeile .unten {
  margin-top: 3px;
  color: var(--text-leise);
  font-size: 0.82rem;
}

.slidezeile[data-aktiv="nein"] .titel {
  color: var(--text-leise);
  text-decoration: line-through;
}

.pfeile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* .knopf ist sonst immer vollbreit; hier zwei kleine Quadrate. */
.pfeil {
  width: 36px;
  height: 26px;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--marke);
  background: var(--papier-2);
  border: 1px solid var(--linie);
  border-radius: 7px;
  cursor: pointer;
}

.pfeil:disabled {
  opacity: 0.35;
}

/* --- Bild am Slide ------------------------------------------------------ */

.abschnitt {
  margin: 22px 0 8px;
  font-size: 1rem;
}

#slideBildVorschau img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: var(--papier-2);
  border: 1px solid var(--linie);
  border-radius: 10px;
}

.ankreuz {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  font-weight: 400;
}

.ankreuz input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* --- Einstellungen ------------------------------------------------------ */

/* Mehrere Karten untereinander statt einer langen. */
[data-ansicht="einstellungen"] .karte {
  margin-bottom: 16px;
}

.farbzeile {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Der native Farbwaehler braucht eine feste Groesse, sonst ist er ein Strich. */
.farbzeile input[type="color"] {
  flex: 0 0 auto;
  width: 54px;
  height: 46px;
  padding: 3px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--papier);
}

.farbzeile input[type="text"] {
  flex: 1;
  font-variant-numeric: tabular-nums;
}

#hintergrundVorschau img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--papier-2);
  border: 1px solid var(--linie);
  border-radius: 10px;
}

/* Die Knoepfe im Hintergrund- und Fernsteuerungsbereich untereinander. */
#hintergrundAktionen .knopf,
#fernAktionen .knopf {
  margin-top: 10px;
}

/* ------------------------------------------------------------------
   Abstaende im Formular (Punkt 15, Rueckmeldung vom iPhone 17 Pro).
   Vorher klebte jedes Label direkt unter dem Feld davor: "Gueltig bis"
   sass auf dem Datumsfeld von "Gueltig von", die Farbfelder ebenso.
   Jedes Feld bekommt jetzt Luft nach unten, das letzte vor dem Knopf
   braucht sie nicht, der Knopf hat eigenen Abstand.
   ------------------------------------------------------------------ */
form input:not([type="checkbox"]):not([type="color"]),
form select,
form textarea,
form .farbzeile {
  margin-bottom: 16px;
}

form .hinweis.klein {
  margin-top: -8px;
}

.zeitgitter input {
  margin-bottom: 12px;
}

/* iOS rendert date- und time-Felder mit eigener Mindestbreite und
   zentriertem Text; ohne das ragen sie aus der Karte und stehen schief
   neben den Textfeldern. */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 50px;
  text-align: left;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Der Steuer-Link: lang, ohne Leerzeichen, darf umbrechen statt die Karte
   zu sprengen. */
.linkfeld {
  margin: 0 0 6px;
  padding: 12px 14px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--papier-2);
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.ausklapp {
  margin-top: 16px;
}

.ausklapp summary {
  cursor: pointer;
  color: var(--marke);
  font-weight: 600;
  padding: 8px 0;
}

.ausklapp[open] summary {
  margin-bottom: 10px;
}


/* ==================================================================
   Gestaltung (Punkt 15, "schicker machen", 06.11.)

   Das eine, was auffallen darf, ist der Kopf: der Nachthimmel der Anzeige
   mit Sternen, Halbmond und Goldschrift. Auf der Startansicht hoch und
   gross, in allen anderen Ansichten schmal. Alles darunter bleibt ruhig.
   ================================================================== */

header.kopf {
  position: relative;
  overflow: hidden;
  gap: 10px;
  color: #ffffff;
  background-color: var(--nacht);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Cg fill='%23F5E9C9'%3E%3Ccircle cx='18' cy='22' r='1.2' opacity='.5'/%3E%3Ccircle cx='70' cy='58' r='.8' opacity='.35'/%3E%3Ccircle cx='122' cy='16' r='1.4' opacity='.45'/%3E%3Ccircle cx='168' cy='74' r='.9' opacity='.3'/%3E%3Ccircle cx='214' cy='34' r='1.1' opacity='.4'/%3E%3Ccircle cx='40' cy='96' r='.7' opacity='.3'/%3E%3Ccircle cx='196' cy='104' r='1' opacity='.35'/%3E%3Ccircle cx='98' cy='92' r='.6' opacity='.25'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, #011F1B 0%, #024D40 100%);
  background-size: 240px 120px, 100% 100%;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 14px;
  border-bottom: 1px solid rgba(180, 158, 104, 0.35);
}

header.kopf h1 {
  font-family: var(--f-titel);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.logo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--gold);
}

.logo svg { display: block; width: 100%; height: 100%; }

.kopf-text { min-width: 0; }

.unterzeile {
  display: none;
  margin: 2px 0 0;
  color: rgba(235, 207, 143, 0.8);
  font-size: 0.88rem;
}

/* Startansicht: der Kopf als Himmel ueber der Liste. */
body[data-ansicht="liste"] header.kopf {
  flex-direction: column;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 28px) 22px 30px;
}

body[data-ansicht="liste"] .logo {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
}

body[data-ansicht="liste"] header.kopf h1 {
  font-size: 2.1rem;
  color: var(--gold-hell);
}

body[data-ansicht="liste"] .unterzeile { display: block; }

/* Ein grosser Halbmond als Wasserzeichen, wie auf der Anzeige. */
header.kopf::after {
  content: "";
  position: absolute;
  right: -40px;
  top: calc(env(safe-area-inset-top) - 30px);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  box-shadow: -26px 18px 0 0 rgba(180, 158, 104, 0.10);
  pointer-events: none;
}

body:not([data-ansicht="liste"]) header.kopf::after {
  width: 110px;
  height: 110px;
  top: calc(env(safe-area-inset-top) - 40px);
}

.zurueck {
  color: var(--gold-hell);
  font-size: 2rem;
}

/* --- Flaechen ---------------------------------------------------------- */

.inhalt { padding-top: 18px; }

.karte {
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
}

.karte h2,
#instanzName {
  font-family: var(--f-titel);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--marke);
  margin-bottom: 8px;
}

@media (prefers-color-scheme: dark) {
  .karte h2, #instanzName { color: var(--gold-hell); }
}

label { color: var(--text); }

input[type="url"], input[type="password"], input[type="text"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
  border-radius: var(--radius-klein);
  background: var(--papier-2);
  border-color: var(--linie);
}

input:focus, select:focus, textarea:focus, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold) !important;
  outline-offset: 2px;
}

/* --- Knoepfe ------------------------------------------------------------ */

.knopf {
  border-radius: var(--radius-klein);
  min-height: 50px;
  font-family: var(--f-text);
  letter-spacing: 0.01em;
  transition: transform 80ms ease, background-color 120ms ease;
}

.knopf:active { transform: scale(0.98); background-color: var(--marke-druck); }

.knopf.zweitrangig {
  border: 1.5px solid var(--linie);
  background: var(--papier);
  color: var(--marke);
}

.knopf.zweitrangig:active { background: var(--papier-2); }

.knopf.gefahr {
  border: 1.5px solid color-mix(in srgb, var(--fehler) 35%, var(--linie));
  background: var(--papier);
}

@media (prefers-color-scheme: dark) {
  .knopf.zweitrangig { color: var(--gold-hell); }
}

@media (prefers-reduced-motion: reduce) {
  .knopf { transition: none; }
  .knopf:active { transform: none; }
}

/* --- Listen ------------------------------------------------------------- */

.instanzzeile,
.zeitraumzeile,
.slidezeile {
  border-radius: var(--radius-klein);
  border-color: var(--linie);
  padding: 15px 16px;
}

.instanzzeile:active, .zeitraumzeile:active { background: var(--papier-2); }

/* Jede Moschee bekommt den Halbmond als Zeichen vorn, der Punkt daneben
   sagt, ob dieses Geraet dort angemeldet ist. */
.instanzzeile::before {
  content: "";
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%23B49E68' d='M38 12a20 20 0 1 0 14 34A17 17 0 0 1 38 12z'/%3E%3Ccircle cx='46' cy='18' r='2.6' fill='%23EBCF8F'/%3E%3C/svg%3E") center / 30px no-repeat,
    linear-gradient(180deg, #011F1B, #024D40);
}

.instanzzeile .name {
  font-family: var(--f-titel);
  font-size: 1.15rem;
  font-weight: 600;
}

.instanzzeile > span[aria-hidden] { color: var(--text-leise); font-size: 1.4rem; }

.punkt { width: 9px; height: 9px; order: 3; }

/* Der Zeitraum, der gerade auf der Anzeige steht, traegt Gold. */
.zeitraumzeile[data-aktuell="ja"] {
  border-left: 4px solid var(--gold);
}

.marke-aktuell {
  background: var(--gold);
  color: var(--nacht);
}

.zeitraumzeile .zeiten { font-size: 0.88rem; }

.leer {
  font-family: var(--f-titel);
  font-size: 1.1rem;
}

/* --- Rueckmeldungen ----------------------------------------------------- */

.ergebnis {
  border-radius: var(--radius-klein);
  background: var(--papier-2);
}

.ergebnis h3 {
  font-family: var(--f-titel);
  font-size: 1.1rem;
  font-weight: 600;
}

/* --- Menue der Instanz -------------------------------------------------- */

.menue {
  margin: 18px 0 6px;
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  overflow: hidden;
}

.menuezeile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--linie);
  background: var(--papier);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menuezeile:last-child { border-bottom: 0; }
.menuezeile:active { background: var(--papier-2); }

.menue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.menue-titel {
  font-family: var(--f-titel);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--marke);
}

.menue-zeile { color: var(--text-leise); font-size: 0.86rem; }
.menue-pfeil { color: var(--gold); font-size: 1.5rem; }

@media (prefers-color-scheme: dark) {
  .menue-titel { color: var(--gold-hell); }
}

.slidezeile .titel,
.zeitraumzeile .bereich {
  font-family: var(--f-titel);
  font-size: 1.1rem;
}

/* ==================================================================
   Designer (Punkt 16)
   ================================================================== */

/* Die Vorschau bleibt oben stehen, waehrend darunter Schrift, Farbe und
   Hintergrund eingestellt werden: man sieht sofort, was sich aendert. */
.design-buehne {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -18px -16px 14px;
  padding: 12px 16px 8px;
  background: var(--grund);
  border-bottom: 1px solid var(--linie);
}

.design-werkzeug {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.design-werkzeug::-webkit-scrollbar { display: none; }

.werkzeug {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1.5px solid var(--linie);
  border-radius: 999px;
  background: var(--papier);
  color: var(--marke);
  font: 600 0.92rem var(--f-text);
  cursor: pointer;
}

.werkzeug::before { content: "+ "; color: var(--gold); }
.werkzeug:disabled { opacity: 0.45; }

@media (prefers-color-scheme: dark) {
  .werkzeug { color: var(--gold-hell); }
}

.design-flaeche {
  position: relative;
  height: 50vh;
  aspect-ratio: 9 / 16;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(180, 158, 104, 0.45), 0 10px 30px rgba(1, 31, 27, 0.25);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background-color: #011F1B;
}

.design-tipp { text-align: center; margin: 8px 0 0; }

.d-schleier { position: absolute; inset: 0; pointer-events: none; }

.d-el {
  position: absolute;
  display: flex;
  align-items: center;
  overflow: visible;
  cursor: grab;
}

.d-el .d-inhalt {
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  white-space: pre-line;
  line-height: 1.15;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.d-el img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.d-el.leer-bild {
  border: 1px dashed rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.7);
  justify-content: center;
  font-size: 12px;
}

/* Hauchduenner Rahmen um alles, damit man auch leere Flaechen trifft. */
.d-el::after {
  content: "";
  position: absolute;
  inset: 0;
  outline: 1px dashed rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.d-el.gewaehlt::after {
  outline: 2px solid var(--gold);
}

.d-griff {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: var(--gold-hell);
  border: 2px solid var(--nacht);
  z-index: 2;
  touch-action: none;
}

.d-griff[data-griff="nw"] { left: 0; top: 0; }
.d-griff[data-griff="ne"] { left: 100%; top: 0; }
.d-griff[data-griff="sw"] { left: 0; top: 100%; }
.d-griff[data-griff="se"] { left: 100%; top: 100%; }

.d-linie {
  position: absolute;
  background: #EBCF8F;
  opacity: 0.9;
  pointer-events: none;
  z-index: 5;
}

.d-linie.senkrecht { top: 0; bottom: 0; width: 1px; }
.d-linie.waagerecht { left: 0; right: 0; height: 1px; }

/* --- Werkzeugleisten unter der Vorschau ---------------------------------- */

.design-panel h2 { font-size: 1.15rem; }

.reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.reihe > label { width: 100%; margin-bottom: 0; }

.segment {
  display: inline-flex;
  border: 1.5px solid var(--linie);
  border-radius: 10px;
  overflow: hidden;
}

.segment button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--linie);
  background: var(--papier);
  color: var(--text);
  font: 500 0.92rem var(--f-text);
  cursor: pointer;
}

.segment button:last-child { border-right: 0; }

.segment button[aria-pressed="true"] {
  background: var(--marke);
  color: var(--marke-text);
}

.farbe {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--linie);
  cursor: pointer;
  padding: 0;
}

.farbe[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

.reihe input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
}

.reihe input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--marke); }

.reihe .wert {
  min-width: 52px;
  text-align: right;
  color: var(--text-leise);
  font-variant-numeric: tabular-nums;
}

.klein-knopf {
  min-height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--linie);
  border-radius: 10px;
  background: var(--papier);
  color: var(--marke);
  font: 600 0.9rem var(--f-text);
  cursor: pointer;
}

.klein-knopf.gefahr { color: var(--fehler); }

@media (prefers-color-scheme: dark) {
  .klein-knopf { color: var(--gold-hell); }
}

.design-aktionen {
  position: sticky;
  bottom: 0;
  padding: 10px 0 calc(env(safe-area-inset-bottom) + 6px);
  background: var(--grund);
}

.marke-design {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--nacht);
  font: 600 0.72rem var(--f-text);
}

/* Auf dem Telefon darf die angeheftete Vorschau nicht mehr als gut ein
   Drittel der Hoehe nehmen, sonst bleibt fuer die Werkzeuge darunter kein
   Platz (im Test auf 402 x 874 aufgefallen). Der Hinweis verschwindet, sobald
   etwas ausgewaehlt ist: dann weiss man, wie es geht. */
.design-flaeche { height: 38vh; }
.design-buehne.mit-auswahl .design-tipp { display: none; }
.design-aktionen { padding-top: 8px; }
.design-aktionen .knopf { min-height: 46px; }


/* ==================================================================
   Rueckmeldung 06.11. nachmittags
   ================================================================== */

/* Kein Zoom: die App ist fuer das Telefon gebaut, Felder haben 17px und
   loesen deshalb auch beim Antippen keinen Zoom aus. touch-action nimmt
   den Doppeltipp-Zoom, viewport im Markup das Aufziehen mit zwei Fingern. */
html { touch-action: manipulation; }

/* Kein Nachfedern ueber den Rand: oben zeigte es sonst die helle Grundfarbe
   ueber dem dunklen Kopf. */
html, body { overscroll-behavior: none; }

/* Der Kopf mit der Zuruecktaste bleibt beim Scrollen stehen. */
header.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Der Halbmond als Wasserzeichen reichte bis in die Statusleiste und stand
   dort als heller Bogen neben Uhr und Akku. Jetzt nur noch auf der
   Startansicht und unterhalb der Statusleiste. */
body:not([data-ansicht="liste"]) header.kopf::after { display: none; }

body[data-ansicht="liste"] header.kopf::after {
  top: calc(env(safe-area-inset-top) + 18px);
  right: -56px;
  width: 150px;
  height: 150px;
}

/* Die Statusleiste bekommt eine ruhige, gleichmaessige Flaeche; der Verlauf
   beginnt erst darunter. */
header.kopf {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Cg fill='%23F5E9C9'%3E%3Ccircle cx='18' cy='22' r='1.2' opacity='.5'/%3E%3Ccircle cx='70' cy='58' r='.8' opacity='.35'/%3E%3Ccircle cx='122' cy='16' r='1.4' opacity='.45'/%3E%3Ccircle cx='168' cy='74' r='.9' opacity='.3'/%3E%3Ccircle cx='214' cy='34' r='1.1' opacity='.4'/%3E%3Ccircle cx='40' cy='96' r='.7' opacity='.3'/%3E%3Ccircle cx='196' cy='104' r='1' opacity='.35'/%3E%3Ccircle cx='98' cy='92' r='.6' opacity='.25'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, #011F1B 0, #011F1B env(safe-area-inset-top), #024D40 100%);
  background-position: 0 env(safe-area-inset-top), 0 0;
  background-repeat: repeat, no-repeat;
}

/* Die Vorschau des Designers haengt jetzt unter dem festen Kopf. */
.design-buehne { top: var(--kopf-hoehe, 0px); }

/* --- Flyer (Punkt 17) ---------------------------------------------------- */

.flyer-formate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-bottom: 16px;
}

.flyer-formate button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--linie);
  text-align: left;
}

.fmt-name { font-weight: 600; }
.fmt-zeile { font-size: 0.8rem; opacity: 0.75; }

.flyer-vorschau {
  display: flex;
  justify-content: center;
  margin: 4px 0 6px;
  padding: 14px;
  border-radius: var(--radius-klein);
  background: var(--papier-2);
}

.flyer-vorschau img {
  max-width: 100%;
  max-height: 46vh;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(1, 31, 27, 0.25);
}

/* Formularfelder erben die Schrift der App. Ohne das zeigt WebKit Textfelder
   in einer Schreibmaschinenschrift (im Designer bei Store-Screenshots
   aufgefallen, 06.11.). */
input, textarea, select, button { font-family: inherit; }

/* Hinweis auf eine neue Android-Version (Punkt 18) */
.aktualisierung {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-klein);
  background: var(--papier);
}
.aktualisierung[hidden] { display: none; }
.akt-text { flex: 1; display: flex; flex-direction: column; font-size: 0.92rem; }
.akt-text span { color: var(--text-leise); }

/* ==================================================================
   Hintergrund der Anzeige (hintergrund.js, hintergrundeditor.js)
   ================================================================== */

.hg-ebenen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hg-foto {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
}
.hg-schleier { position: absolute; inset: 0; }

/* Angedeutete Tafel ueber der Vorschau, Masse in Einheiten einer 1080 breiten
   Flaeche (--hg-px), damit man die Lesbarkeit beurteilen kann. */
.hg-tafel {
  position: absolute;
  inset: 0;
  padding: calc(var(--hg-px) * 90) calc(var(--hg-px) * 90) 0;
  color: #fff;
  pointer-events: none;
  text-align: center;
}
.hg-moschee { font: 600 calc(var(--hg-px) * 38) var(--f-titel); letter-spacing: 0.3em; opacity: 0.7; }
.hg-uhr { font: 700 calc(var(--hg-px) * 220) var(--f-text); line-height: 1.1; }
.hg-titel { font: 600 calc(var(--hg-px) * 110) var(--f-titel); margin-bottom: calc(var(--hg-px) * 50); }
.hg-zeile {
  display: flex;
  justify-content: space-between;
  font: 600 calc(var(--hg-px) * 84) var(--f-titel);
  line-height: 1.65;
}
.hg-zeile span:last-child { font-family: var(--f-text); font-weight: 700; }

#hgFlaeche { cursor: grab; }

/* Kleine Vorschau in den Einstellungen */
.hg-vorschau {
  position: relative;
  width: 108px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  margin: 8px 0 12px;
  box-shadow: 0 0 0 1px rgba(180, 158, 104, 0.45);
}
