@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

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

:root {
  --pink-1: #ff5e8a;
  --pink-2: #ff9ac4;
  --pink-3: #ffd1e3;
  --bg-1: #fff5f8;
  --bg-2: #ffe4ee;
  --text-dark: #4a2b3a;
  --text-light: #8a6577;
  --card-bg: rgba(255, 255, 255, 0.75);
  --shadow: 0 10px 30px rgba(255, 94, 138, 0.15);
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  bottom: -10%;
  font-size: 1.4rem;
  opacity: 0.5;
  animation: floatUp linear infinite;
  color: var(--pink-2);
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-110vh) rotate(25deg); opacity: 0; }
}

main {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

.server-warning {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  background: #ff5e5e;
  color: white;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.server-warning.show { display: block; }

.icon-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  background: var(--card-bg);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  transition: transform 0.2s;
}
.icon-btn:hover { transform: rotate(30deg) scale(1.05); }

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  color: var(--pink-1);
  font-weight: 600;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  margin: 0.4rem 0 0.6rem;
  color: var(--text-dark);
}

#herName { color: var(--pink-1); }

.dayCounter {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.dailyQuote {
  font-style: italic;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--card-bg);
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  max-width: 90%;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.heart-gauge-wrap {
  position: relative;
  width: 180px;
  margin: 0 auto 1.5rem;
}

.heart-gauge { width: 100%; display: block; }

.heart-outline {
  fill: none;
  stroke: var(--pink-1);
  stroke-width: 2;
  opacity: 0.5;
}

#heartFill {
  transition: y 0.6s ease, height 0.6s ease;
}

.heart-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -30%);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  text-shadow: 0 1px 4px rgba(255,255,255,0.8);
}

.mood-presets {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.mood-presets button {
  background: white;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 0.5rem 0.7rem;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: all 0.15s;
}

.mood-presets button span {
  font-size: 0.7rem;
  color: var(--text-light);
  font-family: 'Poppins', sans-serif;
}

.mood-presets button:hover { transform: translateY(-3px); }
.mood-presets button.active {
  border-color: var(--pink-1);
  box-shadow: 0 4px 12px rgba(255, 94, 138, 0.3);
}

input[type="range"] {
  width: 100%;
  max-width: 360px;
  margin: 0.5rem auto 1.5rem;
  display: block;
  accent-color: var(--pink-1);
  height: 6px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--pink-1), var(--pink-2));
  color: white;
  border: none;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 94, 138, 0.35);
  transition: transform 0.15s;
}
.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:active { transform: translateY(0); }

.saved-msg {
  min-height: 1.4rem;
  color: var(--pink-1);
  font-weight: 600;
  margin-top: 0.8rem;
  font-size: 0.9rem;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.stat {
  background: white;
  border-radius: 16px;
  padding: 0.8rem 1.2rem;
  min-width: 100px;
}

.stat .num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pink-1);
  display: block;
}

.stat .label {
  font-size: 0.75rem;
  color: var(--text-light);
}

.history { margin-top: 1.5rem; text-align: left; }
.history h3 {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 0.8rem;
  text-align: center;
  font-weight: 500;
}

.history-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 110px;
  padding: 0 0.5rem;
  border-bottom: 2px solid var(--pink-3);
}

.history-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}

.history-bar .bar-fill {
  width: 100%;
  max-width: 22px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--pink-2), var(--pink-1));
  min-height: 3px;
  transition: height 0.4s;
}

.history-bar.empty .bar-fill { background: #eee; }

.history-bar .bar-label {
  font-size: 0.6rem;
  color: var(--text-light);
  white-space: nowrap;
}

.upload-zone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--pink-2);
  border-radius: 16px;
  padding: 1.2rem 2rem;
  cursor: pointer;
  color: var(--pink-1);
  font-weight: 600;
  margin-bottom: 1.5rem;
  transition: background 0.2s;
}
.upload-zone:hover { background: rgba(255, 94, 138, 0.08); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.gallery img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gallery img:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 16px rgba(255, 94, 138, 0.3);
}

.upload-msg {
  min-height: 1.2rem;
  font-size: 0.85rem;
  color: var(--pink-1);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.empty-msg {
  color: var(--text-light);
  font-size: 0.9rem;
  display: none;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 5, 12, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.open { display: flex; }

.lightbox img {
  max-width: 88vw;
  max-height: 70vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-nav.prev { left: 1rem; }
.lightbox-nav.next { right: 1rem; }
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }

.lightbox-footer {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
  width: min(88vw, 400px);
}

.lightbox-footer input {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: none;
  font-family: 'Poppins', sans-serif;
}

.lightbox-footer button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.1rem;
}
.lightbox-footer button:hover { background: #ff5e8a; }

.settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 5, 12, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.settings-modal.open { display: flex; }

.settings-box {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  width: min(90vw, 360px);
  text-align: left;
}

.settings-box h2 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 1.2rem;
  text-align: center;
}

.settings-box label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0.8rem 0 0.3rem;
}

.settings-box input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #eee;
  background: var(--bg-1);
  font-family: 'Poppins', sans-serif;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.settings-actions button {
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}

#settingsCancel {
  background: #f0f0f0;
  color: var(--text-dark);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-1: #201017;
    --bg-2: #2b1620;
    --text-dark: #ffe4ee;
    --text-light: #cfa3b6;
    --card-bg: rgba(40, 20, 28, 0.75);
    --shadow: 0 10px 30px rgba(0,0,0,0.4);
  }
  .mood-presets button, .stat, .gallery img { background: #33202a; }
  .history-bar.empty .bar-fill { background: #4a3540; }
  .settings-box { background: #2b1620; }
  .settings-box input { background: #201017; border-color: #4a3540; color: var(--text-dark); }
  #settingsCancel { background: #4a3540; color: var(--text-dark); }
}
