:root {
  --grund: #f6f2ec;
  --flaeche: #ffffff;
  --text: #1f1b16;
  --leise: #6b6358;
  --linie: #ddd5ca;
  --primaer: #1f5c4a;
  --primaer-text: #ffffff;
  --pruefen: #b7791f;
  --pruefen-grund: #fff4d6;
  --fehler: #a4262c;
  --fehler-grund: #fde8e8;
  --ok: #1f7a4d;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 16px)
    calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 32px)
    calc(env(safe-area-inset-left) + 16px);
}

[hidden] { display: none !important; }

h1 { font-size: 1.75rem; margin: 8px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; color: var(--leise); font-weight: 600; margin: 32px 0 8px; }

.hinweis { color: var(--leise); margin: -8px 0 16px; }

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.5; cursor: default; }

.gross {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 12px 0;
  padding: 14px 20px;
  font-size: 1.15rem;
  font-weight: 600;
  background: var(--flaeche);
  color: var(--text);
  border: 1px solid var(--linie);
}
.primaer { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
#neues-teil { min-height: 96px; font-size: 1.4rem; margin-top: 24px; }

.leise {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 4px 0;
  background: transparent;
  color: var(--primaer);
  font-weight: 600;
}

/* Liste der heutigen Inserate */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { margin: 8px 0; }
.liste details {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 0 14px;
}
.liste summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.liste summary::-webkit-details-marker { display: none; }
.liste summary .titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste summary .uhrzeit { color: var(--leise); flex: none; }
.liste details[open] { padding-bottom: 8px; }

/* Fotos in der Aufnahme */
.fotos { list-style: none; margin: 0 0 8px; padding: 0; }
.fotos li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  margin: 8px 0;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}
.fotos img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
  background: var(--linie);
}
.fotos select {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  font: inherit;
  font-size: 17px; /* unter 16px zoomt iOS beim Antippen */
  padding: 8px 10px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--grund);
  color: var(--text);
}
.entfernen {
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
  background: transparent;
  color: var(--leise);
}

.beschriftung { display: block; font-weight: 600; margin: 16px 0 6px; }
.optional { color: var(--leise); font-weight: 400; }

textarea, input[type="password"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 10px 12px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  background: var(--flaeche);
  color: var(--text);
  resize: none;
  overflow: hidden;
}
#notizen { overflow: auto; resize: vertical; }
input[type="password"] { min-height: 48px; }

.fehler {
  background: var(--fehler-grund);
  color: var(--fehler);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 600;
  margin: 16px 0 0;
}

.laeuft {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
  padding: 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  font-weight: 600;
}
.kreisel {
  width: 22px;
  height: 22px;
  border: 3px solid var(--linie);
  border-top-color: var(--primaer);
  border-radius: 50%;
  animation: drehen 0.8s linear infinite;
  flex: none;
}
@keyframes drehen { to { transform: rotate(360deg); } }

/* Ergebnisfelder */
.feld { margin: 0 0 14px; }
.feld-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.feld-kopf label { font-weight: 600; flex: 1; }
.kopieren {
  flex: none;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--flaeche);
  color: var(--primaer);
  border: 1px solid var(--linie);
}
.kopieren.ok { color: var(--ok); border-color: var(--ok); }

.marke {
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pruefen);
  background: var(--pruefen-grund);
  border: 1px solid var(--pruefen);
  border-radius: 999px;
  padding: 2px 10px;
}
.feld.pruefen textarea {
  border: 2px solid var(--pruefen);
  background: var(--pruefen-grund);
}

.meldung {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translate(-50%, 20px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100% - 32px);
  text-align: center;
}
.meldung.sichtbar { opacity: 1; transform: translate(-50%, 0); }
