/* =========================================================================
   Vermissungs-Index – Basis-Stylesheet
   Abschnitt 1: Design-Tokens, Grundgerüst, Hintergrund, Toast  (beide Seiten)
   Abschnitt 2: Herz-Seite (index.html)
   dashboard.html lädt zusätzlich dashboard.css.
   Nur System-Schriften, keine externen Ressourcen.
   ========================================================================= */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Farben: weiche Rosé-/Pfirsich-Welt */
  --bg-a: #ffe6ee;
  --bg-b: #ffd9e4;
  --bg-c: #ffe5d4;
  --ink: #5c2436;          /* warmes Dunkelrot statt hartem Schwarz */
  --ink-soft: #96606f;
  --accent: #e8467c;
  --accent-deep: #c3235f;
  --accent-light: #ff9ec0;

  --card-bg: rgba(255, 255, 255, 0.60);
  --card-brd: rgba(255, 255, 255, 0.85);
  --shadow-soft: 0 12px 34px rgba(186, 60, 104, 0.16);
  --shadow-lift: 0 18px 44px rgba(186, 60, 104, 0.22);

  --radius: 24px;
  --radius-sm: 14px;

  /* runde, freundliche Systemschrift */
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system,
          "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: hidden;            /* nie horizontal scrollen */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg-b);
  background-image:
    radial-gradient(115% 85% at 8% 0%,   #fff4f8 0%, rgba(255,244,248,0) 58%),
    radial-gradient(95% 75% at 95% 8%,   #ffe9d5 0%, rgba(255,233,213,0) 55%),
    radial-gradient(120% 70% at 50% 105%,#fff0f4 0%, rgba(255,240,244,0) 60%),
    linear-gradient(168deg, var(--bg-a) 0%, var(--bg-b) 48%, var(--bg-c) 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 2. Hintergrund-Herzchen -------------------------------------- */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.ambient__heart {
  position: absolute;
  left: var(--x);
  bottom: -14vh;
  width: var(--size);
  height: var(--size);
  fill: #fff;
  opacity: 0.34;
  animation: drift var(--dur, 30s) linear var(--delay, 0s) infinite;
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) rotate(-8deg) scale(0.9); opacity: 0; }
  12%  { opacity: 0.38; }
  50%  { transform: translate3d(22px, -60vh, 0) rotate(9deg) scale(1.05); }
  88%  { opacity: 0.24; }
  100% { transform: translate3d(-14px, -125vh, 0) rotate(-6deg) scale(0.95); opacity: 0; }
}

/* ---------- 3. Seitengerüst ---------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3.2vw, 26px);
  padding:
    calc(env(safe-area-inset-top) + clamp(18px, 5vw, 40px))
    calc(env(safe-area-inset-right) + 18px)
    calc(env(safe-area-inset-bottom) + 18px)
    calc(env(safe-area-inset-left) + 18px);
}

.head { text-align: center; }
.head__title {
  margin: 0;
  font-size: clamp(1.45rem, 6.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--accent-deep);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.head__sub {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------- 4. Großer Wert ------------------------------------------------ */
.index {
  width: 100%;
  /* margin-top:auto + .foot{margin-top:auto} verteilen den freien Platz
     gleichmäßig über und unter dem Herz-Block (nur wenn Platz übrig ist). */
  margin-top: auto;
  text-align: center;
  padding: clamp(16px, 4.5vw, 26px) 18px clamp(14px, 3.5vw, 20px);
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.index__value {
  font-size: clamp(3.6rem, 21vw, 6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.55);
  transition: transform 160ms cubic-bezier(.34, 1.56, .64, 1);
}
.index__value.is-bouncing { transform: scale(1.12); }
.index__label {
  margin: 10px 0 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}
.index__decay {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
/* Zustand „Backend schläft“ */
.index.is-offline .index__value { color: var(--ink-soft); opacity: 0.55; }

/* ---------- 5. Die drei Herzen ------------------------------------------- */
.hearts {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: clamp(4px, 1.5vw, 14px);
  margin-top: clamp(2px, 1.5vw, 10px);
}

.heart {
  /* Buttons: keine Browser-Optik, dafür große Tap-Fläche */
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 2px 10px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--accent-deep);
  border-radius: var(--radius-sm);
  transition: transform 140ms ease, opacity 140ms ease;
  touch-action: manipulation;
}
.heart__art {
  position: relative;
  display: block;
  width: var(--size);
  height: var(--size);
  filter: drop-shadow(0 8px 14px rgba(200, 50, 100, 0.28));
  animation: bob var(--bob, 4.4s) ease-in-out var(--bob-delay, 0s) infinite;
}
.heart__art svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--fill, #f2578e);
}
.heart__points {
  position: absolute;
  inset: 0 0 12% 0;                 /* optisch mittig in der Herzform */
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: var(--pt, 1rem);
  letter-spacing: -0.02em;
  text-shadow: 0 1px 3px rgba(150, 20, 60, 0.45);
  pointer-events: none;
}
.heart__name {
  font-size: clamp(0.68rem, 2.9vw, 0.84rem);
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.2;
  text-align: center;
}

/* Größen + leicht unterschiedliche Rosatöne + versetzte Animation */
.heart--s { --size: clamp(50px, 14.5vw, 68px);  --pt: 0.92rem; --fill: #ffa1c0; --bob: 3.8s; --bob-delay: -0.2s; }
.heart--m { --size: clamp(70px, 20vw, 94px);    --pt: 1.24rem; --fill: #f76a9d; --bob: 4.6s; --bob-delay: -1.5s; }
.heart--l { --size: clamp(92px, 26.5vw, 124px); --pt: 1.6rem;  --fill: #e23a73; --bob: 5.4s; --bob-delay: -2.9s; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg) scale(1); }
  50%      { transform: translateY(-7px) rotate(1.5deg) scale(1.035); }
}

.heart:hover .heart__art { filter: drop-shadow(0 10px 18px rgba(200, 50, 100, 0.36)) brightness(1.04); }
.heart:active { transform: scale(0.93); }
.heart[disabled] { opacity: 0.55; cursor: progress; }

/* ---------- 6. Partikel beim Tippen -------------------------------------- */
.fx {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 40;
}
.particle {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--p-size, 18px);
  height: var(--p-size, 18px);
  margin: calc(var(--p-size, 18px) / -2) 0 0 calc(var(--p-size, 18px) / -2);
  transform: translate3d(var(--x), var(--y), 0);
  fill: var(--p-fill, #ff6fa3);
  will-change: transform, opacity;
  animation: pop var(--p-dur, 900ms) cubic-bezier(.18, .7, .3, 1) forwards;
}
@keyframes pop {
  0%   { transform: translate3d(var(--x), var(--y), 0) scale(0.3) rotate(0deg); opacity: 0; }
  18%  { opacity: 1; }
  100% {
    transform: translate3d(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy)), 0)
               scale(var(--p-scale, 1)) rotate(var(--p-rot, 40deg));
    opacity: 0;
  }
}

/* ---------- 7. Toast ------------------------------------------------------ */
.toast {
  /* links UND rechts verankert + margin-inline:auto => wirklich zentriert.
     (Nur left:50% würde die Box auf die halbe Viewport-Breite einschnüren
     und den Text unnötig umbrechen.) */
  position: fixed;
  left: 12px;
  right: 12px;
  margin-inline: auto;
  width: fit-content;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 50;
  max-width: min(92vw, 460px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-lift);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 220ms ease, transform 260ms cubic-bezier(.34, 1.4, .64, 1);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-error { background: rgba(255, 243, 234, 0.95); color: #9a3a1f; }

/* ---------- 8. Fuß / Links ------------------------------------------------ */
.foot {
  margin-top: auto;
  padding-top: 14px;
  text-align: center;
}
.link {
  display: inline-block;
  padding: 10px 16px;
  min-height: 44px;
  line-height: 24px;
  border-radius: 999px;
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  transition: background 160ms ease, transform 160ms ease;
}
.link:hover { background: rgba(255, 255, 255, 0.8); transform: translateY(-1px); }

/* ---------- 9. Fokus / Barrierefreiheit ---------------------------------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------- 10. Weniger Bewegung ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ambient__heart { animation: none; opacity: 0.22; transform: translateY(-40vh); }
  .heart__art { animation: none; }
  .particle { animation-duration: 400ms; }
  .index__value { transition: none; }
  .heart, .link { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* ---------- 11. Etwas Luft auf großen Schirmen ---------------------------- */
@media (min-width: 700px) and (min-height: 620px) {
  .page { gap: 30px; justify-content: center; }
  .foot { margin-top: 26px; }
}
