:root {
  --ink: #171A15;
  --muted: #6B7065;
  --paper: #FAFAF7;
  --white: #FFFFFF;
  --hairline: #E6E3DB;
  --hairline-soft: #EFECE5;
  --gold: #B8862F;
  --gold-deep: #8C6420;
  --gold-soft: #F6EEDC;
  --gold-line: #C9A25A;
  --gold-ink: #5E4313;
  --forest: #2C4A2E;
  --danger: #A0352A;
  --shadow: 0 12px 40px rgba(23, 26, 21, 0.12);
  font-family: system-ui, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html, body { margin: 0; background: #FAFAF7; height: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

#backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 21, 0.45);
}

#sheet {
  position: relative;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.cam-ui #sheet {
  background: #000;
}
body.cam-ui .top {
  display: none !important;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  gap: 8px;
}
.step-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.icon-btn, .stack, .shutter {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn.spacer, .stack.spacer { visibility: hidden; }

.step { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.cam-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}
.cam-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cam-torch {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cam-torch[hidden] {
  display: none !important;
}
.cam-torch.is-on .cam-torch-icon-off {
  display: none;
}
.cam-torch:not(.is-on) .cam-torch-icon-on {
  display: none;
}
.cam-torch.is-on {
  color: #f5d76e;
}
.cam-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #000;
}
.cam-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  background: #000;
  position: relative;
}
.cam-preview,
.cam-viewport {
  touch-action: none;
}
.cam-viewport {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  overflow: hidden;
  flex: none;
}
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.cam-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out;
}
.cam-flash.on {
  opacity: 0.85;
}
.cam-focus {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  pointer-events: none;
  animation: cam-focus-pulse 0.65s ease-out forwards;
}
@keyframes cam-focus-pulse {
  0% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}
.cam-zoom {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  z-index: 4;
}
.cam-zoom-btn {
  min-width: 40px;
  min-height: 32px;
  border: 0;
  border-radius: 16px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
}
.cam-zoom-btn.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}
.camera-fallback {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 21px;
  text-align: center;
  color: #fff;
  z-index: 2;
}
.cam-controls {
  flex: none;
  height: 28vh;
  min-height: 140px;
  max-height: 240px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.cam-controls-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 320px;
  padding: 0 28px;
}
.cam-side {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.cam-gallery {
  justify-self: start;
  background: #2a2a2a;
}
.cam-flip {
  justify-self: end;
  background: #3a3a3a;
  border: 0;
  border-radius: 16px;
}
.cam-flip:active {
  background: #4a4a4a;
}
.cam-gallery.has-thumb .gallery-icon {
  display: none;
}
.gallery-thumb {
  position: absolute;
  inset: 0;
  background: center/cover no-repeat #2a2a2a;
}
.gallery-thumb[hidden] {
  display: none !important;
}
.cam-shutter-ring {
  justify-self: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid #6b6b6b;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.shutter {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  padding: 0;
  transition: transform 0.1s ease-out;
}
.shutter.is-pressed {
  transform: scale(0.92);
}
.stack {
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  font-weight: 600;
}
.side-paths {
  display: flex;
  justify-content: center;
  gap: 21px;
  padding: 0 21px 21px;
}

.text-btn {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.capture-side {
  min-width: 44px;
  justify-content: center;
}
.capture-side.icon-btn {
  border-radius: 22px;
  border: 1px solid var(--hairline);
  background: var(--paper);
}
.gallery-labeled {
  flex-direction: column;
  gap: 4px;
  min-width: 72px;
  min-height: 52px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}
#gallery .gallery-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cam-gallery-alt {
  justify-self: end;
  background: #3a3a3a;
}
#gallery-alt[hidden] {
  display: none !important;
}
.cam-stage-choice {
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
}
.choice-hero {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #000 center/contain no-repeat;
}
.cam-choice-actions {
  flex: none;
  padding: 16px 21px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #000;
}
.cam-btn-primary {
  min-height: 52px;
  border-radius: 26px;
  border: 0;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: 16px;
}
.cam-btn-ghost {
  min-height: 48px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font-weight: 500;
  font-size: 15px;
}
.lens-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  line-height: 1.25;
}
.lens-main { font-size: 15px; font-weight: 500; color: #fff; }
.lens-sub { font-size: 11px; color: rgba(255, 255, 255, 0.65); font-weight: 400; }

.btn {
  min-height: 50px;
  border-radius: 25px;
  border: 0;
  padding: 0 21px;
  font-weight: 500;
  font-size: 15px;
}
.btn.primary { background: var(--gold-deep); color: #fff; }
.btn.ghost { background: var(--white); color: var(--ink); border: 1px solid var(--hairline); }
.btn:disabled { opacity: 0.6; }

.details { padding: 0 21px 21px; gap: 18px; overflow: auto; }
.block { display: flex; flex-direction: column; gap: 8px; }
.label {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.hint.warn { color: var(--danger); }
.line-input, textarea, .date-row input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  outline: none;
  font-size: 16px;
}
textarea { border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 13px; resize: vertical; }
.date-row { display: block; position: relative; }
.date-row input { border: 1px solid var(--hairline); border-radius: 8px; padding: 0 8px; width: 100%; }
.date-row input[type="date"] { color: transparent; caret-color: transparent; }
.date-row input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
}
.date-display {
  position: absolute;
  left: 8px;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 16px;
  color: var(--ink);
}
.metrics .metric-cell[hidden] { display: none !important; }
.metrics[hidden] { display: none !important; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.photo-grid {
  display: contents;
}
.photo-add-tiles {
  display: contents;
}
.add-tile {
  width: 72px;
  height: 72px;
  min-height: 72px;
  flex: none;
  border-radius: 8px;
  border: 1px dashed var(--hairline);
  background: var(--paper);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-tile {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  width: 72px;
  height: 72px;
  min-height: 72px;
  flex: none;
  background: var(--paper);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}
.photo-actions button {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.photo-actions button::before {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(23, 26, 21, 0.62);
  z-index: 0;
}
.photo-actions button > * {
  position: relative;
  z-index: 1;
}
.add-photo {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--white);
}
.add-photo {
  border-style: dashed;
  color: var(--muted);
}

.suggest { display: flex; flex-direction: column; gap: 4px; }
.suggest button, .chip, .choice-grid button {
  min-height: 44px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: var(--white);
  padding: 0 13px;
  text-align: left;
}
.chips, .choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid button { text-align: center; }
#step-done {
  overflow-x: hidden;
  max-width: 100%;
}
#step-done #after {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
  max-width: 100%;
  overflow-x: hidden;
}
#step-done #after .btn {
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
}
#step-done #after .share-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
#step-done #after .share-row .btn {
  width: 100%;
  flex: none;
  min-width: 0;
}
#step-done #after .text-btn {
  width: 100%;
  text-align: center;
}
#step-done #after-lead {
  margin: 0 0 4px;
  line-height: 1.45;
}
.chip[aria-pressed="true"], .choice-grid button[aria-pressed="true"] {
  background: var(--gold-soft);
  border-color: var(--gold-line);
  color: var(--gold-ink);
  font-weight: 600;
}

.map-geo-search { margin-bottom: 8px; width: 100%; }
.map-geo-results { margin-bottom: 8px; max-height: 160px; overflow: auto; }
.map-wrap { position: relative; }
.map {
  height: max(45vh, 160px);
  min-height: 45vh;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}
.login-note .text-btn { margin-left: 6px; font-weight: 600; color: var(--gold-deep); }
.map-info {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1000;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}
.map-attr {
  position: absolute;
  left: 8px;
  right: 48px;
  bottom: 8px;
  z-index: 1000;
  margin: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--white);
  font-size: 11px;
}
#donate-photos-more { margin-left: 6px; font-size: 12px; color: var(--gold-deep); }
.switch-row {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  min-height: 44px;
  padding: 8px 0;
}
.switch-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--forest); }
.switch-row strong { display: block; font-weight: 600; font-size: 14px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--hairline-soft);
}
.metric { display: block; font-size: 18px; font-weight: 300; }
.metric-label { font-size: 10px; color: var(--muted); }

#save-bar {
  position: sticky;
  bottom: 0;
  padding: 13px 21px calc(21px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--white);
}
#save { width: 100%; }

.done { padding: 21px; gap: 21px; align-items: stretch; }
.posting { display: flex; align-items: center; gap: 13px; }
.posting img { width: 55px; height: 55px; object-fit: cover; border-radius: 8px; }
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--hairline);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
.share-row { display: flex; flex-direction: column; gap: 8px; }
.login-note, #form-error { padding: 0 21px 13px; }

.mushroom {
  width: 72px;
  height: 84px;
  margin: 8px auto;
  background:
    radial-gradient(circle at 50% 28%, #F6EEDC 0 18px, #C9A25A 19px 34px, transparent 35px),
    linear-gradient(#8C6420, #8C6420) center 46px / 10px 36px no-repeat;
  transform-origin: 50% 100%;
  animation: grow 1.2s cubic-bezier(.2,.8,.2,1) both;
}
.first-text { text-align: center; font-size: 22px; font-weight: 500; margin: 8px 0 0; }
#celebrate { position: relative; overflow: hidden; min-height: 140px; }
#celebrate::before, #celebrate::after {
  content: "";
  position: absolute;
  inset: 10px 18%;
  background:
    radial-gradient(circle, #C9A25A 0 4px, transparent 5px) 0 0 / 18px 18px,
    radial-gradient(circle, #F6EEDC 0 3px, transparent 4px) 9px 9px / 18px 18px;
  animation: confetti 1.2s ease-out both;
  pointer-events: none;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes grow { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes confetti { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (min-width: 900px) {
  #backdrop { display: block; }
  #sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(480px, 100%);
    max-height: 92dvh;
    min-height: 0;
    border-radius: 21px 21px 0 0;
    box-shadow: var(--shadow);
    overflow: auto;
  }
}

.ask-community-row { margin-top: 8px; }

.place-name-dialog {
  border: none;
  padding: 0;
  max-width: min(92vw, 400px);
  border-radius: 13px;
  background: var(--white);
  color: var(--ink);
}
.place-name-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.place-name-form { padding: 21px; display: flex; flex-direction: column; gap: 13px; }
.place-name-title { margin: 0; font-size: 18px; font-weight: 600; }
.place-name-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.place-name-actions .btn { min-height: 44px; }

.ios-perm-hint {
  border: none;
  padding: 0;
  max-width: min(92vw, 400px);
  border-radius: 13px;
  background: var(--surface, #fff);
  color: var(--text, #171a15);
}
.ios-perm-hint::backdrop { background: rgba(0, 0, 0, 0.45); }
.ios-perm-card { padding: 21px; display: flex; flex-direction: column; gap: 13px; }
.ios-perm-card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.ios-perm-card p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted, #6b7065); }
.ios-perm-card .btn { width: 100%; min-height: 44px; }
/* Fund-Abschluss, Regel B: Alarm nur mit Plus (Ort ist trotzdem gespeichert) */
#step-done #after .after-plus {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--gold-soft);
}
#step-done #after .after-plus[hidden] { display: none; }
#step-done #after .after-plus b { font-size: 15px; }
#step-done #after .after-plus p { margin: 0; font-size: 13px; line-height: 1.45; }
#step-done #after .after-plus .btn { width: 100%; }

/* S2b: Sichtbarkeit als Kärtchen, Entscheidung oben im Formular */
.priv-block { border-bottom: 1px solid var(--hairline-soft); padding-bottom: 12px; }
.priv-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 14px; }
.priv-summary .text-btn { flex: none; }
.vis-cards { display: grid; gap: 8px; margin: 6px 0 4px; }
.vis-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 13px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  cursor: pointer;
}
.vis-card[aria-checked="true"] {
  background: var(--gold-soft);
  border-color: var(--gold-line);
  color: var(--gold-ink);
}
.vis-card .vis-ico { display: inline-flex; flex: none; color: var(--gold-deep); }
.vis-card .vis-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vis-card strong { font-weight: 600; font-size: 14px; }
.vis-card .vis-help { font-size: 12px; line-height: 1.35; color: var(--muted); }
.vis-card[aria-checked="true"] .vis-help { color: var(--gold-ink); }
.vis-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
