/* ============================================================
   Walking with Wieland — Styles
   Mobile-first, ausschließlich für das Handy ausgelegt.
   Feste 6-Farb-Palette, eine Schrift, schlicht (Figma-Mockup).
============================================================ */

@font-face {
  font-family: 'PlaypenSans';
  src: url('../assets/font/PlaypenSansArabic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'PlaypenSans';
  src: url('../assets/font/PlaypenSansArabic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette (verbindlich) */
  --cream: #F7F7EB;
  --pale:  #E6EBC2;
  --green: #A6BD7B;
  --dark:  #042615;
  --teal:  #A9C9C5;
  --blue:  #93C3D9;

  --font: 'PlaypenSans', system-ui, sans-serif;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(4, 38, 21, .18);
  --shadow-sm: 0 4px 14px rgba(4, 38, 21, .14);

  --maxw: 520px;            /* Handy-Spalte, auch auf größeren Screens zentriert */
  --nav-h: 64px;
  --space: 16px;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  color: var(--dark);
  background: #2f4534;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; }

/* Sichtbarer Tastatur-Fokus (Qualitäts-Untergrenze) */
:focus-visible {
  outline: 3px solid var(--dark);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Hintergrund (full-bleed, fix) ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("../assets/wald-hg-leer.png");
  background-size: cover;
  background-position: center top;
  /* kein background-attachment:fixed -> auf iOS sonst ruckelig */
}
.bg--home       { background-image: url("../assets/wieland-hoehle-hg.png"); }
.bg--walk       { background-image: url("../assets/wald-hg-voll.png"); }
.bg--collection {
  background-image: url("../assets/Hintergrundhoele.png");
  background-size: cover;
  background-position: center center;
}

/* ---------- Screen-Container ---------- */
.screen {
  position: relative;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 18px)
    calc(env(safe-area-inset-right) + 18px)
    calc(env(safe-area-inset-bottom) + 18px)
    calc(env(safe-area-inset-left) + 18px);
}
/* Walk-Screen: kein Padding oben (Nav-Card läuft bis zum Rand) */
.screen--walk {
  padding-top: calc(env(safe-area-inset-top) + 12px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 18px);
}
/* Seiten mit unterer Navi brauchen unten Platz für die fixe Nav */
.screen--nav { padding-bottom: calc(env(safe-area-inset-bottom) + var(--nav-h) + 22px); }

.spacer { flex: 1 1 auto; }
.center-col { display: flex; flex-direction: column; align-items: center; }

/* ---------- Typografie ---------- */
.h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 14px; }
.h3 { font-size: 1.05rem; font-weight: 700; margin: 24px 0 12px; }
.lead { font-size: 1.05rem; line-height: 1.45; margin: 0; }
.muted { opacity: .72; }
.on-dark { color: var(--cream); }
.text-center { text-align: center; }

/* großer Hinweis-Text direkt auf dem Hintergrund (z. B. "Leg dein Handy weg…") */
.overlay-text {
  color: var(--dark);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 18ch;
}

/* ---------- Wochenleiste (Pfoten-Pille) ---------- */
.weekbar {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border-radius: 999px;
  padding: 7px 12px;
  box-shadow: var(--shadow-sm);
}
.weekbar__count { font-weight: 700; font-size: .95rem; margin-right: 2px; }
.weekbar__dots { display: inline-flex; gap: 6px; }
.pawdot {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--pale);
  color: rgba(4, 38, 21, .28);
}
.pawdot svg { width: 17px; height: 17px; }
.pawdot.is-on { background: var(--green); color: var(--dark); }

/* ---------- Karten ---------- */
.card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card--center { text-align: center; }
.modal-card { width: 100%; max-width: 360px; }

/* Karte mit Schließen-X oben rechts */
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}

/* ---------- Buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--dark); color: var(--cream);
  font-size: 1.05rem; font-weight: 600;
  padding: 15px 26px;
  border-radius: 999px;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn[disabled] { opacity: .5; cursor: default; }

.btn--brett {
  background-image: url("../assets/Brett.png");
  background-size: 100% 100%;
  background-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.btn-row { display: flex; flex-direction: column; gap: 10px; }
.btn-sm { width: auto; padding: 10px 16px; font-size: .92rem; }

/* Icon-Knopf (rund) */
.icon-btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 10px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--cream); color: var(--dark);
  box-shadow: var(--shadow-sm);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn--bare { background: transparent; box-shadow: none; }

/* ---------- Slider ---------- */
.field { margin: 18px 0; }
.field__label { display: block; font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

input[type="range"].range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin: 8px 0;
  background: var(--pale);
  border-radius: 999px; outline-offset: 6px;
}
input[type="range"].range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--dark); border: 3px solid var(--cream);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"].range::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--dark); border: 3px solid var(--cream);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"].range::-moz-range-track {
  height: 6px; background: var(--pale); border-radius: 999px;
}

/* ---------- Toggle / Switch ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch__slider {
  position: absolute; inset: 0;
  background: #c9cdb0; border-radius: 999px; transition: background .15s ease;
}
.switch__slider::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--cream); box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}
.switch input:checked + .switch__slider { background: var(--green); }
.switch input:checked + .switch__slider::before { transform: translateX(22px); }
.switch input:focus-visible + .switch__slider { outline: 3px solid var(--dark); outline-offset: 2px; }

/* Textfelder */
.input {
  width: 100%; font-size: 1rem; font-family: inherit;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 2px solid rgba(4, 38, 21, .18); background: #fff; color: var(--dark);
}
.input:focus-visible { outline: 3px solid var(--dark); outline-offset: 1px; }

/* ---------- Sprechblase ---------- */
.bubble {
  position: relative;
  background: var(--cream);
  color: var(--dark);
  border-radius: 18px;
  padding: 12px 15px;
  max-width: 220px;
  font-size: .95rem; line-height: 1.35;
  box-shadow: var(--shadow-sm);
}
.bubble::after {
  content: ""; position: absolute; left: 26px; bottom: -9px;
  border-width: 10px 9px 0 9px; border-style: solid;
  border-color: var(--cream) transparent transparent transparent;
}

/* ---------- Wieland ---------- */
.wieland { width: min(72%, 320px); height: auto; pointer-events: none; background: transparent; }
.wieland--walk { width: min(80%, 360px); }
.wieland--sit  { width: 62vw; }
@keyframes ww-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.wieland--bob { animation: ww-bob 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .wieland--bob { animation: none; }
}

/* ---------- Übungs-Overlay ---------- */
.exercise-layer {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: transparent;
  padding: calc(env(safe-area-inset-top) + 14px) 14px 0;
}

/* Textbox oben: leicht transparent, Waldhintergrund schimmert durch */
.ex-text-box {
  flex: 0 0 auto;
  background: rgba(247, 247, 235, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.exercise__eyebrow { font-size: .82rem; font-weight: 700; letter-spacing: .06em; opacity: .7; }
.exercise__title { font-size: 1.35rem; font-weight: 700; line-height: 1.25; margin: 4px 0 0; max-width: 22ch; }

/* Mittlerer Bereich: Übungskomponenten vertikal zentriert */
.exercise__body {
  flex: 1 1 auto; min-height: 0;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.exercise__body .counter { color: var(--cream); }
.exercise__body .counter__hint { color: rgba(247,247,235,.8); opacity: 1; }
.exercise__body .exercise__title { color: var(--cream); }
.exercise__body .breath-phase { color: var(--cream); }
/* Tap-Area hat Cream-Hintergrund → Text muss dunkel sein */
.tap-area .counter__hint { color: var(--dark); opacity: .7; }
.tap-area .counter { color: var(--dark); }

/* Foto-Übung: Button immer sichtbar zwischen exercise__body und Wieland-Bereich */
.ex-photo-row {
  flex: 0 0 auto;
  width: 100%; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 6px 14px;
}
.ex-photo-row > .btn { width: auto; }

/* Unterer Bereich: Wieland links, Andere Übung + Überspringen rechts */
.ex-bottom {
  flex: 0 0 auto;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 8px 0;
}
.ex-bottom__actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* Geschafft-Button: volle Breite, Brett-Optik, bricht aus dem Padding heraus */
.ex-done-btn {
  flex: 0 0 auto;
  width: calc(100% + 28px);
  margin: 0 -14px;
  border-radius: 0;
  padding: 16px 14px calc(env(safe-area-inset-bottom) + 16px);
  font-size: 1.1rem;
}

/* Zähler-Anzeige */
.counter { font-size: 3.4rem; font-weight: 800; color: var(--dark); line-height: 1; }
.counter__hint { font-size: .95rem; opacity: .7; }
.tap-area {
  width: 100%; max-width: 320px; min-height: 150px;
  border-radius: var(--radius);
  background: rgba(247, 247, 235, .82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; box-shadow: var(--shadow);
}

/* ---------- Timer-Kreis ---------- */
.timer-circle {
  width: min(50vw, 180px); aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(247, 247, 235, .85);
  display: grid; place-items: center; text-align: center;
  box-shadow: var(--shadow);
  font-size: 1.2rem; font-weight: 700; color: var(--dark);
  padding: 20px;
}
.timer-circle small { display: block; font-weight: 500; opacity: .7; font-size: .85rem; margin-top: 4px; }

/* ---------- Atem-Kreis ---------- */
/* Wrap reserviert den max. visuellen Platz (75px × scale 1.9 = ~143px) */
.breath-wrap {
  width: 150px; height: 150px; flex: 0 0 150px;
  display: flex; align-items: center; justify-content: center;
}
.breath-circle {
  width: 75px; height: 75px; border-radius: 999px;
  background: var(--teal); box-shadow: var(--shadow);
  transition: transform 1s ease-in-out;
}
.breath-phase { font-size: 1.15rem; font-weight: 700; }

/* ---------- Foto-Übung ---------- */
.photo-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  width: 100%; max-width: 320px;
}
.photo-thumb {
  width: 72px; height: 72px; flex-shrink: 0;
  border-radius: 12px; overflow: hidden;
  background: rgba(247, 247, 235, .5); display: grid; place-items: center;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
#photo-add { padding: 10px 28px; font-size: 1rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Beenden-Bestätigung ---------- */
.end-confirm {
  position: fixed; inset: 0; z-index: 55;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  background: rgba(4, 38, 21, .4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.end-confirm__text {
  color: var(--cream);
  font-size: 1.25rem; font-weight: 700; line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
  margin: 0 0 6px;
}
.end-confirm__continue {
  width: 100%; max-width: 340px;
  padding: 16px 24px;
  font-size: 1.1rem;
}
.end-confirm__end {
  width: auto;
  padding: 10px 32px;
  font-size: .95rem;
}

/* ---------- Beenden-Button (Walk-Screen, fixed unten rechts) ---------- */
.walk-end-btn {
  position: fixed;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 46;
  width: auto;
  padding: 11px 24px;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
}

/* Debug-Übungsauslöser (Walk-Screen, fixed unten links) */
.walk-debug-btn {
  position: fixed;
  left: 18px;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 46;
  width: auto;
  padding: 11px 24px;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
}

/* Spacer-Verhältnis: Wieland im unteren Drittel */
.walk-spacer-top { flex: 2 1 auto; }
.walk-spacer-bot { flex: 1 1 auto; }

/* ---------- untere Navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--dark);
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 8px 6px calc(env(safe-area-inset-bottom) + 8px);
  box-shadow: 0 -6px 20px rgba(4, 38, 21, .25);
}
.nav-item {
  flex: 1; text-decoration: none; color: rgba(247, 247, 235, .62);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border-radius: 12px;
  font-size: .7rem; font-weight: 600;
}
.nav-ico { width: 28px; height: 28px; opacity: .55; transition: opacity .15s; }
.nav-item.is-active { color: var(--cream); }
.nav-item.is-active .nav-ico { opacity: 1; transform: translateY(-1px); }

/* ---------- Statistik-Seite Layout ---------- */
/* Screen-Modifier: eigenes Layout (kein overflow-y: auto auf Screenebene) */
.screen--stats {
  overflow: hidden;
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--nav-h));
}

/* Titel-Bereich: direkt auf dem Hintergrund, keine Card */
.stats-header {
  flex: 0 0 auto;
  padding: 0 0 12px;
}
.stats-title {
  font-size: 2rem; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 2px 14px rgba(0,0,0,.8);
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.stats-subtitle {
  font-size: .9rem; line-height: 1.4;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 2px 12px rgba(0,0,0,.8);
  margin: 0;
}

/* Tagesspalten-Header: immer sichtbar über dem Scroll-Bereich */
.stat-head {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 28px repeat(7, 1fr); gap: 6px;
  padding-bottom: 6px;
  text-align: center;
  font-size: .72rem; font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 2px 10px rgba(0,0,0,.8);
}

/* Scrollbarer Wochen-Bereich – Fade nur oben (ältere Wochen) */
.stat-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 100%);
}
.stat-scroll::-webkit-scrollbar { display: none; }

/* Wochen-Raster */
.stat-weeks { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; }
.stat-row-wrap {
  display: grid; grid-template-columns: 28px repeat(7, 1fr); gap: 6px;
  align-items: center;
}
.stat-week-lbl {
  font-size: .55rem; line-height: 1.15;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 2px 10px rgba(0,0,0,.8);
  text-align: center;
}
.cell {
  aspect-ratio: 1; border-radius: 8px;
  border: 2px solid rgba(247, 247, 235, .25);
  display: grid; place-items: center; color: var(--dark);
  background: transparent;
}
.cell svg { width: 60%; height: 60%; }
.cell--free   { background: var(--blue);  border-color: transparent; }
.cell--guided { background: var(--green); border-color: transparent; }
.cell--both   { background: linear-gradient(135deg, var(--blue) 50%, var(--green) 50%); border-color: transparent; }

/* Legende: Brett-PNG, gleiche Randabstände wie week-nav (16px von Viewport-Kanten) */
.stat-legend-bar {
  flex: 0 0 auto;
  background-image: url("../assets/Brett.png");
  background-size: 100% 100%;
  background-color: transparent;
  /* Seitenabstand: Screen hat 18px Padding, Brett soll 16px vom Rand → -2px */
  margin: 8px -2px 16px;
  padding: 12px 16px 12px;
}
.stat-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.legend-col { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--cream); }
.legend-swatch { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 5px; border: 2px solid rgba(247, 247, 235, .3); }
.legend-swatch.is-free   { background: var(--blue);  border-color: transparent; }
.legend-swatch.is-guided { background: var(--green); border-color: transparent; }
.legend-swatch.is-both   { background: linear-gradient(135deg, var(--blue) 50%, var(--green) 50%); border-color: transparent; }

/* ---------- Sammlung / Höhle ---------- */
.collection-group { margin-bottom: 22px; }
.collection-group__title { font-size: 1rem; font-weight: 700; margin: 0 0 10px; }
.collection-count { font-weight: 600; font-size: .82rem; opacity: .55; margin-left: 4px; }
.collection-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.token {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: rgba(247, 247, 235, .55);
  display: grid; place-items: center; padding: 8px;
}
.token svg { width: 78%; height: 78%; }
.token.is-locked { opacity: 1; }
.token.is-locked svg { filter: grayscale(1); opacity: .35; }
.collection-meta { font-size: .8rem; opacity: .7; text-align: center; margin-top: 4px; }

/* Achievement-Liste */
.ach-list { display: flex; flex-direction: column; gap: 10px; }
.ach {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(247, 247, 235, .55);
}
.ach.is-done { background: var(--pale); }
.ach__badge { width: 34px; height: 34px; flex: none; }
.ach__txt b { display: block; font-size: .95rem; }
.ach__txt span { font-size: .82rem; opacity: .72; }

/* ---------- Modal (Trophäe / Abschluss) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 38, 21, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.trophy-big { width: 120px; height: 120px; margin: 0 auto 6px; }
@keyframes ww-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: ww-pop .45s ease-out; }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }
.modal-trophies { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 4px; }
.modal-trophies .token { width: 64px; }
/* Done-Modal: scrollbar wenn Trophäen-Liste den Bildschirm sprengt */
#done-modal .modal-card {
  max-height: calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
}
/* Achievement-Icon im Trophy-Modal und in der Token-Zeile */
.trophy-big img.trophy-icon  { width: 100%; height: 100%; object-fit: contain; display: block; }
.token img.trophy-icon { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ---------- Karten-Panel (Leaflet) ---------- */
.map-panel { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--cream); }
.map-panel[hidden] { display: none; }
.map-panel__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}
#map, #route-map { flex: 1 1 auto; }

/* Tages-Detail-Panel */
.day-panel__body {
  flex: 1 1 auto; overflow-y: auto;
  padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 0;
}

/* ── Walk-Log (Timeline) ── */
.walk-log { display: flex; flex-direction: column; gap: 0; }
.log-sep  { border: none; border-top: 1px solid rgba(4,38,21,.12); margin: 20px 0; }
.log-hint { font-size: .88rem; opacity: .7; padding: 16px 0; margin: 0; }

.log-entry {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 0;
  position: relative;
}
.log-entry + .log-entry::before,
.log-section::before {
  content: '';
  position: absolute; left: 7px; top: 0; bottom: 0;
  width: 2px; background: rgba(4,38,21,.15);
}
.log-dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2px solid var(--dark);
}
.log-entry--start .log-dot { background: var(--green); }
.log-entry--end   .log-dot { background: var(--cream); }
.log-entry__body  { display: flex; flex-direction: column; gap: 2px; }
.log-entry__body b { font-size: .92rem; }
.log-badge {
  font-size: .72rem; font-weight: 700; padding: 1px 7px;
  border-radius: 20px; background: rgba(4,38,21,.1); color: var(--dark);
  width: fit-content;
}
.log-meta { font-size: .82rem; opacity: .7; }
.log-time { font-size: .82rem; opacity: .6; font-variant-numeric: tabular-nums; }

/* Übungs-Icon Reihe */
.log-section { position: relative; padding: 4px 0 4px 28px; }
.log-ex-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-icon-btn {
  width: 54px; height: 54px;
  background: rgba(247,247,235,.7);
  border: none; border-radius: 12px;
  padding: 6px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.ex-icon-btn:active { opacity: .7; }
.ex-icon-img { width: 100%; height: 100%; object-fit: contain; display: block; }

.log-ex-detail {
  margin-top: 10px;
  background: rgba(247,247,235,.9);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .88rem;
}
.log-ex-header { font-size: .72rem; font-weight: 700; letter-spacing: .06em; opacity: .65; margin: 0 0 4px; }
.log-ex-text   { margin: 0; line-height: 1.4; }

.log-route { padding: 4px 0 8px 28px; }
.log-route-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(4,38,21,.05);
  border: 1.5px solid rgba(4,38,21,.2);
  border-radius: 20px; padding: 7px 15px;
  font: inherit; font-size: .82rem; color: var(--dark);
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
.log-route-btn:active { opacity: .7; }
.log-route-icon { width: 15px; height: 15px; flex: none; }

.cell--btn {
  cursor: pointer; border: none; font: inherit;
  -webkit-appearance: none; appearance: none;
}
.cell--btn:active { opacity: .7; }

/* kleine Helfer */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.mt-auto { margin-top: auto; }
.hint { font-size: .85rem; opacity: .75; line-height: 1.4; }
[hidden] { display: none !important; }

/* ---------- Einstellungen ---------- */
.setting-status {
  font-size: .9rem; margin: 6px 0 12px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(166, 189, 123, .28); color: var(--dark);
}
.row--wrap { flex-wrap: wrap; }
.set-details { margin-top: 14px; }
.set-details > summary {
  cursor: pointer; font-size: .9rem; font-weight: 600;
  color: var(--dark); padding: 6px 0; list-style: none;
}
.set-details > summary::-webkit-details-marker { display: none; }
.set-details > summary::before { content: "+ "; }
.set-details[open] > summary::before { content: "– "; }
.stepper { display: flex; align-items: center; gap: 18px; margin-top: 6px; }
.stepper .icon-btn { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stepper__value { font-size: 1.6rem; font-weight: 700; min-width: 2ch; text-align: center; }

/* ---------- Home-Szene ---------- */
/* Wieland + Höhle sind jetzt im Hintergrundbild – nur Blase + Button bleiben */
.home-scene {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 8px;
}
.home-scene__spacer-top  { flex: 1 1 0; } /* Blase im oberen Drittel */
.home-scene__spacer-bot  { flex: 3 1 0; } /* Puffer zwischen Blase und Button */
.home-scene .bubble { align-self: center; }
.home-scene .btn    { align-self: stretch; }

/* ---------- Check-In – Mehrschritt-Flow ---------- */
.switch-row .field__label { margin-bottom: 0; }
.energy-badge {
  background: var(--dark); color: var(--cream);
  font-size: .82rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; flex: none;
}
.loc-row { display: flex; gap: 8px; flex-wrap: wrap; }

.ci-screen { overflow: hidden; }
.ci-step { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.ci-step__header {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 18px; flex: none;
}
.ci-back-btn { position: absolute; left: 0; color: var(--cream); }
.ci-step__q {
  font-size: 1.25rem; font-weight: 700;
  color: var(--cream);
  text-shadow: 0 2px 10px rgba(4,38,21,.65);
  margin: 0; text-align: center; padding: 0 52px; line-height: 1.25;
}

.ci-step__visual {
  flex: 1 1 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}

.ci-level-icon, .ci-stress-img {
  max-height: 45vh; width: auto;
  max-width: min(68vw, 260px);
  object-fit: contain; pointer-events: none; display: block;
}

@keyframes ci-stress-bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
.ci-stress-img {
  animation: ci-stress-bob ease-in-out infinite;
  animation-duration: 1.5s;
}

.ci-step__foot {
  flex: none;
  background: var(--cream); border-radius: var(--radius);
  padding: 18px 20px; margin-top: 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow);
}
.ci-slider-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ci-slider-level { font-size: .95rem; font-weight: 700; }
.ci-ends { display: flex; justify-content: space-between; font-size: .78rem; opacity: .6; margin: -4px 0 0; }
.ci-route-card { width: 100%; max-width: 360px; }

/* ---------- Spaziergang ---------- */
.walk-top { display: flex; flex-direction: column; gap: 6px; }
.walk-center { gap: 22px; }
.walk-sub { font-size: .9rem; color: var(--dark); opacity: .65; margin-top: 2px; }

/* Prominente Navigations-Karte (Mockup: großes weißes Feld mit Pfeil) */
.nav-card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0 20px;
  height: 5.5rem;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}
.nav-card__text {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--dark);
}
.nav-card__arrow {
  width: 40px; height: 40px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  will-change: transform;
}
.nav-card__arrow svg { width: 36px; height: 36px; }

/* Utility */
.mt-16 { margin-top: 16px; }
.mt-0 { margin-top: 0; }

/* ---------- Kamera-Overlay ---------- */
.cam-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: #000;
  display: flex; flex-direction: column;
}
.cam-inner { display: flex; flex-direction: column; height: 100%; }
.cam-preview-wrap { flex: 1 1 auto; position: relative; overflow: hidden; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: rgba(0,0,0,.85); gap: 16px; flex: none;
}
.cam-counter { color: #fff; font-size: 1.1rem; font-weight: 700; min-width: 64px; text-align: center; }
.cam-shutter {
  width: 68px; height: 68px; border-radius: 50%; flex: none;
  border: 5px solid #fff; background: rgba(255,255,255,.18);
  cursor: pointer; transition: background .12s;
  -webkit-appearance: none; appearance: none;
}
.cam-shutter:active { background: rgba(255,255,255,.55); }
.cam-close-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.45); background: rgba(0,0,0,.4);
  color: #fff; font-size: 1.6rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.cam-close-btn:active { opacity: .7; }
.cam-hint { color: rgba(255,255,255,.8); font-size: .9rem; text-align: center; padding: 6px 16px; min-height: 26px; flex: none; }
.cam-fallback {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; padding: 32px 24px;
}
.cam-fallback__text { color: rgba(255,255,255,.9); text-align: center; line-height: 1.55; }
.cam-fallback__btn { width: auto; min-width: 180px; text-align: center; }
.cam-skip-btn { color: rgba(255,255,255,.6); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.96);
  display: flex; flex-direction: column;
}
.lightbox__img-wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 52px 16px 8px; overflow: hidden; }
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(0,0,0,.75); gap: 10px; flex: none;
}
.lightbox__nav {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1);
  color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.lightbox__nav:disabled { opacity: .25; pointer-events: none; }
.lightbox__nav:active { background: rgba(255,255,255,.2); }
.lightbox__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lightbox__close {
  position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 14px;
  width: 40px; height: 40px; border-radius: 50%; z-index: 91;
  border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.55);
  color: #fff; font-size: 1.5rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.lightbox__close:active { opacity: .7; }
.lightbox__save-hint { color: rgba(255,255,255,.55); font-size: .75rem; text-align: center; padding: 4px 16px 10px; flex: none; }

/* ---------- Foto-Strip (Statistik) ---------- */
.photo-strip-wrap { margin: 12px 0 0; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip__thumb {
  flex: none; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
  border: 2px solid rgba(4,38,21,.12); background: rgba(4,38,21,.05);
  cursor: pointer; padding: 0;
  -webkit-appearance: none; appearance: none;
}
.photo-strip__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip__thumb:active { opacity: .75; }
.photo-strip__empty { font-size: .8rem; color: rgba(4,38,21,.5); margin: 8px 0 0; }

/* ---------- Welt-Galerie-Panel (Höhle) ---------- */
.gallery-panel {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--cream);
}
.gallery-panel__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  border-bottom: 1px solid rgba(4,38,21,.1); flex: none;
}
.gallery-panel__title { font-size: 1rem; font-weight: 700; }
.gallery-panel__close { margin-left: auto; }
.gallery-panel__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); }
.gallery-panel__empty { text-align: center; padding: 56px 24px; opacity: .6; line-height: 1.65; }
.gallery-group { margin-bottom: 28px; }
.gallery-group__date { font-size: .78rem; font-weight: 700; letter-spacing: .05em; opacity: .6; margin: 0 0 10px; text-transform: uppercase; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery-thumb {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 2px solid rgba(4,38,21,.1); background: rgba(4,38,21,.06);
  cursor: pointer; padding: 0;
  -webkit-appearance: none; appearance: none;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb:active { opacity: .75; }

/* ---------- Wielands Höhle: Position-Layer + Trophy-Grid ----------
   Hintergrund: Hintergrundhoele.png (background-size: cover).
   Overlay: Positionen.svg (viewBox 0 0 259.2 460.8), volle Breite,
            vertikal zentriert via top:50% + translateY(-50%).
   Alle %-Werte sind relativ zur .position-layer (= SVG-viewBox).

   Formel:
     bottom = (1 − (box_y + box_h) / 460.8) × 100
     left   = (box_x + box_w / 2) / 259.2 × 100

   Box-Koordinaten aus Positionen.svg:
     Box_oben_links   (W5): x=13.96  y=109.86 w=130.36 h=66.94
     Box_oben_rechts  (W4): x=157.85 y=110.63 w=89.01  h=66.94
     Box_Mitte        (W1): x=20.89  y=212.58 w=222.67 h=66.94
     Box_unten_links  (W2): x=15.77  y=312.99 w=93.75  h=66.94
     Box_unten_rechts (W3): x=116.92 y=313.76 w=131.14 h=66.94
   -------------------------------------------------------------------*/

/* Overlay-Layer: volle Breite, SVG-Seitenverhältnis, vertikal zentriert */
.position-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  aspect-ratio: 259.2 / 460.8;
  z-index: 1;
  pointer-events: none;
}

.position-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.shelf-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.trophy-slot {
  position: absolute;
  display: block;
  transition: opacity .35s;
}
.trophy-slot img { width: 100%; height: auto; display: block; }
.trophy-slot.is-empty { opacity: 0; pointer-events: none; }

/* Zahl sitzt in der zahl_*-Box direkt unter dem Brett.
   top:100% setzt Oberkante der Zahl auf Unterkante des Icons (≈ Brettkante). */
.trophy-count {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,.65);
  pointer-events: none;
}

/* ── Trophy-Positionen (aus Positionen.svg-Boxen, relativ zur .position-layer) ──
   bottom = (1 − (box_y + box_h) / 460.8) × 100
   left   = (box_x + box_w / 2) / 259.2 × 100                                    */
/* W5 Entdeckerblick  – Box_oben_links:   bottom=(1-176.80/460.8)=61.6%  left=79.14/259.2=30.5% */
.trophy--w5 { width: 33%; bottom: 61.6%; left: 30.5%; transform: translateX(-50%); }
/* W4 Schatzkiste     – Box_oben_rechts:  bottom=(1-177.57/460.8)=61.5%  left=202.36/259.2=78.1% */
.trophy--w4 { width: 24%; bottom: 61.5%; left: 78.1%; transform: translateX(-50%); }
/* W1 Spürnase        – Box_Mitte:        bottom=(1-279.52/460.8)=39.3%  left=132.23/259.2=51.0% */
.trophy--w1 { width: 36%; bottom: 39.3%; left: 51.0%; transform: translateX(-50%); }
/* W2 Ruhe            – Box_unten_links:  bottom=(1-379.93/460.8)=17.6%  left=62.65/259.2=24.2% */
.trophy--w2 { width: 23%; bottom: 17.6%; left: 24.2%; transform: translateX(-50%); }
/* W3 Zeitgefühl      – Box_unten_rechts: bottom=(1-380.70/460.8)=17.4%  left=182.49/259.2=70.4% */
.trophy--w3 { width: 33%; bottom: 17.4%; left: 70.4%; transform: translateX(-50%); }

/* ── Fotoleine: Polaroid-Slots ────────────────────────────────
   Leinenvektor in Positionen.svg (root-Ebene, SVG-Koordinaten):
     M.2,11.62 c18.31,11.11,63.28,35.03,125.17,34.48
                66.38,-0.59,113.36,-28.99,130.91,-40.87

   5 Aufhängepunkte (Bezier-Berechnung, top = y/460.8×100, left = x/259.2×100):
     1. Seg1 t=0.35: x=28.81 y=26.40 → left=11.1% top=5.7%
     2. Seg1 t=0.75: x=82.28 y=42.51 → left=31.7% top=9.2%
     3. P3 (Scheitelpunkt): x=125.37 y=46.10 → left=48.4% top=10.0%
     4. Seg2 t=0.30: x=178.87 y=39.26 → left=69.0% top=8.5%
     5. Seg2 t=0.65: x=227.49 y=21.88 → left=87.8% top=4.7%

   Breite 13% → Safe-Zone: linke Kante 4.6%, rechte Kante 94.3%  ✓
   -------------------------------------------------------------------*/
.polaroid-slot {
  position: absolute;
  width: 13%;
  display: none;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: top center;
}
.polaroid-slot.has-photo { display: block; }

#pol-1 { left: 11.1%; top: 5.7%;  transform: translateX(-50%) rotate(-4deg); }
#pol-2 { left: 31.7%; top: 9.2%;  transform: translateX(-50%) rotate(3deg);  }
#pol-3 { left: 48.4%; top: 10.0%; transform: translateX(-50%) rotate(-2deg); }
#pol-4 { left: 69.0%; top: 8.5%;  transform: translateX(-50%) rotate(4deg);  }
#pol-5 { left: 87.8%; top: 4.7%;  transform: translateX(-50%) rotate(-3deg); }

.polaroid-slot:active { opacity: .8; }

/* 1:1-Verhältnis via padding-bottom-Trick */
.polaroid-frame {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background-image: url("../assets/Polaroidrahmen.svg");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* Foto innerhalb des Bilderrahmen-Rects (Polaroid-SVG: 136.8×136.8)
   Bilderrahmen: x=18.95 y=11.01 w=98.11 h=86.94  rotate(-1.54°) */
.polaroid-photo {
  position: absolute;
  left: 13.9%;
  top: 8.0%;
  width: 71.7%;
  height: 63.6%;
  object-fit: cover;
  border-radius: 4px;
  transform: rotate(-1.54deg);
  transform-origin: center center;
}

/* Wochen-Navigation (Brett-PNG, fix über der Haupt-Nav) */
.week-nav {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: url("../assets/Brett.png");
  background-size: 100% 100%;
  background-color: transparent;
  padding: 10px 16px;
  gap: 8px;
}
.week-nav__btn {
  background: none; border: none; cursor: pointer;
  color: var(--cream);
  font-size: 1.8rem; line-height: 1;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  -webkit-appearance: none; appearance: none;
}
.week-nav__btn:disabled { opacity: .25; pointer-events: none; }
.week-nav__btn:active { opacity: .6; }
.week-nav__label {
  flex: 1;
  text-align: center;
  color: var(--cream);
  font-size: .9rem;
  font-weight: 600;
}

/* ---------- Inline Minimap ---------- */
.nav-row { display: flex; align-items: stretch; gap: 8px; }
.nav-card { flex: 1; min-width: 0; }
.map-btn {
  flex: none; width: 58px;
  background: var(--cream); color: var(--dark);
  border: none; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); cursor: pointer;
  font-size: .9rem; font-weight: 700; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  padding: 0; -webkit-appearance: none; appearance: none;
}
.map-btn:active { opacity: .75; }
.inline-minimap {
  width: 100%; height: 190px;
  border-radius: var(--radius); overflow: hidden;
  position: relative; box-shadow: var(--shadow);
  margin-top: 2px;
}
/* Rotatable wrapper: JS sets width/height/left/top to diagonal of parent (always square) */
#minimap-rotatable {
  position: absolute;
  transform-origin: center center;
  will-change: transform;
}
#minimap-container { width: 100%; height: 100%; }
.fullmap-btn {
  position: absolute; bottom: 10px; right: 10px; z-index: 1;
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(247,247,235,.92); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--dark); box-shadow: var(--shadow-sm);
  -webkit-appearance: none; appearance: none;
}
