@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --denim: #22304f;
  --denim-tief: #141c2e;
  --weiss: #f5f7fa;
  --gelb: #f4c534;
  --rot: #d8433b;
  --schiefer: #5b6678;
  --linie: #dce2ea;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--weiss);
  color: var(--denim-tief);
  font-family: 'Bricolage', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

:focus-visible {
  outline: 3px solid var(--gelb);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ---------- Grundgerüst ---------- */

.seite {
  min-height: 100%;
  padding: calc(var(--oben) + 18px) 16px calc(var(--unten) + 110px);
}

.kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.kopf h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
}

.kopf .zahl {
  color: var(--schiefer);
  font-size: 15px;
  white-space: nowrap;
}

.hinweis {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff6d6;
  font-size: 14px;
}

/* ---------- Suche und Filter ---------- */

.suche {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--linie);
  border-radius: 14px;
  background: #fff;
  font-size: 17px;
}

.reihe {
  display: flex;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.reihe::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid var(--linie);
  border-radius: 19px;
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.chip small {
  margin-left: 5px;
  color: var(--schiefer);
  font-size: 13px;
}

.chip.an {
  border-color: var(--denim);
  background: var(--denim);
  color: #fff;
}

.chip.an small {
  color: #b9c3d6;
}

select.chip {
  appearance: none;
  padding-right: 30px;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235b6678' stroke-width='1.6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
}

/* ---------- Kacheln mit Etikett ---------- */

.raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px 10px;
  margin-top: 18px;
}

.teil {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
}

.teil img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  background: var(--linie);
}

/* Das eingenähte Etikett: der eine laute Baustein der Oberfläche. */
.etikett {
  position: relative;
  width: calc(100% - 14px);
  margin: -18px 0 0 7px;
  padding: 6px 8px 7px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(20, 28, 46, 0.16);
  outline: 1px dashed #b9c3d6;
  outline-offset: -3px;
}

.etikett b {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etikett span {
  display: block;
  overflow: hidden;
  color: var(--schiefer);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teil.wartet img {
  opacity: 0.55;
}

.teil.wartet .etikett {
  background: #fff6d6;
}

.leer {
  margin-top: 56px;
  text-align: center;
  color: var(--schiefer);
}

.leer strong {
  display: block;
  margin-bottom: 6px;
  color: var(--denim-tief);
  font-size: 22px;
  font-weight: 700;
}

/* ---------- Leiste unten ---------- */

.leiste {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 96px 1fr;
  align-items: center;
  height: calc(64px + var(--unten));
  padding-bottom: var(--unten);
  border-top: 1px solid var(--linie);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.leiste .reiter {
  height: 64px;
  color: var(--schiefer);
  font-size: 15px;
  font-weight: 600;
}

.leiste .reiter.an {
  color: var(--denim-tief);
}

.leiste .foto {
  justify-self: center;
  width: 76px;
  height: 76px;
  margin-top: -30px;
  border: 5px solid #fff;
  border-radius: 50%;
  background: var(--gelb);
  box-shadow: 0 6px 18px rgba(20, 28, 46, 0.28);
}

.leiste .foto svg {
  display: block;
  width: 30px;
  margin: auto;
}

/* ---------- Kamera ---------- */

.kamera {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
}

.kamera video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kamera .blitz {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.kamera .blitz.an {
  animation: blitz 0.18s ease-out;
}

@keyframes blitz {
  from {
    opacity: 0.85;
  }
  to {
    opacity: 0;
  }
}

.kamera .oben,
.kamera .unten {
  position: relative;
  z-index: 1;
}

.kamera .oben {
  padding: calc(var(--oben) + 12px) 0 22px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
}

.kamera .frage {
  margin: 0 16px 8px;
  font-size: 15px;
  font-weight: 600;
}

.kamera .reihe {
  margin: 0;
}

.kamera .chip {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

.kamera .chip.an {
  border-color: var(--gelb);
  background: var(--gelb);
  color: var(--denim-tief);
}

.kamera .mitte {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.kamera .mitte p {
  max-width: 280px;
  margin: 0 0 16px;
  font-size: 17px;
}

.kamera .unten {
  padding: 26px 16px calc(var(--unten) + 18px);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.kamera .streifen {
  display: flex;
  gap: 6px;
  height: 58px;
  margin-bottom: 14px;
  overflow: hidden;
}

.kamera .streifen img {
  flex: none;
  width: 44px;
  height: 58px;
  border: 2px solid #fff;
  border-radius: 8px;
  object-fit: cover;
}

.kamera .streifen img:first-child {
  animation: rein 0.22s ease-out;
}

@keyframes rein {
  from {
    transform: scale(1.6) translateY(-30px);
    opacity: 0;
  }
}

.kamera .bedienung {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.kamera .zaehler {
  font-size: 15px;
}

.kamera .zaehler b {
  display: block;
  font-size: 30px;
  font-weight: 750;
  line-height: 1;
}

.kamera .ausloeser {
  width: 82px;
  height: 82px;
  border: 5px solid #fff;
  border-radius: 50%;
  background: var(--gelb);
  transition: transform 0.08s;
}

.kamera .ausloeser:active {
  transform: scale(0.9);
}

.kamera .ausloeser:disabled {
  background: #777;
}

.kamera .fertig {
  justify-self: end;
  height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

/* ---------- Blatt von unten ---------- */

.schleier {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  background: rgba(20, 28, 46, 0.5);
}

.blatt {
  width: 100%;
  max-height: 94%;
  padding: 16px 16px calc(var(--unten) + 18px);
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  background: var(--weiss);
  animation: hoch 0.2s ease-out;
}

@keyframes hoch {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.blatt h2 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.blatt .bild {
  display: block;
  width: 100%;
  max-height: 46vh;
  margin-bottom: 14px;
  border-radius: 16px;
  object-fit: contain;
  background: var(--denim-tief);
}

.feld {
  display: block;
  margin-top: 14px;
}

.feld > span {
  display: block;
  margin-bottom: 6px;
  color: var(--schiefer);
  font-size: 14px;
  font-weight: 500;
}

.feld input,
.feld select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--linie);
  border-radius: 12px;
  background: #fff;
  font-size: 17px;
}

.feld .reihe {
  margin-top: 0;
}

.knoepfe {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.knopf {
  flex: 1;
  height: 52px;
  border-radius: 14px;
  background: var(--denim);
  color: #fff;
  font-size: 17px;
  font-weight: 650;
}

.knopf.leise {
  flex: none;
  padding: 0 16px;
  border: 1.5px solid var(--linie);
  background: #fff;
  color: var(--denim-tief);
  font-weight: 550;
}

.knopf.weg {
  flex: none;
  padding: 0 16px;
  border: 1.5px solid var(--rot);
  background: #fff;
  color: var(--rot);
  font-weight: 550;
}

.knopf.weg.sicher {
  background: var(--rot);
  color: #fff;
}

.knopf.gelb {
  background: var(--gelb);
  color: var(--denim-tief);
}

/* ---------- Orte ---------- */

.neu-ort {
  display: flex;
  gap: 8px;
}

.neu-ort .suche {
  flex: 1;
}

.neu-ort .knopf {
  flex: none;
  height: 48px;
  padding: 0 16px;
}

.orte {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.orte li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  border-bottom: 1px solid var(--linie);
}

.orte .name {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  text-align: left;
  font-size: 18px;
  font-weight: 600;
}

.orte .name small {
  display: block;
  color: var(--schiefer);
  font-size: 14px;
  font-weight: 400;
}

.orte .klein {
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid var(--linie);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

/* ---------- Meldung ---------- */

.meldung {
  position: fixed;
  right: 16px;
  bottom: calc(var(--unten) + 120px);
  left: 16px;
  z-index: 30;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--denim-tief);
  color: #fff;
  font-size: 15px;
  text-align: center;
}

/* ---------- Login ---------- */

.login {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 24px;
  background: var(--denim);
}

.login form {
  width: 100%;
  max-width: 340px;
  color: #fff;
}

.login h1 {
  margin: 0 0 4px;
  font-size: 44px;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.login p {
  margin: 0 0 22px;
  color: #b9c3d6;
}

.login .feld > span {
  color: #b9c3d6;
}

.login .feld input {
  border-color: transparent;
  color: var(--denim-tief);
}

.login .fehler {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--gelb);
}

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

/* Im Teil-Blatt steht „Speichern“ allein in der ersten Zeile. */
.blatt .knoepfe {
  flex-wrap: wrap;
}

.blatt .knopf[type='submit'] {
  flex-basis: 100%;
}

.blatt .knopf.leise,
.blatt .knopf.weg {
  flex: 1;
}
