/* ---------- theme variables ---------- */
:root {
  --bg-from: #ffd1dc;
  --bg-to:   #ff8fa3;
  --text:    #5a1a2b;
  --muted:   rgba(90, 26, 43, 0.6);
  --accent:  #c2185b;
  --card-bg: rgba(255, 255, 255, 0.35);
  --card-bd: rgba(255, 255, 255, 0.5);
}
body[data-theme="pink"]     { --bg-from:#ffd1dc; --bg-to:#ff8fa3; --text:#5a1a2b; --muted:rgba(90,26,43,.6); --accent:#c2185b; --card-bg:rgba(255,255,255,.35); --card-bd:rgba(255,255,255,.5); }
body[data-theme="sunset"]   { --bg-from:#ffb88c; --bg-to:#ff6a88; --text:#4a1717; --muted:rgba(74,23,23,.6); --accent:#d84315; --card-bg:rgba(255,247,240,.35); --card-bd:rgba(255,247,240,.5); }
body[data-theme="mint"]     { --bg-from:#d4fff2; --bg-to:#8de5b8; --text:#1a4a35; --muted:rgba(26,74,53,.6);  --accent:#2e7d32; --card-bg:rgba(255,255,255,.4);  --card-bd:rgba(255,255,255,.55); }
body[data-theme="midnight"] { --bg-from:#1a1033; --bg-to:#0d0820; --text:#fff0f5; --muted:rgba(255,240,245,.55); --accent:#ff80ab; --card-bg:rgba(255,255,255,.06); --card-bd:rgba(255,255,255,.12); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  transition: background 0.6s ease, color 0.6s ease;
}

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

h1, h2 { letter-spacing: -0.02em; }

.muted { color: var(--muted); font-size: 0.95rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- background particles ---------- */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-particles span {
  position: absolute;
  bottom: -2rem;
  font-size: 1.5rem;
  opacity: 0.45;
  animation: rise linear infinite;
  color: var(--accent);
}
body[data-theme="midnight"] .bg-particles span { color: var(--accent); }
@keyframes rise {
  0%   { transform: translateY(0) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

/* ---------- top nav ---------- */
.anchors {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  padding: 1.25rem 0 0;
  font-size: 0.9rem;
}
.anchors a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 2px 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.anchors a:hover, .anchors a:focus-visible {
  color: var(--text);
  border-bottom-color: var(--accent);
  outline: none;
}

/* ---------- settings button ---------- */
.settings-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-bd);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.25s ease, background 0.2s ease;
}
.settings-btn:hover { transform: rotate(35deg); }
.settings-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- hero ---------- */
.hero {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.card {
  padding: 3rem 2rem;
  user-select: none;
  animation: pop 0.9s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes pop {
  0%   { transform: scale(0.6) translateY(20px); opacity: 0; }
  100% { transform: scale(1)   translateY(0);     opacity: 1; }
}
.card h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin: 0 0 1rem;
  font-weight: 700;
}
.heart {
  display: inline-block;
  animation: beat 1.2s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.15s ease;
  color: var(--accent);
}
.heart:hover, .heart:focus-visible { transform: scale(1.25); outline: none; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}
.subtitle {
  font-size: 1.15rem;
  opacity: 0.85;
  margin: 0 0 0.4rem;
  min-height: 1.5em;
  transition: opacity 0.5s ease;
}
.signoff { font-size: 1rem; opacity: 0.6; margin: 0; font-style: italic; }
.tap-hint { margin-top: 1.5rem; font-size: 0.85rem; opacity: 0.5; letter-spacing: 0.05em; }

/* ---------- panel sections ---------- */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
  margin: 1.25rem 0;
  backdrop-filter: blur(10px);
}
.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.4rem;
}

/* ---------- counter section ---------- */
.counter-display {
  font-size: 1.6rem;
  margin: 0;
  font-weight: 600;
}
.counter-display .counter-empty {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}

/* ---------- notes section ---------- */
.note-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}
.note-form textarea {
  flex: 1 1 240px;
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--card-bd);
  background: var(--card-bg);
  color: var(--text);
}
.note-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.note-form button {
  padding: 0.6rem 1.1rem;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
}
.note-form button:hover { filter: brightness(1.05); }
.note-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.note-list li {
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--card-bd);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.95rem;
}
body[data-theme="midnight"] .note-list li { background: rgba(255,255,255,0.06); }
.note-list .ts { color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
.note-list .del {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1;
}
.note-list .del:hover { color: var(--accent); }

/* ---------- about ---------- */
.about p { margin: 0.25rem 0; }

/* ---------- click-spawn particles ---------- */
.spawn {
  position: fixed;
  pointer-events: none;
  font-size: 1.6rem;
  animation: float 1.4s ease-out forwards;
  z-index: 4;
  color: var(--accent);
}
@keyframes float {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(-50%, -180%) scale(1.6); opacity: 0; }
}

/* ---------- drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drawer-backdrop.open { opacity: 1; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 100vw);
  background: linear-gradient(160deg, var(--bg-from) 0%, var(--bg-to) 130%);
  color: var(--text);
  z-index: 10;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(.2,.9,.3,1);
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--card-bd);
}
.drawer-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.drawer-close {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.drawer-body {
  padding: 1rem 1.25rem 2rem;
  overflow-y: auto;
}
.control {
  border: 0;
  padding: 0;
  margin: 0 0 1.25rem;
}
.control legend {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  padding: 0;
}
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.radio-row label, .check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  cursor: pointer;
  user-select: none;
}
.check {
  display: flex;
  margin: 0.35rem 0;
  border-radius: 12px;
}
.radio-row input, .check input { accent-color: var(--accent); }
.control input[type="date"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--card-bd);
  background: var(--card-bg);
  color: var(--text);
}
.link-btn {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
}
.reset-btn {
  margin-top: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--card-bd);
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.reset-btn:hover { color: var(--accent); }

/* ---------- reduced motion ---------- */
body.reduce-motion .heart,
body.reduce-motion .card,
body.reduce-motion .bg-particles span,
body.reduce-motion .spawn {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .heart, .card, .bg-particles span, .spawn { animation: none; }
  html { scroll-behavior: auto; }
}
