:root {
  --bg: #0f1220;
  --card: #151a2e;
  --text: #e5e7f3;
  --muted: #aab0d0;
  --accent: #ff6db6;
  --accent-2: #6dd5ff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1b2242, transparent),
              radial-gradient(1200px 600px at 110% 40%, #1a3560, transparent),
              var(--bg);
}

.wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 68px 20px 48px;
}
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(21, 26, 46, 0.7);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
  z-index: 11;
}
.brand { font-weight: 800; color: var(--text); }
.nav-actions { display: flex; gap: 8px; }
.nav-btn { padding: 8px 12px; }

.hud {
  position: fixed;
  top: 60px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; padding: 8px 12px;
  background: rgba(21, 26, 46, 0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  z-index: 10;
}
.hud-item { color: var(--text); font-weight: 600; }

.ribbon {
  position: fixed;
  top: 100px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, #ffd2e7, #cbe8ff);
  color: #0b0f1c;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  font-weight: 700;
  z-index: 9;
  animation: popIn 420ms ease;
}
@keyframes popIn {
  0% { transform: translateX(-50%) scale(0.85); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.card {
  width: min(720px, 92vw);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.00)), var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}

h1 { font-size: 28px; margin: 0 0 6px; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

.progress {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
  margin: 8px 0 22px;
}
.bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 360ms ease; }

.question p { font-size: 22px; margin: 14px 0 18px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions { position: relative; min-height: 56px; }
.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 12px 18px; border-radius: 10px; color: #0b0f1c; font-weight: 600;
  background: #e6e8fb;
  box-shadow: 0 10px 20px rgba(0,0,0,0.22), inset 0 -2px 0 rgba(0,0,0,0.12);
  transition: transform 140ms ease, filter 140ms ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.02); }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(90deg, #ffd2e7, #cbe8ff); }

.final { width: min(720px, 92vw); text-align: center; }
.hidden { display: none; }

.heart {
  width: 160px; height: 160px; position: relative; margin: 14px auto 18px;
  transform: rotate(-45deg);
  background: radial-gradient(circle at 30% 30%, #ff85b0, #ff2f79);
  animation: pulse 1200ms infinite ease-in-out, glowShift 6s infinite linear;
  filter: drop-shadow(0 12px 24px rgba(255, 47, 121, 0.35));
}
.heart::before, .heart::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: inherit; }
.heart::before { top: -80px; left: 0; }
.heart::after { left: 80px; top: 0; }

@keyframes pulse {
  0% { transform: rotate(-45deg) scale(1); }
  50% { transform: rotate(-45deg) scale(1.06); }
  100% { transform: rotate(-45deg) scale(1); }
}
@keyframes glowShift {
  0% { filter: drop-shadow(0 12px 24px rgba(255, 47, 121, 0.35)); }
  50% { filter: drop-shadow(0 18px 34px rgba(255, 90, 150, 0.45)); }
  100% { filter: drop-shadow(0 12px 24px rgba(255, 47, 121, 0.35)); }
}

h2 { font-size: 26px; margin: 10px 0 6px; }
.final p { color: var(--muted); margin: 0 0 18px; }

.float-layer { position: relative; width: 100%; height: 140px; overflow: visible; pointer-events: none; }
.float-layer .float-heart { position: absolute; font-size: 22px; animation: floatUp 3.8s ease-in forwards; }
@keyframes floatUp { 0% { transform: translateY(40px) translateX(0) scale(0.8); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-140px) translateX(var(--dx, 0px)) scale(1.2); opacity: 0; } }

.burst-layer { position: relative; width: 100%; height: 180px; pointer-events: none; overflow: visible; }
.burst-piece { position: absolute; font-size: 22px; animation: burst 1200ms ease-out forwards; }
@keyframes burst { 0% { transform: translate(0, 0) scale(0.6) rotate(0deg); opacity: 1; } 100% { transform: translate(var(--x, 0px), var(--y, -120px)) scale(1.1) rotate(180deg); opacity: 0; } }

.type-caret { display: inline-block; width: 10px; border-left: 2px solid var(--text); margin-left: 4px; }
@keyframes caretBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.type-caret { animation: caretBlink 800ms steps(1) infinite; }

.game-area {
  margin-top: 12px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 12px;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}
.game-area .heart-token { position: absolute; font-size: 26px; cursor: pointer; user-select: none; transition: transform 120ms ease; }
.game-area .heart-token:active { transform: scale(0.9); }
.game-area .star-token { position: absolute; font-size: 26px; cursor: pointer; user-select: none; transition: transform 120ms ease; }
.game-area .star-token:active { transform: scale(0.9); }

.final-score { color: var(--muted); }

.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 12px; }
.memory-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  height: 70px;
  display: grid;
  place-items: center;
  font-size: 24px;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, background 160ms ease;
}
.memory-card:hover { transform: translateY(-2px); }
.memory-card.flipped { background: rgba(255,255,255,0.16); }
.memory-card.matched { background: linear-gradient(90deg, #ffd2e7, #cbe8ff); color: #0b0f1c; cursor: default; }

.sticker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 10px; padding: 12px; }
.sticker-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 28px;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, background 160ms ease;
}
.sticker-item:hover { background: rgba(255,255,255,0.16); transform: translateY(-2px); }

.note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; padding: 12px; grid-auto-rows: minmax(90px, auto); }
.note-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  min-height: 90px;
  display: grid;
  place-items: center;
  padding: 10px;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
  text-align: center;
  overflow-wrap: anywhere;
}
.note-card:hover { transform: translateY(-2px); }
.note-card.open { background: linear-gradient(90deg, #ffd2e7, #cbe8ff); color: #0b0f1c; }
