:root {
  --pink: #ff5d8f;
  --pink-light: #ffd1dc;
  --purple: #a06cd5;
  --bg: #fff5f8;
  --text: #4a2b3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, var(--bg), #ffe9f0);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.floating-heart {
  position: absolute;
  bottom: -10%;
  font-size: 1.5rem;
  animation: floatUp linear infinite;
  opacity: 0.7;
}

@keyframes floatUp {
  to {
    transform: translateY(-110vh) rotate(20deg);
    opacity: 0;
  }
}

.app-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem 1rem 1rem;
}

.brand {
  margin: 0 0 1rem;
  font-size: 1.8rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.tab-btn {
  border: none;
  background: white;
  color: var(--pink);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(255, 93, 143, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tab-btn:hover { transform: translateY(-2px); }

.tab-btn.active {
  background: var(--pink);
  color: white;
}

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

.tab-panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  text-align: center;
  color: var(--pink);
}

.lead {
  text-align: center;
  opacity: 0.85;
}

.hint {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.6;
}

.btn {
  display: block;
  margin: 1rem auto;
  border: none;
  background: var(--pink);
  color: white;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(255, 93, 143, 0.35);
  transition: transform 0.15s ease;
}

.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.97); }

/* Memory game */
.memory-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  max-width: 420px;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  background: var(--pink);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s ease, background 0.2s ease;
  transform-style: preserve-3d;
}

.memory-card.flipped,
.memory-card.matched {
  background: white;
  box-shadow: inset 0 0 0 2px var(--pink-light);
}

.memory-card.matched { opacity: 0.6; cursor: default; }

/* Quiz */
.quiz-question {
  background: white;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.quiz-options {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.quiz-option {
  border: 2px solid var(--pink-light);
  background: white;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.quiz-option.correct { background: #d6f5d6; border-color: #7bc97b; }
.quiz-option.wrong { background: #fbd6d6; border-color: #d97b7b; }
.quiz-option[disabled] { cursor: default; }

.quiz-result {
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  margin-top: 1rem;
}

/* Love meter */
.meter-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: 360px;
  margin: 0 auto 1rem;
}

.meter-bar {
  flex: 1;
  height: 18px;
  background: white;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--pink-light);
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  transition: width 0.3s ease;
}

.heart-btn { font-size: 1.1rem; }

.reasons-list {
  list-style: none;
  padding: 0;
  max-width: 500px;
  margin: 1rem auto 0;
}

.reasons-list li {
  background: white;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  animation: fadeIn 0.4s ease;
}

/* Letter */
.letter-text {
  white-space: pre-line;
  background: white;
  padding: 1.2rem;
  border-radius: 14px;
  max-width: 500px;
  margin: 1rem auto 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  min-height: 2rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 500px;
  margin: 1.5rem auto 0;
}

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

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

.stat-label {
  font-size: 0.85rem;
  opacity: 0.7;
}

.app-footer {
  text-align: center;
  padding: 1rem;
  opacity: 0.6;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

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