/* Farben: dunkles Nachtblau, Glut fuer das Atmen, Eisblau fuer das Eisbad. */
:root {
  --grund: #0a0f1c;
  --flaeche: #131a2b;
  --flaeche2: #1c2540;
  --linie: #2a3552;
  --text: #eef3fb;
  --leise: #93a1bd;
  --atem: #ff8a3d;
  --atem-hell: #ffc061;
  --eis: #5cd4ff;
  --eis-tief: #2f8fe0;
  --auf-farbe: #0b1322;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

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

html { background: var(--grund); }

body {
  margin: 0 auto;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

input { user-select: text; -webkit-user-select: text; }
h1, h2, p { margin: 0; }
h1 { font-size: 18px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 800; line-height: 1.2; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

.klein { color: var(--leise); font-size: 14px; }
.mitte { text-align: center; }

.verlaeufe { position: absolute; width: 0; height: 0; }

/* --- Grundgeruest ---------------------------------------------------------- */

#seite { min-height: 100dvh; display: flex; flex-direction: column; transition: background 0.6s; }

.kopf {
  display: grid;
  grid-template-columns: 76px 1fr 76px;
  align-items: center;
  padding: calc(var(--oben) + 12px) 16px 10px;
  text-align: center;
}
.kopf > :last-child { justify-self: end; }

.rund {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--flaeche2);
}
.rund svg { width: 22px; height: 22px; }
.rund.leise { background: none; color: var(--leise); }

.inhalt {
  flex: 1;
  display: flex; flex-direction: column; gap: 16px;
  padding: 8px 20px calc(var(--unten) + 104px);
}
.inhalt.mit-fuss { padding-bottom: calc(var(--unten) + 110px); }
.inhalt.doppelt { padding-bottom: calc(var(--unten) + 176px); }

.fuss {
  position: fixed; bottom: 0; left: 50%; translate: -50% 0;
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px 20px calc(var(--unten) + 16px);
  background: linear-gradient(to top, var(--grund) 62%, transparent);
  z-index: 5;
}

.karte { background: var(--flaeche); border-radius: 20px; padding: 16px; }
.karte.liste { padding: 4px 16px; }

.zeile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 54px; padding: 8px 0;
}
.zeile + .zeile { border-top: 1px solid var(--linie); }
.zeile.unter { padding-left: 16px; color: var(--leise); }
.zeile.aus { opacity: 0.35; pointer-events: none; }
.zeitwert { font-size: 20px; font-variant-numeric: tabular-nums; }

/* --- Knoepfe und Eingaben -------------------------------------------------- */

.knopf {
  display: block; width: 100%;
  min-height: 50px; padding: 12px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--linie);
  font-weight: 700; text-align: center;
  transition: transform 0.1s, opacity 0.2s;
}
.knopf:active { transform: scale(0.97); }
.knopf:disabled { opacity: 0.5; }
.knopf.voll { background: var(--text); color: var(--auf-farbe); border-color: transparent; }
.knopf.gross { min-height: 62px; font-size: 19px; border-radius: 20px; }
.knopf.schmal { width: auto; min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.knopf.atemfarbe { background: linear-gradient(135deg, var(--atem-hell), var(--atem)); }
.knopf.eisfarbe { background: linear-gradient(135deg, #a5eaff, var(--eis)); }

.text-knopf { display: block; width: 100%; padding: 10px; color: var(--leise); text-align: center; text-decoration: underline; text-underline-offset: 3px; }

.wahl { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--flaeche); border-radius: 16px; }
.wahl button { min-height: 44px; border-radius: 12px; color: var(--leise); font-weight: 600; }
.wahl button.an { background: var(--flaeche2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--linie); }

.stufen { display: flex; align-items: center; gap: 4px; }
.stufen button { width: 42px; height: 42px; border-radius: 50%; background: var(--flaeche2); font-size: 22px; line-height: 1; }
.stufen output { min-width: 40px; text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.umschalter {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 52px; height: 32px; margin: 0;
  border-radius: 16px; background: var(--linie);
  position: relative; transition: background 0.2s;
}
.umschalter::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%; background: #fff;
  transition: translate 0.2s;
}
.umschalter:checked { background: var(--eis-tief); }
.umschalter:checked::after { translate: 20px 0; }

.formular { display: flex; flex-direction: column; gap: 14px; }
.formular label { display: flex; flex-direction: column; gap: 6px; color: var(--leise); font-size: 14px; }
input:not([type="checkbox"]):not([type="range"]) {
  width: 100%; min-height: 50px; padding: 10px 14px;
  border-radius: 14px; border: 1.5px solid var(--linie);
  background: var(--grund); color: var(--text); font: inherit; font-size: 17px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--eis); outline-offset: 2px; }
.meldung { color: #ff8f8f; font-size: 14px; min-height: 0; }
.meldung:empty { display: none; }
.reihe { display: flex; gap: 8px; margin: 12px 0; }
.reihe .knopf { width: auto; white-space: nowrap; }

.regler-zeile { display: block; margin-bottom: 14px; font-weight: 600; }
.regler { width: 100%; height: 34px; accent-color: var(--eis); }
.regler-enden { display: flex; justify-content: space-between; }

/* --- Sechsecke ------------------------------------------------------------- */

.sechseck polygon { fill: var(--flaeche2); stroke: var(--flaeche2); stroke-width: 8; stroke-linejoin: round; }

.puls { position: relative; width: min(74vw, 300px); aspect-ratio: 1; will-change: transform; }
.puls .sechseck { position: absolute; inset: 0; }
.puls .aussen polygon { fill: var(--atem); stroke: var(--atem); opacity: 0.28; }
.puls .mitte { scale: 0.82; }
.puls .mitte polygon { fill: var(--atem); stroke: var(--atem); opacity: 0.6; }
.puls .innen { scale: 0.64; }
.puls .innen polygon { fill: url(#v-atem); stroke: var(--atem-hell); stroke-width: 6; }
.puls b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: min(22vw, 92px); font-weight: 300; color: #7a3306; font-variant-numeric: tabular-nums;
}

.vorschau { display: grid; place-items: center; height: 120px; }
.vorschau .puls { width: 110px; }

.halter { position: relative; width: min(74vw, 300px); aspect-ratio: 1; --rand: var(--eis); }
.halter .sechseck { position: absolute; inset: 0; filter: drop-shadow(0 0 22px color-mix(in srgb, var(--rand) 45%, transparent)); }
.halter polygon { fill: var(--flaeche); stroke: var(--rand); stroke-width: 4; }
.halter b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: min(17vw, 70px); font-weight: 800; font-variant-numeric: tabular-nums;
}

.sitzung { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 0 24px calc(var(--unten) + 120px); text-align: center; }
.sitzung h2 { min-height: 2.4em; display: grid; place-items: center; }
.buehne { display: grid; place-items: center; width: min(74vw, 300px); aspect-ratio: 1; }
.buehne > * { grid-area: 1 / 1; }
.buehne[data-phase="atmen"] .halter,
.buehne:not([data-phase="atmen"]) .puls { display: none; }
.buehne[data-phase="erholung"] .halter { --rand: var(--atem-hell); }
.buehne[data-phase="loslassen"] .halter { --rand: #7dffb0; }

#seite[data-phase="atmen"] { background: radial-gradient(120% 70% at 50% 45%, #2a1a14, var(--grund)); }
#seite[data-phase="halten"], #seite[data-phase="eis"] { background: radial-gradient(120% 70% at 50% 45%, #0f2538, var(--grund)); }
#seite[data-phase="erholung"] { background: radial-gradient(120% 70% at 50% 45%, #2a2314, var(--grund)); }
#seite[data-phase="loslassen"] { background: radial-gradient(120% 70% at 50% 45%, #12291f, var(--grund)); }

.lob { position: relative; width: 104px; aspect-ratio: 1; margin: 6px auto 0; }
.lob.gross { width: 190px; }
.lob .sechseck { position: absolute; inset: 0; }
.lob.atem polygon { fill: url(#v-atem); stroke: var(--atem-hell); }
.lob.eis polygon { fill: url(#v-eis); stroke: #a5eaff; }
.lob > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--auf-farbe); }
.lob > span svg { width: 46px; height: 46px; stroke-width: 2.6; }
.lob b { font-size: 38px; font-weight: 800; line-height: 1.1; }
.lob small { font-weight: 600; opacity: 0.7; }

/* --- Start ----------------------------------------------------------------- */

.start-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: calc(var(--oben) + 22px) 20px 8px; }
.start-kopf h1 { font-size: 34px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.gruss { color: var(--leise); font-size: 18px; }

.serien { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.serie {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px;
  padding: 14px; border-radius: 20px; background: var(--flaeche);
  border: 1.5px solid color-mix(in srgb, var(--farbe) 45%, transparent);
}
.serie.atem { --farbe: var(--atem); }
.serie.eis { --farbe: var(--eis); }
.serie i { color: var(--farbe); }
.serie i svg { width: 30px; height: 30px; }
.serie b { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.serie span { grid-column: 1 / -1; margin-top: 6px; font-weight: 600; font-size: 14px; }
.serie small { grid-column: 1 / -1; color: var(--leise); font-size: 12px; white-space: nowrap; }
.serie.leer { border-color: var(--linie); }
.serie.leer i { color: var(--leise); }

.waben { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px -6px; }
.wabe { position: relative; aspect-ratio: 1; transition: transform 0.12s; }
.wabe:active { transform: scale(0.95); }
.wabe .sechseck { position: absolute; inset: 0; }
.wabe.atem polygon { fill: url(#v-atem); stroke: var(--atem-hell); stroke-width: 5; }
.wabe.eis polygon { fill: url(#v-eis); stroke: #a5eaff; stroke-width: 5; }
.wabe.atem .sechseck { filter: drop-shadow(0 10px 24px rgb(255 138 61 / 0.3)); }
.wabe.eis .sechseck { filter: drop-shadow(0 10px 24px rgb(92 212 255 / 0.28)); }
.wabe span { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--auf-farbe); }
.wabe span svg { width: 46px; height: 46px; stroke-width: 2; }
.wabe b { font-size: 22px; font-weight: 800; }

.spruch { width: 100%; min-height: 112px; padding: 18px 20px; border-radius: 20px; background: var(--flaeche); text-align: left; border-left: 4px solid var(--atem); }
.spruch p { font-size: 19px; font-weight: 600; line-height: 1.35; text-wrap: balance; opacity: 0; transition: opacity 0.25s; }
.spruch p.da { opacity: 1; }

/* --- Ergebnisse ------------------------------------------------------------ */

.kacheln { display: grid; gap: 12px; }
.kacheln.zwei { grid-template-columns: 1fr 1fr; }
.kachel { position: relative; padding: 14px 16px; border-radius: 20px; background: var(--flaeche); }
.kachel b { display: block; font-size: 22px; white-space: nowrap; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kachel small { color: var(--leise); font-size: 13.5px; }
.kachel i { position: absolute; top: 14px; right: 14px; }
.kachel i svg { width: 26px; height: 26px; }
.kachel.atem { border: 1.5px solid color-mix(in srgb, var(--atem) 45%, transparent); }
.kachel.atem i { color: var(--atem); }
.kachel.eis { border: 1.5px solid color-mix(in srgb, var(--eis) 45%, transparent); }
.kachel.eis i { color: var(--eis); }
.kachel.atem b, .kachel.eis b { font-size: 40px; }

.monat { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monat b { font-size: 18px; }
.wochentage, .tage { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wochentage { margin-bottom: 6px; color: var(--leise); font-size: 12px; font-weight: 600; text-align: center; }
.tag {
  aspect-ratio: 1; border-radius: 13px; background: var(--flaeche2);
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.tag.atem { background: linear-gradient(135deg, var(--atem-hell), var(--atem)); color: var(--auf-farbe); }
.tag.eis { background: linear-gradient(135deg, #a5eaff, var(--eis)); color: var(--auf-farbe); }
.tag.beide { background: linear-gradient(135deg, var(--atem) 50%, var(--eis) 50%); color: var(--auf-farbe); }
.tag.zukunft { opacity: 0.35; }
.tag.heute { box-shadow: 0 0 0 2px var(--grund), 0 0 0 4px var(--text); }
.tag.gewaehlt:not(.heute) { box-shadow: 0 0 0 2px var(--grund), 0 0 0 3.5px var(--leise); }
.legende { display: flex; justify-content: center; gap: 16px; margin-top: 14px; }
.legende span { display: flex; align-items: center; gap: 6px; }
.punkt { width: 12px; height: 12px; border-radius: 4px; }
.punkt.atem { background: var(--atem); }
.punkt.eis { background: var(--eis); }
.punkt.beide { background: linear-gradient(135deg, var(--atem) 50%, var(--eis) 50%); }

.eintrag { justify-content: flex-start; }
.eintrag > i svg { width: 26px; height: 26px; }
.eintrag.atem > i { color: var(--atem); }
.eintrag.eis > i { color: var(--eis); }
.eintrag > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eintrag small { color: var(--leise); font-size: 13px; }

.gruppe { display: flex; flex-direction: column; gap: 8px; --farbe: var(--atem); }
.gruppe.eis { --farbe: var(--eis); }
.gruppe-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.gruppe-kopf small { color: var(--leise); white-space: nowrap; }
.balken { height: 8px; border-radius: 4px; background: var(--flaeche2); overflow: hidden; }
.balken i { display: block; height: 100%; border-radius: 4px; background: var(--farbe); }
.abzeichen-reihe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.abzeichen { text-align: center; }
.abzeichen-form { position: relative; aspect-ratio: 1; }
.abzeichen-form .sechseck { position: absolute; inset: 0; }
.abzeichen-form polygon { fill: var(--flaeche2); stroke: var(--linie); stroke-width: 3; }
.abzeichen-form span { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 12%; font-size: 13px; font-weight: 800; line-height: 1.1; color: var(--leise); }
.abzeichen.geschafft.atem polygon { fill: url(#v-atem); stroke: var(--atem-hell); }
.abzeichen.geschafft.eis polygon { fill: url(#v-eis); stroke: #a5eaff; }
.abzeichen.geschafft span { color: var(--auf-farbe); }
.abzeichen.geschafft .sechseck { filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.4)); }
.abzeichen small { display: block; margin-top: 6px; font-size: 13px; color: var(--leise); }

/* --- Community und Profil -------------------------------------------------- */

.person { display: flex; align-items: center; gap: 12px; }
.person.ich { box-shadow: inset 0 0 0 1.5px var(--leise); }
.rang { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--flaeche2); font-weight: 800; }
.person-mitte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-mitte b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-mitte em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--leise); margin-left: 4px; }
.person-mitte small { color: var(--leise); font-size: 12.5px; }
.person-serien { display: flex; flex-direction: column; gap: 4px; }
.marke { display: flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; }
.marke svg { width: 18px; height: 18px; }
.marke.atem { color: var(--atem); }
.marke.eis { color: var(--eis); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 17px; letter-spacing: 0.04em; }

.konto { justify-content: center; padding-top: calc(var(--oben) + 24px); padding-bottom: calc(var(--unten) + 24px); }
.marke-gross { text-align: center; margin-bottom: 8px; }
.marke-gross h1 { font-size: 34px; font-weight: 800; }
.logo { position: relative; width: 96px; aspect-ratio: 1; margin: 0 auto 10px; }
.logo .sechseck { position: absolute; inset: 0; }
.logo .aussen polygon { fill: none; stroke: var(--eis); stroke-width: 9; }
.logo .innen { scale: 0.5; }
.logo .innen polygon { fill: url(#v-atem); stroke: var(--atem); }

/* --- Leiste unten, Hinweis, Karte ueber der Seite -------------------------- */

#leiste {
  position: fixed; bottom: 0; left: 50%; translate: -50% 0;
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 8px calc(var(--unten) + 8px);
  background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie);
  z-index: 6;
}
#leiste a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--leise); font-size: 12px; font-weight: 600; }
#leiste a svg { width: 26px; height: 26px; }
#leiste a.an { color: var(--text); }

#hinweis {
  position: fixed; left: 50%; bottom: calc(var(--unten) + 96px); translate: -50% 20px;
  max-width: min(88vw, 420px); padding: 12px 18px; border-radius: 16px;
  background: var(--text); color: var(--auf-farbe); font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, translate 0.25s; z-index: 30;
}
#hinweis.da { opacity: 1; translate: -50% 0; }

.feier { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgb(4 7 14 / 0.78); }
.feier-karte { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: 26px; background: var(--flaeche); text-align: center; animation: rein 0.3s ease-out; }
.feier-reihe { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.feier-reihe .abzeichen { width: 104px; }
.frage-text { font-size: 20px; font-weight: 700; }
@keyframes rein { from { opacity: 0; transform: translateY(16px) scale(0.96); } }

/* Der unsichtbare Schalter fuer das Tippen des iPhones (siehe ton.js). */
.haptik-schalter { position: fixed; left: 0; bottom: 0; opacity: 0; pointer-events: none; }

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