/* ============================================================= */
/*  Princess Niha's Magical Birthday — style.css                  */
/*  Sections:                                                     */
/*   1. Design tokens & themes                                    */
/*   2. Base & resets                                             */
/*   3. Utilities & accessibility                                 */
/*   4. Ambient FX layers (aurora, fireflies, floaters)          */
/*   5. Buttons                                                   */
/*   6. Glass cards                                               */
/*   7. Loading screen                                            */
/*   8. Passcode screen                                           */
/*   9. Topbar controls                                           */
/*  10. Hero + parallax                                           */
/*  11. Photo gallery + modal                                     */
/*  12. Magical story                                             */
/*  13. Birthday message                                          */
/*  14. Interactive cake                                          */
/*  15. Football mini game                                        */
/*  16. Certificate                                               */
/*  17. Grand finale + footer                                     */
/*  18. Secret easter-egg page                                    */
/*  19. Reveal-on-scroll                                          */
/*  20. Responsive                                                */
/*  21. Reduced motion                                            */
/* ============================================================= */

/* ---------- 1. DESIGN TOKENS & THEMES ---------- */
:root {
  /* Palette */
  --pink-50: #fff2f8;
  --pink-100: #ffe0ef;
  --pink-200: #ffc2dd;
  --pink-300: #ff9ec7;
  --pink-400: #ff77b0;
  --blue-100: #e6f2ff;
  --blue-200: #c7e2ff;
  --blue-300: #a6ccff;
  --purple-300: #c7a6ff;
  --purple-400: #a97fe0;
  --purple-500: #8a5fd0;
  --gold: #f5c542;
  --gold-deep: #d99a1c;
  --white: #ffffff;

  /* Theme-aware (light default) */
  --bg-1: #ffe9f4;
  --bg-2: #e9f1ff;
  --bg-3: #f3e9ff;
  --text: #5a3d6b;
  --text-soft: #8a6ea0;
  --glass-bg: rgba(255, 255, 255, 0.35);
  --glass-brd: rgba(255, 255, 255, 0.6);
  --glass-shadow: rgba(157, 111, 214, 0.25);
  --accent: var(--pink-400);
  --accent-2: var(--purple-400);

  /* Type */
  --font-display: "Fredoka", "Quicksand", system-ui, sans-serif;
  --font-body: "Quicksand", system-ui, sans-serif;
  --font-script: "Great Vibes", cursive;

  /* Motion */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.6s;

  --radius: 24px;
  --shadow-soft: 0 20px 50px -15px var(--glass-shadow);
}

[data-theme="dark"] {
  --bg-1: #1a1230;
  --bg-2: #201a3d;
  --bg-3: #2a1c44;
  --text: #f3e9ff;
  --text-soft: #c7b3e0;
  --glass-bg: rgba(40, 28, 68, 0.45);
  --glass-brd: rgba(199, 166, 255, 0.35);
  --glass-shadow: rgba(0, 0, 0, 0.5);
  --accent: var(--pink-300);
  --accent-2: var(--purple-300);
}

/* ---------- 2. BASE & RESETS ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.8s var(--ease-soft), color 0.4s ease;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

h1,
h2,
p {
  margin: 0;
}

/* ---------- 3. UTILITIES & ACCESSIBILITY ---------- */
.hidden {
  display: none !important;
}

.visually-hidden,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  clip: auto;
  padding: 10px 18px;
  background: var(--white);
  color: var(--purple-500);
  border-radius: 999px;
  z-index: 9999;
  box-shadow: var(--shadow-soft);
}

:focus-visible {
  outline: 3px solid var(--purple-400);
  outline-offset: 3px;
  border-radius: 6px;
}

.section {
  position: relative;
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 5vw, 4rem);
  z-index: 2;
  /* Offset anchor jumps so the sticky top bar never hides section titles */
  scroll-margin-top: 72px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  text-align: center;
  background: linear-gradient(90deg, var(--pink-400), var(--purple-400), var(--blue-300));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(169, 127, 224, 0.25));
}

.section-sub {
  text-align: center;
  color: var(--text-soft);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  margin-top: 0.75rem;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 4. AMBIENT FX LAYERS ---------- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.aurora {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(40% 30% at 20% 20%, rgba(255, 158, 199, 0.45), transparent 70%),
    radial-gradient(45% 35% at 80% 25%, rgba(166, 204, 255, 0.4), transparent 70%),
    radial-gradient(50% 40% at 50% 80%, rgba(199, 166, 255, 0.4), transparent 70%);
  filter: blur(30px);
  animation: aurora-drift 18s ease-in-out infinite alternate;
  opacity: 0.8;
}

@keyframes aurora-drift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1.05); }
  50% { transform: translate3d(3%, 2%, 0) scale(1.15); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.08); }
}

/* Fireflies */
.fireflies span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c2, rgba(255, 224, 130, 0.2));
  box-shadow: 0 0 8px 2px rgba(255, 235, 150, 0.8);
  animation: firefly-float linear infinite;
  opacity: 0;
}

@keyframes firefly-float {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--fx, 40px), var(--fy, -120px)) scale(1); opacity: 0; }
}

/* Floaters: balloons / hearts / butterflies / clouds */
.floaters span {
  position: absolute;
  bottom: -60px;
  font-size: var(--fs, 28px);
  animation: rise-up linear infinite;
  will-change: transform;
  opacity: 0.9;
}

@keyframes rise-up {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { transform: translateY(-115vh) translateX(var(--drift, 30px)) rotate(var(--rot, 15deg)); opacity: 0; }
}

/* ---------- 5. BUTTONS ---------- */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--white);
  padding: 0.9em 2em;
  border-radius: 999px;
  position: relative;
  transition: transform 0.25s var(--ease-soft), box-shadow 0.25s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-magic {
  background: linear-gradient(135deg, var(--pink-400), var(--purple-400));
  box-shadow: 0 10px 25px -8px rgba(169, 127, 224, 0.7);
}

.btn-magic:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px -8px rgba(169, 127, 224, 0.85);
}

.btn-glow {
  background: linear-gradient(135deg, var(--pink-300), var(--purple-400), var(--blue-300));
  background-size: 200% 200%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 12px 30px -6px rgba(255, 119, 176, 0.7);
  animation: glow-pulse 3s ease-in-out infinite, gradient-shift 6s ease infinite;
}

.btn-glow:hover {
  transform: translateY(-3px) scale(1.03);
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 12px 30px -6px rgba(255, 119, 176, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.15), 0 18px 45px -6px rgba(169, 127, 224, 0.9); }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---------- 6. GLASS CARDS ---------- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

/* ---------- 7. LOADING SCREEN ---------- */
.loading-screen {
  background: linear-gradient(160deg, var(--pink-100), var(--blue-100) 55%, var(--purple-300));
  flex-direction: column;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-inner {
  text-align: center;
  padding: 2rem;
}

.loading-crown {
  font-size: clamp(3rem, 12vw, 5rem);
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(217, 154, 28, 0.4));
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(4deg); }
}

.loading-snowflakes {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--white);
  margin: 1rem 0;
}

.loading-snowflakes span {
  animation: spin-fall 3s linear infinite;
}
.loading-snowflakes span:nth-child(2) { animation-delay: 0.4s; }
.loading-snowflakes span:nth-child(3) { animation-delay: 0.8s; }
.loading-snowflakes span:nth-child(4) { animation-delay: 1.2s; }
.loading-snowflakes span:nth-child(5) { animation-delay: 1.6s; }

@keyframes spin-fall {
  0% { transform: translateY(-6px) rotate(0deg); opacity: 0.6; }
  50% { transform: translateY(6px) rotate(180deg); opacity: 1; }
  100% { transform: translateY(-6px) rotate(360deg); opacity: 0.6; }
}

.loading-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 4vw, 1.7rem);
  color: var(--purple-500);
  margin-bottom: 1.4rem;
}

.loading-bar {
  width: min(320px, 80vw);
  height: 14px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(138, 95, 208, 0.25);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink-400), var(--purple-400), var(--blue-300));
  border-radius: 999px;
  transition: width 0.2s ease;
}

.loading-percent {
  margin-top: 0.6rem;
  font-weight: 600;
  color: var(--purple-500);
}

/* ---------- 8. PASSCODE (shared input styling, used by gallery lock) ---------- */
@keyframes card-in {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.passcode-input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.4rem;
  color: var(--purple-500);
  border: 2px solid var(--glass-brd);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.passcode-input:focus {
  border-color: var(--purple-400);
  box-shadow: 0 0 0 4px rgba(169, 127, 224, 0.25);
  outline: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}

.passcode-error {
  min-height: 1.4rem;
  margin-top: 0.8rem;
  color: #e0457b;
  font-weight: 600;
}

.passcode-tip {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* ---------- 9. TOPBAR CONTROLS ---------- */
.glass-bar {
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-brd);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--purple-500);
  font-size: clamp(0.95rem, 3vw, 1.2rem);
}

.topbar-controls {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-brd);
  transition: transform 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.75);
}

.icon-btn.active {
  background: linear-gradient(135deg, var(--pink-300), var(--purple-400));
}

/* ---------- 10. HERO + PARALLAX ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* "safe" keeps content top-aligned instead of clipping when it can't fit */
  justify-content: safe center;
  text-align: center;
  /* Clear the sticky top bar so the first line ("Happy 6th Birthday")
     is never hidden behind it, and never clip the heading. */
  padding-top: clamp(90px, 14vh, 150px);
  position: relative;
}

.parallax-bg {
  position: absolute;
  inset: 0;
  overflow: hidden; /* contain the flying birds/clouds without clipping the title */
  z-index: 0;
}

.layer {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.layer-clouds {
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.9), transparent) 10% 25% / 220px 90px no-repeat,
    radial-gradient(closest-side, rgba(255, 255, 255, 0.8), transparent) 70% 18% / 280px 110px no-repeat,
    radial-gradient(closest-side, rgba(255, 255, 255, 0.7), transparent) 45% 35% / 200px 80px no-repeat;
  animation: drift-x 40s linear infinite;
}

@keyframes drift-x {
  from { background-position-x: 10%, 70%, 45%; }
  to { background-position-x: 40%, 100%, 75%; }
}

.layer-birds .bird,
.butterflies-layer .butterfly {
  position: absolute;
  font-size: 1.6rem;
  animation: fly-across linear infinite;
}

.layer-birds .bird:nth-child(1) { top: 18%; animation-duration: 22s; }
.layer-birds .bird:nth-child(2) { top: 28%; animation-duration: 30s; animation-delay: 5s; font-size: 1.2rem; }
.layer-birds .bird:nth-child(3) { top: 12%; animation-duration: 26s; animation-delay: 10s; }

.butterflies-layer .butterfly:nth-child(1) { top: 55%; animation-duration: 18s; }
.butterflies-layer .butterfly:nth-child(2) { top: 68%; animation-duration: 24s; animation-delay: 4s; }
.butterflies-layer .butterfly:nth-child(3) { top: 42%; animation-duration: 20s; animation-delay: 8s; }

@keyframes fly-across {
  0% { transform: translateX(-10vw) translateY(0); }
  50% { transform: translateX(55vw) translateY(-30px); }
  100% { transform: translateX(115vw) translateY(0); }
}

.hero-content {
  position: relative;
  z-index: 3;
  animation: card-in 1s var(--ease-soft) both;
}

.hero-crown {
  font-size: clamp(3rem, 12vw, 6rem);
  animation: bob 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(217, 154, 28, 0.45));
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  margin: 0.5rem 0;
}

.hero-happy {
  display: block;
  font-size: clamp(1.4rem, 5vw, 2.6rem);
  color: var(--purple-500);
}

.hero-name {
  display: block;
  font-size: clamp(2.6rem, 11vw, 6rem);
  background: linear-gradient(90deg, var(--pink-400), var(--purple-400), var(--blue-300));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
  filter: drop-shadow(0 6px 18px rgba(255, 119, 176, 0.4));
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--text-soft);
  margin: 1rem auto 2rem;
  max-width: 30ch;
  min-height: 1.5em;
}

.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--purple-400);
  border-radius: 999px;
  z-index: 3;
}

.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--purple-400);
  animation: scroll-dot 1.6s infinite;
}

@keyframes scroll-dot {
  0% { opacity: 0; transform: translateY(0); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(18px); }
}

/* ---------- 11. PHOTO GALLERY + MODAL ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
  max-width: 1100px;
  margin: 2.5rem auto 0;
}

.magic-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  padding: 10px;
  background: linear-gradient(135deg, var(--gold), #fff2c2, var(--gold-deep));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.35s var(--ease-soft), box-shadow 0.35s ease;
  overflow: hidden;
}

.magic-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
}

.magic-frame:hover,
.magic-frame:focus-visible {
  transform: translateY(-8px) rotate(-1deg) scale(1.02);
  box-shadow: 0 30px 60px -18px rgba(169, 127, 224, 0.5);
}

.magic-frame:hover::after {
  transform: translateX(120%);
}

.magic-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.4);
}

.frame-fallback {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  color: var(--purple-500);
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--pink-100), var(--blue-100));
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 20, 55, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-figure {
  margin: 0;
  max-width: 90vw;
  max-height: 82vh;
  text-align: center;
}

.modal-img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 16px;
  border: 6px solid var(--white);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.modal-img.kenburns {
  animation: kenburns 12s ease-in-out infinite alternate;
}

@keyframes kenburns {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.12) translate(-2%, -2%); }
}

.modal-caption {
  color: var(--white);
  margin-top: 0.8rem;
  font-family: var(--font-display);
}

.modal-close,
.modal-nav,
.modal-slideshow {
  position: absolute;
  color: var(--white);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close {
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
}

.modal-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  font-size: 2rem;
  line-height: 0;
}

.modal-prev { left: 16px; }
.modal-next { right: 16px; }

.modal-slideshow {
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1.4rem;
  font-family: var(--font-display);
}

.modal-close:hover,
.modal-nav:hover,
.modal-slideshow:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---------- 12. MAGICAL STORY ---------- */
.story-track {
  max-width: 800px;
  margin: 2.5rem auto 0;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.story-chapter {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--ease-soft), transform 0.7s var(--ease-soft);
}

.story-chapter.in-view {
  opacity: 1;
  transform: translateY(0);
}

.story-chapter:nth-child(even) {
  flex-direction: row-reverse;
  text-align: right;
}

.story-emoji {
  font-size: clamp(2.6rem, 9vw, 4rem);
  flex-shrink: 0;
  animation: bob 4s ease-in-out infinite;
}

.story-body h3 {
  font-family: var(--font-display);
  color: var(--purple-500);
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  margin: 0 0 0.4rem;
}

.story-body p {
  color: var(--text);
  line-height: 1.55;
}

/* ---------- 13. BIRTHDAY MESSAGE ---------- */
.message {
  display: flex;
  justify-content: center;
}

.message-card {
  max-width: 620px;
  width: 100%;
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}

.message-lines {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.message-lines .line {
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  color: var(--text);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s var(--ease-soft);
}

.message-lines .line.show {
  opacity: 1;
  transform: translateY(0);
}

.message-lines .line.highlight {
  font-family: var(--font-script);
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: var(--pink-400);
}

.message-lines .line.signature {
  font-family: var(--font-script);
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--purple-400);
  margin-top: 0.6rem;
}

/* ---------- 14. INTERACTIVE CAKE ---------- */
.cake-section {
  text-align: center;
}

.cake-stage {
  perspective: 900px;
  margin: 3rem auto 1rem;
  width: min(320px, 80vw);
  height: 320px;
  display: grid;
  place-items: center;
}

.cake-clickable {
  background: none;
  display: block;
}

.cake3d {
  position: relative;
  width: 220px;
  height: 220px;
  transform-style: preserve-3d;
  transform: rotateX(12deg);
  margin: 0 auto;
}

.cake-plate {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 26px;
  background: linear-gradient(180deg, #ffffff, #e0d0f0);
  border-radius: 50%;
  box-shadow: 0 18px 30px -10px rgba(138, 95, 208, 0.5);
}

.cake-layer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--pink-300), var(--pink-400));
  box-shadow: inset 0 -8px 12px rgba(224, 69, 123, 0.3);
}

.cake-layer-2 {
  bottom: 0;
  width: 220px;
  height: 80px;
}

.cake-layer-1 {
  bottom: 74px;
  width: 170px;
  height: 66px;
  background: linear-gradient(180deg, var(--pink-200), var(--pink-300));
}

.cake-top {
  position: absolute;
  bottom: 134px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 40px;
  border-radius: 16px 16px 8px 8px;
  background: linear-gradient(180deg, #fff6fb, var(--pink-200));
  box-shadow: inset 0 -6px 10px rgba(255, 158, 199, 0.4);
}

/* Frosting drips */
.cake-layer-2::before,
.cake-layer-1::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 20px;
  background:
    radial-gradient(circle at 12% 0, #fff6fb 10px, transparent 11px),
    radial-gradient(circle at 34% 0, #fff6fb 12px, transparent 13px),
    radial-gradient(circle at 56% 0, #fff6fb 10px, transparent 11px),
    radial-gradient(circle at 78% 0, #fff6fb 12px, transparent 13px),
    radial-gradient(circle at 98% 0, #fff6fb 10px, transparent 11px);
}

.candles {
  position: absolute;
  bottom: 172px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 5;
}

.candle {
  position: relative;
  width: 12px;
  height: 46px;
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, #ff9ec7, #ff9ec7 6px, #fff 6px, #fff 12px);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.candle:hover { transform: translateY(-3px); }

.flame {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 22px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff2b0, #ffb347 45%, #ff6a00 80%);
  box-shadow: 0 0 16px 4px rgba(255, 160, 60, 0.7);
  transform-origin: bottom center;
  animation: flicker 0.6s ease-in-out infinite alternate;
}

@keyframes flicker {
  from { transform: translateX(-50%) scale(1) rotate(-3deg); }
  to { transform: translateX(-50%) scale(1.12) rotate(3deg); }
}

.candle.out .flame {
  opacity: 0;
  transform: translateX(-50%) scale(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.smoke {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(200, 200, 210, 0.7);
  transform: translateX(-50%);
  animation: smoke-rise 1.2s ease-out forwards;
  pointer-events: none;
}

@keyframes smoke-rise {
  0% { opacity: 0.8; transform: translate(-50%, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(2); }
}

.cake-done {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  color: var(--pink-400);
  min-height: 1.6em;
  margin-top: 1rem;
}

/* ---------- 15. FOOTBALL MINI GAME ---------- */
.football {
  text-align: center;
}

.pitch {
  position: relative;
  max-width: 680px;
  height: 360px;
  margin: 2.5rem auto 0;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(180deg, #7bd48a 0 40px, #6fce7f 40px 80px);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.goal {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 110px;
  border: 6px solid var(--white);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.goal-net {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.6;
}

.goalie {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.4rem;
  transition: transform 0.25s ease;
}

.football {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  background: none;
  transition: transform 0.2s ease;
  z-index: 4;
}

.football:hover { transform: translateX(-50%) scale(1.1) rotate(15deg); }

.football.kick {
  animation: shoot 0.9s var(--ease-soft) forwards;
}

@keyframes shoot {
  0% { transform: translate(-50%, 0) scale(1) rotate(0); }
  60% { transform: translate(-50%, -230px) scale(0.6) rotate(540deg); }
  100% { transform: translate(-50%, -220px) scale(0.55) rotate(720deg); opacity: 0.9; }
}

.goal.scored { animation: net-shake 0.5s ease; }

@keyframes net-shake {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(-53%); }
  75% { transform: translateX(-47%); }
}

.crowd {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.6rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.crowd.cheer {
  opacity: 1;
  animation: bob 0.6s ease-in-out infinite;
}

/* Pitch fades away when the goal is scored, so nothing overlaps the wish */
.pitch {
  transition: opacity 0.5s ease, transform 0.5s var(--ease-soft);
}
.pitch.hide {
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}

.trophy-reveal {
  text-align: center;
  min-height: 4rem;
  margin-top: 1.4rem;
}

/* Full birthday wish revealed after scoring */
.football-wish {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(1.6rem, 5vw, 2.6rem);
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: pop-in 0.6s var(--ease-soft) both;
}
.wish-trophy {
  font-size: clamp(3rem, 12vw, 5rem);
  animation: bob 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(217, 154, 28, 0.5));
}
.wish-goal {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-deep);
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  margin-top: 0.2rem;
}
.wish-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  margin: 0.6rem 0;
  background: linear-gradient(90deg, var(--pink-400), var(--purple-400), var(--blue-300));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wish-line {
  color: var(--text);
  font-size: clamp(1rem, 3vw, 1.25rem);
  margin: 0.3rem 0;
}
.wish-again { margin-top: 1.2rem; }

.trophy-reveal .trophy {
  display: inline-block;
  font-size: 3.5rem;
  animation: pop-in 0.7s var(--ease-soft) both, bob 3s 0.7s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(217, 154, 28, 0.5));
}

.trophy-reveal .superstar {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 4vw, 2rem);
  color: var(--gold-deep);
  margin-top: 0.4rem;
  animation: pop-in 0.7s 0.2s var(--ease-soft) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.3); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- 16. CERTIFICATE ---------- */
.cert {
  max-width: 560px;
  margin: 2.5rem auto 1.5rem;
  padding: 8px;
  background: linear-gradient(135deg, var(--gold), #fff2c2, var(--gold-deep));
  position: relative;
}

.cert-ribbon {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 90px;
  background: linear-gradient(180deg, var(--pink-400), var(--purple-400));
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  box-shadow: 0 8px 16px rgba(169, 127, 224, 0.5);
  z-index: 3;
}

.cert-inner {
  background: linear-gradient(160deg, #fffdf8, #fff2f8);
  border: 2px dashed var(--gold-deep);
  border-radius: 16px;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.2rem, 4vw, 2.5rem) 2rem;
  text-align: center;
}

.cert-seal {
  font-size: 3rem;
  filter: drop-shadow(0 6px 12px rgba(217, 154, 28, 0.4));
}

.cert-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  color: var(--gold-deep);
  margin-top: 0.4rem;
}

.cert-awarded {
  color: var(--text-soft);
  margin-top: 1rem;
}

.cert-name {
  font-family: var(--font-script);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  color: var(--pink-400);
  line-height: 1.1;
  margin: 0.2rem 0;
}

.cert-reason {
  color: var(--text);
  max-width: 34ch;
  margin: 0.6rem auto 0;
}

.cert-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  border-top: 1px solid rgba(217, 154, 28, 0.3);
  padding-top: 1rem;
}

.certificate { text-align: center; }

/* ---------- 17. GRAND FINALE + FOOTER ---------- */
.finale {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  text-align: center;
  overflow: hidden;
  /* Keep the birthday greeting clear of the sticky top bar */
  padding-top: clamp(90px, 12vh, 140px);
  padding-bottom: clamp(2rem, 6vw, 4rem);
}

.finale-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 120%, #3a2a6b, #1a1030 70%);
}

.finale-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 20%, #fff, transparent),
    radial-gradient(2px 2px at 80% 50%, #fff, transparent),
    radial-gradient(1px 1px at 35% 60%, #fff, transparent),
    radial-gradient(2px 2px at 70% 75%, #fff, transparent);
  background-repeat: repeat;
  animation: twinkle 3s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.finale-content {
  position: relative;
  z-index: 3;
  color: var(--white);
}

.finale-crown {
  font-size: clamp(3rem, 12vw, 5.5rem);
  animation: bob 3s ease-in-out infinite;
}

.finale-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.15;
  margin: 0.5rem 0;
  text-shadow: 0 6px 24px rgba(255, 119, 176, 0.6);
}

.finale-sub {
  font-family: var(--font-script);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: var(--pink-200);
  margin-bottom: 2rem;
}

.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* ---------- 18. SECRET EASTER-EGG PAGE ---------- */
.secret-page {
  background: radial-gradient(ellipse at 50% 30%, #5b3f8a, #1a1030 75%);
}

.secret-inner {
  text-align: center;
  color: var(--white);
  animation: pop-in 0.7s var(--ease-soft) both;
  padding: 2rem;
}

.secret-crown {
  font-size: clamp(4rem, 15vw, 7rem);
  animation: bob 2.5s ease-in-out infinite;
}

.secret-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 3rem);
  background: linear-gradient(90deg, var(--gold), var(--pink-300), var(--gold));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.secret-text {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  margin-top: 0.8rem;
  color: var(--pink-100);
}

.secret-sparkles {
  font-size: 2rem;
  margin-top: 1.4rem;
  letter-spacing: 0.4rem;
  animation: bob 3s ease-in-out infinite;
}

/* ---------- 19. REVEAL-ON-SCROLL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.9s var(--ease-soft), transform 0.9s var(--ease-soft);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 20. CELEBRATION CANVAS ---------- */
.celebration-canvas {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
}

/* ---------- 21. RESPONSIVE ---------- */
@media (max-width: 640px) {
  .story-chapter,
  .story-chapter:nth-child(even) {
    flex-direction: column;
    text-align: center;
  }

  .modal-nav {
    width: 46px;
    height: 46px;
    font-size: 1.6rem;
  }

  .pitch {
    height: 300px;
  }

  /* Collapsible mobile nav */
  .nav-toggle { display: grid; }
  .topnav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.6rem;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-brd);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding-block: 0;
  }
  .topnav.open {
    max-height: 340px;
    padding-block: 0.6rem;
  }
  .nav-link { text-align: center; }

  .memory-grid { max-width: 300px; gap: 0.4rem; }
}

@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================================= */
/*  EVERGREEN ADDITIONS — Nav, Arcade, Games, Diary, About        */
/* ============================================================= */

/* ---------- Ghost button + shared inputs ---------- */
.btn-ghost {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--purple-500);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-brd);
  padding: 0.7em 1.4em;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.8); }

.text-input,
.text-area {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--glass-brd);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
[data-theme="dark"] .text-input,
[data-theme="dark"] .text-area { background: rgba(20, 14, 38, 0.6); }
.text-input:focus,
.text-area:focus {
  outline: none;
  border-color: var(--purple-400);
  box-shadow: 0 0 0 4px rgba(169, 127, 224, 0.22);
}
.text-area { resize: vertical; line-height: 1.55; }

.field-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--purple-500);
  margin: 1rem 0 0.4rem;
  font-size: 0.95rem;
}

/* ---------- Top navigation ---------- */
.topnav {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.nav-link {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--purple-500);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-link:hover,
.nav-link.active {
  background: linear-gradient(135deg, var(--pink-300), var(--purple-400));
  color: var(--white);
}
.nav-toggle { display: none; }

/* ---------- Game Arcade ---------- */
.games { text-align: center; }

.arcade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(1rem, 3vw, 1.6rem);
  max-width: 820px;
  margin: 2.5rem auto 0;
}

.arcade-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.6rem 1rem;
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform 0.3s var(--ease-soft), box-shadow 0.3s ease;
}
.arcade-card:hover,
.arcade-card:focus-visible {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 26px 50px -18px rgba(169, 127, 214, 0.5);
}
.arcade-card.selected {
  outline: 3px solid var(--purple-400);
}
.arcade-emoji { font-size: 2.6rem; }
.arcade-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--purple-500);
}
.arcade-desc { color: var(--text-soft); font-size: 0.9rem; }

/* Game stage (host for the active game) */
.game-stage {
  max-width: 640px;
  margin: 2rem auto 0;
  padding: clamp(1.2rem, 4vw, 2rem);
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.game-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--purple-500);
  font-size: 1.3rem;
}
.game-score {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--pink-400);
}
.game-msg {
  min-height: 1.5em;
  margin-top: 0.8rem;
  font-family: var(--font-display);
  color: var(--pink-400);
  font-weight: 600;
}

/* Memory Match */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  max-width: 380px;
  margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1;
  border-radius: 14px;
  font-size: clamp(1.6rem, 8vw, 2.2rem);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pink-300), var(--purple-400));
  color: transparent;
  border: none;
  transition: transform 0.3s var(--ease-soft), background 0.3s ease;
  transform-style: preserve-3d;
}
.mem-card::before { content: "❔"; color: rgba(255, 255, 255, 0.9); }
.mem-card.flipped,
.mem-card.matched {
  background: rgba(255, 255, 255, 0.85);
  color: initial;
}
.mem-card.flipped::before,
.mem-card.matched::before { content: ""; }
.mem-card.flipped,
.mem-card.matched { animation: flip-in 0.4s var(--ease-soft); }
.mem-card.matched { box-shadow: 0 0 0 3px var(--gold); cursor: default; }
@keyframes flip-in {
  from { transform: rotateY(90deg); }
  to { transform: rotateY(0); }
}

/* Balloon Pop + Star Catcher play area */
.play-area {
  position: relative;
  height: 340px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #cfe8ff, #eddcff);
  touch-action: none;
  user-select: none;
}
[data-theme="dark"] .play-area { background: linear-gradient(180deg, #23204a, #2e2350); }

.balloon {
  position: absolute;
  bottom: -60px;
  font-size: 2.4rem;
  cursor: pointer;
  will-change: transform;
}
.balloon.pop { animation: pop-away 0.3s ease forwards; }
@keyframes pop-away {
  to { transform: scale(1.8); opacity: 0; }
}

.falling {
  position: absolute;
  top: -40px;
  font-size: 2rem;
  will-change: transform;
  pointer-events: none;
}
.basket {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.6rem;
  pointer-events: none;
}

/* ---------- Diary / Blog ---------- */
.blog { text-align: center; }
.blog-toolbar {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0 1.5rem;
}
.import-label { display: inline-flex; align-items: center; }

.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto;
  text-align: left;
}
.blog-card {
  position: relative;
  padding: 1.3rem 1.3rem 3.2rem;
  border-radius: var(--radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform 0.3s var(--ease-soft), box-shadow 0.3s ease;
}
.blog-card:hover { transform: translateY(-5px); box-shadow: 0 24px 44px -18px rgba(169, 127, 214, 0.5); }
.blog-card-mood { font-size: 1.8rem; }
.blog-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--purple-500);
  font-size: 1.2rem;
  margin: 0.3rem 0;
}
.blog-card-date { color: var(--text-soft); font-size: 0.8rem; }
.blog-card-excerpt { color: var(--text); margin-top: 0.5rem; line-height: 1.5; font-size: 0.95rem; }
.blog-card-actions {
  position: absolute;
  bottom: 0.8rem;
  right: 1rem;
  display: flex;
  gap: 0.4rem;
}
.mini-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--glass-brd);
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s ease, background 0.2s ease;
}
.mini-btn:hover { transform: scale(1.12); background: rgba(255, 255, 255, 0.9); }
.blog-empty {
  grid-column: 1 / -1;
  color: var(--text-soft);
  padding: 2rem;
  font-size: 1.05rem;
}
.blog-note { color: var(--text-soft); font-size: 0.85rem; margin-top: 1.5rem; }

/* Editor + Reader modals */
.editor-card,
.reader-card {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(1.6rem, 5vw, 2.4rem);
  text-align: left;
}
.editor-heading,
.reader-content h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--purple-500);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.editor-close { position: absolute; top: 12px; right: 12px; background: rgba(157,111,214,0.15); }

.mood-picker { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.mood-opt {
  font-size: 1.6rem;
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.mood-opt:hover { transform: scale(1.1); }
.mood-opt.selected { border-color: var(--purple-400); background: rgba(255, 255, 255, 0.95); }

.editor-actions { display: flex; gap: 0.6rem; margin-top: 1.4rem; }

.reader-content .reader-mood { font-size: 2.6rem; }
.reader-content .reader-date { color: var(--text-soft); font-size: 0.85rem; margin-bottom: 1rem; }
.reader-content .reader-body { line-height: 1.7; white-space: pre-wrap; color: var(--text); }

/* ---------- About Me ---------- */
.about { text-align: center; }
.about-card {
  max-width: 560px;
  margin: 2.5rem auto 0;
  padding: clamp(1.8rem, 5vw, 3rem);
  text-align: center;
}
.about-avatar {
  font-size: 3.4rem;
  filter: drop-shadow(0 8px 16px rgba(217, 154, 28, 0.35));
}
.about-view { margin: 1.2rem 0; text-align: left; }
.about-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--glass-brd);
}
.about-row:last-child { border-bottom: none; }
.about-key { font-family: var(--font-display); font-weight: 600; color: var(--purple-500); }
.about-val { color: var(--text); text-align: right; }
.about-form { text-align: left; margin: 1.2rem 0; }
.about-form .field-label:first-child { margin-top: 0; }
.about-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Gallery lock + uploads ---------- */
.gallery-lock { display: flex; justify-content: center; margin-top: 2rem; }
.lock-card {
  text-align: center;
  padding: clamp(1.8rem, 5vw, 3rem);
  width: min(440px, 92vw);
}
.lock-emoji { font-size: 2.6rem; margin-bottom: 0.5rem; }
.lock-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--purple-500);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
}
.lock-hint { color: var(--text-soft); margin: 0.4rem 0 1.3rem; }
.lock-card.shake { animation: shake 0.5s; }

.gallery-toolbar {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0 2rem;
}
.gallery-note { text-align: center; color: var(--text-soft); font-size: 0.85rem; margin-top: 1.5rem; }

.frame-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 0.9rem;
  z-index: 6;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.magic-frame:hover .frame-del,
.magic-frame:focus-within .frame-del { opacity: 1; }
.frame-del:hover { transform: scale(1.12); }

/* ---------- Arcade group titles ---------- */
.arcade-group-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--purple-500);
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  text-align: center;
  margin: 2.2rem 0 0.4rem;
}
#arcade-mind, #arcade-football, #arcade-reflex { margin-top: 1rem; }

/* ---------- Simon / Magic Sequence ---------- */
.simon-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  max-width: 300px;
  margin: 0 auto;
}
.simon-pad {
  aspect-ratio: 1;
  border: none;
  border-radius: 18px;
  font-size: 2.4rem;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.simon-pad:hover { transform: scale(1.03); }
.simon-pad.lit {
  opacity: 1;
  transform: scale(1.06);
  box-shadow: 0 0 30px 6px rgba(255, 255, 255, 0.9);
}

/* ---------- Tic-Tac-Toe ---------- */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 300px;
  margin: 0 auto;
}
.ttt-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  font-size: clamp(1.8rem, 9vw, 2.6rem);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
[data-theme="dark"] .ttt-cell { background: rgba(20, 14, 38, 0.55); }
.ttt-cell:hover { transform: scale(1.05); background: rgba(255, 255, 255, 0.95); }

/* ---------- Counting Fun ---------- */
.count-display {
  text-align: center;
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  line-height: 1.4;
  min-height: 3rem;
  max-width: 420px;
  margin: 0 auto 1rem;
  word-break: break-word;
}
.count-q {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--purple-500);
  margin-bottom: 1rem;
}
.count-options { display: flex; gap: 0.8rem; justify-content: center; }
.count-opt {
  width: 64px; height: 64px;
  border-radius: 16px;
  border: 2px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.75);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--purple-500);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.count-opt:hover { transform: translateY(-3px) scale(1.05); }
.count-opt.right { background: #b6f0c2; border-color: #4bbf6b; }
.count-opt.wrong { background: #ffc2d4; border-color: #e0457b; }

/* ---------- Penalty Shootout ---------- */
.penalty-pitch {
  position: relative;
  height: 240px;
  border-radius: 18px;
  background: repeating-linear-gradient(180deg, #7bd48a 0 30px, #6fce7f 30px 60px);
  overflow: hidden;
  margin-bottom: 1rem;
}
.pen-goal {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 90px;
  border: 6px solid #fff;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.5) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.5) 1px, transparent 1px);
  background-size: 20px 20px;
}
.pen-keeper {
  position: absolute;
  bottom: 4px;
  left: 50%;
  margin-left: -18px;
  font-size: 2.4rem;
  transition: transform 0.4s var(--ease-soft);
}
.pen-ball {
  position: absolute;
  bottom: 14px;
  left: 50%;
  margin-left: -22px;
  font-size: 2.8rem;
  transition: transform 0.6s var(--ease-soft);
}
.pen-controls { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.pen-dir { padding: 0.7em 1.1em; font-size: 1rem; }
.pen-dir:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Keepie-Uppies ---------- */
.ku-ball {
  position: absolute;
  font-size: 3rem;
  width: 54px; height: 54px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

/* ---------- Diary writing prompt ---------- */
.diary-prompt {
  max-width: 620px;
  margin: 1.8rem auto 0;
  padding: clamp(1.2rem, 4vw, 1.8rem);
  text-align: center;
}
.diary-prompt-emoji { font-size: 2rem; }
.diary-prompt-text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--purple-500);
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  margin: 0.5rem auto 1rem;
  line-height: 1.45;
  max-width: 34ch;
}
.diary-prompt-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Mobile polish ---------- */
/* Remove the grey tap flash and the 300ms tap delay on touch devices */
body { -webkit-tap-highlight-color: transparent; }
.btn, .btn-ghost, .icon-btn, .arcade-card, .mem-card, .simon-pad,
.ttt-cell, .count-opt, .mini-btn, .mood-opt, .nav-link,
.magic-frame, button {
  touch-action: manipulation;
}

/* Use the *stable/dynamic* viewport height so mobile URL bars don't cause jumps */
@supports (height: 100svh) {
  .hero, .finale { min-height: 100svh; }
  .screen { min-height: 100svh; }
}

@media (max-width: 480px) {
  /* Comfortable two-up photo grid on phones */
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .magic-frame { padding: 6px; border-radius: 16px; }

  /* Slightly smaller control icons so the top bar never crowds */
  .icon-btn { width: 40px; height: 40px; font-size: 1.05rem; }
  .topbar { padding: 0.5rem 0.8rem; }
  .topbar-controls { gap: 0.35rem; }

  /* Games fit small screens */
  .arcade { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .arcade-card { padding: 1.1rem 0.6rem; }
  .arcade-emoji { font-size: 2rem; }
  .arcade-name { font-size: 1rem; }
  .arcade-desc { font-size: 0.78rem; }
  .game-stage { padding: 1rem; }
  .pen-goal { width: min(240px, 80%); }
  .count-opt { width: 56px; height: 56px; font-size: 1.4rem; }
  .play-area, .penalty-pitch { height: 300px; }
}

/* ---------- 22. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1ms !important;
    scroll-behavior: auto !important;
  }

  .aurora,
  .layer-clouds,
  .flame {
    animation: none !important;
  }

  .reveal,
  .story-chapter,
  .message-lines .line {
    opacity: 1 !important;
    transform: none !important;
  }
}
