/* HowManySleepsLeft — shared styles */
:root {
  --night-1: #1b1f4b;
  --night-2: #3b2f6e;
  --moon: #ffd966;
  --moon-dark: #f2c14e;
  --ink: #2b2350;
  --pink: #ff8fb1;
  --mint: #7ee0c3;
  --sky: #8ec5ff;
  --red: #e5484d;
  --card: #ffffff;
  --text-light: #f5f3ff;
  --radius: 24px;
  --font: "Fredoka", "Baloo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--text-light);
  background: radial-gradient(circle at 50% 0%, var(--night-2), var(--night-1) 70%) fixed;
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

body.theme-christmas { background: radial-gradient(circle at 50% 0%, #1f5f4a, #12263d 70%) fixed; }
body.theme-newyear   { background: radial-gradient(circle at 50% 0%, #4b2d7a, #120f2e 70%) fixed; }
body.theme-custom    { background: radial-gradient(circle at 50% 0%, #2f5d8a, #1b1f4b 70%) fixed; }

/* twinkling stars */
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff8, transparent),
    radial-gradient(2px 2px at 30% 70%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 50% 30%, #fff9, transparent),
    radial-gradient(2px 2px at 70% 15%, #fff7, transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, #fff8, transparent),
    radial-gradient(2px 2px at 20% 90%, #fff5, transparent),
    radial-gradient(1.5px 1.5px at 92% 88%, #fff7, transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .5; } to { opacity: 1; } }

main, header, footer { position: relative; z-index: 1; }

a { color: var(--moon); }

/* header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  max-width: 1000px; margin: 0 auto; padding: 18px 20px;
}
.logo {
  font-size: 1.5rem; font-weight: 700; text-decoration: none; color: var(--text-light);
}
.logo span { color: var(--moon); }
.site-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--text-light); font-weight: 600;
  padding: 8px 14px; border-radius: 999px; background: #ffffff14;
}
.site-nav a:hover { background: #ffffff2a; }

/* hero */
.hero { max-width: 760px; margin: 0 auto; padding: 10px 20px 30px; text-align: center; }
.mascot-wrap { width: 190px; height: 190px; margin: 0 auto; position: relative; }
.mascot { width: 100%; height: 100%; animation: bob 3.5s ease-in-out infinite; overflow: visible; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.mascot .eyes-closed, .mascot .zzz { display: none; }
.mascot.asleep .eyes-open { display: none; }
.mascot.asleep .eyes-closed, .mascot.asleep .zzz { display: inline; }
.mascot .zzz text { animation: zfloat 2.5s ease-in-out infinite; }
@keyframes zfloat { 0% { opacity: 0; transform: translate(0,6px);} 50% {opacity:1;} 100% { opacity: 0; transform: translate(6px,-10px);} }
.mascot.dance { animation: dance .5s ease-in-out infinite; }
@keyframes dance { 0%,100% { transform: rotate(-10deg) scale(1);} 50% { transform: rotate(10deg) scale(1.08);} }

.big-count { margin: 6px 0 0; line-height: 1; }
.big-count .num {
  display: block; font-size: clamp(5rem, 22vw, 9.5rem); font-weight: 700; color: var(--moon);
  text-shadow: 0 6px 0 #00000033;
}
.big-count .label { display: block; font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 600; margin-top: 4px; }
.subline { font-size: 1.15rem; opacity: .9; margin: 12px 0 0; }

/* live timer */
.timer { display: flex; justify-content: center; gap: 10px; margin: 22px 0 6px; flex-wrap: wrap; }
.timer div {
  background: #ffffff18; border-radius: 16px; padding: 10px 14px; min-width: 78px;
}
.timer b { display: block; font-size: 1.8rem; }
.timer small { opacity: .8; }

/* progress path */
.path { margin: 26px auto 8px; max-width: 560px; }
.path-track {
  position: relative; height: 18px; border-radius: 999px; background: #ffffff22;
}
.path-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--moon)); width: 0; transition: width 1s; }
.path-rider { position: absolute; top: 50%; font-size: 2rem; transform: translate(-50%, -60%); transition: left 1s; left: 0; }
.path-goal { position: absolute; right: -6px; top: 50%; transform: translateY(-60%); font-size: 1.8rem; }
.path-caption { font-size: .95rem; opacity: .85; margin-top: 10px; }

/* buttons */
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.btn {
  font-family: inherit; font-size: 1.1rem; font-weight: 600; cursor: pointer;
  border: none; border-radius: 999px; padding: 14px 22px; text-decoration: none; display: inline-block;
  background: var(--moon); color: var(--ink); box-shadow: 0 5px 0 var(--moon-dark);
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--moon-dark); }
.btn.pink { background: var(--pink); box-shadow: 0 5px 0 #e06e93; }
.btn.mint { background: var(--mint); box-shadow: 0 5px 0 #57bfa1; }
.btn.ghost { background: #ffffff1f; color: var(--text-light); box-shadow: none; }
.btn[disabled] { opacity: .55; cursor: default; }

.toast { min-height: 1.6em; margin-top: 12px; font-weight: 600; color: var(--mint); }

/* sections & cards */
.section { max-width: 1000px; margin: 0 auto; padding: 30px 20px; }
.section h2 { font-size: 1.8rem; text-align: center; margin: 0 0 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 20px;
  text-decoration: none; display: block; box-shadow: 0 8px 0 #00000026; transition: transform .15s;
}
a.card:hover { transform: translateY(-4px) rotate(-1deg); }
.card .emoji { font-size: 2.4rem; }
.card h3 { margin: 6px 0 2px; font-size: 1.25rem; }
.card .sleeps { font-size: 1.05rem; font-weight: 600; color: #7a4fd1; }
.card p { margin: 6px 0 0; }

.surprise-box {
  max-width: 560px; margin: 0 auto; text-align: center; background: var(--card); color: var(--ink);
  border-radius: var(--radius); padding: 24px; box-shadow: 0 8px 0 #00000026;
}
.surprise-box .reveal { font-size: 1.25rem; margin-top: 14px; min-height: 1.5em; }

.prose { max-width: 720px; margin: 0 auto; padding: 10px 20px 30px; font-size: 1.1rem; }
.prose h2 { text-align: left; }
.prose li { margin-bottom: 6px; }

/* forms */
.form-card { max-width: 520px; margin: 0 auto; background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 24px; box-shadow: 0 8px 0 #00000026; }
.form-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form-card input[type=text], .form-card input[type=date] {
  width: 100%; font-family: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 14px; border: 2px solid #ddd6f3;
}
.emoji-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-pick button {
  font-size: 1.7rem; background: #f3f0ff; border: 3px solid transparent; border-radius: 14px; padding: 6px 10px; cursor: pointer;
}
.emoji-pick button.selected { border-color: #7a4fd1; background: #e7defc; }
.share-link { width: 100%; font-family: monospace; font-size: .95rem; padding: 10px; border-radius: 10px; border: 2px dashed #b9a8ef; margin-top: 10px; }

/* gift guide */
.gift-group { margin-bottom: 30px; }
.gift-group h3 { font-size: 1.4rem; margin: 0 0 12px; }
.gift-list .card h3 { font-size: 1.1rem; }
.disclosure { font-size: .9rem; opacity: .8; text-align: center; }

/* snow + confetti */
.flake, .confetti { position: fixed; top: -20px; pointer-events: none; z-index: 2; user-select: none; }
.flake { color: #fff; animation: fall linear forwards; }
.confetti { width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

footer.site-footer { text-align: center; padding: 30px 20px 40px; opacity: .75; font-size: .95rem; }

.hidden { display: none !important; }

@media (max-width: 520px) {
  .timer div { min-width: 64px; padding: 8px 10px; }
  .timer b { font-size: 1.4rem; }
  .site-header { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .mascot, .stars, .flake, .confetti, .zzz text { animation: none !important; }
}
