/* Sheeple. Poster style: flat colour, banded skies, a chunky soft serif. */
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("fonts/work-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("fonts/work-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("fonts/work-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --cream: #F4EAD5;
  --paper: #F6F0E2;
  --ink: #1F2140;
  --navy: #262852;
  --violet: #3D3670;
  --gold: #F5C777;
  --gold-deep: #E8B04B;
  --teal: #1F4656;
  --muted: #4A4B63;
  --night: #1B1D44;
  --lavender: #C9C2DD;
  --book: #8E3B46;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sky-ink: #1F2140;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
p, h1, h2 { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 3px; }

/* ---------- buttons ---------- */
.btn {
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, opacity 0.2s, background 0.2s;
  padding: 0 22px;
}
.btn.light { background: var(--cream); color: var(--ink); }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: default; }

.badge {
  align-self: center;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 33, 64, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- landing: full-screen dusk, few words ---------- */
.landing { position: fixed; inset: 0; overflow: hidden; background: #3E5A46; color: var(--cream); }
.landing.night { background: #24382C; }
.landing-scene, .landing-scene .scene { position: absolute; left: 0; top: 0; display: block; }
.landing-top {
  position: absolute; left: 28px; right: 28px; top: calc(64px + var(--safe-t));
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.lkicker { font-size: 11px; font-weight: 600; letter-spacing: 0.26em; color: #F6C977; }
.landing-top h1 { font-family: var(--serif); font-size: 66px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; color: var(--cream); }
.tagline { margin-top: 2px; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.35; color: rgba(244, 234, 213, 0.9); max-width: 30ch; }
.landing-bottom {
  position: absolute; left: 28px; right: 28px; bottom: calc(26px + var(--safe-b));
  max-width: 420px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}
.topics { font-size: 12.5px; line-height: 1.5; text-align: center; color: rgba(244, 234, 213, 0.82); }
.topics b { font-weight: 600; letter-spacing: 0.18em; font-size: 10.5px; color: #F6C977; margin-right: 8px; }
.landing .btn { width: 100%; }
.notd { margin-top: 6px; border-top: 1px solid rgba(244, 234, 213, 0.18); padding-top: 14px; display: flex; align-items: center; gap: 14px; }
.notd-num { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1; color: #E8B04B; }
.notd-label { font-size: 10px; font-weight: 600; letter-spacing: 0.2em; color: #F6C977; margin-bottom: 2px; }
.notd-text { font-size: 13.5px; line-height: 1.35; color: var(--cream); }
.landing .badge { background: rgba(244, 234, 213, 0.14); color: var(--cream); }
@media (min-width: 700px) {
  .landing-top { top: calc(84px + var(--safe-t)); }
  .landing-top h1 { font-size: 92px; }
  .tagline { font-size: 20px; }
}
@media (max-height: 700px) {
  .landing-top { top: calc(40px + var(--safe-t)); }
  .landing-top h1 { font-size: 56px; }
  .landing-bottom { gap: 12px; bottom: calc(18px + var(--safe-b)); }
}

/* landing animation: one sheep loops the world, hops the fence, goes off-screen and comes back */
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95%, 97% { transform: scaleY(0.1); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.twinkle { animation: twinkle 3.4s ease-in-out infinite; }
.twinkle.t2 { animation-duration: 4.1s; animation-delay: -1.5s; }
.twinkle.t3 { animation-duration: 3.8s; animation-delay: -2.2s; }
.zz { font-family: var(--serif); font-style: italic; font-weight: 700; fill: var(--cream); animation: floatZ 2.6s ease-out infinite; }
.zz.z1 { font-size: 16px; } .zz.z2 { font-size: 21px; animation-delay: -0.85s; } .zz.z3 { font-size: 27px; animation-delay: -1.7s; }
@keyframes floatZ { 0% { opacity: 0; transform: translate(0, 6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -14px); } }

/* ---------- game ---------- */
.game {
  position: fixed; inset: 0; overflow: hidden;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  background: #2F4B3B;
}
.scene-wrap, .scene { position: absolute; left: 0; top: 0; display: block; }
.scene-wrap { transform: translateY(calc(-1 * var(--shift, 0px))); transition: transform 0.38s cubic-bezier(.2, .8, .2, 1); }
.game.tight .qblock { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .game::after {
    content: "Turn your phone upright to play.";
    position: absolute; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    background: var(--navy); color: var(--cream);
    font-family: var(--serif); font-size: 22px;
  }
}
.scene stop { transition: stop-color 1.8s ease; }
.scene #stars { transition: opacity 1.2s ease; }
.star { fill: #FCE6A8; }
.star.tw1 { animation: twinkle 3.6s ease-in-out infinite; }
.star.tw2 { animation: twinkle 4.4s ease-in-out -1.2s infinite; }
.ticklabel { font-family: var(--sans); font-size: 13px; font-weight: 600; text-anchor: middle; }
.signtext { font-family: var(--sans); font-size: 8.5px; font-weight: 600; letter-spacing: 0.06em; fill: #1F2140; text-anchor: middle; }
#overlay { transition: opacity 0.3s ease; }
.where { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky-ink); opacity: 0.75; transition: color 1.2s; }
.biome-banner {
  position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease;
}
.biome-banner.show { opacity: 1; transform: none; }
.bb-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.22em; color: var(--sky-ink); opacity: 0.85; }
.bb-name { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 28px; line-height: 1.1; color: var(--sky-ink); }
.flagtext { font-family: var(--serif); font-size: 13px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.flagtext.small { font-size: 10.5px; }
.flagrise { animation: flagUp 0.45s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes flagUp { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.swaying { transform-origin: 0px -110px; animation: sway 1.6s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.spark { fill: #FCE6A8; stroke: #E8B04B; stroke-width: 0.8; animation: spark 0.9s ease-out both; }
@keyframes spark { from { opacity: 1; translate: 0 0; scale: 0.4; } to { opacity: 0; translate: var(--dx) var(--dy); scale: 1.2; } }
.pose-nod .zz { fill: var(--cream); }

.column {
  position: absolute; left: 0; right: 0; top: 0;
  margin: 0 auto; max-width: 640px;
  padding: calc(14px + var(--safe-t)) 14px 0 18px;
  pointer-events: none;
}
.column > * { pointer-events: auto; }
.hud { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.progress { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.qcount { font-size: 12.5px; font-weight: 600; color: var(--sky-ink); transition: color 1.2s; }
.dots { display: flex; gap: 4px; align-items: center; }
.dots span { width: 14px; height: 3px; border-radius: 2px; background: var(--sky-ink); opacity: 0.22; transition: background 1.2s, opacity 0.3s; }
.dots span.done, .dots span.now { opacity: 1; }
.hud-right { display: flex; gap: 8px; align-items: center; }
/* the time bar, under the big number */
.timebar { display: flex; align-items: center; gap: 12px; width: min(300px, 82%); margin-top: 16px; color: var(--sky-ink); transition: color 0.6s, opacity 0.3s; }
.tb-track { position: relative; flex: 1; height: 6px; border-radius: 3px; overflow: hidden; }
.tb-track::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0.2; }
.tb-fill { position: absolute; inset: 0; background: currentColor; border-radius: 3px; transform-origin: left center; }
.tb-sec { min-width: 2.2ch; text-align: right; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.timebar.low { color: var(--warn); }
.timebar.urgent .tb-track { height: 8px; }
.revealing .timebar { display: none; }
.mute {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--sky-ink); display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; flex: none;
}
.results .mute { color: var(--cream); }
.mute .cross { display: none; }
.mute.is-muted .cross { display: inline; }
.mute.is-muted .waves { display: none; }

.qblock { margin-top: 26px; padding-right: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; transition: opacity 0.3s; }
.qtext { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.2; letter-spacing: -0.005em; color: var(--sky-ink); transition: color 1.2s, font-size 0.3s, opacity 0.3s; text-wrap: pretty; }
.chip { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--sky-ink); opacity: 0.8; transition: color 1.2s; }
.numblock { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: opacity 0.3s; }
.numlabel { font-size: 11px; font-weight: 600; letter-spacing: 0.22em; color: var(--sky-ink); opacity: 0.8; }
.bignum { display: flex; align-items: baseline; justify-content: center; gap: 8px; color: var(--sky-ink); transition: color 1.2s, opacity 0.2s; }
.bignum .v { font-family: var(--serif); font-size: 80px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.bignum .suffix { font-family: var(--sans); font-size: 17px; font-weight: 500; opacity: 0.85; }
.bignum.untouched { opacity: 0.35; }
.yousaid { font-size: 15px; color: var(--sky-ink); min-height: 1em; }

.dragzone { position: absolute; left: 0; right: 0; touch-action: none; cursor: grab; outline-offset: -6px; z-index: 2; }
/* Phones: leave the outer strips to the browser's swipe-back gesture rather than starting a drag there. */
@media (max-width: 699px) { .dragzone { left: 22px; right: 22px; } }
.dragzone:active { cursor: grabbing; }
.hint {
  position: absolute; left: 24px; right: 24px; bottom: calc(100px + var(--safe-b));
  text-align: center; font-size: 13px; color: rgba(244, 234, 213, 0.85); pointer-events: none;
}
.lock { position: absolute; left: 28px; right: 28px; bottom: calc(30px + var(--safe-b)); z-index: 3; }

.asking .hint { opacity: 1; }
.revealing .hint, .transitioning .hint { opacity: 0; }
.revealing .lock, .transitioning .lock { display: none; }
.revealing .dragzone, .transitioning .dragzone { pointer-events: none; }
.asking .numlabel { display: none; }
.revealing .qblock { align-items: center; text-align: center; padding-right: 0; }
.revealing .qtext { font-size: 19px; opacity: 0.78; }
.revealing .chip { display: none; }
.revealing .numblock { margin-top: 18px; }

/* the full-screen reveal: score and band first, everything else flows underneath */
.reveal {
  position: absolute; inset: 0; z-index: 6;
  background: var(--paper); color: var(--ink);
  opacity: 0; visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.reveal.show { opacity: 1; visibility: visible; transition: opacity 0.5s ease; }
.reveal-inner {
  min-height: 100%; box-sizing: border-box; max-width: 460px; margin: 0 auto;
  padding: calc(24px + var(--safe-t)) 28px calc(24px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.rv-q { font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.rv-hero { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; align-items: center; }
.rv-score { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.rv-score .n { font-family: var(--serif); font-size: clamp(104px, 33vw, 150px); font-weight: 500; line-height: 0.9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rv-score .of { font-family: var(--serif); font-size: 24px; color: var(--muted); }
.rv-band { margin-top: 8px; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 36px; line-height: 1.1; color: var(--violet); }
.reveal.bullseye .rv-band { color: #9A6B1F; }
.reveal.show .rv-hero { animation: rvIn 0.6s cubic-bezier(.2, .8, .2, 1) both; }
.reveal.show.bullseye .rv-score { animation: pop 0.7s 0.15s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes rvIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.rv-sheep { margin-top: 18px; display: flex; align-items: center; gap: 12px; text-align: left; max-width: 340px; }
.rv-bust { flex: none; display: flex; }
.rv-bust .bust { width: 48px; height: 48px; }
.line { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.3; color: var(--violet); }
.rv-nums { margin-top: 26px; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rv-nums .lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.rv-nums .val { margin-top: 4px; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-nums .rv-ans { color: #9A6B1F; }
.reveal .rule { width: 100%; height: 1px; background: #E2D5BA; margin: 18px 0 16px; }
.fact { font-family: var(--serif); font-size: 17px; line-height: 1.4; color: var(--ink); max-width: 36ch; }
.fact-label { display: block; font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; color: var(--book); margin-bottom: 6px; }
.next { margin-top: auto; width: 100%; height: 52px; font-size: 18px; flex: none; }
.reveal .fact { margin-bottom: 24px; }

@media (max-height: 700px) {
  .qblock { margin-top: 14px; gap: 8px; }
  .numblock { margin-top: 12px; }
  .qtext { font-size: 25px; }
  .bignum .v { font-size: 64px; }
  .timebar { margin-top: 10px; }
  .rv-score .n { font-size: 96px; }
  .rv-band { font-size: 30px; }
  .rv-nums { margin-top: 18px; }
  .reveal .fact { margin-bottom: 16px; }
  .rv-nums .val { font-size: 24px; }
  .reveal .rule { margin: 14px 0 12px; }
  .fact { font-size: 15.5px; }
  .next, .lock { height: 48px; }
  .hint { bottom: calc(88px + var(--safe-b)); }
}

@media (min-width: 700px) {
  .column { padding-top: calc(22px + var(--safe-t)); }
  .qtext { font-size: 40px; }
  .revealing .qtext { font-size: 22px; }
  .qblock { margin-top: 26px; }
  .bignum .v { font-size: 96px; }
  .bignum .suffix { font-size: 20px; }
  .lock { left: 50%; right: auto; width: 360px; margin-left: -180px; }
  .hint { bottom: calc(104px + var(--safe-b)); }
  .rv-score .n { font-size: 168px; }
  .rv-band { font-size: 42px; }
}

/* ---------- results ---------- */
.results { position: fixed; inset: 0; overflow-y: auto; background: var(--night); color: var(--cream); -webkit-overflow-scrolling: touch; }
.nightsky { position: fixed; inset: 0; width: 100%; height: 100%; }
.results-inner {
  position: relative; max-width: 520px; margin: 0 auto;
  padding: calc(22px + var(--safe-t)) 24px calc(40px + var(--safe-b));
  display: flex; flex-direction: column; gap: 16px;
}
.results .kicker { font-size: 11px; letter-spacing: 0.24em; color: #E8C887; }
.results-top { display: flex; align-items: center; justify-content: space-between; }
.total-block { display: flex; flex-direction: column; gap: 6px; }
.total { display: flex; align-items: baseline; gap: 8px; }
.total .t { font-family: var(--serif); font-size: 84px; font-weight: 500; line-height: 0.95; font-variant-numeric: tabular-nums; }
.total .of { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--lavender); }
.beat { font-size: 16px; min-height: 1.3em; }
.streak { font-size: 13px; color: var(--lavender); margin-top: -10px; }
.verdict { display: flex; align-items: center; gap: 14px; }
.verdict .bust { flex: none; }
.journey { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid rgba(244, 234, 213, 0.14); border-bottom: 1px solid rgba(244, 234, 213, 0.14); }
.journey .globe { flex: none; }
.j-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; color: #E8C887; }
.j-name { margin-top: 2px; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.15; color: var(--cream); }
.j-next { margin-top: 3px; font-size: 13px; color: var(--lavender); }
.verdict { gap: 12px; }
.verdict .bust { width: 44px; height: 44px; }
.verdict p { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.35; }
.share { width: 100%; height: 52px; font-size: 18px; }
.toast { min-height: 0; font-size: 14px; text-align: center; color: var(--gold); opacity: 0; transition: opacity 0.3s; white-space: pre-line; margin-top: -8px; }
.toast.show { opacity: 1; }
.answers-head { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.answers-head .sub { font-size: 13px; color: var(--lavender); }
.answers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ans { border-top: 1px solid rgba(244, 234, 213, 0.14); }
.ans:last-child { border-bottom: 1px solid rgba(244, 234, 213, 0.14); }
.ans-head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border: 0; background: transparent; color: var(--cream);
  text-align: left; cursor: pointer;
}
.ans-n { width: 18px; flex: none; font-size: 12px; color: #9C95B8; font-variant-numeric: tabular-nums; }
.ans-short { flex: 1; font-size: 15px; font-weight: 500; line-height: 1.3; }
.ans-score { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.ans-pts { font-family: var(--serif); font-size: 20px; font-weight: 700; line-height: 1; }
.ans-band { font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #E8C887; }
.chev { flex: none; transition: transform 0.2s; }
.ans.open .chev { transform: rotate(180deg); }
.ans-body { padding: 0 0 16px 30px; display: flex; flex-direction: column; gap: 10px; }
.ans-body[hidden] { display: none; }
.ans-q { font-family: var(--serif); font-style: italic; font-size: 15.5px; font-weight: 400; line-height: 1.35; color: #E9E3F2; }
.ans-line { font-size: 13.5px; color: var(--lavender); }
.ans-line strong { color: var(--cream); font-weight: 600; }
.ans-line .gold { color: var(--gold); }
.ans-beat { font-size: 13.5px; color: var(--lavender); }
.chart { display: block; width: 100%; height: auto; max-width: 420px; overflow: visible; }
.chart .you { font-family: var(--sans); font-size: 10.5px; font-weight: 600; fill: var(--cream); text-anchor: middle; }
.chart .axis { font-family: var(--sans); font-size: 11.5px; fill: var(--lavender); }
.comeback { margin-top: 8px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--lavender); }
.results .badge { background: rgba(244, 234, 213, 0.1); color: var(--lavender); }
.game .badge { position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px; z-index: 5; background: rgba(244, 234, 213, 0.85); color: var(--ink); font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Shown only if today's game can't be fetched */
.loadfail { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: #262852; color: var(--cream); }
.loadfail h1 { font-family: var(--serif); font-size: 56px; margin: 0; }
.loadfail p { max-width: 320px; line-height: 1.5; margin: 0 0 8px; }
