/* ===========================================================
   SpiraVita — Glass / Aurora
   Tiefes Nachtblau, lebendiger Farbnebel, frosted-glass Karten,
   feine Körnung, federnde Motion. Weiche Serifen-Headline.
   =========================================================== */

:root {
  /* Basis */
  --night-900: #050811;
  --night-800: #0a0f1e;
  --ink:       #f1f3fb;
  --ink-soft:  #b3bbd6;
  --ink-faint: #707aa0;

  /* Akzente */
  --amber:     #f7cf8b;
  --amber-hot: #ffb86b;
  --peach:     #ffd9a8;
  --rose:      #ef9d9a;
  --violet:    #9d8cff;
  --teal:      #6fe0c8;

  /* Glas */
  --glass:      rgba(255, 255, 255, 0.055);
  --glass-hi:   rgba(255, 255, 255, 0.10);
  --glass-line: rgba(255, 255, 255, 0.14);
  --glass-edge: rgba(255, 255, 255, 0.28); /* oberer Lichtrand */

  /* Schrift */
  --display: "Bricolage Grotesque", -apple-system, system-ui, sans-serif;
  --body: "Bricolage Grotesque", -apple-system, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 24px;
  --radius-sm: 16px;
  --maxw: 560px;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* KEIN height:100% und KEIN overflow-x:hidden auf html/body -> beides würde
   body/html zum Scroll-Container machen und position:fixed (Nav) sowie
   position:sticky (Collapsing-Header) brechen. */
html, body { max-width: 100%; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--night-900);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- Atmosphäre: lebendiger, langsam wabernder Farbnebel ---------- */
.aurora {
  position: fixed;
  inset: -25vh -20vw;
  z-index: -2;
  background:
    radial-gradient(42vw 42vw at 18% 8%, rgba(247, 207, 139, 0.45), transparent 62%),
    radial-gradient(48vw 48vw at 88% 18%, rgba(239, 157, 154, 0.42), transparent 62%),
    radial-gradient(52vw 52vw at 50% 50%, rgba(157, 140, 255, 0.30), transparent 60%),
    radial-gradient(50vw 50vw at 80% 88%, rgba(157, 140, 255, 0.34), transparent 64%),
    radial-gradient(44vw 44vw at 10% 90%, rgba(111, 224, 200, 0.26), transparent 64%),
    var(--night-900);
  filter: saturate(1.25);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.05) rotate(0deg); }
  100% { transform: translate3d(3%, 3%, 0) scale(1.12) rotate(4deg); }
}

/* feine Körnung über allem für Tiefe (kein "flaches Digital"-Gefühl) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 22px 132px; /* unten Platz für die Bottom-Nav */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Glas-Mixin-Basis ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-line);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 18px 40px -22px rgba(0, 0, 0, 0.8);
}

/* ---------- Typo ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber);
  opacity: 0.9;
}
.eyebrow.has-mark { display: inline-flex; align-items: center; gap: 9px; opacity: 1; }
.brand-mark { height: 26px; width: auto; flex: none; display: block; }
h1.brand {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(36px, 12vw, 56px);
  line-height: 0.96;
  letter-spacing: -0.015em;
  margin: 8px 0 4px;
}
h1.brand em {
  font-style: normal;
  font-weight: 600;
  background: linear-gradient(120deg, var(--peach), var(--rose) 60%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede { color: var(--ink-soft); font-size: 15.5px; max-width: 34ch; line-height: 1.45; }

.section-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 23px;
  margin: 10px 0 14px;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--body);
  font-weight: 600;
  font-size: 16px;
  border: none;
  border-radius: 999px;
  padding: 17px 22px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.2s var(--spring), box-shadow 0.3s ease, background 0.25s ease, border-color 0.25s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; pointer-events: none; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-primary {
  position: relative;
  color: #281a06;
  background: linear-gradient(135deg, #ffe7c2, var(--amber-hot) 55%, #ff9d6b);
  box-shadow:
    0 14px 36px -10px rgba(255, 168, 107, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
}
.btn-primary::after { /* Glanzlauf */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.5) 48%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--spring);
}
.btn-ghost {
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---------- Stat-Glas-Pills ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 26px 0 28px;
}
.stat {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 14px 30px -22px rgba(0,0,0,0.8);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  text-align: center;
}
.stat .num {
  font-family: var(--mono);
  font-size: 27px;
  color: var(--ink);
  line-height: 1;
}
.stat .num span { font-size: 13px; color: var(--ink-soft); }
.stat .lbl {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ---------- Übungs-Glas-Karten ---------- */
.ex-list { display: flex; flex-direction: column; gap: 14px; }

/* Karten-Rail: horizontal wischen, Nachbarn lugen an (breit: ~3 nebeneinander) */
.ex-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(240px, 64%);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 4px 4px 16px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ex-rail::-webkit-scrollbar { display: none; }

/* Rail-Pfeile: nur in der Karten-Ansicht und nur an Geräten mit Maus */
.rail-wrap { position: relative; }
.rail-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .rail-wrap.cards .rail-nav {
    display: grid; place-items: center;
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 2;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--glass); border: 1px solid var(--glass-line);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
    opacity: 0; transition: opacity 0.2s ease;
  }
  .rail-wrap.cards:hover .rail-nav,
  .rail-wrap.cards .rail-nav:focus-visible { opacity: 1; }
  .rail-nav.prev { left: -8px; }
  .rail-nav.next { right: -8px; }
}

/* Klang lädt noch (Naturklang wird geholt/dekodiert) */
.amb-btn.loading .amb-ic { animation: amb-loading 0.9s ease-in-out infinite; }
.amb-btn.loading #amb-label { opacity: 0.55; }
@keyframes amb-loading { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.ex-rail > .ex-card { scroll-snap-align: start; }

.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-row .section-title { transition: opacity 0.13s ease; }
.view-toggle { display: flex; gap: 4px; padding: 3px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line); }
.vt-btn { display: grid; place-items: center; width: 30px; height: 26px; border-radius: 999px;
  background: transparent; border: none; color: var(--ink-soft); cursor: pointer; }
.vt-btn.active { background: rgba(247, 207, 139, 0.16); color: var(--amber); }
.ex-card {
  position: relative;
  overflow: hidden;                 /* Wasserzeichen/Schimmer bleiben in der Rundung */
  text-align: left;
  color: var(--ink);
  font-family: var(--body);
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 22px 44px -26px rgba(0,0,0,0.85);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.22s var(--spring), border-color 0.3s, background 0.3s;
}
.ex-card:active { transform: scale(0.98); }
.ex-card .glow {
  position: absolute; inset: 0;
  background: radial-gradient(160px 110px at 88% -10%, rgba(247, 207, 139, 0.22), transparent 70%);
  pointer-events: none;
}
.ex-card h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 21px;
  margin-bottom: 6px;
  padding-right: 46px; /* Platz für den Favoriten-Stern */
}
.fav {
  position: absolute;
  top: 11px; right: 11px;
  z-index: 1;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  transition: color 0.2s ease, transform 0.2s var(--spring), filter 0.3s ease;
}
.fav:active { transform: scale(0.85); }
.fav.on { color: var(--amber); filter: drop-shadow(0 0 7px rgba(247, 207, 139, 0.45)); }
.fav.on svg { fill: currentColor; }
.ex-card .pattern {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 0.05em;
}
.ex-card .meta { font-size: 13px; color: var(--ink-soft); margin-top: 9px; line-height: 1.45; }
.ex-card:focus-visible { outline: 2px solid rgba(247, 207, 139, 0.55); outline-offset: 2px; }
.ex-why {
  display: inline-block;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber);
  text-decoration: none;
  position: relative;
  z-index: 1;
}

/* Zweck-Label (Einschlafen / Fokus / …) — wie die Wissen-Referenz-Tags */
.ex-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(247, 207, 139, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
  max-width: calc(100% - 92px);   /* nicht unter Stern + geübt-Marker */
}

/* "schon geübt" — bewusst leise: kleines ✓ (+Anzahl) oben rechts neben dem Stern */
.ex-done {
  position: absolute;
  top: 11px; right: 55px;              /* direkt links neben dem 44px-Favoriten-Stern */
  height: 44px;                        /* gleiche Höhe -> sauber mittig zum Stern */
  display: inline-flex; align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  opacity: 0.7;
  white-space: nowrap;
  pointer-events: none;                /* Klick geht weiter an die Karte */
}

/* Zweck-Färbung der Karte: dezenter Schimmer aus der Ecke + Pill im Farbton */
.ex-card.tinted::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(130% 115% at 90% 110%,
              color-mix(in srgb, var(--card-tint) 17%, transparent), transparent 62%);
}
.ex-card.tinted .ex-tag {
  color: var(--card-tint);
  border-color: color-mix(in srgb, var(--card-tint) 35%, transparent);
}
/* großes, fast transparentes Icon als Wasserzeichen unten rechts */
.ex-mark {
  position: absolute; right: -16px; bottom: -18px;
  width: 118px; height: 118px;
  color: var(--card-tint, var(--amber));
  opacity: 0.09;
  pointer-events: none;
}
.ex-mark svg { width: 100%; height: 100%; }

/* „Details“-Knopf öffnet den Info-Dialog */
.ex-info {
  margin-top: 8px;
  font-family: var(--body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--amber);
  background: transparent;
  border: none;
  /* großzügige Tippfläche (~44px) ohne mehr sichtbaren Platz zu belegen */
  padding: 12px 16px 12px 0;
  margin-bottom: -8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.ex-info:active { transform: scale(0.96); }

/* Native Beschreibung im <dialog> */
.info-dialog {
  /* Der globale `* { margin:0 }`-Reset hebelt das native Dialog-Zentrieren aus
     -> hier fest in die Mitte. Optik = wie die Glas-Karten der App. */
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100vh - 40px);
  overflow: hidden auto;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  /* gehobene Glasfläche: heller Weiß-Verlauf über einem halbtransparenten
     Indigo -> die Aurora scheint durch, nicht mehr fast schwarz. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(34, 41, 74, 0.78);
  -webkit-backdrop-filter: blur(34px) saturate(1.7);
  backdrop-filter: blur(34px) saturate(1.7);
  color: var(--ink);
  padding: 26px;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 44px 90px -30px rgba(0,0,0,0.85);
}
.info-dialog[open] { animation: info-pop 0.4s var(--spring) both; }
@keyframes info-pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.info-dialog::backdrop { background: rgba(5, 8, 17, 0.38); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.info-dialog .glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(220px 150px at 88% -8%, rgba(247, 207, 139, 0.22), transparent 70%);
}
.info-dialog > * { position: relative; }   /* Inhalt über dem Glow */
.info-dialog .ex-tag { margin-bottom: 12px; }
.info-dialog h3 { font-family: var(--display); font-weight: 400; font-size: 23px; margin-bottom: 8px; }
.info-dialog .pattern { font-family: var(--mono); font-size: 13px; color: var(--amber); letter-spacing: 0.05em; }
.info-reason { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 14px 0; }
.info-how { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.04); border: 1px solid var(--glass-line); }
.info-how strong { color: var(--ink); font-weight: 600; margin-right: 4px; }
.ex-warn { color: var(--rose); font-size: 11px; }
.info-safety { font-size: 13px; line-height: 1.55; color: var(--peach); margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(239, 157, 154, 0.12); border: 1px solid rgba(239, 157, 154, 0.3); }
.info-safety strong { color: var(--rose); display: block; margin-bottom: 3px; font-weight: 600; }
.info-amb { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 12px; }
.info-src { display: inline-block; font-size: 13px; font-weight: 600; color: var(--amber); text-decoration: none; margin-bottom: 18px; }
.info-dialog form { margin-top: 6px; }

.empty {
  border: 1px dashed var(--glass-line);
  border-radius: var(--radius);
  padding: 30px 22px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  background: rgba(255,255,255,0.02);
}
.empty::before {           /* dezente Atem-Ringe als Piktogramm */
  content: "";
  display: block;
  width: 46px; height: 46px;
  margin: 0 auto 16px;
  opacity: 0.22;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3bbd6' stroke-width='1.4'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3C/svg%3E");
}

/* ---------- Create-View ---------- */
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
textarea#goal {
  width: 100%;
  min-height: 118px;
  resize: none;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  padding: 18px;
}
textarea#goal::placeholder { color: var(--ink-faint); }
textarea#goal:focus { outline: none; border-color: rgba(247, 207, 139, 0.55); box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 4px rgba(247,207,139,0.10); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 15px 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.25s ease, background 0.2s ease, transform 0.18s var(--spring);
}
.chip-ic { display: inline-flex; }            /* Akzentfarbe kommt per inline color */
.chip-ic svg { display: block; }
.chip:active { transform: scale(0.96); }
.chip.on {
  color: #2a1c08;
  background: linear-gradient(135deg, #ffe7c2, var(--amber-hot) 55%, #ff9d6b);
  border-color: transparent;
}
/* aktiver Filter-Chip */
.chip.active {
  color: var(--ink);
  background: var(--glass-hi);
  border-color: rgba(247, 207, 139, 0.55);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 3px rgba(247, 207, 139, 0.12);
}

/* Hintergrundgeräusche: Auswahl-Grid + Lautstärke-Slider */
.amb-grid { display: flex; flex-wrap: wrap; gap: 9px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin: 6px 0;
  background: var(--glass-line); border-radius: 999px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #ffe7c2, var(--amber-hot));
  box-shadow: 0 2px 8px rgba(255, 170, 90, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--amber-hot);
}

.thinking { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 14px; padding: 14px 0; }
.thinking .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); animation: pulse-dot 1.2s ease-in-out infinite; box-shadow: 0 0 14px var(--amber); }
@keyframes pulse-dot { 0%,100%{opacity:.3; transform:scale(.7)} 50%{opacity:1; transform:scale(1.25)} }

/* ---------- Session-View (Atmen) ---------- */
.session {
  position: fixed; inset: 0;
  z-index: 10;
  /* gleiches Aurora-Rezept wie der Startscreen, nur etwas gedimmt -
     deckend (night-900-Basis), damit der Home-Screen dahinter verdeckt bleibt */
  background:
    radial-gradient(42vw 42vw at 18% 8%, rgba(247,207,139,0.26), transparent 62%),
    radial-gradient(48vw 48vw at 88% 16%, rgba(239,157,154,0.24), transparent 62%),
    radial-gradient(52vw 52vw at 50% 62%, rgba(157,140,255,0.26), transparent 60%),
    radial-gradient(44vw 44vw at 12% 92%, rgba(111,224,200,0.18), transparent 64%),
    var(--night-900);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 26px) 22px calc(env(safe-area-inset-bottom) + 30px);
}
.session-top { text-align: center; }
.session-top .name { font-family: var(--display); font-weight: 400; font-size: 23px; }
.session-top .round { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin-top: 5px; letter-spacing: 0.05em; }

/* ---------- Atem-Visual: flacher Kreis + beidseitig wachsende Bögen ---------- */
.breath-stage {
  flex: 1; width: 100%;
  display: grid; place-items: center;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.breath-svg {
  width: min(76vw, 340px);
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
}
.b-base {
  fill: rgba(255, 255, 255, 0.025);
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.5;
}
.b-arc {
  fill: none;
  stroke: var(--b-accent, var(--amber));
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 9px var(--b-glow, rgba(255, 184, 107, 0.45)));
  transition: stroke-dashoffset linear, stroke 1.3s ease, filter 1.3s ease;
}
/* Akzentfarbe je Phase (Custom-Props vererben sich an die Bögen) */
.breath-stage[data-phase="inhale"]  { --b-accent:#ffce86; --b-glow:rgba(255,184,107,0.5); }
.breath-stage[data-phase="holdIn"]  { --b-accent:#ffbfa4; --b-glow:rgba(255,150,140,0.45); }
.breath-stage[data-phase="exhale"]  { --b-accent:#b3a2ff; --b-glow:rgba(157,140,255,0.5); }
.breath-stage[data-phase="holdOut"] { --b-accent:#8be4d1; --b-glow:rgba(111,224,200,0.45); }

.breath-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;   /* zentriert den b-core exakt in der Mitte */
  pointer-events: none;
}
.b-core {
  display: flex; flex-direction: column;
  align-items: center;
}
.b-word {
  font-family: var(--display);
  font-weight: 400;
  font-size: 27px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.b-word.count {
  font-family: var(--mono);
  font-weight: 300;
  font-size: 84px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
/* Strich unter dem Wort, wächst beim Halten von 0 -> voll (display steuert Platz) */
.b-hold {
  display: none;
  margin-top: 12px;
  width: 78px; height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--peach), var(--amber-hot));
  transform: scaleX(0);
  transform-origin: center;
}
/* Sekunden des aktuellen Atemschritts, klein unter dem Wort */
.b-sec {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-height: 0;
  line-height: 1;
}
.b-sec:empty { margin-top: 0; }   /* leer -> kein Platz -> "Start" bleibt zentriert */
/* Wiederholungen klein im unteren Drittel (höher, damit es den Ring nicht streift) */
.b-reps {
  position: absolute;
  top: calc(50% + 64px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

/* Kurzes Aufleuchten des Ziel-Feldes, wenn ein Chip getippt wurde */
.flash { animation: field-flash 0.55s ease; }
@keyframes field-flash {
  0%   { box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 4px rgba(247, 207, 139, 0.38); }
  100% { box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 4px rgba(247, 207, 139, 0); }
}

/* Abschluss: sanfter Ring-Puls + Funken aus der Mitte */
.breath-stage.celebrate .breath-svg { animation: ring-pulse 0.8s var(--spring); }
@keyframes ring-pulse { 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.spark {
  position: absolute; top: 50%; left: 50%;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--spark-c, var(--amber));
  box-shadow: 0 0 10px var(--spark-c, var(--amber));
  pointer-events: none;
  animation: spark-fly 1s var(--spring) forwards;
}
@keyframes spark-fly {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1); }
}

.session-bottom { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; }
.phase-hint { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; min-height: 20px; }
.amb-btn {
  display: flex; align-items: center; gap: 8px;
  width: fit-content; margin: 0 auto 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
  color: var(--ink-soft);
  border-radius: 999px; padding: 8px 16px;
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.amb-btn.on { color: var(--amber); border-color: rgba(247, 207, 139, 0.45); background: var(--glass-hi); }
.amb-btn .amb-ic { display: inline-flex; }
.amb-btn .amb-ic svg { display: block; }
.amb-btn:active { transform: scale(0.96); }

/* Klang-Wähler: ‹ zurück · [Klang / stumm] · vor › */
.amb-ctl { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto 16px; }
.amb-ctl .amb-btn { margin: 0; min-width: 160px; justify-content: center; }
.amb-nav {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
  color: var(--ink-soft);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.amb-nav:active { transform: scale(0.9); }

/* ---------- Hover: NUR auf Hover-Geräten (sonst klebt der Zustand nach Touch) ---------- */
@media (hover: hover) {
  .ex-card:hover { transform: translateY(-3px); border-color: rgba(247, 207, 139, 0.45); background: var(--glass-hi); }
  .chip:hover { color: var(--ink); border-color: rgba(247, 207, 139, 0.45); background: var(--glass-hi); }
  .btn-ghost:hover { border-color: rgba(247, 207, 139, 0.45); background: var(--glass-hi); }
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 44px -10px rgba(255, 168, 107, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
  .btn-primary:hover::after { transform: translateX(120%); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
  .thinking .dot { animation: none; }
  .amb-btn.loading .amb-ic { animation: none; opacity: 0.5; }
  .b-arc { filter: none; }            /* Atem-Bögen bleiben (sind informativ), nur Glow weg */
  .btn-primary::after { display: none; }
  .view-enter, .stagger > * { animation: none; }
  .flash, .breath-stage.celebrate .breath-svg { animation: none; }
}

/* Eintritts-Animation */
.view-enter { animation: rise 0.55s var(--spring) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise 0.55s var(--spring) both; }
.stagger > *:nth-child(1){animation-delay:.05s}
.stagger > *:nth-child(2){animation-delay:.12s}
.stagger > *:nth-child(3){animation-delay:.19s}
.stagger > *:nth-child(4){animation-delay:.26s}
.stagger > *:nth-child(5){animation-delay:.33s}
.stagger > *:nth-child(6){animation-delay:.40s}

.spacer { flex: 1; }
.foot-note { text-align: center; font-size: 12px; color: var(--ink-faint); margin-top: 30px; letter-spacing: 0.03em; }

/* ---------- View Transitions (Seitenwechsel) ---------- */
/* Inhalt blendet weich rein/raus; die Nav (eigener Name) bleibt stehen. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out 0.2s ease both; }
  ::view-transition-new(root) { animation: vt-in 0.36s var(--spring) both; }
  ::view-transition-group(navbar) { animation-duration: 0.36s; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

/* ---------- Home: KI-Generator-Block ---------- */
.gen-block { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.gen-block .btn-primary { margin-top: 14px; }

/* ---------- Statistik: Session-Log ---------- */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.log-item .l-name { font-family: var(--display); font-weight: 400; font-size: 16px; }
.log-item .log-date { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }
.log-item .l-meta { font-family: var(--mono); font-size: 12.5px; color: var(--amber); white-space: nowrap; }

/* Verlauf unten, damit Inhalt sauber hinter der Nav ausblendet statt zu kollidieren */
/* ---------- Bottom-Nav (schwebende Glas-Pille) ---------- */
.tabbar {
  position: fixed;
  /* Zentrierung OHNE transform: translateX(-50%) kollidiert mit
     view-transition-name (Nav würde beim Tabwechsel nach links/rechts springen). */
  left: 0; right: 0;
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100vw - 24px);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 9;
  display: flex;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(13, 18, 36, 0.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 18px 44px -14px rgba(0, 0, 0, 0.9);
  view-transition-name: navbar;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background 0.25s ease, transform 0.2s var(--spring);
}
.tab .ic { line-height: 1; }
.tab:active { transform: scale(0.95); }
.tab.active {
  color: #281a06;
  background: linear-gradient(135deg, var(--peach), var(--amber-hot));
  box-shadow: 0 8px 20px -8px rgba(255, 168, 107, 0.6);
}

/* ---------- Wissen: Referenz-Karten ---------- */
.ref-card { display: block; text-decoration: none; }
.ref-card h3 { padding-right: 0; }
.ref-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(247, 207, 139, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
}
.ref-card .pattern { font-size: 12px; }
.ref-open { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--amber); }
.disclaimer {
  margin-top: 22px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-faint);
  text-align: center;
  padding: 0 8px;
}

/* ---------- Mehr: Impressum ---------- */
.imprint {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.imprint p { margin-bottom: 12px; }
.imprint strong { color: var(--ink); }
.imprint a { color: var(--amber); text-decoration: none; }
.credits { list-style: none; margin-top: 10px; font-size: 12.5px; line-height: 1.6; color: var(--ink-faint); }
.credits li { margin-bottom: 6px; }
.credits a { color: var(--amber); text-decoration: none; }

/* ---------- Hero ----------
   Kompakte Leiste (sticky, KONSTANTE Höhe) + großer Titel im normalen Fluss.
   Beim Scrollen scrollt der Titel einfach weg und gleitet hinter die Leiste —
   es ändert sich keine Layout-Höhe, daher kein Zittern. Die Leiste bekommt beim
   Scrollen nur frosted glass als Hintergrund (rein visuell). */
.hero {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 5;
  margin: 0 -22px;               /* volle Breite hinter dem #app-Padding */
  padding: 10px 22px;
  background: transparent;
  transition: background 0.28s ease, -webkit-backdrop-filter 0.28s ease, backdrop-filter 0.28s ease, border-color 0.28s ease;
}
.hero .eyebrow { transition: color 0.28s ease; }
.hero-big { margin: 6px 0 16px; }
/* Der Blur beim Scrollen kommt jetzt vom durchgehenden .notch-scrim (Notch + Leiste
   als EINE Fläche) — der Header selbst bleibt transparent, sonst zwei Blur-Kanten. */
/* Notch-Streifen über der Leiste: eigenes fixed Element auf Body-Ebene (wie die
   Tab-Leiste), damit backdrop-filter den scrollenden Inhalt zuverlässig erfasst —
   als Pseudo-Element im Backdrop-Kontext des Headers klappt das auf iOS nicht.
   Transparent oben, tönt/blurrt beim Scrollen synchron mit der Leiste. */
.notch-scrim {
  position: fixed;
  top: 0; left: 0; right: 0;
  /* Notch + Kopfleiste als EINE Fläche (Höhe der Leiste kommt aus mount()) */
  height: calc(env(safe-area-inset-top) + var(--herobar-h, 0px));
  z-index: 4;                 /* über dem Inhalt, HINTER dem Eyebrow-Text (Hero z:5) */
  pointer-events: none;
  background: transparent;
  transition: background 0.28s ease, -webkit-backdrop-filter 0.28s ease, backdrop-filter 0.28s ease, box-shadow 0.28s ease;
}
body.scrolled .notch-scrim {
  background: rgba(10, 14, 28, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 1px 0 var(--glass-line);   /* feiner Abschluss unter der Leiste */
}
body.scrolled .hero .eyebrow { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .hero, .hero .eyebrow { transition: none; }
}

/* ---------- Mehr: KI-Einstellungen ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; margin-bottom: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.s-title { font-size: 15px; color: var(--ink); }
.s-sub { font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; margin-top: 4px; }
.switch {
  appearance: none; -webkit-appearance: none;
  flex: none;
  width: 50px; height: 30px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  position: relative; cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink-soft);
  transition: transform 0.25s var(--spring), background 0.25s ease;
}
.switch:checked { background: linear-gradient(135deg, var(--peach), var(--amber-hot)); border-color: transparent; }
.switch:checked::after { transform: translateX(20px); background: #281a06; }
.ai-config { display: none; flex-direction: column; gap: 12px; padding-top: 2px; }
.ai-config.open { display: flex; }
.ai-config .field label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.ai-config input,
.ai-config select {
  width: 100%;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  padding: 13px 15px;
}
.ai-config input::placeholder { color: var(--ink-faint); }
.ai-config input:focus,
.ai-config select:focus { outline: none; border-color: rgba(247, 207, 139, 0.55); box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 4px rgba(247,207,139,0.10); }
.ai-status { font-size: 13px; min-height: 18px; line-height: 1.4; color: var(--ink-soft); }
.ai-status.ok { color: var(--teal); }
.ai-status.err { color: var(--rose); }

/* Segmentierter Pill-Schalter (Sprache, Stimme) — passt zum Glass/Aurora-Look */
.seg {
  display: inline-flex;
  width: 100%;
  gap: 5px;
  padding: 5px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-radius: 999px;
}
.seg button {
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .22s ease, background .22s ease, box-shadow .22s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  color: #2a1c08;
  background: linear-gradient(135deg, #ffe7c2, var(--amber-hot) 55%, #ff9d6b);
  box-shadow: 0 5px 16px rgba(255, 170, 90, 0.22);
}
