:root {
  --rosa: #FFD1DC;
  --rosa-tief: #FF8FAB;
  --pfirsich: #FFE5D0;
  --lavendel: #E6DDFF;
  --mint: #D6F5E8;
  --butter: #FFF4C2;
  --bg: #FFF5F8;
  --bg2: #FFE4EC;
  --card: #FFFFFF;
  --text: #5A3E4B;
  --muted: #9B7F8C;
  --line: #F6D5DF;
  --shadow: 0 8px 24px rgba(214, 120, 150, 0.16), 0 2px 6px rgba(214, 120, 150, 0.10);
  --radius: 24px;
  --love: #FFD1DC;
  --everyday: #FFF4C2;
  --moods: #E6DDFF;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2A1B24;
    --bg2: #34212C;
    --card: #3D2733;
    --text: #FBE7EF;
    --muted: #C9A6B6;
    --line: #523443;
    --rosa-tief: #FF9DB8;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --love: #6B3A4E;
    --everyday: #6A5A33;
    --moods: #4E4170;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, var(--bg2) 0 18%, transparent 19%),
    radial-gradient(circle at 90% 35%, var(--bg2) 0 12%, transparent 13%),
    var(--bg);
  background-attachment: fixed;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}
h1, h2, h3, .title { font-family: 'Baloo 2', 'Nunito', sans-serif; margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }
img { -webkit-user-drag: none; }

/* Splash */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; transition: opacity .35s; }
.splash.weg { opacity: 0; pointer-events: none; }
.splash-heart { font-size: 64px; animation: pochen 1s ease-in-out infinite; }
@keyframes pochen { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }

/* Gate */
.screen.gate { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; gap: 10px; }
.gate h1 { font-size: 34px; }
.gate p { font-size: 18px; color: var(--muted); max-width: 300px; }

/* Figuren mit Emoji-Ersatz */
.fig-fallback { display: inline-grid; place-items: center; line-height: 1; }
.hero { margin: 0; display: grid; place-items: center; }
.hero img, .hero .fig-fallback { width: 220px; height: 220px; object-fit: contain; font-size: 120px; }
.hero.small img, .hero.small .fig-fallback { width: 160px; height: 160px; font-size: 84px; }

/* Layout */
#app { min-height: 100%; }
.view { padding: calc(16px + var(--safe-t)) 16px calc(110px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.top { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 14px; }
.title { font-size: 32px; font-weight: 800; letter-spacing: .2px; }
.title .amp { color: var(--rosa-tief); }
.view-title { font-size: 26px; margin: 4px 4px 14px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Zähler und Jahrestag */
.counter { margin-top: 8px; padding: 10px 20px; text-align: center; }
.counter .days { font-family: 'Baloo 2'; font-weight: 800; font-size: 22px; }
.counter .days b { color: var(--rosa-tief); }
.counter .next { font-size: 13px; color: var(--muted); font-weight: 700; }
.counter.feier { background: linear-gradient(135deg, var(--rosa), var(--lavendel)); padding: 14px 22px; }
.counter.feier img { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 4px; }
.counter.feier .fig-fallback { font-size: 56px; display: block; }
.counter.feier .days { font-size: 24px; color: #5A3E4B; }

/* Einrichtungskarte (Push / Installation) */
.setup { padding: 16px 18px; margin-bottom: 16px; display: flex; gap: 14px; align-items: center; border: 2px dashed var(--rosa-tief); }
.setup .big { font-size: 36px; }
.setup h3 { font-size: 18px; }
.setup p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.setup ol { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.setup .pill { margin-top: 10px; }

/* Letzte Nachricht */
.latest { padding: 14px 16px; margin-bottom: 18px; display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, var(--card), var(--bg2)); }
.latest .fig { width: 84px; height: 84px; flex: none; }
.latest .fig img { width: 100%; height: 100%; object-fit: contain; }
.latest .fig .fig-fallback { width: 100%; height: 100%; font-size: 52px; }
.latest .fig.photo img { object-fit: cover; border-radius: 18px; }
.latest .from { font-size: 13px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.latest .msg { font-family: 'Baloo 2'; font-size: 21px; font-weight: 700; line-height: 1.15; }
.latest .when { font-size: 13px; color: var(--muted); }
.latest .reacted { font-size: 22px; margin-left: auto; }

/* Knopfgruppen */
.group { margin-bottom: 18px; }
.group h2 { font-size: 20px; margin: 0 6px 8px; display: flex; align-items: center; gap: 8px; }
.group h2::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: var(--line); }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.buttons .boop { width: calc((100% - 20px) / 3); }
@media (min-width: 520px) { .buttons .boop { width: calc((100% - 40px) / 5); } }
.boop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 10px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.boop:active { transform: scale(.94); }
.boop .bubble { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; }
.boop .bubble img { width: 100%; height: 100%; object-fit: contain; }
.boop .bubble .fig-fallback { font-size: 32px; }
.boop .lbl { font-size: 12.5px; font-weight: 800; text-align: center; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center; }
.boop.wackeln { animation: wackeln .5s ease; }
@keyframes wackeln { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-10deg) scale(1.06); } 40% { transform: rotate(9deg) scale(1.06); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }

/* Kamera-Knopf */
.fab-space { height: 20px; }
.fab {
  position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #FF9DB8, #FFB98F); font-size: 28px; box-shadow: 0 10px 24px rgba(255, 120, 150, .45);
  z-index: 20; transition: transform .15s;
}
.fab:active { transform: scale(.9); }

/* Navigation */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; justify-content: space-around; padding: 8px 8px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 20px rgba(214, 120, 150, .12); border-radius: 22px 22px 0 0;
}
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 800; color: var(--muted); padding: 4px 0; border-radius: 14px; }
.tabs button span { font-size: 22px; transition: transform .15s; }
.tabs button.active { color: var(--rosa-tief); }
.tabs button.active span { transform: translateY(-2px) scale(1.12); }

/* Verlauf */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.item:has(.rx) { margin-bottom: 10px; }
.day { align-self: center; font-size: 12px; font-weight: 800; color: var(--muted); background: var(--card); padding: 4px 12px; border-radius: 999px; margin: 10px 0 2px; box-shadow: var(--shadow); }
.item { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.item.robert { align-self: flex-start; }
.item.nicole { align-self: flex-end; flex-direction: row-reverse; }
.item .fig { width: 54px; height: 54px; flex: none; }
.item .fig img { width: 100%; height: 100%; object-fit: contain; }
.item .fig .fig-fallback { width: 100%; height: 100%; font-size: 32px; }
.bub { position: relative; padding: 10px 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.item.robert .bub { border-bottom-left-radius: 6px; background: var(--mint); color: #3E4B45; }
.item.nicole .bub { border-bottom-right-radius: 6px; background: var(--rosa); color: #5A3E4B; }
@media (prefers-color-scheme: dark) { .item.robert .bub { background: #2F5446; color: #E3FFF3; } .item.nicole .bub { background: #6B3A4E; color: #FFE7F0; } }
.bub .t { font-family: 'Baloo 2'; font-weight: 700; font-size: 17px; line-height: 1.2; }
.bub .w { font-size: 11.5px; opacity: .7; font-weight: 700; margin-top: 2px; }
.bub img.ph { display: block; width: 190px; max-width: 58vw; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; margin-bottom: 4px; background: var(--bg2); }
.bub .rx { position: absolute; bottom: -12px; font-size: 18px; background: var(--card); border-radius: 999px; padding: 0 5px; box-shadow: var(--shadow); }
.item.robert .bub .rx { right: -8px; }
.item.nicole .bub .rx { left: -8px; }
.item.blink .bub { animation: blink 1.6s ease 2; }
@keyframes blink { 50% { box-shadow: 0 0 0 4px var(--rosa-tief); } }
.more { text-align: center; color: var(--muted); font-size: 14px; padding: 16px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty img, .empty .fig-fallback { width: 160px; height: 160px; object-fit: contain; font-size: 80px; }
.empty p { font-weight: 700; }

/* Galerie */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery button { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--bg2); position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .who { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.85); color: #5A3E4B; padding: 1px 7px; border-radius: 999px; }
.gallery .rx { position: absolute; right: 6px; bottom: 4px; font-size: 16px; }

/* Overlays */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(20, 8, 14, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 12px calc(16px + var(--safe-b)); }
.overlay.soft { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay > img { max-width: 100%; max-height: 72vh; border-radius: 20px; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.4); touch-action: pan-y; }
.overlay-bar { display: flex; gap: 12px; margin-top: 18px; }
.pill { padding: 12px 24px; border-radius: 999px; background: linear-gradient(135deg, #FF9DB8, #FFB98F); color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 8px 20px rgba(255, 120, 150, .35); }
.pill.ghost { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; }
.overlay.soft .pill.ghost, .setup .pill.ghost { background: var(--bg2); color: var(--text); }
.close { position: absolute; top: calc(14px + var(--safe-t)); right: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; font-size: 20px; }
.viewer-meta { color: #fff; font-weight: 700; margin-top: 12px; font-size: 14px; opacity: .85; text-align: center; }
.upload { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; background: rgba(20,8,14,.6); color: #fff; font-weight: 800; }
.upload-heart { font-size: 60px; animation: pochen 1s ease-in-out infinite; }

/* Reaktionen */
.react-bar { display: flex; gap: 6px; margin-top: 14px; background: rgba(255,255,255,.14); padding: 6px 10px; border-radius: 999px; }
.react-bar button, .react-pop button { font-size: 26px; padding: 4px 6px; border-radius: 50%; transition: transform .12s; }
.react-bar button:active, .react-pop button:active { transform: scale(1.3); }
.react-bar button.on, .react-pop button.on { background: rgba(255, 143, 171, .35); }
.react-pop { position: fixed; z-index: 45; display: flex; gap: 2px; padding: 6px 8px; border-radius: 999px; background: var(--card); box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: auf .18s ease; }
@keyframes auf { from { transform: scale(.6); opacity: 0; } }

/* Foto-Quelle */
.sheet { position: fixed; inset: 0; z-index: 35; background: rgba(40, 15, 28, .35); display: flex; align-items: flex-end; }
.sheet-card { width: 100%; background: var(--card); border-radius: 26px 26px 0 0; padding: 14px 14px calc(14px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; animation: hoch .2s ease; }
@keyframes hoch { from { transform: translateY(100%); } }
.sheet-card button { padding: 15px; border-radius: 18px; background: var(--bg2); font-weight: 800; font-size: 17px; }
.sheet-card button.ghost { background: none; color: var(--muted); }

/* Willkommen */
.welcome-card { background: var(--card); border-radius: 30px; box-shadow: var(--shadow); padding: 24px 22px; text-align: center; max-width: 340px; }
.welcome-card img, .welcome-card .fig-fallback { width: 200px; height: 200px; object-fit: contain; font-size: 100px; }
.welcome-card h2 { font-size: 28px; margin-top: 6px; }
.welcome-card p { color: var(--muted); font-weight: 700; margin: 6px 0 18px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); font-weight: 800; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); animation: auf .2s ease; white-space: nowrap; }

/* Herzen und Konfetti */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.fx span { position: absolute; font-size: 26px; animation: flieg 1.4s ease-out forwards; }
@keyframes flieg { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), -220px) scale(1.2) rotate(var(--rot)); opacity: 0; } }
.fx i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Reaktionen auffindbar machen */
.bub, .latest { cursor: pointer; -webkit-touch-callout: none; }
.rx-add {
  position: absolute; bottom: -12px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); color: var(--rosa-tief); font-size: 16px; font-weight: 800; line-height: 1;
  box-shadow: var(--shadow); display: grid; place-items: center;
}
.item.robert .rx-add { right: -10px; }
.item.nicole .rx-add { left: -10px; }
.item:has(.rx-add) { margin-bottom: 10px; }
.latest .reacted.hint { color: var(--rosa-tief); font-weight: 800; opacity: .8; }
