:root {
  --bg: #141327;
  --bg2: #1d1b38;
  --dark-country: #23213f;
  --dark-country-stroke: #2e2b52;
  --lit-country: #ff9ec7;
  --lit-country-hover: #ffb8d6;
  --pink: #ff7eb3;
  --cream: #fff4e0;
  --paper: #fffaf2;
  --ink: #5a4636;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 10%, #221f45 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, #2a1a3a 0%, transparent 55%),
    var(--bg);
  font-family: 'Quicksand', sans-serif;
  color: var(--cream);
}

/* ---------- welcome splash ---------- */
#welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 25% 15%, #2b2757 0%, transparent 55%),
    radial-gradient(ellipse at 75% 85%, #3a2050 0%, transparent 55%),
    var(--bg);
  transition: opacity 0.9s ease;
}
#welcome-screen.leaving {
  opacity: 0;
  pointer-events: none;
}

.welcome-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 0 24px;
  transition: transform 0.9s cubic-bezier(0.6, 0, 0.3, 1), opacity 0.7s ease;
}
#welcome-screen.leaving .welcome-inner {
  transform: scale(1.6);
  opacity: 0;
}

.welcome-logo {
  width: min(150px, 34vw);
  border-radius: 50%;
  border: 5px solid rgba(255, 211, 230, 0.85);
  box-shadow: 0 0 40px rgba(255, 126, 179, 0.55);
  animation:
    logo-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    bob 3s ease-in-out 0.8s infinite;
}
@keyframes logo-pop {
  from { transform: scale(0) rotate(-25deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.welcome-title {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(42px, 9vw, 74px);
  line-height: 1;
}
.welcome-title span {
  display: inline-block;
  background: linear-gradient(90deg, #ffb8d6, #ff7eb3, #ffd9a0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  animation: letter-rise 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(0.45s + var(--i) * 0.07s);
}
@keyframes letter-rise {
  from { transform: translateY(38px) rotate(8deg); opacity: 0; }
  to { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.welcome-couple {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(18px, 3.5vw, 24px);
  animation: fade-rise 0.7s ease 1.3s both;
}
.heart-beat {
  display: inline-block;
  animation: heart-beat 1.2s ease-in-out 1.3s infinite;
}
@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.35); }
  40% { transform: scale(1); }
  55% { transform: scale(1.2); }
}

.welcome-tag {
  font-size: clamp(14px, 2.6vw, 16px);
  line-height: 1.5;
  opacity: 0.8;
  animation: fade-rise 0.7s ease 1.55s both;
}
@keyframes fade-rise {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 0.85; }
}

#enter-btn {
  margin-top: 8px;
  animation: fade-rise 0.7s ease 1.8s both, btn-throb 2s ease-in-out 2.6s infinite;
}
.cute-btn.big {
  font-size: 19px;
  padding: 14px 30px;
}
@keyframes btn-throb {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 126, 179, 0.4); transform: scale(1); }
  50% { box-shadow: 0 4px 26px rgba(255, 126, 179, 0.8); transform: scale(1.05); }
}

.floaties { position: absolute; inset: 0; z-index: 1; }
.floaty {
  position: absolute;
  bottom: -70px;
  opacity: 0.4;
  animation: float-up linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 126, 179, 0.3));
}
@keyframes float-up {
  to { transform: translateY(-115vh) rotate(340deg); }
}

/* ---------- header ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.8s ease 0.4s, transform 0.8s ease 0.4s;
}
.pre-intro .topbar {
  opacity: 0;
  transform: translateY(-26px);
}
.pre-intro #about-btn { opacity: 0; pointer-events: none; }
#about-btn { transition: opacity 0.8s ease 0.6s, transform 0.15s; }
.logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 126, 179, 0.45);
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-5px) rotate(3deg); }
}
.title-wrap h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 30px;
  background: linear-gradient(90deg, #ffb8d6, #ff7eb3, #ffd9a0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}
.tagline { font-size: 13px; opacity: 0.75; }
.stats {
  margin-left: auto;
  font-family: 'Baloo 2', cursive;
  font-size: 14px;
  background: rgba(255, 126, 179, 0.12);
  border: 1px solid rgba(255, 126, 179, 0.35);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- map ---------- */
#map-container { position: fixed; inset: 0; }
#map { width: 100%; height: 100%; display: block; }

.country {
  fill: var(--dark-country);
  stroke: var(--dark-country-stroke);
  stroke-width: 0.5;
  transition: fill 0.3s;
}
.country.lit {
  fill: var(--lit-country);
  stroke: #ffd3e6;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(255, 126, 179, 0.65));
  animation: glow 2.6s ease-in-out infinite;
}
.country.lit:hover { fill: var(--lit-country-hover); }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 126, 179, 0.45)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 126, 179, 0.85)); }
}

.city-marker { cursor: pointer; }
.city-marker circle.pulse {
  fill: none;
  stroke: var(--pink);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { stroke-opacity: 0.9; }
  100% { stroke-opacity: 0; }
}
.city-marker text.heart { font-size: 10px; text-anchor: middle; }
.city-marker text.label {
  font-family: 'Baloo 2', cursive;
  fill: #fff;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(20, 19, 39, 0.8);
  stroke-width: 3px;
}

#tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Baloo 2', cursive;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  z-index: 30;
  transform: translate(-50%, -140%);
}

#empty-state {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: rgba(255, 244, 224, 0.08);
  border: 1px dashed rgba(255, 126, 179, 0.5);
  border-radius: 20px;
  padding: 18px 28px;
  z-index: 15;
}
#empty-state img { width: 70px; border-radius: 50%; margin-bottom: 8px; }
#empty-state p { font-family: 'Baloo 2', cursive; font-size: 16px; }

/* ---------- buttons ---------- */
.cute-btn {
  font-family: 'Baloo 2', cursive;
  font-size: 15px;
  padding: 9px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9ec7, #ff7eb3);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 126, 179, 0.4);
  transition: transform 0.15s;
}
.cute-btn:hover { transform: scale(1.06); }
.cute-btn:active { transform: scale(0.96); }
#back-btn { position: fixed; top: 90px; left: 20px; z-index: 25; }

.hidden { display: none !important; }

/* ---------- hall of yums ---------- */
#board-btn {
  position: fixed;
  bottom: 20px;
  right: 76px;
  z-index: 25;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 20px;
  transition: opacity 0.8s ease 0.7s, transform 0.15s;
}
.pre-intro #board-btn { opacity: 0; pointer-events: none; }

#board-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 9, 25, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadein 0.3s;
}
#board-card {
  width: min(480px, 92vw);
  max-height: 86vh;
  background: var(--paper);
  color: var(--ink);
  border-radius: 26px;
  border: 3px solid #ffd3e6;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: bookdrop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
#board-card h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  color: #c2447a;
}

.board-stats { display: flex; gap: 10px; width: 100%; }
.stat-chip {
  flex: 1;
  background: #ffeef5;
  border-radius: 16px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-chip .num {
  font-family: 'Baloo 2', cursive;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: #c2447a;
}
.stat-chip .lbl { font-size: 11.5px; font-weight: 600; opacity: 0.65; text-align: center; }

.board-tabs { display: flex; gap: 6px; width: 100%; }
.board-tab {
  flex: 1;
  font-family: 'Baloo 2', cursive;
  font-size: 14px;
  padding: 7px 0;
  border-radius: 999px;
  border: 2px solid #ffd3e6;
  background: transparent;
  color: #c2447a;
  cursor: pointer;
  transition: transform 0.15s;
}
.board-tab:hover { transform: scale(1.04); }
.board-tab.active {
  background: linear-gradient(135deg, #ff9ec7, #ff7eb3);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 126, 179, 0.4);
}

#board-list {
  width: 100%;
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fdf1e3;
  border-radius: 14px;
  padding: 8px 12px;
}
.board-row .rank {
  width: 28px;
  text-align: center;
  font-family: 'Baloo 2', cursive;
  font-size: 18px;
  font-weight: 800;
  color: #b07d2b;
  flex-shrink: 0;
}
.board-row .thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #ffe1ee;
  flex-shrink: 0;
}
.board-row .row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.board-row .row-title {
  font-family: 'Baloo 2', cursive;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-row .row-sub { font-size: 12px; opacity: 0.65; }
.board-row .row-score {
  font-family: 'Baloo 2', cursive;
  font-size: 19px;
  font-weight: 800;
  color: #c2447a;
  background: #ffeef5;
  border-radius: 999px;
  padding: 4px 13px;
  flex-shrink: 0;
}
.board-row .row-score.pending { opacity: 0.45; }
.board-empty {
  text-align: center;
  font-family: 'Baloo 2', cursive;
  opacity: 0.6;
  padding: 20px 0;
}

/* ---------- about card ---------- */
#about-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 25;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 20px;
}
#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 9, 25, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadein 0.3s;
}
#about-card {
  width: min(440px, 90vw);
  background: var(--paper);
  color: var(--ink);
  border-radius: 26px;
  border: 3px solid #ffd3e6;
  padding: 28px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: bookdrop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
#about-card img {
  width: 110px;
  border-radius: 50%;
  border: 4px solid #ffe1ee;
}
#about-card h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  color: #c2447a;
}
#about-card p { font-size: 15px; line-height: 1.45; }
.about-scores { display: flex; gap: 8px; width: 100%; }
.about-scores .score-badge { padding: 8px 4px; }
.about-hint { opacity: 0.75; font-size: 13.5px !important; }

/* ---------- the book ---------- */
#book-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 9, 25, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadein 0.3s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

#book-scene {
  perspective: 1800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#book {
  position: relative;
  width: min(560px, 92vw);
  height: min(740px, 80vh);
  transform-style: preserve-3d;
  animation: bookdrop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bookdrop {
  from { transform: translateY(-60px) scale(0.8); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

#book-spine {
  position: absolute;
  inset: 0;
  border-radius: 8px 16px 16px 8px;
  background: linear-gradient(135deg, #b3446c, #8e3357);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  transform: translateZ(-8px);
}

#book-cover {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 8px 16px 16px 8px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.14), transparent 45%),
    linear-gradient(135deg, #ff8fbc, #e26a99);
  border: 3px solid #ffd3e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: transform 1s cubic-bezier(0.6, 0, 0.3, 1);
}
#book-cover img {
  width: 45%;
  border-radius: 50%;
  border: 4px solid var(--cream);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
#book-cover h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 34px;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
}
#book-cover p {
  font-family: 'Baloo 2', cursive;
  font-size: 18px;
  color: #fff;
  background: rgba(0,0,0,0.15);
  padding: 4px 16px;
  border-radius: 999px;
}
#book.open #book-cover { transform: rotateY(-160deg); }

#book-pages { position: absolute; inset: 0; }

.page {
  position: absolute;
  inset: 0;
  border-radius: 6px 14px 14px 6px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.07), transparent 8%),
    var(--paper);
  color: var(--ink);
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform-origin: left center;
  backface-visibility: hidden;
  transition: transform 0.8s cubic-bezier(0.6, 0, 0.3, 1);
  box-shadow: inset -3px 0 8px rgba(0,0,0,0.05);
  overflow: hidden;
}
.page.flipped { transform: rotateY(-160deg); pointer-events: none; }

.page .photo-frame {
  width: 100%;
  height: 48%;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid #ffe1ee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  background: #f3e8dc;
  transform: rotate(-1.2deg);
}
.page .photo-frame img { width: 100%; height: 100%; object-fit: cover; }

.page h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 27px;
  color: #c2447a;
  line-height: 1.15;
}
.page .place {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.75;
}
.page .place a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px dashed #c2447a;
}
.page .place a:hover { color: #c2447a; }
.page .scores { display: flex; gap: 8px; margin-top: 2px; }
.score-badge {
  flex: 1;
  text-align: center;
  border-radius: 14px;
  padding: 7px 4px;
  font-family: 'Baloo 2', cursive;
}
.score-badge .who { font-size: 13px; display: block; opacity: 0.8; }
.score-badge .val { font-size: 24px; font-weight: 800; }
.score-badge.p { background: #e8f1ff; color: #4a6fa5; }
.score-badge.e { background: #ffeef5; color: #c2447a; }
.score-badge.pe { background: #fff3d6; color: #b07d2b; }
.score-badge .val.pending { font-size: 12px; opacity: 0.6; }

.page .note {
  font-size: 15px;
  font-style: italic;
  background: #fdf1e3;
  border-radius: 10px;
  padding: 8px 10px;
  flex: 1;
  overflow: auto;
}
.page .date {
  font-family: 'Baloo 2', cursive;
  font-size: 12px;
  text-align: right;
  opacity: 0.6;
}

#book-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
#page-indicator {
  font-family: 'Baloo 2', cursive;
  font-size: 15px;
  min-width: 70px;
  text-align: center;
}

@media (max-width: 640px) {
  .tagline { display: none; }
  .stats { display: none; }
  .title-wrap h1 { font-size: 24px; }
  .logo { width: 48px; height: 48px; }
}
