:root {
  --bg-deep: #0f0e17;
  --bg-soft: #1a1825;
  --accent: #e8a598;
  --accent-gold: #d4a574;
  --text: #f5f0eb;
  --text-muted: #b8b0a8;
  --card: rgba(255, 255, 255, 0.06);
  --glow: rgba(232, 165, 152, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Space background – moving starfield */
.stars,
.twinkling,
.stars-move {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.stars {
  background:
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.9), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 50px 160px, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 90px 40px, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.7), transparent);
  background-repeat: repeat;
  background-size: 200px 200px;
  background-position: 0 0;
  opacity: 0.85;
  animation: spaceDrift 45s linear infinite;
}

.stars-move {
  background:
    radial-gradient(1px 1px at 10px 20px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 60px 90px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 120px 50px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 180px 130px, rgba(255,255,255,0.4), transparent);
  background-repeat: repeat;
  background-size: 220px 180px;
  background-position: 0 0;
  opacity: 0.6;
  animation: spaceDrift 25s linear infinite reverse;
}

@keyframes spaceDrift {
  from { background-position: 0 0; }
  to { background-position: -400px 0; }
}

.twinkling {
  background: transparent;
  animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

/* Hero */
.hero {
  margin-bottom: 3rem;
}

.date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin: 0 0 0.5rem;
}

.title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 600;
  margin: 0 0 0.25rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}

.norwegian {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-style: italic;
  color: var(--accent);
  margin: 0.5rem 0 0.75rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  animation: fadeInUp 0.8s ease-out 0.35s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  animation: fadeInUp 0.8s ease-out 0.5s both;
}

.btn {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 1.2rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gold) 100%);
  color: var(--bg-deep);
  box-shadow: 0 4px 20px var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--glow);
}

.btn-secondary {
  background: var(--card);
  color: var(--accent);
  border: 1px solid rgba(232, 165, 152, 0.4);
}

.btn-secondary:hover {
  box-shadow: 0 0 20px rgba(232, 165, 152, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-game {
  background: linear-gradient(135deg, #7b68a6 0%, #9b87c4 100%);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(123, 104, 166, 0.4);
}

.btn-game:hover {
  box-shadow: 0 6px 28px rgba(123, 104, 166, 0.5);
}

/* Countdown to 14th birthday – always on its own row below the buttons */
.countdown-wrap {
  flex-basis: 100%;
  width: 100%;
  max-width: 420px;
  margin: 2.5rem auto 0;
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.countdown-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  letter-spacing: 0.05em;
}

.countdown-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.countdown-unit {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  min-width: 4rem;
  text-align: center;
}

.countdown-value {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.countdown-unit-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* Game section */
.game-section {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.game-section.hidden {
  display: none;
}

.game-panel {
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.35s ease-out;
  -webkit-user-select: none;
  user-select: none;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.game-score {
  font-size: 1rem;
  color: var(--text-muted);
}

.game-score strong {
  color: var(--accent);
  font-size: 1.25rem;
}

.game-close {
  position: static;
  width: 2rem;
  height: 2rem;
}

.game-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.game-wrap {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #0a0912;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  touch-action: manipulation;
}

.game-start,
.game-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.game-start {
  pointer-events: auto;
  cursor: pointer;
}

.game-start.hidden {
  display: none;
}

.game-over {
  pointer-events: auto;
  cursor: pointer;
}

.game-over.hidden {
  display: none;
}

.game-over p {
  margin: 0 0 0.5rem;
}

.game-over p:first-child {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.game-final-score {
  font-size: 1.1rem;
}

.game-final-score strong {
  color: var(--accent-gold);
}

.game-again {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem !important;
}

/* Subtle title hover */
.hero .title {
  cursor: default;
  transition: transform 0.2s ease;
}

.hero .title:hover {
  transform: scale(1.02);
}

/* Message modal */
.message-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.message-modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.message-content {
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 420px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.35s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.message-content h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  color: var(--accent);
  margin: 0 0 1rem;
}

.message-content p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}

.close-btn:hover {
  color: var(--text);
  background: var(--card);
}

/* Hearts container (floating hearts) */
.hearts-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.hearts-container .heart {
  position: absolute;
  top: 100vh; /* start at bottom so no flash at top */
  font-size: 1.5rem;
  animation: floatUp 4s ease-in forwards;
  opacity: 0.8;
}

@keyframes floatUp {
  from {
    transform: translateY(0) scale(0.5);
    opacity: 0.8;
  }
  to {
    transform: translateY(-100vh) translateY(-120px) scale(1);
    opacity: 0;
  }
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}
