/* Base */
:root {
  --bg: #fff0f6;
  --ink: #39182d;
  --sub: #7a355c;
  --rose: #ff4d88;
  --rose-2: #ff85aa;
  --lav: #f2b6ff;
  --soft: #ffe0ec;
  --card: #ffffff;
  --shadow: 0 12px 34px rgba(255, 77, 136, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 80% -10%, #ffd2e4, transparent),
    radial-gradient(1000px 800px at -10% 20%, #ffe8f4, transparent),
    linear-gradient(180deg, #fff5fa, var(--bg));
  overflow-x: hidden;
}

/* Background canvas */
#bgCanvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.site-header, main, .hearts { position: relative; z-index: 1; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,245,250,.85));
  backdrop-filter: blur(8px);
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  box-shadow: 0 6px 24px rgba(255, 77, 136, 0.18);
}
.site-header::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -2px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(255,133,170,.35), rgba(255,77,136,.5), rgba(255,133,170,.35)); filter: blur(.6px); }
.logo { font-family: 'Playfair Display', serif; font-size: 20px; letter-spacing: .4px; }
.logo span { color: var(--rose); }
.nav { display: flex; gap: 8px; overflow:auto; scrollbar-width:none; }
.nav::-webkit-scrollbar{display:none}
.nav__btn {
  border: 1px solid #ffd3e2;
  background: linear-gradient(180deg, #ffffff, #ffeaf3);
  color: var(--sub);
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(57,24,45,.06);
  cursor: pointer;
}
.nav__btn:focus-visible { outline: 2px solid var(--rose-2); outline-offset: 2px; }
.nav__btn:hover { background: var(--soft); color: var(--ink); box-shadow: 0 6px 16px rgba(255, 77, 136, .25); }

/* Sections */
.section { padding: 32px 16px; min-height: calc(100dvh - 64px); display: none; }
.section--active { display: block; }
.section__head { display:flex; align-items:center; justify-content: space-between; gap: 8px; max-width: 960px; margin: 0 auto 16px; }
.section__head h2 { font-family: 'Playfair Display', serif; margin: 0; }
.controls { display: flex; align-items:center; gap: 12px; flex-wrap: wrap; }
.stat { color: var(--sub); background:#fff; padding:8px 10px; border-radius: 10px; box-shadow: var(--shadow); }

/* Buttons */
.btn {
  border: 1px solid #ffd3e2;
  background: linear-gradient(180deg, #ffffff, #fff3f8);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 600;
  transition: background .2s ease, box-shadow .2s ease, transform .08s ease;
}
.btn--primary { background: linear-gradient(135deg, var(--rose), var(--rose-2)); color: #fff; box-shadow: 0 10px 24px rgba(255,77,136,.3); }
.btn:hover { background: #fff; box-shadow: 0 12px 28px rgba(57,24,45,.10); transform: translateY(-1px); }
.btn--primary:hover { box-shadow: 0 14px 28px rgba(255,77,136,.35); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

/* Hero */
.hero { max-width: 960px; margin: 0 auto; padding: 24px; text-align: center; position: relative; z-index: 1; }
.hero__title { font-family: 'Playfair Display', serif; font-size: clamp(26px, 6vw, 60px); margin: 8px 0; }
.hero__subtitle { color: var(--sub); margin: 0 0 18px; }
.hero__actions { display:flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.farm-strip { display:flex; gap: 6px; justify-content:center; margin-top: 14px; }

/* Animated flowers field */
.flowers { position: fixed; left: 0; right: 0; top: auto; bottom: 0; height: 100svh; overflow: hidden; pointer-events: none; }
.section#home { position: relative; }
.flower {
  position: absolute;
  width: var(--s, 24px);
  height: var(--s, 24px);
  filter: drop-shadow(0 6px 10px rgba(255, 77, 136, .28));
  transform-origin: center;
  animation: float var(--d, 14s) linear infinite;
}
@keyframes float {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110svh) rotate(360deg); opacity: .9; }
}

/* Memory grid */
.memory-grid {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.card {
  aspect-ratio: 1/1;
  position: relative;
  perspective: 800px;
}
.card__inner {
  width: 100%; height: 100%; position: absolute; inset: 0; border-radius: 16px; transform-style: preserve-3d; transition: transform .45s ease;
}
.card.is-flipped .card__inner { transform: rotateY(180deg); }
.card__face {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; border-radius: 16px; backface-visibility: hidden; box-shadow: var(--shadow);
}
.card__face--front { background: linear-gradient(180deg, #fff, #ffeaf1); }
.card__face--back { background: #fff; transform: rotateY(180deg); }
.card.matched { outline: 3px solid var(--rose); box-shadow: 0 0 0 4px rgba(255,77,136,.12) inset; }

/* Petal canvas */
#petalCanvas { display: block; margin: 0 auto; max-width: 100%; height: auto; background: linear-gradient(180deg, #fff, #fff7fb); border-radius: 16px; box-shadow: var(--shadow); touch-action: none; }
.hint { text-align:center; color: var(--sub); }

/* Modal */
.modal { border: none; border-radius: 16px; padding: 0; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(64,34,58,.25); backdrop-filter: blur(2px); }
.modal__content { padding: 24px; background: #fff; border-radius: 16px; min-width: 280px; text-align: center; }
.modal__emoji { font-size: 40px; margin-bottom: 8px; }

/* Floating hearts */
.hearts { position: fixed; left: 0; right: 0; bottom: 0; pointer-events: none; display: grid; place-items: center; }
.heart { position: absolute; font-size: var(--s, 14px); animation: pop 6s linear infinite; opacity: .8; }
@keyframes pop {
  0% { transform: translateY(0) scale(.9); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-90svh) scale(1.3); opacity: 0; }
}

/* Pixel Art */
.pixel { image-rendering: pixelated; width: 64px; height: 64px; }
.pixel--lg { width: 96px; height: 96px; }
.stickers { position: absolute; inset: 0; pointer-events: none; }
.sticker { position: absolute; transform: translate(-50%, -50%); opacity: .9; filter: drop-shadow(0 4px 8px rgba(57,24,45,.2)); }
.sticker:nth-child(1) { left: 12%; top: 24%; }
.sticker:nth-child(2) { right: 10%; top: 36%; }
.sticker:nth-child(3) { left: 18%; bottom: 18%; }
.sticker:nth-child(4) { right: 16%; bottom: 22%; }

.pixel-gallery { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.pixel-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px; text-align: center; display:flex; flex-direction:column; align-items:center; }
.pixel-gallery .pixel { width: 100%; height: auto; max-width: 160px; }
.pixel-card figcaption { margin-top: 8px; color: var(--sub); font-size: 14px; }

/* Responsive */
@media (max-width: 600px) {
  .memory-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .hero { padding: 18px 12px; }
  .section__head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stickers { display:none; }
  .site-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .logo { text-align: center; font-size: 18px; }
  .nav { width: 100%; gap: 10px; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .nav__btn { flex: 0 0 auto; scroll-snap-align: start; padding: 10px 16px; }
  .hero__actions { gap: 12px; }
  .section { min-height: auto; padding: 24px 12px; }
  .controls { gap: 10px; }
  .pixel-gallery { gap: 12px; }
  .pixel-card { padding: 12px; }
  .pixel-card figcaption { word-break: break-word; }
}

@media (max-width: 420px) {
  .memory-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* small effect for wrong password */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.shake { animation: shake .35s ease; }

/* New content sections */
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 760px; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.timeline__dot { width: 40px; height: 40px; display: grid; place-items: center; background: #fff; border-radius: 10px; box-shadow: var(--shadow); }
.timeline__card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; }

.cards { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cardx { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; text-align: center; }
.cardx h4 { margin: 8px 0 6px; font-family: 'Playfair Display', serif; }
.cardx p { margin: 0; color: var(--sub); }
/* heartbeat animation for reasons (gentle scale) */
.reasons .cardx { animation: heartbeat 2.6s ease-in-out infinite; transform-origin: center; }
@keyframes heartbeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.04); }
  30% { transform: scale(0.985); }
  45% { transform: scale(1.05); }
  60% { transform: scale(1.0); }
  100% { transform: scale(1); }
}

.playlist { max-width: 760px; margin: 0 auto; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; }
.playlist li { margin: 8px 0; }
.playlist a { color: var(--rose); text-decoration: none; }
.playlist a:hover { text-decoration: underline; }

.checklist { max-width: 520px; margin: 0 auto; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; }
.checklist li { margin: 8px 0; }

/* Daily message card */
.daily-wrap { display: grid; place-items: center; min-height: 60vh; }
.daily-card { max-width: 720px; margin: 0 auto; background: linear-gradient(180deg, #fff, #fff6fa); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; text-align: center; border: 2px solid #ffd3e2; }
.daily-card h4 { margin: 6px 0 8px; font-family: 'Playfair Display', serif; }
.daily-card .daily-text { font-size: clamp(18px, 3.8vw, 28px); line-height: 1.35; margin: 0; }
.daily-card .daily-emoji { font-size: 28px; margin-bottom: 6px; }

/* Harvest grid */
.harvest-grid { max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.plot { aspect-ratio: 1/1; background: #ffe3ec; border-radius: 8px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.plot .sprout, .plot .crop { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; }
.plot .sprout { opacity: .8; }

/* Fishing */
.fishing { max-width: 420px; margin: 0 auto; }
.bar { position: relative; height: 46px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.zone { position: absolute; top: 6px; bottom: 6px; width: 70px; background: rgba(255, 205, 0, .25); border: 2px solid #ffcd00; border-radius: 10px; }
.marker { position: absolute; top: 0; bottom: 0; width: 4px; background: var(--rose); box-shadow: 0 0 0 2px rgba(255,77,136,.2); }

/* Gate */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(800px 600px at 30% -10%, rgba(255,133,170,.25), transparent), rgba(255,240,246,.9); backdrop-filter: blur(6px); z-index: 50; }
.gate__card { width: min(520px, 92vw); background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 20px; text-align: center; }
.gate__input { width: 100%; padding: 12px 14px; border: 2px solid #ffd0e0; border-radius: 12px; margin: 8px 0 12px; font-size: 16px; }

/* Alternating sections for variety */
.section:nth-of-type(odd) { background: linear-gradient(180deg, rgba(255,245,250,.55), rgba(255,240,246,.2)); }
.section:nth-of-type(even) { background: linear-gradient(180deg, rgba(255,232,244,.45), rgba(255,245,250,.2)); }

/* Stardew-like accents */
.tile { image-rendering: pixelated; width: 32px; height: 32px; }
.field { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: 6px; padding: 8px 0; pointer-events: none; }

/* Welcome overlay */
.welcome { position: fixed; inset: 0; display: none; place-items: center; background: rgba(255,240,246,.92); backdrop-filter: blur(6px); z-index: 40; opacity: 0; transition: opacity .8s ease; }
.welcome.show { display: grid; opacity: 1; }
.welcome.hide { opacity: 0; pointer-events: none; }
.welcome__card { width: min(520px, 90vw); background: #fff; padding: 24px; border-radius: 16px; text-align: center; box-shadow: var(--shadow); }

/* Content reveal */
.reveal { animation: reveal .8s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.magic:hover { box-shadow: 0 12px 28px rgba(255,77,136,.28); transform: translateY(-2px); }
/* Magic glow for common cards */
.cardx:hover, .pixel-card:hover, .photo:hover { box-shadow: 0 14px 30px rgba(255,77,136,.26); transform: translateY(-2px); }

/* Map */
.map-grid { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; background: #ffe9f2; padding: 8px; border-radius: 12px; box-shadow: var(--shadow); }
.cell { aspect-ratio: 1/1; background: #fff; border: 1px solid #ffd3e2; position: relative; }
.pin { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; }

/* Album */
.album-grid { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.photo { background: linear-gradient(180deg, #fff, #fff6fa); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); border: 2px solid #ffd3e2; }
.photo img { width: 100%; display: block; image-rendering: pixelated; aspect-ratio: 1/1; object-fit: cover; }

/* Quests */
.quests { max-width: 720px; margin: 0 auto; background: linear-gradient(180deg, #fff, #fff6fa); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; list-style: none; display: grid; gap: 10px; border: 2px solid #ffd3e2; }
.quests li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; background: #ffffff; border: 1px solid #ffe0ec; border-radius: 12px; padding: 10px 12px; box-shadow: 0 4px 16px rgba(255,77,136,.08); }
.quests li span:first-child { font-weight: 600; }
.badge { width: 36px; height: 36px; display: grid; place-items: center; background: #fff0f6; border: 1px solid #ffd3e2; border-radius: 10px; opacity: .45; filter: grayscale(1); transition: .25s ease; box-shadow: 0 4px 10px rgba(255,77,136,.12); }
.badge.active { opacity: 1; filter: none; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(255,77,136,.25); animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,136,.28);} 70% { box-shadow: 0 0 0 10px rgba(255,77,136,0);} 100% { box-shadow: 0 0 0 0 rgba(255,77,136,0);} }

/* Guestbook */
.guest-form { max-width: 720px; margin: 0 auto 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.guest-input { border: 2px solid #ffd0e0; border-radius: 10px; padding: 10px 12px; }
.guest-list { max-width: 720px; margin: 0 auto; list-style: none; padding: 0; display: grid; gap: 8px; }
.guest-list li { background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }

@media (max-width: 600px) {
  .guest-form { grid-template-columns: 1fr; }
  .hero__title { font-size: clamp(24px, 7vw, 42px); }
  .farm-strip { gap: 4px; }
  .pixel { width: 56px; height: 56px; }
  .pixel--lg { width: 84px; height: 84px; }
  .playlist, .quests, .checklist, .pixel-gallery, .album-grid, .cards { width: 100%; }
  .album-grid, .pixel-gallery { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .cards { gap: 12px; }
  .timeline li { grid-template-columns: 32px 1fr; }
  .fishing { max-width: 100%; padding: 0 6px; }
  .bar { height: 42px; }
  .zone { width: 64px; }
}


/* Pixel Pet */
.pet { position: fixed; right: 12px; bottom: 12px; z-index: 30; display: grid; gap: 6px; justify-items: center; }
.pet__canvas { image-rendering: pixelated; width: 96px; height: 96px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); border: 2px solid #ffd3e2; }
.pet__bubble { background:#fff; border:1px solid #ffd3e2; padding:6px 10px; border-radius: 10px; box-shadow: var(--shadow); color: var(--ink); font-size: 14px; max-width: 220px; }
.pet__actions { display: flex; gap: 6px; }


/* Simon */
.simon-grid { max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.simon-pad { aspect-ratio: 1/1; border-radius: 14px; border: 2px solid #ffd3e2; box-shadow: var(--shadow); cursor: pointer; }
.pad-0 { background: radial-gradient(circle at 30% 30%, #9cff9c, #2ecc71); }
.pad-1 { background: radial-gradient(circle at 30% 30%, #ff9c9c, #e74c3c); }
.pad-2 { background: radial-gradient(circle at 30% 30%, #ffe69c, #f1c40f); }
.pad-3 { background: radial-gradient(circle at 30% 30%, #9cc8ff, #3498db); }
.simon-pad.active { filter: brightness(1.25) saturate(1.15); transform: scale(1.02); }

/* Tic Tac Toe */
.ttt-grid { max-width: 360px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ttt-cell { aspect-ratio: 1/1; background: #fff; border: 2px solid #ffd3e2; border-radius: 12px; box-shadow: var(--shadow); display: grid; place-items: center; font-size: 42px; font-weight: 700; color: var(--rose); cursor: pointer; }
.ttt-cell.ai { color: #7a355c; }
.ttt-cell.win { outline: 3px solid var(--rose); box-shadow: 0 0 0 4px rgba(255,77,136,.12) inset; }



