:root {
  --bg-canvas: #ffd9e8;         /* backdrop behind the "phone" on desktop */
  --grouped: #fdeef4;           /* iOS grouped list bg, pink-tinted */
  --card: #ffffff;
  --ink: #462233;
  --ink-soft: #8a5a6e;
  --muted: #b08698;
  --pink: #ff4f93;
  --pink-deep: #ff2d7e;
  --pink-soft: #ffd8e7;
  --pink-faint: #fff2f7;
  --sep: #f3d9e4;
  --gold: #ffb02e;
  --nav-h: 46px;
  --tab-h: 58px;
  --shadow: 0 10px 26px rgba(255, 90, 150, 0.16);
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 50% -10%, #ffe7d2 0%, transparent 55%),
    var(--bg-canvas);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .nav-title, .large-title, .bday-title, .lb-name, .card h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ───────── App shell (phone column) ───────── */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  background: var(--grouped);
  position: relative;
  overflow-x: hidden;
}
@media (min-width: 480px) {
  body { padding: 22px 0; align-items: flex-start; }
  .app {
    min-height: calc(100dvh - 44px);
    border-radius: 44px;
    box-shadow: 0 30px 70px rgba(190, 40, 100, 0.28);
    overflow: hidden;
    outline: 8px solid #ffffff;
  }
  .navbar { border-radius: 44px 44px 0 0; }
}

/* ───────── Nav bar (frosted) ───────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: rgba(255, 240, 246, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.nav-title { text-align: center; font-size: 17px; color: var(--ink); }

/* ───────── Main scroll area ───────── */
.app-main {
  padding: 12px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 26px);
}

.screen { display: none; animation: fade 0.28s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.screen-head { padding: 8px 4px 12px; }
.large-title { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.large-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ───────── Birthday screen ───────── */
.balloons { position: absolute; inset: 0 0 auto 0; height: 0; pointer-events: none; z-index: 0; }
.balloons span {
  position: absolute;
  top: -10px;
  font-size: 30px;
  animation: rise linear infinite;
  opacity: 0.9;
}
.balloons span:nth-child(1) { left: 8%;  animation-duration: 15s; }
.balloons span:nth-child(2) { left: 28%; animation-duration: 19s; font-size: 24px; }
.balloons span:nth-child(3) { left: 52%; animation-duration: 13s; }
.balloons span:nth-child(4) { left: 72%; animation-duration: 21s; font-size: 26px; }
.balloons span:nth-child(5) { left: 88%; animation-duration: 17s; }
@keyframes rise {
  0% { transform: translateY(70vh) rotate(-6deg); opacity: 0; }
  15% { opacity: 0.9; }
  100% { transform: translateY(-30vh) rotate(6deg); opacity: 0; }
}

.bday-hero { text-align: center; padding: 30px 10px 18px; position: relative; z-index: 1; }
.bday-emoji { font-size: 74px; line-height: 1; filter: drop-shadow(0 8px 14px rgba(255,90,150,0.35)); animation: pop 0.7s cubic-bezier(.2,1.4,.5,1) both; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bday-title { margin: 14px 0 0; font-size: 34px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.bday-title span { display: block; font-size: 22px; color: var(--pink-deep); }
.bday-sub { margin: 12px auto 0; max-width: 320px; color: var(--ink-soft); font-size: 15.5px; }

.ios-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.bday-card { margin-top: 8px; text-align: center; position: relative; z-index: 1; }
.bday-card p { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.bday-card p b { color: var(--ink); }
.bday-card-soft { color: var(--muted) !important; }
.bday-card-badge {
  display: inline-block;
  margin-bottom: 14px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  color: #fff;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
}
.btn-primary {
  margin-top: 6px;
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--pink), var(--pink-deep));
  box-shadow: 0 8px 18px rgba(255, 60, 130, 0.34);
  cursor: pointer;
  transition: transform 0.12s;
  font-family: inherit;
}
.btn-primary:active { transform: scale(0.97); }

.tip {
  margin: 18px 4px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* confetti pieces */
.confetti-piece {
  position: fixed;
  top: -20px;
  z-index: 40;
  font-size: 18px;
  pointer-events: none;
  animation: conffall linear forwards;
}
@keyframes conffall {
  to { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ───────── Cards ───────── */
.grid { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.14s;
}
.card:active { transform: scale(0.992); }

.card-photo { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--pink-soft), #ffe7cf); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Swipe gallery */
.gallery { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--pink-soft), #ffe7cf); }
.gallery::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 44px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.26));
  pointer-events: none;
  z-index: 1;
}
.gallery-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track .slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: block;
  user-select: none;
}
.gallery .dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  z-index: 3;
}
.gallery .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, background 0.2s;
  pointer-events: auto;
  cursor: pointer;
}
.gallery .dot.on { background: #fff; transform: scale(1.35); }
.card-photo .area-tag, .gallery .area-tag {
  position: absolute; top: 12px; left: 12px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: var(--pink-deep);
  font-size: 12px; font-weight: 800;
  padding: 5px 12px; border-radius: 999px;
}
.card-body { padding: 16px 18px 20px; }
.card h3 { margin: 0; font-size: 20px; color: var(--ink); }
.card .meta { color: var(--muted); font-size: 13px; margin: 3px 0 0; }

/* Google rating row */
.g-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
}
.g-rating b { color: var(--ink); font-weight: 800; }
.g-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--sep);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #4285f4;
}
.g-stars {
  position: relative;
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1px;
  color: #ffd9a8;                 /* empty star colour */
  background: none;
}
.g-stars::before {
  content: "★★★★★";
  position: absolute;
  left: 0; top: 0;
  width: var(--pct);
  overflow: hidden;
  color: #ffb02e;                 /* filled star colour */
  white-space: nowrap;
}
.g-count { color: var(--muted); font-weight: 600; }

.card .cuisine {
  display: inline-block; margin-top: 10px;
  font-size: 12px; color: var(--pink-deep);
  background: var(--pink-soft); padding: 4px 12px;
  border-radius: 999px; font-weight: 700;
}
.card .blurb { color: var(--ink-soft); font-size: 14px; margin: 13px 0 0; line-height: 1.5; }

/* Pescetarian fit */
.pesc-pill {
  display: inline-block;
  margin: 10px 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}
.pesc-great { color: #0f8a5f; background: #d9f7e9; }
.pesc-some { color: #b8791a; background: #ffeecb; }
.pesc-veg { color: #0f8a7a; background: #d6f5ef; }
.pesc-note {
  margin-top: 12px;
  padding: 11px 13px;
  background: #eafaf2;
  border: 1.5px solid #cdeede;
  border-radius: 14px;
  font-size: 13px;
  color: #256a52;
  line-height: 1.5;
}
.pesc-note b { color: #0f8a5f; }

.times { margin: 15px 0 0; padding: 14px 15px; background: var(--pink-faint); border-radius: 16px; }
.times .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--pink-deep); font-weight: 800; }
.times .window { font-weight: 700; margin: 5px 0 10px; font-size: 14px; color: var(--ink); }
.slots { display: flex; flex-wrap: wrap; gap: 7px; }
.slot { font-size: 13px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: #fff; border: 1.5px solid var(--pink-soft); color: var(--pink-deep); }
.slot.none { background: #fff0f4; border-color: #ffc2d6; color: #db3f78; }
.times-note { margin-top: 11px; font-size: 12px; color: var(--ink-soft); line-height: 1.45; border-top: 1px dashed var(--sep); padding-top: 9px; }

details.menu { margin-top: 14px; }
details.menu summary { cursor: pointer; font-weight: 800; font-size: 14px; color: var(--pink-deep); list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::before { content: "🍽️ "; }
details.menu ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: 13.5px; }
details.menu li { margin: 4px 0; }

.links { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
.links a {
  flex: 1 1 auto; text-align: center;
  font-size: 13.5px; font-weight: 700; text-decoration: none;
  color: var(--ink-soft); background: var(--pink-faint);
  border: 1.5px solid var(--sep); padding: 11px 12px; border-radius: 13px;
  transition: transform 0.12s;
}
.links a:active { transform: scale(0.96); }
.links a.primary { flex-basis: 100%; background: linear-gradient(90deg, var(--pink), var(--pink-deep)); color: #fff; border: none; box-shadow: 0 6px 14px rgba(255,60,130,0.28); }

/* Rating */
.rating { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--sep); }
.rating .label { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.stars { display: flex; gap: 6px; }
.star { cursor: pointer; font-size: 34px; line-height: 1; color: var(--pink-soft); background: none; border: none; padding: 0; transition: transform 0.12s, color 0.15s; }
.star:active { transform: scale(1.3); }
.star.filled { color: var(--pink-deep); }
.rating .current { font-size: 13px; color: var(--ink-soft); margin-top: 9px; min-height: 18px; font-weight: 600; }
.rating .current b { color: var(--pink-deep); }
.clear-btn { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; margin-left: 8px; font-family: inherit; }

/* ───────── Leaderboard ───────── */
.leaderboard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 14px; }
.lb-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 0.5px solid var(--sep); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { font-size: 19px; font-weight: 700; text-align: center; color: var(--muted); }
.lb-row.top .lb-rank { color: var(--pink-deep); }
.lb-name { font-weight: 700; font-size: 16px; }
.lb-name small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; font-family: -apple-system, system-ui, sans-serif; }
.lb-score { display: flex; align-items: center; gap: 7px; font-weight: 800; }
.lb-score .num { min-width: 26px; text-align: right; color: var(--pink-deep); }
.lb-score .of { color: var(--muted); font-weight: 600; font-size: 12px; }
.lb-empty { color: var(--ink-soft); text-align: center; padding: 34px 14px; font-size: 15px; line-height: 1.5; }
.pill { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; background: var(--pink-deep); color: #fff; margin-left: 7px; font-family: -apple-system, system-ui, sans-serif; font-weight: 700; vertical-align: middle; }

.toolbar { display: flex; justify-content: center; margin: 16px 0 0; }
.reset-all { background: #fff; border: 1.5px solid var(--sep); color: var(--ink-soft); padding: 11px 20px; border-radius: 14px; cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit; }
.reset-all:active { transform: scale(0.96); }

.footnote { margin: 20px 6px 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }

/* ───────── Tab bar ───────── */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 440px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(255, 240, 246, 0.86);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 0.5px solid var(--sep);
  z-index: 60;
}
@media (min-width: 480px) { .tabbar { bottom: 22px; border-radius: 0 0 44px 44px; } }
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  font-family: inherit;
  padding: 8px 0 4px;
  transition: color 0.15s, transform 0.1s;
}
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--pink-deep); }
.tab:active { transform: scale(0.9); }
