:root {
  --peach-50: #fff5f0;
  --peach-100: #fee2d2;
  --peach-200: #fcccb5;
  --pink-100: #fce7f3;
  --pink-200: #fbcfe8;
  --pink-300: #f9a8d4;
  --pink-400: #f472b6;
  --pink-500: #ec4899;
  --pink-700: #be185d;
  --mint-200: #a7f3d0;
  --mint-300: #6ee7b7;
  --lav-200: #ddd6fe;
  --lav-500: #8b5cf6;
  --gold-300: #fcd34d;
  --gold-500: #f59e0b;
  --ink: #4a2c4a;
  --ink-soft: #7b5b78;
  --paper: #fffaf6;
  --shadow: 0 18px 50px -12px rgba(244, 114, 182, 0.4), 0 4px 14px -4px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Vietnamese", "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, #ffd6ec 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, #ffe2cf 0%, transparent 55%),
    radial-gradient(circle at 50% 90%, #e0e7ff 0%, transparent 60%),
    linear-gradient(135deg, #fff0f6 0%, #ffe4f1 50%, #f5e4ff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex; flex-direction: column; min-height: 100vh;
  padding: 70px 16px 80px;
}

#sparkles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.85) 1.5px, transparent 3px),
    radial-gradient(circle at 78% 32%, rgba(255,200,230,0.75) 1.5px, transparent 3px),
    radial-gradient(circle at 38% 78%, rgba(255,255,255,0.85) 1.5px, transparent 3px),
    radial-gradient(circle at 88% 88%, rgba(255,210,230,0.7) 1.5px, transparent 3px),
    radial-gradient(circle at 22% 62%, rgba(255,255,255,0.7) 1.5px, transparent 3px);
  background-size: 240px 240px;
  animation: sparkle-drift 22s linear infinite;
}
@keyframes sparkle-drift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: 240px 240px, -240px 240px, 240px -240px, -240px -240px, 120px 240px; }
}

/* Star HUD (top-left) */
.star-hud {
  position: fixed;
  top: 18px; left: 18px;
  z-index: 50;
  background: linear-gradient(135deg, var(--gold-300), var(--pink-300));
  color: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 6px 18px -4px rgba(245, 158, 11, 0.5);
  display: flex; gap: 6px; align-items: center;
  border: 2px solid white;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.star-hud {
  appearance: none;
  border: 2px solid white;
  cursor: pointer;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.1;
  max-width: 110px;
}
.star-hud .star-hint {
  flex-basis: 100%;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.92;
  letter-spacing: 0.02em;
}
.star-hud.bump { animation: bump 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.star-icon { font-size: 18px; }

/* Language toggle (top-right) */
.lang-toggle {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 50;
  appearance: none;
  border: 2px solid white;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 20px;
  display: flex; gap: 6px; align-items: center;
  box-shadow: 0 6px 18px -4px rgba(236, 72, 153, 0.3);
  transition: transform 0.15s;
}
.lang-toggle:hover  { transform: scale(1.05); }
.lang-toggle:active { transform: scale(0.95); }
.flag-active   { font-size: 22px; }
.flag-inactive { opacity: 0.35; font-size: 16px; }

#app {
  position: relative; z-index: 1;
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%;
}

.screen {
  display: none; width: 100%; max-width: 540px;
  animation: fade-up 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.screen.active { display: block; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--paper);
  border-radius: 28px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  border: 2px solid white;
}
.card.wide { max-width: 100%; }
.welcome-card { padding: 36px 24px 30px; }

h1 {
  font-size: 28px;
  margin: 12px 0 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--pink-500), var(--lav-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.15;
}
h2 {
  font-size: 22px; margin: 4px 0 4px;
  font-weight: 700; color: var(--ink); letter-spacing: -0.01em;
}
h3.section-h {
  margin: 24px 0 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--pink-700);
  text-align: left;
  padding-left: 4px;
}
p { margin: 8px 0; line-height: 1.55; }
.lead { font-size: 16px; }
.sub  { color: var(--ink-soft); font-size: 14px; }
.tiny { color: var(--ink-soft); font-size: 12px; margin-top: 14px; opacity: 0.75; }
.big-emoji {
  font-size: 64px; line-height: 1; display: inline-block;
}
.bounce { animation: bounce 1.4s ease-in-out infinite; }
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12) rotate(-4deg); }
}

/* Anya avatar */
.anya-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.anya-avatar.big { width: 92px; height: 92px; margin: 0 auto 10px; }
.anya-face {
  font-size: 60px; line-height: 1;
  background: linear-gradient(135deg, var(--pink-200), var(--peach-200));
  border-radius: 50%;
  width: 92px; height: 92px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -8px rgba(236, 72, 153, 0.5);
  animation: anya-bob 3s ease-in-out infinite;
}
.anya-face.bond {
  background: linear-gradient(135deg, var(--mint-200), var(--lav-200));
}
.anya-face.sakamoto {
  background: linear-gradient(135deg, #fed7aa, #fcd34d);
}
.anya-avatar:not(.big) .anya-face {
  width: 56px; height: 56px; font-size: 38px;
}
.sparkle {
  position: absolute; font-size: 22px;
  animation: sparkle-pulse 1.8s ease-in-out infinite;
}
.sparkle.s1 { top: -6px; right: -8px; animation-delay: 0s; }
.sparkle.s2 { bottom: 0; left: -10px; animation-delay: 0.9s; }
@keyframes anya-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-6px) rotate(3deg); }
}
@keyframes sparkle-pulse {
  0%, 100% { transform: scale(0.85) rotate(0deg); opacity: 0.6; }
  50%      { transform: scale(1.15) rotate(20deg); opacity: 1; }
}

/* Story bubbles */
.story-row {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
  text-align: left;
}
.story-row.reverse { flex-direction: row-reverse; text-align: right; }
.story-bubble {
  background: white;
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: 0 4px 14px -8px rgba(180, 100, 160, 0.35);
  border: 2px solid var(--pink-100);
  flex: 1; min-width: 0;
}
.story-bubble p { margin: 0; font-size: 15px; line-height: 1.5; }
.story-row.reverse .story-bubble { background: linear-gradient(135deg, #fff5f0, #fff); }

/* Question header */
.q-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-num {
  background: linear-gradient(135deg, var(--pink-300), var(--lav-500));
  color: white; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
}
.q-when { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* Buttons */
.btn {
  appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 700;
  padding: 14px 28px; border-radius: 18px; margin-top: 18px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--pink-500), var(--lav-500));
  color: white;
  box-shadow: 0 10px 26px -6px rgba(236, 72, 153, 0.55);
}
.btn.primary:hover {
  box-shadow: 0 14px 32px -6px rgba(236, 72, 153, 0.65);
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 500;
}
.btn.ghost:hover { color: var(--pink-700); }
.btn.small {
  display: block;
  margin: 10px auto 0;
  font-size: 13px;
  padding: 8px 14px;
}

/* Choices */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.choice {
  appearance: none; border: 3px solid white; background: white;
  border-radius: 22px; padding: 0; cursor: pointer;
  font-family: inherit; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s, border-color 0.25s;
  box-shadow: 0 8px 22px -10px rgba(180, 100, 160, 0.35);
  text-align: left; position: relative;
}
.choice:hover {
  transform: translateY(-4px) rotate(-0.3deg);
  border-color: var(--pink-300);
  box-shadow: 0 14px 32px -8px rgba(236, 72, 153, 0.45);
}
.choice:active { transform: scale(0.97); }
.choice img {
  width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block;
  background: linear-gradient(135deg, var(--pink-100), var(--peach-100));
}
.choice-body { padding: 12px 14px 14px; }
.choice-name { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; line-height: 1.25; }
.choice-vibe { font-size: 12px; color: var(--pink-700); margin-top: 6px; font-weight: 500; line-height: 1.4; }
.choice.picked  { border-color: var(--pink-500); animation: chosen-pop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.choice.dimmed  { opacity: 0.35; transform: scale(0.94); }
@keyframes chosen-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ====== MINI-GAME COMMON ====== */
.mini-card { padding: 24px 20px; text-align: center; }
.mini-card-full { padding: 14px; }
.mini-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold-300), var(--pink-300));
  color: white;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px -4px rgba(245, 158, 11, 0.5);
}
.mini-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--pink-100), var(--peach-100));
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--pink-700);
  gap: 8px;
  flex-wrap: wrap;
}
.mini-meta-right { margin-left: auto; }
.big-stars {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-500), var(--pink-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 12px 0 8px;
  line-height: 1;
}

/* ====== MEMORY MATCH ====== */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 3px solid white;
  background: linear-gradient(135deg, var(--pink-300), var(--lav-500));
  cursor: pointer;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 6px 16px -8px rgba(236, 72, 153, 0.45);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s;
  font-family: inherit;
  user-select: none;
}
.mem-card:not(.flipped):hover { transform: translateY(-3px) scale(1.04); }
.mem-card:active { transform: scale(0.95); }
.mem-card.flipped {
  background: white;
  border-color: var(--pink-300);
  color: var(--ink);
  transform: rotateY(180deg) scale(1);
}
.mem-card.flipped > * { transform: rotateY(180deg); }
.mem-card.matched {
  background: linear-gradient(135deg, var(--mint-200), var(--mint-300));
  border-color: var(--mint-300);
  animation: match-pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes match-pop {
  0%   { transform: scale(1) rotateY(180deg); }
  40%  { transform: scale(1.18) rotateY(180deg); }
  100% { transform: scale(1) rotateY(180deg); }
}

/* ====== SOOT SPRITE CATCH ====== */
.soot-area {
  position: relative;
  width: 100%;
  height: 360px;
  background: linear-gradient(160deg, #f5e4ff 0%, #ffe4f1 100%);
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid white;
  box-shadow: inset 0 0 24px rgba(180, 100, 160, 0.15);
}
.soot-sprite {
  position: absolute;
  width: 56px;
  height: 56px;
  background: radial-gradient(circle, #2a2a2a 0%, #000 70%);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  animation: soot-pop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.5);
}
.soot-sprite::before {
  content: '';
  position: absolute;
  top: 35%; left: 30%;
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
  box-shadow: 18px 0 0 white;
}
.soot-sprite::after {
  content: '';
  position: absolute;
  top: 39%; left: 33%;
  width: 4px; height: 4px;
  background: #000;
  border-radius: 50%;
  box-shadow: 18px 0 0 #000;
}
.soot-sprite.caught {
  animation: soot-burst 0.3s forwards;
}
@keyframes soot-pop {
  from { transform: translate(-50%, -50%) scale(0); }
  to   { transform: translate(-50%, -50%) scale(1); }
}
@keyframes soot-burst {
  to {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
    filter: blur(4px);
  }
}

/* ====== PEANUT MATCH (Bejeweled) ====== */
.peanut-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-width: 360px;
  margin: 0 auto;
  background: linear-gradient(135deg, var(--pink-100), var(--peach-100));
  padding: 6px;
  border-radius: 14px;
  border: 3px solid white;
}
.p-tile {
  aspect-ratio: 1;
  border-radius: 10px;
  background: white;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: clamp(20px, 6vw, 28px);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  user-select: none;
  box-shadow: 0 2px 4px -2px rgba(0,0,0,0.1);
}
.p-tile:hover { transform: scale(1.05); }
.p-tile.p-selected {
  background: linear-gradient(135deg, var(--gold-300), var(--pink-300));
  border-color: var(--gold-500);
  transform: scale(1.1);
  box-shadow: 0 4px 12px -2px rgba(245, 158, 11, 0.5);
}
.p-tile.p-clearing {
  animation: p-burst 0.4s forwards;
}
@keyframes p-burst {
  to { transform: scale(1.5); opacity: 0; }
}

/* ====== RUNNER (canvas) ====== */
.runner-canvas {
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 18px;
  border: 3px solid white;
  box-shadow: inset 0 0 24px rgba(180, 100, 160, 0.12), 0 8px 22px -10px rgba(180, 100, 160, 0.35);
  touch-action: none;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}

/* Gem colors for Peanut Match — looks like real Bejeweled tiles */
.p-sym-0 { background: linear-gradient(135deg, #fde68a, #fbbf24); }   /* peanut gold */
.p-sym-1 { background: linear-gradient(135deg, #fbcfe8, #f472b6); }   /* heart pink */
.p-sym-2 { background: linear-gradient(135deg, #fef08a, #facc15); }   /* lightning yellow */
.p-sym-3 { background: linear-gradient(135deg, #ddd6fe, #a78bfa); }   /* butterfly purple */
.p-sym-4 { background: linear-gradient(135deg, #fecdd3, #fb7185); }   /* blossom rose */

/* ====== REWARDS MODAL ====== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(74, 44, 74, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  animation: fade-up 0.25s ease both;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--paper);
  border-radius: 26px;
  border: 2px solid white;
  padding: 24px 20px;
  max-width: 440px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: var(--shadow);
}

.star-callout {
  background: linear-gradient(135deg, #fff5e0, #fce7f3);
  border: 2px dashed var(--gold-300);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ====== REVEAL ====== */
.reveal-card { padding: 28px 18px; }
.star-total {
  background: linear-gradient(135deg, #fff5e0, #fce7f3);
  border-radius: 22px;
  padding: 16px;
  margin: 18px 0 8px;
  border: 2px solid var(--gold-300);
}
.star-total-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--pink-700);
}
.star-total-big {
  font-size: 44px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-500), var(--pink-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 4px;
  line-height: 1;
}

.schedule { margin: 12px 0 8px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.day-label {
  font-size: 12px; font-weight: 800; color: var(--pink-700);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin: 14px 0 4px; padding-left: 4px;
  display: flex; align-items: center; gap: 6px;
}
.day-label:first-child { margin-top: 0; }
.sched-item {
  background: white; border-radius: 16px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 3px 12px -6px rgba(180, 100, 160, 0.3);
  border: 2px solid var(--pink-100);
}
.sched-emoji {
  font-size: 28px;
  width: 44px; height: 44px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink-100), var(--peach-100));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.sched-body { flex: 1; min-width: 0; }
.sched-time { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.sched-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-top: 2px; line-height: 1.3; }
.sched-fixed .sched-emoji { background: linear-gradient(135deg, var(--mint-200), var(--lav-200)); }

/* Rewards */
.rewards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.reward {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: white;
  border-radius: 14px;
  border: 2px solid var(--pink-100);
  text-align: left;
  transition: opacity 0.3s;
}
.reward.unlocked {
  background: linear-gradient(135deg, #fff5e0, #ffe4f1);
  border-color: var(--gold-300);
  box-shadow: 0 4px 14px -6px rgba(245, 158, 11, 0.3);
}
.reward.locked { opacity: 0.5; }
.reward-stars {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 14px;
  background: linear-gradient(135deg, var(--gold-300), var(--pink-300));
  color: white;
  padding: 5px 10px;
  border-radius: 999px;
  min-width: 50px;
  text-align: center;
}
.reward.locked .reward-stars {
  background: linear-gradient(135deg, #ccc, #aaa);
}
.reward-text { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.reward-check { font-size: 18px; }
.reward.locked .reward-check { opacity: 0.4; }

/* Footer */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  text-align: center; font-size: 11px; color: var(--ink-soft);
  padding: 10px; opacity: 0.55; pointer-events: none;
}

/* Mobile */
@media (max-width: 420px) {
  h1 { font-size: 25px; }
  h2 { font-size: 19px; }
  .card { padding: 24px 16px; }
  .choices { gap: 10px; }
  .choice-body { padding: 10px 12px 12px; }
  .choice-name { font-size: 14px; }
  .choice-vibe { font-size: 11px; }
  .anya-avatar.big, .anya-face { width: 80px; height: 80px; }
  .anya-face { font-size: 50px; }
  .memory-grid { gap: 8px; }
  .mem-card { font-size: 26px; }
  .soot-area { height: 320px; }
  .soot-sprite { width: 48px; height: 48px; }
  .mini-header { font-size: 13px; padding: 8px 12px; }
  .big-stars { font-size: 40px; }
  .star-total-big { font-size: 36px; }
  body { padding: 64px 12px 80px; }
  .star-hud, .lang-toggle { top: 12px; }
  .star-hud { left: 12px; padding: 6px 12px; font-size: 14px; }
  .lang-toggle { right: 12px; padding: 6px 12px; font-size: 18px; }
}

@media (max-width: 340px) {
  .choices { grid-template-columns: 1fr; }
}
