/* ════════════════════════════════════════════════════
   MEIN TAG — v1.1
   Lebendig & warm im Hellmodus, sanft im Dunkelmodus.

   WICHTIGER BUGFIX GANZ OBEN:
   Das hidden-Attribut setzt normalerweise display:none.
   Aber unsere .overlay-Regel (display:flex) hat eine
   höhere Spezifität und ÜBERSCHREIBT das — deshalb ging
   der Brief nie weg! Diese Regel mit !important gewinnt
   jetzt immer. Merksatz: eigene display-Regeln schlagen
   das hidden-Attribut, wenn man nicht aufpasst.
   ════════════════════════════════════════════════════ */

[hidden] {
  display: none !important;
}

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

/* ── Farbsystem: Hell-Modus (Standard) ── */
:root {
  --gruen: #2d6a4f;
  --gruen-dunkel: #1b4332;
  --gruen-hell: #d8f3dc;
  --mint: #74c69d;
  --pfirsich: #ff9f68;
  --pfirsich-hell: #ffe3cf;
  --sonne: #ffc94d;
  --sonne-hell: #fff3d6;
  --lila: #9d6fd8;
  --lila-hell: #f0e7fb;
  --himmel: #4ea8de;
  --himmel-hell: #e0f0fc;
  --rot: #e85d5d;
  --rot-hell: #fdeaea;

  --hintergrund: linear-gradient(160deg, #fff3e6 0%, #ffe9f0 30%, #e8f3ff 65%, #e6f9ee 100%);
  --karte: #ffffff;
  --karte-innen: #faf7f2;
  --text: #33365a;
  --text-weich: #62658a;
  --text-leise: #9b9eb8;
  --rand: #efecf5;
  --schatten: 0 6px 20px rgba(51, 54, 90, 0.08);

  --radius: 20px;
  --radius-klein: 13px;
}

/* ── Dunkel-Modus: wird per data-theme="dunkel" am <html> aktiviert ── */
[data-theme="dunkel"] {
  --gruen: #6fcf97;
  --gruen-dunkel: #d8f3dc;
  --gruen-hell: #1e3a2d;
  --mint: #4f9d75;
  --pfirsich: #ffae7a;
  --pfirsich-hell: #3a2c22;
  --sonne: #ffd97d;
  --sonne-hell: #3a3422;
  --lila: #b794e8;
  --lila-hell: #2d2440;
  --himmel: #7cc0ee;
  --himmel-hell: #1e2f3f;
  --rot: #ef8a8a;
  --rot-hell: #3c2424;

  --hintergrund: linear-gradient(160deg, #1a1c2e 0%, #20223a 50%, #1b2433 100%);
  --karte: #262940;
  --karte-innen: #2e3150;
  --text: #e8e9f5;
  --text-weich: #b4b7d4;
  --text-leise: #7e81a3;
  --rand: #363a5c;
  --schatten: 0 6px 20px rgba(0, 0, 0, 0.35);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--hintergrund);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  transition: background 0.4s, color 0.4s;
}

.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── Kopf mit Deko-Blobs ── */
header {
  position: relative;
  margin-bottom: 30px;
  text-align: center;
  padding: 24px 0;
}

.header-deko {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.deko-blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  filter: blur(2px);
  animation: schweben 6s ease-in-out infinite;
}

.blob-1 { width: 38px; height: 38px; background: var(--sonne);    top: 0;    left: 12%; }
.blob-2 { width: 26px; height: 26px; background: var(--lila);     top: 55%;  right: 10%; animation-delay: 2s; }
.blob-3 { width: 20px; height: 20px; background: var(--pfirsich); bottom: 0; left: 24%; animation-delay: 4s; }

@keyframes schweben {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

header h1 {
  font-size: 32px;
  background: linear-gradient(120deg, var(--gruen), var(--himmel), var(--lila));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  position: relative;
}

header p {
  color: var(--text-weich);
  margin-top: 6px;
  font-size: 15px;
}

/* ── Sections: Karten mit farbigem Akzentstreifen ── */
section {
  background: var(--karte);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--schatten);
  border-top: 4px solid transparent;
  transition: background 0.4s;
}

.akzent-gruen    { border-top-color: var(--mint); }
.akzent-pfirsich { border-top-color: var(--pfirsich); }
.akzent-sonne    { border-top-color: var(--sonne); }
.akzent-lila     { border-top-color: var(--lila); }
.akzent-himmel   { border-top-color: var(--himmel); }
.akzent-rot      { border-top-color: var(--rot); }

h2 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--text);
}

.abschnitt-intro {
  font-size: 13px;
  color: var(--text-weich);
  line-height: 1.7;
  margin-bottom: 14px;
}

/* ── Buttons ── */
.btn-primaer {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gruen), var(--mint));
  color: white;
  border: none;
  border-radius: var(--radius-klein);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

[data-theme="dunkel"] .btn-primaer {
  color: #16281e;
}

.btn-primaer:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(45, 106, 79, 0.3);
}

.btn-sekundaer {
  padding: 10px 18px;
  background: var(--gruen-hell);
  color: var(--gruen-dunkel);
  border: none;
  border-radius: var(--radius-klein);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s;
}

.btn-sekundaer:hover { filter: brightness(0.95); }

.btn-gefahr {
  padding: 10px 18px;
  background: var(--rot-hell);
  color: var(--rot);
  border: none;
  border-radius: var(--radius-klein);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ── Frage des Tages ── */
.frage-des-tages {
  background: linear-gradient(135deg, #8e6fd8, #b08be8);
  border-top: none;
}

[data-theme="dunkel"] .frage-des-tages {
  background: linear-gradient(135deg, #4a3a78, #5d4a92);
}

.frage-des-tages h2 {
  color: #e9defa;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.frage-text {
  color: white;
  font-size: 17px;
  line-height: 1.6;
  font-weight: 500;
}

/* ── Stimmung ── */
.emojis {
  display: flex;
  gap: 10px;
}

.emojis button {
  flex: 1;
  padding: 12px 6px;
  border: 2px solid var(--rand);
  border-radius: 15px;
  background: var(--karte);
  cursor: pointer;
  font-size: 27px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}

.emojis button span {
  font-size: 11px;
  color: var(--text-weich);
  font-weight: 700;
}

.emojis button:hover { transform: translateY(-3px) scale(1.03); }

.emojis button.gewaehlt {
  border-color: var(--gruen);
  background: var(--gruen-hell);
  transform: scale(1.05);
}

/* ── Erweiterte Skala ── */
.erweitert {
  margin-top: 16px;
  background: var(--lila-hell);
  border-radius: var(--radius-klein);
  padding: 16px;
}

.erweitert-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--lila);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.erweitert-toggle {
  background: none;
  border: none;
  color: var(--text-leise);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 8px;
}

.erweitert-zeigen {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  background: none;
  border: 2px dashed var(--lila);
  border-radius: var(--radius-klein);
  color: var(--lila);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.slider-gruppe { margin-bottom: 14px; }
.slider-gruppe:last-child { margin-bottom: 0; }

.slider-gruppe label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.slider-wert {
  background: var(--karte);
  border-radius: 8px;
  padding: 1px 10px;
  color: var(--lila);
  font-weight: 800;
}

.slider-gruppe input[type="range"] {
  width: 100%;
  accent-color: var(--lila);
  cursor: pointer;
}

.slider-enden {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-leise);
  margin-top: 2px;
}

/* ── Textfelder ── */
textarea, .bruecke input, .overlay-karte input[type="text"] {
  width: 100%;
  border: 2px solid var(--rand);
  border-radius: var(--radius-klein);
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--karte);
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea { min-height: 110px; resize: vertical; }
textarea:focus, .bruecke input:focus { border-color: var(--mint); }

.speichern { margin-top: 12px; }

/* ── Kurve ── */
.kurve-wrap { width: 100%; overflow: hidden; }
#kurveSvg { width: 100%; height: auto; }

.kurve-hinweis {
  font-size: 12px;
  color: var(--text-leise);
  margin-top: 10px;
  line-height: 1.6;
}

.kurve-punkt { cursor: pointer; }

/* ── Brücke ── */
.bruecke input { margin-bottom: 10px; }

.bruecke-ergebnis {
  margin-top: 14px;
  background: var(--sonne-hell);
  border-radius: var(--radius-klein);
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

/* ── Brief ── */
.brief textarea { min-height: 130px; }
.brief .btn-sekundaer { margin-top: 10px; }

.brief-status {
  font-size: 12px;
  color: var(--gruen);
  margin-top: 8px;
  font-weight: 700;
}

/* ── Übungen ── */
.uebung {
  border: 2px solid var(--rand);
  border-radius: var(--radius-klein);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--karte);
}

.uebung-kopf {
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.uebung-kopf:hover { background: var(--karte-innen); }

.uebung-dauer {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-leise);
  background: var(--karte-innen);
  border-radius: 8px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.uebung-pfeil {
  color: var(--text-leise);
  transition: transform 0.25s;
  flex-shrink: 0;
}

.uebung.offen .uebung-pfeil { transform: rotate(180deg); }

.uebung-inhalt { display: none; padding: 0 16px 16px; }
.uebung.offen .uebung-inhalt { display: block; }

.uebung-inhalt p, .uebung-inhalt li {
  font-size: 13px;
  color: var(--text-weich);
  line-height: 1.8;
}

.uebung-inhalt ol { padding-left: 20px; margin: 8px 0 10px; }

.uebung-beschreibung {
  font-style: italic;
  margin-bottom: 4px;
}

/* Box-Atmung */
.atmung-anzeige { text-align: center; padding: 20px 0 10px; }

.atmung-kreis {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--himmel), var(--mint));
  margin: 0 auto 12px;
  transition: transform 4s ease-in-out;
}

.atmung-kreis.gross { transform: scale(1.6); }

.atmung-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ── Denkfallen ── */
.denkfalle {
  background: var(--karte-innen);
  border-radius: var(--radius-klein);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  border-left: 4px solid var(--himmel);
}

.denkfalle strong {
  font-size: 13px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
}

.denkfalle-detail {
  display: none;
  margin-top: 8px;
}

.denkfalle.offen .denkfalle-detail { display: block; }

.denkfalle-detail p {
  font-size: 13px;
  color: var(--text-weich);
  line-height: 1.7;
}

.denkfalle-beispiel {
  margin-top: 6px;
  font-style: italic;
  background: var(--karte);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ── Einträge ── */
.eintrag-karte {
  background: var(--karte-innen);
  border-radius: var(--radius-klein);
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--mint);
}

.eintrag-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.eintrag-datum { font-size: 11px; color: var(--text-leise); }

.eintrag-stimmung {
  font-size: 13px;
  font-weight: 800;
  color: var(--gruen);
}

.eintrag-extra {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.eintrag-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--lila-hell);
  color: var(--lila);
  border-radius: 8px;
  padding: 2px 8px;
}

.eintrag-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.eintraege-leer {
  font-size: 13px;
  color: var(--text-leise);
  text-align: center;
  padding: 10px 0;
}

/* ── Hilfe ── */
.hilfe-karte {
  background: var(--karte-innen);
  border-radius: var(--radius-klein);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.hilfe-karte.dringend {
  background: var(--rot-hell);
  border-left: 4px solid var(--rot);
}

.hilfe-karte strong { font-size: 13px; color: var(--text); }

.hilfe-karte p {
  font-size: 13px;
  color: var(--text-weich);
  line-height: 1.7;
  margin-top: 4px;
}

.hilfe-karte a {
  color: var(--gruen);
  font-weight: 800;
  text-decoration: none;
}

.hilfe-karte a:hover { text-decoration: underline; }

/* ── Einstellungen ── */
.einstellung-zeile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rand);
}

.einstellung-zeile:last-child { border-bottom: none; }
.einstellung-zeile strong { font-size: 14px; color: var(--text); }

.einstellung-zeile p {
  font-size: 12px;
  color: var(--text-leise);
  margin-top: 2px;
  line-height: 1.5;
}

.einstellung-zeile button,
.einstellung-zeile .datei-label { flex-shrink: 0; }

.datei-label { display: inline-block; text-align: center; }

/* ── In-App Nachricht ── */
.nachricht-popup {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 500px;
  z-index: 200;
  animation: nachrichtRein 0.5s ease-out;
}

@keyframes nachrichtRein {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.nachricht-inhalt {
  background: linear-gradient(135deg, var(--gruen), var(--mint));
  color: white;
  border-radius: var(--radius);
  padding: 16px 44px 16px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 10px 32px rgba(45, 106, 79, 0.4);
  position: relative;
}

[data-theme="dunkel"] .nachricht-inhalt { color: #16281e; }

.nachricht-icon { font-size: 22px; flex-shrink: 0; }
.nachricht-inhalt p { font-size: 14px; line-height: 1.6; font-weight: 500; }

.nachricht-schliessen {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.25);
  border: none;
  color: inherit;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
}

/* ── Overlays ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 32, 55, 0.55);
  backdrop-filter: blur(5px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay-karte {
  background: var(--karte);
  border-radius: 26px;
  padding: 32px 26px;
  max-width: 430px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
  animation: karteRein 0.35s ease-out;
}

@keyframes karteRein {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.onb-emoji { font-size: 46px; margin-bottom: 12px; }

.overlay-karte h2 { font-size: 20px; margin-bottom: 10px; line-height: 1.4; }

.overlay-karte p {
  font-size: 14px;
  color: var(--text-weich);
  line-height: 1.7;
  margin-bottom: 16px;
}

.onb-fortschritt {
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-leise) !important;
  font-weight: 800;
  margin-bottom: 8px !important;
}

.onb-label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-weich);
  margin-bottom: 6px;
}

.overlay-karte input[type="text"] { margin-bottom: 16px; }

.onb-antwort {
  display: block;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 10px;
  background: var(--karte-innen);
  border: 2px solid var(--rand);
  border-radius: var(--radius-klein);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.onb-antwort:hover {
  border-color: var(--mint);
  background: var(--gruen-hell);
}

/* Brief-Popup */
.brief-karte { text-align: left; }
.brief-karte h2, .brief-karte .onb-emoji, .brief-intro { text-align: center; }

.brief-text {
  background: var(--karte-innen);
  border-radius: var(--radius-klein);
  padding: 18px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 16px;
  border-left: 4px solid var(--sonne);
}

.brief-hilfe {
  background: var(--gruen-hell);
  border-radius: var(--radius-klein);
  padding: 14px;
  margin-bottom: 16px;
}

.brief-hilfe p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--gruen-dunkel);
  margin: 0;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
  color: var(--text-leise);
  line-height: 2;
}

.footer-lizenz { font-size: 11px; }

/* ── Reduzierte Bewegung ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
