@font-face{font-family:"Fraunces";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/fraunces-latin-600-normal.woff2) format("woff2")}
@font-face{font-family:"Fraunces";font-style:normal;font-weight:900;font-display:swap;src:url(fonts/fraunces-latin-900-normal.woff2) format("woff2")}
@font-face{font-family:"Karla";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/karla-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"Karla";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/karla-latin-600-normal.woff2) format("woff2")}
@font-face{font-family:"Karla";font-style:normal;font-weight:800;font-display:swap;src:url(fonts/karla-latin-800-normal.woff2) format("woff2")}
html{box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);background:linear-gradient(var(--night) 50%,var(--mead1) 50%)}
body{margin:0;font:14px system-ui}img{max-width:100%}[hidden]{display:none!important}
/* Layout: one picture-book page. The night meadow fills a portrait frame (edge to edge on phones);
   the count sits in the sky like a numeral in a bedtime story. One committed night look in every host. */
:root {
  --night: #0A0E29;
  --ink: #F6F0DF;
  --dim: #B9BCD9;
  --moon: #FFE9A6;
  --star: #FFF6D6;
  --card: rgba(12, 16, 46, .92);
  --line: rgba(246, 240, 223, .2);
  --sky0: #0A0E2B; --sky1: #42418A; --mead0: #3F8770; --mead1: #193F44;   /* the edges of the painted scene */
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Karla", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; touch-action: none; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* no text growing when the phone rotates */
@supports (height: 100dvh) { html { height: 100dvh; } }   /* the visible screen, even as browser bars come and go */
body {
  background: var(--night); color: var(--ink); font-family: var(--body); overflow: hidden;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }

.stage { box-sizing: border-box; height: 100%; padding-inline: 16px; padding-block: 12px; display: grid; place-items: center; }
.frame {
  position: relative; overflow: hidden; border-radius: 22px; cursor: pointer;
  /* matches the scene, so the screen shake never shows a flat strip at the edges (--hz is set by script) */
  background: linear-gradient(var(--sky0), var(--sky1) var(--hz, 70%), var(--mead0) var(--hz, 70%), var(--mead1));
  font-size: 10px; /* set by script: 1em = 10 world units */
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .5);
}
/* Phones: edge to edge, and no rounded clip, which costs GPU time on every frame of a live canvas. */
@media (max-width: 540px) {
  .stage { padding: 0; }
  .frame { border-radius: 0; box-shadow: none; }
}
.scene, .scene > * { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene > #cv { bottom: auto; }   /* only the strip where the sheep move; placed by script */
/* Twinkling stars, the shooting star and the flash run as CSS animations, off the main thread. */
.sky i { position: absolute; border-radius: 50%; background: var(--star); opacity: .72; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .09; } }
.sky canvas { position: absolute; animation: appear 1.2s ease-out backwards; }   /* stars that come out mid-run */
@keyframes appear { from { opacity: 0; } }
.streak {
  position: absolute; width: 5.6em; height: .2em; margin-top: -.1em; border-radius: .1em; opacity: 0;
  background: linear-gradient(to right, rgba(255, 246, 214, 0), rgba(255, 246, 214, .36) 45%, rgba(255, 246, 214, .9));
  transform-origin: 100% 50%;
}
.flash { background: #FFFFFF; opacity: 0; pointer-events: none; }

.count {
  position: absolute; left: .34em; top: .5em; margin: 0; pointer-events: none;
  font-family: var(--display); font-weight: 900; font-size: 9.6em; line-height: .9;
  font-variant-numeric: tabular-nums; color: var(--ink);
  transform-origin: 30% 60%; will-change: transform;
}
/* The number is drawn from pre-made digits on its own canvas (sized by script), so a new count never re-blurs its glow. */
.count canvas { display: block; pointer-events: none; }
.measure { position: absolute; visibility: hidden; font-size: 9.6em; }   /* the number's size, read by script */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the same glow the number has (.3em and .04em of the number's size) */
.count small { display: block; font-family: var(--body); font-weight: 800; font-size: .145em; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); margin-top: .9em; padding-left: .3em; text-shadow: 0 .276em 2.07em rgba(10, 14, 41, .6); }
.best {
  position: absolute; left: 2.5em; top: 1.3em; margin: 0; pointer-events: none;
  font-size: 1.3em; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
}
.best b { color: var(--moon); font-weight: 800; }
.mute {
  position: absolute; right: 1.2em; bottom: 1.2em; width: 3.8em; height: 3.8em; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(10, 14, 41, .45); display: grid; place-items: center;
}
.mute svg { width: 1.9em; height: 1.9em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.title { position: absolute; left: 3.2em; right: 3.2em; top: 13.4em; pointer-events: none; }
.title h1 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 6.2em; line-height: .92; letter-spacing: -.01em; text-wrap: balance; text-shadow: 0 .04em .3em rgba(10, 14, 41, .6); }
.title p { margin: 1.1em 0 0; font-size: 1.75em; line-height: 1.35; color: var(--dim); max-width: 15em; }
.go {
  position: absolute; left: 0; right: 0; bottom: 2.6em; margin: 0; text-align: center; pointer-events: none;
  font-size: 1.5em; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--ink);
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .35; } }

.over {
  position: absolute; left: 2.4em; right: 2.4em; top: 7.2em; box-sizing: border-box; padding: 2.4em 2.4em 2.2em;
  border-radius: 2em; background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .6em; cursor: default;
}
.over .k { margin: 0; font-size: 1.3em; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.over .n { margin: 0; font-family: var(--display); font-weight: 900; font-size: 6.4em; line-height: .95; font-variant-numeric: tabular-nums; }
.over .n span { font-size: .42em; font-weight: 600; color: var(--dim); margin-left: .25em; }
.over .why { margin: .2em 0 0; font-size: 1.6em; line-height: 1.35; color: var(--ink); }
.over .pb { margin: 0; font-size: 1.4em; font-weight: 600; color: var(--dim); }
.over .pb b { color: var(--moon); }
.over .row { display: flex; gap: .8em; margin-top: 1em; flex-wrap: wrap; }
.btn {
  flex: 1 1 9em; min-height: 3em; padding: 0 1em; border-radius: .8em; border: 1px solid var(--line);
  background: transparent; font-size: 1.5em; font-weight: 800;
}
.btn.main { background: var(--moon); color: #1A1530; border-color: transparent; }
.sheet {
  position: absolute; inset: 0; box-sizing: border-box; padding: 2.4em; background: rgba(6, 9, 30, .93);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4em; cursor: default;
}
.sheet img { max-width: 100%; max-height: 70%; border-radius: 1.6em; box-shadow: 0 0 0 1px var(--line), 0 1em 3em rgba(0, 0, 0, .5); -webkit-touch-callout: default; }
.sheet .hint { margin: 0; font-size: 1.5em; line-height: 1.35; color: var(--dim); text-align: center; }
.sheet .row { display: flex; gap: .8em; width: 100%; }

@media (prefers-reduced-motion: reduce) { .go, .sky i, .sky canvas { animation: none; } }
