/* Ten Numbers, Storybook Critters: Nutmeg the squirrel fills her jar with the
   acorns your guesses earn. Sky blue, chunky rounded type, white cards with a
   soft drop, sunflower buttons: the same storybook as Deep Cut and Mother Tongue. */

:root {
  color-scheme: light;
  --sky: #cfeaff;
  --ink: #2e2a3b;
  --ink-2: #3e3a52;
  --muted: #5b5670;
  --card: #ffffff;
  --card-edge: #9cc8ea;
  --track: #eaf4ff;
  --sun: #ffb938;
  --sun-edge: #d68a00;
  --coral: #ff6f61;
  --leaf: #7bc96f;
  --nut: #c98b5b;
  --nut-cap: #7a4e2e;
  --fur: #d98a3a;
  --error: #b23a2e;
  --good: #2f7d3e;
  --link: #1f5f99;
  --display: Fredoka, Nunito, system-ui, sans-serif;
  font: 16px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
/* Headings break evenly, and paragraphs don't end on one short word. */
h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

body {
  margin: 0;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sky);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

:focus-visible {
  outline: 3px solid rgba(31, 95, 153, 0.45);
  outline-offset: 3px;
}

.sheet h2:focus {
  outline: none;
}

/* Header */

.top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 14px 16px 6px;
}

.wordmark {
  text-align: center;
}

.wordmark h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 27px;
  line-height: 1.1;
}

.day-label {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--card-edge);
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  cursor: pointer;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

/* Layout and shared pieces */

main {
  flex: 1;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 6px 16px 24px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--card-edge);
}

.primary {
  min-height: 54px;
  padding: 12px 20px;
  border: 0;
  border-radius: 18px;
  background: var(--sun);
  box-shadow: 0 4px 0 var(--sun-edge);
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.primary:hover {
  filter: brightness(1.04);
}

.primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--sun-edge);
}

.secondary {
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
}

.link {
  align-self: center;
  padding: 8px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
}

.kicker {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.note {
  margin: -6px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.feedback {
  min-height: 22px;
  margin: -6px 0 0;
  text-align: center;
  font-weight: 700;
  color: var(--error);
}

.feedback.ok {
  color: var(--good);
}

/* Start screen */

.hello {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.hello-nutmeg {
  width: 112px;
  height: 112px;
  flex: none;
}

.bubble {
  position: relative;
  margin: 0 0 58px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--card-edge);
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
}

.bubble::after {
  content: "";
  position: absolute;
  right: -14px;
  bottom: 12px;
  border: 8px solid transparent;
  border-left-color: var(--card);
}

.headline {
  margin: -6px 0 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 27px;
  line-height: 1.2;
}

#intro > p {
  margin: 0;
  text-align: center;
  color: var(--ink-2);
}

#intro > .fine {
  font-size: 13px;
}

.example {
  display: grid;
  gap: 8px;
}

.example p {
  margin: 0;
}

.example .example-answer {
  margin: -4px 0 2px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
}

.example-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.example-row .muted {
  font-weight: 400;
}

/* Tiers */

.tier-list {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--card-edge);
}

.tier {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 14px;
}

.tier svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.tier b {
  flex: 1;
  font-family: var(--display);
  font-weight: 600;
}

.tier span {
  color: var(--muted);
}

.tier.now {
  min-height: 42px;
  background: var(--sun);
}

.tier.now span {
  color: var(--ink);
  font-weight: 800;
}

/* A question */

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress li {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
}

.progress li.now {
  box-shadow: inset 0 0 0 3px var(--sun);
}

.progress li svg {
  width: 16px;
  height: 16px;
}

.mini-jar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.mini-jar svg {
  width: 30px;
  height: 38px;
}

.running-total {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.question-card {
  text-align: center;
}

.topic {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.question-text {
  margin: 4px 0 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.2;
}

.guess {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.answer-box {
  position: relative;
  min-width: 0;
}

.answer-box input {
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.answer-box input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--sun);
}

.answer-box.with-unit input {
  padding-right: 76px;
}

.unit-label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--display);
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.unit-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: -6px;
}

.unit-toggle button {
  min-height: 36px;
  padding: 4px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.unit-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--card);
}

.guess.shake {
  animation: shake 0.32s;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

/* The reveal */

.answer-card p {
  margin: 0;
}

.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 2px 0 !important;
}

.reveal-answer {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.reveal-alt {
  color: var(--muted);
  font-weight: 700;
}

.reveal-guess {
  font-size: 15px;
}

.number-line {
  padding: 6px 4px 0;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--card-edge);
}

.number-line svg {
  display: block;
  width: 100%;
  height: auto;
}

.nl-label {
  font-family: Nunito, sans-serif;
  font-weight: 700;
  font-size: 11px;
  fill: var(--muted);
}

.nl-mark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  fill: var(--ink);
}

.nl-acorn {
  animation: toss 0.9s cubic-bezier(0.3, 0.6, 0.4, 1) both;
}

@keyframes toss {
  0% {
    transform: translate(var(--from), -60px) rotate(-180deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  75% {
    transform: translate(0, 4px) rotate(10deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

.nl-flag {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: rise 0.5s 0.6s both cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes rise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.earned {
  display: grid;
  gap: 8px;
}

.verdict-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

.verdict {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
}

.points-pill {
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--sun);
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.acorns {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}

.acorns svg {
  width: 100%;
  height: auto;
}

.acorns .won {
  animation: drop 0.4s both cubic-bezier(0.3, 1.5, 0.5, 1);
}

.acorns .empty {
  opacity: 0.25;
  filter: grayscale(1);
}

@keyframes drop {
  from {
    transform: translateY(-24px) scale(0.6);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.source {
  margin: -4px 0 0;
  text-align: center;
  color: var(--ink-2);
}

/* Results */

.results-hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
}

.big-jar {
  width: 120px;
  height: 148px;
}

.hug-nutmeg {
  width: 104px;
  height: 104px;
  margin-left: -18px;
}

.jar-fill {
  transition: transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

#results .kicker + .kicker {
  margin-top: -12px;
}

.tier-name {
  margin: -10px 0 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.1;
}

.total {
  margin: -8px 0 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  font-variant-numeric: tabular-nums;
}

.total .muted {
  font-family: Nunito, sans-serif;
  font-weight: 400;
}

#total-note {
  margin: -12px 0 0;
  text-align: center;
}

.summary {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 16px;
  list-style: none;
}

.summary li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
}

.s-question {
  font-size: 14px;
  font-weight: 700;
}

.s-detail {
  grid-column: 1;
  font-size: 13px;
  color: var(--muted);
}

.s-points {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 44px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--track);
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
}

.s-points.great {
  background: var(--sun);
}

.next-in {
  margin: 0;
  text-align: center;
  color: var(--ink-2);
}

.next-in strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Nutmeg */

.tail {
  transform-box: fill-box;
  transform-origin: 80% 95%;
  animation: swish 1.8s ease-in-out infinite alternate;
}

@keyframes swish {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}

.bob {
  animation: bob 1.2s ease-in-out infinite alternate;
}

@keyframes bob {
  from {
    transform: translateY(-1.5px);
  }
  to {
    transform: translateY(1.5px);
  }
}

.wave {
  transform-box: fill-box;
  transform-origin: 20% 90%;
  animation: wave 0.5s ease-in-out infinite alternate;
}

@keyframes wave {
  from {
    transform: rotate(-20deg);
  }
  to {
    transform: rotate(20deg);
  }
}

/* Dialogs */

.sheet {
  width: min(460px, calc(100% - 32px));
  padding: 20px;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--card-edge);
}

.sheet::backdrop {
  background: rgba(46, 42, 59, 0.45);
}

.sheet h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 700;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-head h2 {
  margin: 0;
}

.sheet-nutmeg {
  width: 64px;
  height: 64px;
  flex: none;
}

.sheet ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
  padding-left: 20px;
}

.sheet .primary {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  padding: 12px 6px;
  border-radius: 16px;
  background: var(--sky);
  text-align: center;
}

.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 12px;
  color: var(--ink-2);
}

.foot {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 10px 16px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-2);
}

.foot p {
  text-wrap: balance;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
