:root {
  --night: #fff8fb;
  --night-soft: #f7f1fb;
  --plum: #49394f;
  --rose: #d96791;
  --peach: #d98375;
  --lavender: #a998dc;
  --mint: #78bba0;
  --cream: #403446;
  --muted: #77697e;
  --glass: rgba(255, 255, 255, 0.82);
  --line: rgba(88, 62, 96, 0.13);
  --success: #65ae8c;
  --danger: #d95f78;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #8f4667;
  background: var(--night);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 5% 8%, rgba(255, 196, 211, 0.72), transparent 34%),
    radial-gradient(circle at 96% 18%, rgba(202, 191, 242, 0.68), transparent 34%),
    radial-gradient(circle at 45% 100%, rgba(190, 232, 214, 0.58), transparent 42%),
    linear-gradient(160deg, #fff9fb 0%, #fbf6ff 48%, #fffaf5 100%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; }

.ambient {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.42;
  pointer-events: none;
}
.ambient-one { top: 5%; left: -10rem; background: #ffc3d6; }
.ambient-two { right: -11rem; bottom: 2%; background: #cfc5f5; }

.app-shell {
  width: min(100%, 31rem);
  min-height: 100svh;
  margin: 0 auto;
  position: relative;
  isolation: isolate;
}

.screen {
  display: none;
  min-height: 100svh;
  padding: max(2rem, env(safe-area-inset-top)) 1.25rem max(1.75rem, env(safe-area-inset-bottom));
  animation: enter 420ms ease both;
}
.screen.is-active { display: flex; }

.welcome-screen, .finish-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.finish-screen {
  justify-content: flex-start;
  padding-top: max(2rem, env(safe-area-inset-top));
}

.brand-mark {
  width: 4.25rem;
  height: 4.25rem;
  display: grid;
  place-items: center;
  margin-bottom: 1.4rem;
  color: var(--cream);
  font-size: 1.6rem;
  border: 1px solid rgba(217, 103, 145, 0.24);
  border-radius: 50% 50% 48% 52%;
  background: linear-gradient(145deg, #ffd6e2, #f2dcf8);
  box-shadow: 0 0 0 0.65rem rgba(217, 103, 145, 0.055), 0 0 2.2rem rgba(169, 152, 220, 0.18);
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--peach);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  line-height: 0.99;
  letter-spacing: -0.035em;
}
h1 { font-size: clamp(3rem, 13vw, 4.2rem); }
h2 { font-size: clamp(2.45rem, 11vw, 3.65rem); }
h1 em, h2 em { color: var(--rose); font-weight: 600; }

.intro {
  max-width: 24rem;
  margin: 1.35rem auto 1.8rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.final-love {
  color: #7d526b;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.55;
}

.rule-card, .final-message {
  width: 100%;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1.25rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 0.8rem 2.2rem rgba(105, 77, 115, 0.07);
  backdrop-filter: blur(10px);
}
.rule-card p, .final-message p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.rule-card strong { color: var(--cream); }
.rule-icon {
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 0.8rem;
  color: var(--peach);
  background: rgba(238, 174, 151, 0.18);
}

.primary-button, .secondary-button {
  width: 100%;
  min-height: 3.6rem;
  padding: 0.9rem 1.1rem;
  border-radius: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.primary-button {
  color: #1a0b25;
  border: 0;
  background: linear-gradient(110deg, #f1b39e, #e889aa, #b8a7e8);
  box-shadow: 0 0.9rem 2.1rem rgba(169, 119, 158, 0.2);
}
.secondary-button { color: var(--cream); border: 1px solid var(--line); background: rgba(255,255,255,0.72); }
.primary-button:active, .secondary-button:active, .answer-button:active { transform: scale(0.98); }
.microcopy, .game-footnote { margin: 1rem 0 0; color: #8b7a91; font-size: 0.76rem; }

.game-screen { flex-direction: column; }
.game-header { padding: 0.25rem 0.25rem 1.15rem; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 0.65rem; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.progress-copy span:last-child { color: var(--peach); }
.progress-track { height: 0.25rem; overflow: hidden; border-radius: 99px; background: rgba(80,56,88,0.1); }
.progress-fill { width: 5%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rose), var(--lavender), var(--mint)); transition: width 450ms ease; }
.heart-track { display: flex; justify-content: space-between; gap: 0.25rem; margin-top: 0.75rem; color: rgba(77,54,84,0.18); font-size: 0.72rem; }
.heart-track .done { color: var(--rose); }
.heart-track .current { color: var(--peach); transform: scale(1.35); }

.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(255,248,252,0.86));
  box-shadow: 0 1.8rem 4rem rgba(101, 77, 111, 0.13);
  backdrop-filter: blur(18px);
}
.card-topline { min-height: 2.3rem; display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-kicker { color: var(--peach); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.timer { display: inline-flex; align-items: baseline; gap: 0.12rem; color: var(--cream); font-size: 0.72rem; }
.timer strong { font-size: 1.2rem; }
.timer.is-urgent { color: var(--danger); animation: pulse 600ms ease infinite alternate; }
.is-hidden { visibility: hidden; }

.question-title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.75rem, 7.7vw, 2.35rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.question-subtitle { min-height: 2.5em; margin: 0.7rem 0 1.35rem; color: var(--muted); font-size: 0.87rem; line-height: 1.45; }
.answer-list { display: grid; gap: 0.7rem; }
.answer-button {
  width: 100%;
  min-height: 3.35rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  color: var(--cream);
  text-align: left;
  border: 1px solid rgba(88,62,96,0.12);
  border-radius: 0.95rem;
  background: rgba(255,255,255,0.72);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.answer-button:hover { border-color: rgba(169,152,220,0.65); background: rgba(231,224,250,0.48); }
.answer-letter { flex: 0 0 auto; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: 50%; color: #755f9d; background: rgba(189,175,230,0.25); font-size: 0.75rem; font-weight: 700; }
.answer-button.correct { border-color: var(--success); background: rgba(167,222,199,0.28); }
.answer-button.wrong { border-color: var(--danger); background: rgba(245,181,194,0.25); animation: shake 360ms ease; }
.answer-button:disabled { cursor: default; }

.memory-stage {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin: 1rem 0 1.5rem;
}
.memory-symbol { aspect-ratio: 1; display: grid; place-items: center; border-radius: 1rem; background: rgba(226,216,247,0.52); font-size: 1.7rem; }
.memory-symbol.covered { color: transparent; background: rgba(244,219,229,0.5); position: relative; }
.memory-symbol.covered::after { content: "?"; position: absolute; color: var(--peach); font: 600 1.25rem "Playfair Display", serif; }
.challenge-note { margin: -0.65rem 0 1.2rem; color: #8b7a91; font-size: 0.78rem; }

.sequence-title,
.stroop-word,
.language-word {
  text-align: center;
  font-size: clamp(2.3rem, 11vw, 3.7rem);
  letter-spacing: 0.02em;
}

.stroop-word {
  padding: 1rem 0 0.4rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-shadow: 0 0.6rem 1.8rem rgba(92,65,102,0.12);
}

.language-word {
  text-transform: none;
  font-size: clamp(1.75rem, 8vw, 2.6rem);
}

.language-expression {
  text-align: center;
  font-size: clamp(1.55rem, 7vw, 2.15rem);
  line-height: 1.16;
}

.feedback { position: fixed; inset: 0; z-index: 10; display: none; place-items: end center; padding: 1rem; background: rgba(68,46,76,0.28); backdrop-filter: blur(10px); }
.feedback.is-open { display: grid; animation: fade 180ms ease both; }
.feedback-panel { width: min(100%, 29rem); padding: 1.5rem; text-align: center; border: 1px solid var(--line); border-radius: 1.5rem; background: #fffafd; box-shadow: 0 -1rem 4rem rgba(85,61,94,0.18); animation: rise 300ms ease both; }
.feedback-symbol { width: 3.4rem; height: 3.4rem; display: grid; place-items: center; margin: -3.2rem auto 1rem; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--peach), var(--rose), var(--lavender)); box-shadow: 0 0.7rem 2rem rgba(177,111,153,0.28); font-size: 1.3rem; }
.feedback-panel h2 { font-size: 2.2rem; }
.feedback-panel > p:not(.eyebrow) { margin: 0.8rem auto 1.25rem; color: var(--muted); line-height: 1.5; }

.finish-screen .final-orbit { display: flex; gap: 1.4rem; align-items: center; margin-bottom: 1.5rem; color: var(--peach); }
.finish-screen .final-orbit span:nth-child(2) { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--rose), var(--lavender)); box-shadow: 0 0 2.4rem rgba(177,111,153,0.24); font-size: 1.45rem; animation: heartbeat 1.6s ease infinite; }
.finish-screen .intro { margin-bottom: 1.15rem; }
.answer-summary {
  width: 100%;
  display: grid;
  gap: 0.65rem;
  padding: 0;
  margin: 0 0 1.6rem;
  list-style: none;
  text-align: left;
}
.answer-summary li {
  display: grid;
  grid-template-columns: 2.15rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255,255,255,0.74);
  box-shadow: 0 0.65rem 1.6rem rgba(105,77,115,0.055);
}
.summary-number {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #755f9d;
  background: linear-gradient(145deg, rgba(244,207,220,0.75), rgba(220,211,247,0.8));
  font-size: 0.72rem;
  font-weight: 800;
}
.summary-question {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.summary-answer {
  display: block;
  margin-top: 0.22rem;
  color: var(--plum);
  font-size: 0.95rem;
  line-height: 1.4;
}
.final-greeting {
  margin: 0 0 1.3rem;
  color: #7d526b;
  font: 600 1.45rem/1.4 "Playfair Display", Georgia, serif;
}
.final-message { margin-top: 0.25rem; margin-bottom: 1.35rem; align-items: flex-start; }
.final-message > span { color: var(--rose); font: 600 2rem "Playfair Display", serif; line-height: 1; }

.confetti { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.confetti-piece { position: absolute; top: -2rem; width: 0.55rem; height: 0.85rem; border-radius: 0.15rem; animation: fall 2.8s linear forwards; }

@keyframes enter { from { opacity: 0; transform: translateY(0.6rem); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(2rem); } }
@keyframes pulse { to { opacity: 0.55; } }
@keyframes shake { 25% { transform: translateX(-0.35rem); } 50% { transform: translateX(0.35rem); } 75% { transform: translateX(-0.2rem); } }
@keyframes heartbeat { 50% { transform: scale(1.08); } }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(760deg); opacity: 0.1; } }

@media (min-height: 760px) {
  .card { padding: 1.55rem; }
  .answer-list { gap: 0.8rem; }
  .feedback { place-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
