*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green-dark: #1b4332;
  --green: #2d6a4f;
  --green-light: #52b788;
  --green-pale: #d8f3dc;
  --green-mist: #ecfdf3;
  --cream: #fffbf5;
  --paper: #fffef9;
  --ink: #1a1a1a;
  --pink-accent: #ffb3c7;
  --shadow: 0 12px 40px rgba(27, 67, 50, 0.15);
  --radius: 24px;
  --font-display: "Playfair Display", Georgia, serif;
  --font-hand: "Caveat", cursive;
  --font-body: "DM Sans", system-ui, sans-serif;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(82, 183, 136, 0.25), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 179, 199, 0.2), transparent 35%),
    linear-gradient(160deg, var(--green-mist) 0%, var(--cream) 45%, var(--green-pale) 100%);
}

.petals {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -10%;
  font-size: 1.2rem;
  opacity: 0.55;
  animation: fall linear infinite;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(360deg);
  }
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}

.screen--active {
  opacity: 1;
  visibility: visible;
}

.scrapbook {
  background: var(--paper);
  border: 2px dashed var(--green-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

.scrapbook-inline {
  border: 2px dashed var(--green-light);
  border-radius: 16px;
  background: var(--green-mist);
}

.card {
  width: min(100%, 420px);
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
}

.loader-card {
  width: min(100%, 320px);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.bow {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  animation: wiggle 1.2s ease-in-out infinite;
}

.loader-heart {
  font-size: 3rem;
  animation: pulse 0.9s ease-in-out infinite;
}

.loader-text {
  margin-top: 1rem;
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--green-dark);
}

.loader-bar {
  margin: 1.25rem auto 0.75rem;
  width: 70%;
  height: 8px;
  background: var(--green-pale);
  border-radius: 999px;
  overflow: hidden;
}

.loader-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green-light), var(--green));
  border-radius: inherit;
  animation: load 2.2s ease forwards;
}

.sticker {
  position: absolute;
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.sticker--tl { top: -0.5rem; left: 0.75rem; transform: rotate(-12deg); }
.sticker--tr { top: -0.4rem; right: 0.75rem; transform: rotate(10deg); }
.sticker--bl { bottom: 0.5rem; left: 1rem; transform: rotate(8deg); }
.sticker--br { bottom: 0.4rem; right: 0.75rem; transform: rotate(-8deg); }

.eyebrow {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--green);
  margin-bottom: 0.35rem;
}

h1,
h2 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--green-dark);
}

h1 {
  font-size: clamp(2rem, 7vw, 2.6rem);
}

h1 em {
  font-style: italic;
  color: var(--green);
}

h2 {
  font-size: clamp(1.55rem, 5.5vw, 2rem);
}

.subtitle {
  margin: 1rem 0 1.5rem;
  color: #444;
  line-height: 1.55;
  font-size: 0.98rem;
}

.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: 999px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.94);
}

.btn--primary {
  background: linear-gradient(135deg, var(--green-light), var(--green));
  color: white;
  padding: 0.85rem 2rem;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(45, 106, 79, 0.35);
}

.btn--yes {
  background: linear-gradient(135deg, #74c69d, var(--green));
  color: white;
  padding: 0.75rem 1.6rem;
  min-width: 110px;
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.3);
}

.btn--no {
  background: white;
  color: #666;
  padding: 0.75rem 1.4rem;
  border: 2px solid #ddd;
  position: relative;
  transition: left 0.15s ease, top 0.15s ease, transform 0.2s;
}

.pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.pick-btn {
  border: 2px dashed var(--green-pale);
  background: var(--green-mist);
  border-radius: 16px;
  padding: 1rem 0.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}

.pick-btn:hover {
  transform: scale(1.03);
}

.pick-btn:disabled,
.color-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.pick-btn.correct-flash {
  background: var(--green-pale);
  border-color: var(--green-light);
  animation: pop 0.5s ease;
}

.pick-btn.wrong-flash {
  animation: shake 0.45s ease;
}

.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-pale);
  border: 2px solid var(--green-light);
  transition: transform 0.25s ease, background 0.25s ease;
}

.progress-dot--active {
  background: var(--green);
  transform: scale(1.25);
}

.progress-dot--done {
  background: var(--green-light);
}

.quiz-feedback {
  margin-top: 1rem;
  font-family: var(--font-hand);
  font-size: 1.45rem;
  color: var(--green-dark);
  min-height: 2rem;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.color-btn {
  aspect-ratio: 1;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--swatch);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.color-btn:hover {
  transform: scale(1.08);
}

.color-btn.correct-flash {
  box-shadow: 0 0 0 4px var(--green-light), 0 4px 14px rgba(0, 0, 0, 0.15);
  animation: pop 0.5s ease;
}

.color-btn.wrong-flash {
  animation: shake 0.45s ease;
}

.color-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: #666;
}

.pick-grid--stack .pick-btn {
  padding: 0.85rem 0.5rem;
}

.final-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  margin-bottom: 1rem;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--green-dark);
}

.success-score {
  display: inline-block;
  padding: 0.4rem 1rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--green-dark);
}

.photo-frame {
  width: 120px;
  height: 120px;
  margin: 0 auto 1.25rem;
  padding: 8px;
  background: white;
  border: 2px solid var(--green-pale);
  border-radius: 12px;
  transform: rotate(-3deg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, var(--green-pale), var(--green-mist));
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.photo-placeholder span {
  font-size: 2.2rem;
}

.photo-placeholder small {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--green);
}

.question-title span {
  font-style: italic;
  color: var(--green);
}

.button-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  min-height: 60px;
  position: relative;
}

.no-message {
  min-height: 2.5rem;
  margin-top: 1rem;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--green-dark);
  line-height: 1.3;
}

.success-card {
  position: relative;
  overflow: hidden;
}

.success-emoji {
  font-size: 2rem;
  letter-spacing: 0.3rem;
  margin-bottom: 0.5rem;
}

.success-text {
  margin: 1rem 0 1.25rem;
  line-height: 1.6;
  color: #333;
  font-size: 0.96rem;
}

.trait-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.trait-tags span {
  background: var(--green-pale);
  color: var(--green-dark);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.coupon {
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--green-dark);
}

.card--scroll {
  max-height: min(92vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.love-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--green-dark);
}

.love-counter__heart {
  font-size: 1.4rem;
}

.love-counter small {
  font-size: 0.75rem;
  font-weight: 400;
  color: #666;
}

#welcome-counter {
  margin-bottom: 1rem;
}

.daily-love {
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.daily-love__label {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--green);
  margin-bottom: 0.4rem;
}

.daily-love__text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #333;
}

.letter {
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.letter-text {
  font-size: 0.92rem;
  line-height: 1.65;
  color: #333;
}

.letter-sign {
  margin-top: 0.85rem;
  font-family: var(--font-hand);
  font-size: 1.45rem;
  color: var(--green-dark);
  text-align: right;
}

.letter-sign em {
  font-style: normal;
  font-size: 1.6rem;
}

.game-card h2 {
  font-size: clamp(1.35rem, 5vw, 1.75rem);
}

.game-subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.35rem;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
}

.game-stat {
  background: var(--green-mist);
  border-radius: 12px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.game-stat span {
  font-size: 0.68rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.game-stat strong {
  font-size: 1.25rem;
  color: var(--green-dark);
}

.timing-wrap {
  margin: 0.75rem 0;
}

.timing-bar {
  position: relative;
  width: 100%;
  height: 56px;
  background: var(--green-mist);
  border: 2px dashed var(--green-light);
  border-radius: 999px;
  overflow: hidden;
}

.timing-zone {
  position: absolute;
  top: 6px;
  bottom: 6px;
  background: linear-gradient(90deg, rgba(82, 183, 136, 0.35), rgba(45, 106, 79, 0.55));
  border-radius: 999px;
  border: 2px solid var(--green-light);
}

.timing-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 2;
}

.timing-feedback {
  min-height: 1.75rem;
  margin-top: 0.65rem;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--green-dark);
}

.timing-feedback--perfect {
  color: var(--green);
  animation: pop 0.35s ease;
}

.timing-feedback--good {
  color: var(--green-light);
}

.timing-feedback--ok {
  color: #888;
}

.timing-feedback--miss {
  color: #c44;
}

.btn--tap {
  width: 100%;
  margin-top: 0.25rem;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #3d405b, #1b4332);
  color: white;
  box-shadow: 0 8px 24px rgba(27, 67, 50, 0.35);
  touch-action: manipulation;
}

.btn--tap:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--tap-hit {
  background: linear-gradient(135deg, var(--green-light), var(--green));
}

.btn--tap-miss {
  animation: shake 0.2s ease;
}

.game-high {
  margin-top: 0.35rem;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--green);
}

.game-result {
  margin: 0.75rem 0;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--green-dark);
  line-height: 1.35;
}

.game-card .btn {
  margin-top: 0.5rem;
  width: 100%;
}

.game-card .btn + .btn {
  margin-top: 0.65rem;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.pop-in {
  animation: popIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bounce {
  animation: bounce 2s ease infinite;
}

@keyframes load {
  to { width: 100%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pop {
  50% { transform: scale(1.08); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 380px) {
  .card {
    padding: 1.5rem 1rem;
  }

  .button-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn--no {
    position: static !important;
  }
}
