:root {
  --purple-dark:   #3a3558;
  --purple-mid:    #7a78a8;
  --purple-light:  #c8cadb;
  --text-muted:    #5a5790; /* dunklere Variante für Fließtext auf --purple-light-Basis — --purple-light selbst hat auf Weiß nur 1.6:1 Kontrast, weit unter WCAG AA (4.5:1) */
  --lavender:      #f4e2e7;
  --lavender-soft: #fdf5f7;
  --mint:          #b9dcd2;
  --teal:          #ddf0eb;
  --teal-mid:      #6aada0;
  --white:         #ffffff;
  --gray-text:     #4a4a5e;
  --gray-light:    #f2f3f6;
  --gray-mid:      #e0e2ea;
  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 4px 20px rgba(58,53,88,0.09);
  --shadow-lg:     0 8px 40px rgba(58,53,88,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--purple-light);
  min-height: 100vh;
  color: var(--gray-text);
  padding: 0 0 80px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

.app-header {
  text-align: center; padding: 28px 20px 16px;
  background: var(--purple-light);
}
.brand-title {
  font-family: 'Fredoka', sans-serif; font-size: 2.2rem; font-weight: 700;
  letter-spacing: 0.3px; line-height: 1;
}
.brand-title .migra { color: var(--purple-mid); }
.brand-title .motion { color: var(--teal-mid); }
.brand-sub {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2.5px; color: var(--purple-dark); margin-top: 4px;
}

.nav {
  display: flex; justify-content: center; gap: 6px;
  padding: 12px 16px 4px; flex-wrap: wrap;
}
.nav-btn {
  padding: 8px 16px; border: none; border-radius: 50px; font-size: 0.83rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  background: var(--white); color: var(--purple-mid);
  box-shadow: 0 2px 8px rgba(74,45,107,0.08);
  text-decoration: none; display: inline-block;
}
.nav-btn.active { background: var(--purple-mid); color: var(--white); cursor: default; }
.nav-btn:hover:not(.active) { background: var(--white); box-shadow: 0 2px 12px rgba(74,45,107,0.15); }

.view { padding: 12px 14px 0; max-width: 680px; margin: 0 auto; }

.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px;
}
.card-title {
  font-size: 0.75rem; font-weight: 700; color: var(--purple-mid);
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 14px;
}

.dauer-offen-karte {
  display: flex; gap: 12px; align-items: flex-start; text-decoration: none;
  border-left: 4px solid var(--teal-mid); background: var(--teal);
  color: var(--purple-dark); font-size: 0.88rem; line-height: 1.55;
}
.dauer-offen-karte .do-icon { flex-shrink: 0; font-size: 1.05rem; }
.dauer-offen-karte .do-mehr { opacity: 0.8; }

.starthilfe { border: 2px solid var(--purple-light); }
.starthilfe .sh-text { font-size: 0.88rem; color: var(--gray-text); line-height: 1.6; margin: 0 0 12px; }
.starthilfe .sh-schritt {
  display: flex; gap: 12px; align-items: flex-start; text-decoration: none;
  padding: 12px 14px; border-radius: 12px; background: var(--lavender-soft);
  color: var(--gray-text); font-size: 0.88rem; line-height: 1.5; margin-bottom: 8px;
}
.starthilfe .sh-schritt strong { color: var(--purple-dark); }
.starthilfe .sh-nr {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--purple-mid); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}
.starthilfe .sh-fuss { font-size: 0.78rem; color: var(--gray-text); opacity: 0.8; margin: 10px 0 0; }

.daily-message-card {
  background: linear-gradient(135deg, var(--lavender), var(--teal));
  box-shadow: none;
}
.daily-message {
  font-family: 'Fredoka', sans-serif; font-size: 1.05rem; font-weight: 600;
  color: var(--purple-dark); text-align: center; line-height: 1.5;
}
/* Die Begrüßung steht über dem Spruch, in derselben Karte. Bewusst kleiner
   als der Spruch: Sie ist die Anrede, nicht die Botschaft. */
.begruessung {
  font-family: 'Fredoka', sans-serif; font-size: 0.92rem; font-weight: 600;
  color: var(--purple-mid); text-align: center; line-height: 1.4;
  margin: 0 0 8px;
}
.begruessung .namensfrage {
  display: inline-block; margin-left: 6px; font-size: 0.82rem; font-weight: 600;
  color: var(--purple-mid); background: none; border: none; padding: 0;
  text-decoration: underline; cursor: pointer; font-family: inherit;
}
.namensfeld { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.namensfeld input {
  font-family: inherit; font-size: 0.95rem; color: var(--gray-text);
  padding: 9px 12px; border-radius: 9px; border: 1.5px solid var(--purple-light);
  background: var(--white); max-width: 190px; flex: 1 1 140px; min-width: 0;
}
.namensfeld button {
  font-family: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; border: none;
  background: var(--purple-mid); color: var(--white);
}

.settings-opt {
  padding: 11px 13px; border-radius: 10px; border: 2px solid var(--gray-mid);
  cursor: pointer; transition: all 0.18s; display: flex; align-items: center; gap: 10px;
  background: var(--lavender-soft); margin-bottom: 7px;
}
.settings-opt:hover { border-color: var(--purple-mid); }
.settings-opt.selected { border-color: var(--purple-mid); background: var(--lavender); }
.settings-opt .so-icon { font-size: 1.15rem; }
.settings-opt .so-label { font-size: 0.86rem; font-weight: 600; color: var(--purple-dark); }

.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--purple-mid); color: white; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; transition: background 0.2s;
  text-decoration: none; display: block; text-align: center;
}
.btn-primary:hover { background: var(--purple-dark); }
.btn-danger {
  width: 100%; margin-top: 8px; padding: 11px;
  border: 2px solid #ef9a9a; border-radius: 12px;
  background: transparent; color: #c62828;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: #ffebee; }
.btn-secondary {
  width: 100%; padding: 12px; border: 2px solid var(--purple-light); border-radius: 12px;
  background: transparent; color: var(--purple-mid); font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: block; text-align: center;
}
.btn-secondary:hover { background: var(--lavender); }

.empty-state {
  font-size: 0.84rem; color: var(--text-muted); text-align: center; padding: 10px 4px;
}

/* KREISDIAGRAMM (Migräne-Verteilung) */
.donut-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-chart {
  width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.donut-hole {
  width: 72px; height: 72px; border-radius: 50%; background: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-center-num { font-size: 1.3rem; font-weight: 800; color: var(--purple-dark); line-height: 1; }
.donut-center-label { font-size: 0.62rem; color: var(--text-muted); margin-top: 2px; text-align: center; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 160px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--gray-text); }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }

/* MIGRÄNE-VERLAUF
   Die Reihe reicht so weit zurück, wie eingetragen ist, und wird geschoben.
   `flex: 1 0 48px` hält beides aus: Bei wenigen Monaten verteilen sie sich
   über die Karte wie vorher, bei vielen bleiben sie bei ihrer Breite stehen
   und laufen aus dem Bild heraus. */
.trend-scroll {
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px; padding: 0 4px 2px;
  scrollbar-width: thin;
}
.trend-row { display: flex; justify-content: space-between; gap: 6px; flex-wrap: nowrap; }
.trend-month { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1 0 48px; min-width: 44px; }
.trend-jahr {
  font-size: 0.62rem; color: var(--text-muted); font-weight: 700;
  letter-spacing: 0.4px; min-height: 0.9em; line-height: 1;
}
.trend-hinweis { font-size: 0.72rem; line-height: 1.5; color: var(--text-muted); margin-top: 10px; }
.trend-ring {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.trend-ring-hole {
  width: 32px; height: 32px; border-radius: 50%; background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: var(--purple-dark);
}
.trend-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

/* MÜK-WIDGET */
.moh-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; margin-bottom: 8px; }
.moh-track { height: 10px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
.moh-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.moh-fill.green  { background: #81c784; }
.moh-fill.yellow { background: #ffb74d; }
.moh-fill.red    { background: #e57373; }

/* SCHLAF/STRESS MINI-BARS */
.ampel-mini-block { margin-bottom: 16px; }
.ampel-mini-block:last-child { margin-bottom: 0; }
.ampel-mini-title { font-size: 0.82rem; font-weight: 600; color: var(--purple-dark); margin-bottom: 8px; }
.ampel-mini-track { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--gray-light); }
.ampel-mini-seg { height: 100%; }
.ampel-mini-legend-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.ampel-mini-legend { display: flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--gray-text); }
.ampel-mini-legend .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 420px) {
  .view { padding: 10px 10px 0; }
  .brand-title { font-size: 1.9rem; }
  .donut-row { justify-content: center; text-align: left; }
}

