/*
 * Get started — the disc is the motif: every Tookan sits on a round colour
 * disc, so every choice on this page is one too. The one loud moment is the
 * hatching; everything around it stays calm.
 */
:root {
  --sand: #F4EEE6;
  --paper: #FFFDF8;
  --ink: #2A2733;
  --ink-soft: #5E5A68;
  --navy: #3A4A63;
  --orange: #F5911E;
  --orange-ink: #B9620A;
  --leaf: #2F7D5B;
  --line: #E4D8C7;
  --shell: #FFF6E6;
  --speck: #E7C9A2;
  --focus: #3A4A63;
  --shadow: 0 1px 0 rgba(107, 74, 35, .08), 0 8px 24px -12px rgba(107, 74, 35, .35);
  --display: 'Grandstander', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --body: 'Nunito Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sand: #16141F;
    --paper: #211E2C;
    --ink: #F1ECE4;
    --ink-soft: #B9B2C4;
    --navy: #9FB3D6;
    --orange-ink: #FFB25E;
    --line: #34303F;
    --shell: #F6EBD8;
    --focus: #FFB25E;
    --shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--sand);
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 600px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}
main.wide { max-width: 980px; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 12px; }

h1, h2 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(38px, 10vw, 56px); }
h2 { font-size: clamp(26px, 7vw, 34px); }
p { margin: 0; }
.lead { color: var(--ink-soft); margin-top: 10px; max-width: 34ch; }
.muted { color: var(--ink-soft); font-size: 15px; }

/* ── top bar ───────────────────────────────────────────── */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 18px;
}
.back {
  background: none;
  border: 0;
  padding: 8px 4px;
  font-weight: 800;
  color: var(--navy);
  cursor: pointer;
}
.back::before { content: '‹ '; font-size: 1.2em; }
.steps { display: flex; gap: 6px; }
.steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.steps i.on { background: var(--orange); }
.me { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; }

/* ── discs ─────────────────────────────────────────────── */
.disc {
  --d: #F7C59F;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--d);
  flex: none;
}
.avatar { width: 44px; height: 44px; overflow: hidden; background: var(--orange); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── home ──────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  margin: 6px 0 30px;
}
.hero .mascot {
  width: min(42vw, 210px);
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 55%, #FFD7A8 0 62%, transparent 63%);
  display: grid;
  place-items: end center;
}
.hero .mascot img { width: 108%; transform: translate(4%, 4%); }
.hero .mascot.pfp { background: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px var(--paper), var(--shadow); place-items: center; }
.hero .mascot.pfp img { width: 100%; height: 100%; object-fit: cover; transform: none; }

.paths { display: grid; gap: 14px; }
.path {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 14px 16px 14px 14px;
  border: 0;
  border-radius: 999px 28px 28px 999px;
  background: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease;
}
.path:active { transform: scale(.98); }
.path .disc { width: 76px; height: 76px; font-size: 36px; }
.path b { display: block; font-family: var(--display); font-size: 22px; font-weight: 800; line-height: 1.1; }
.path div > span { display: block; color: var(--ink-soft); font-size: 15px; margin-top: 4px; }
.pill {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--orange-ink);
  font-weight: 800;
  font-size: 13px;
  font-style: normal;
}
.pill.free { color: var(--leaf); }
.coin { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }

@media (min-width: 820px) {
  .paths { grid-template-columns: repeat(3, 1fr); }
  .path { grid-template-columns: 1fr; justify-items: center; text-align: center; border-radius: 120px 120px 28px 28px; padding: 22px 18px 24px; }
  .path .disc { width: 120px; height: 120px; font-size: 56px; }
}

.shelf { margin-top: 34px; }
.shelf h2 { font-size: 22px; margin-bottom: 12px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.strip button {
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper);
  cursor: pointer;
  scroll-snap-align: start;
}
.strip button.on { border-color: var(--orange); }
.strip img { width: 100%; height: 100%; object-fit: cover; }
.strip .waiting { display: grid; place-items: center; font-size: 30px; }

/* ── option grid (quiz, archetype, aviary) ─────────────── */
.ask { margin: 8px 0 22px; }
.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100px, 30%), 1fr));
  gap: 18px 12px;
}
.option {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
}
.option .disc {
  width: 100%;
  max-width: 108px;
  aspect-ratio: 1;
  font-size: clamp(34px, 9vw, 46px);
  box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s;
}
.option .label { font-weight: 800; font-size: 15px; line-height: 1.2; }
.option .hint { color: var(--ink-soft); font-size: 13px; line-height: 1.25; }
.option[aria-pressed='true'] .disc { transform: scale(1.06); box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--navy); }

.aviary .option .disc { overflow: hidden; max-width: 150px; }
.aviary .option img { width: 100%; height: 100%; object-fit: cover; }
.aviary .options { grid-template-columns: repeat(auto-fill, minmax(min(130px, 45%), 1fr)); }

/* ── actions ───────────────────────────────────────────── */
.actions {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding: 14px 0 max(4px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--sand) 70%, transparent);
}
.cta {
  min-height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 0 -1px #D97A0C;
  transition: transform .1s, box-shadow .1s;
}
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 -1px #D97A0C; }
.cta:disabled { opacity: .45; cursor: default; }
.quiet {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
}

/* ── summary (end of quiz) ─────────────────────────────── */
.recipe { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.recipe span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 15px;
}

/* ── image ─────────────────────────────────────────────── */
.drop {
  display: grid;
  place-items: center;
  gap: 10px;
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 10px auto 18px;
  border: 3px dashed var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
}
.drop img { width: 100%; height: 100%; object-fit: cover; }
.drop input { display: none; }
textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  font: 600 16px/1.45 var(--body);
  resize: vertical;
}
.note { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }

/* ── hatching: the loud moment ─────────────────────────── */
.nest {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px 16px;
  margin: 26px 0 8px;
}
@media (min-width: 820px) { .nest { grid-template-columns: repeat(var(--n, 4), 1fr); } }
.cell { display: grid; justify-items: center; gap: 10px; }
.cell .disc {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  overflow: hidden;
}
.egg {
  position: absolute;
  bottom: 14%;
  width: 46%;
  aspect-ratio: 4 / 5;
  border-radius: 50% 50% 48% 48% / 60% 60% 40% 40%;
  background:
    radial-gradient(circle at 30% 30%, var(--speck) 0 4%, transparent 5%),
    radial-gradient(circle at 64% 22%, var(--speck) 0 3%, transparent 4%),
    radial-gradient(circle at 55% 58%, var(--speck) 0 5%, transparent 6%),
    radial-gradient(circle at 26% 70%, var(--speck) 0 3%, transparent 4%),
    radial-gradient(circle at 38% 28%, #fff 0 10%, transparent 30%),
    var(--shell);
  box-shadow: inset -8px -10px 0 rgba(160, 110, 50, .12), 0 10px 0 -4px rgba(0, 0, 0, .12);
  transform-origin: 50% 100%;
  animation: wobble 2.6s ease-in-out infinite;
}
.cell:nth-child(2) .egg { animation-delay: -.7s; }
.cell:nth-child(3) .egg { animation-delay: -1.4s; }
.cell:nth-child(4) .egg { animation-delay: -2s; }
.egg.cracking { animation: shake .45s linear infinite; }
.egg.cracking::after {
  content: '';
  position: absolute;
  inset: 34% 8% auto;
  height: 16%;
  background: linear-gradient(135deg, transparent 45%, rgba(110, 70, 30, .6) 46% 54%, transparent 55%) 0 0 / 25% 100% repeat-x;
}
@keyframes wobble {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-7deg); }
  82% { transform: rotate(6deg); }
  88% { transform: rotate(-3deg); }
}
@keyframes shake {
  0%, 100% { transform: rotate(0) translateX(0); }
  25% { transform: rotate(-4deg) translateX(-2px); }
  75% { transform: rotate(4deg) translateX(2px); }
}
.cell img.born { width: 100%; height: 100%; object-fit: cover; animation: born .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes born { from { transform: scale(.4) translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }
.shell-half {
  position: absolute;
  width: 26%;
  aspect-ratio: 1;
  background: var(--shell);
  border-radius: 50% 50% 10% 10%;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 80% 55%, 60% 75%, 40% 55%, 20% 75%, 0 60%);
  animation: fly 1s ease-out forwards;
  pointer-events: none;
}
.shell-half.right { --dx: 140%; --r: 70deg; }
.shell-half.left { --dx: -140%; --r: -70deg; }
@keyframes fly { to { transform: translate(var(--dx), -160%) rotate(var(--r)); opacity: 0; } }
.caption {
  min-height: 2.6em;
  max-width: 200px;
  text-align: center;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink-soft);
}
.caption b { color: var(--ink); }
.rare-tag {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd1f0, #c8f3ff, #e3d4ff, #ffd1f0);
  background-size: 200% 100%;
  animation: holo 3s linear infinite;
  color: #3b2a5a;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}
.holo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 45%, rgba(200, 240, 255, .4) 50%, transparent 65%);
  background-size: 250% 100%;
  animation: holo 2.4s linear infinite;
  mix-blend-mode: overlay;
  pointer-events: none;
}
@keyframes holo { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* the choice after the hatch */
.cell button.pickable {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.cell .disc.on { box-shadow: 0 0 0 4px var(--sand), 0 0 0 8px var(--orange); }

/* ── berry game ────────────────────────────────────────── */
.game { position: relative; margin-top: 18px; border-radius: 28px; overflow: hidden; background: #DDF0E2; touch-action: none; }
@media (prefers-color-scheme: dark) { .game { background: #1F3A2C; } }
.game canvas { display: block; width: 100%; height: min(56vh, 420px); }
.game .hud {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  pointer-events: none;
}
.mini-nest { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.mini-nest .disc { width: 48px; height: 48px; overflow: hidden; font-size: 22px; }
.mini-nest img { width: 100%; height: 100%; object-fit: cover; }

/* ── the chosen one ────────────────────────────────────── */
.crowned { display: grid; justify-items: center; text-align: center; gap: 14px; margin-top: 40px; }
.crowned .disc { width: min(70vw, 300px); aspect-ratio: 1; overflow: hidden; box-shadow: 0 0 0 8px var(--paper), var(--shadow); animation: born .8s cubic-bezier(.2, 1.4, .4, 1) both; }
.crowned img { width: 100%; height: 100%; object-fit: cover; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ── states ────────────────────────────────────────────── */
.center { display: grid; justify-items: center; text-align: center; gap: 16px; margin-top: 18vh; }
.spinner { width: 58px; height: 58px; border-radius: 50%; background: var(--orange); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }
#toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--sand);
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 10;
}
#toast { display: flex; align-items: center; gap: 4px; }
#toast[hidden] { display: none; }
#toast button { white-space: nowrap; margin-left: 10px; border: 0; background: none; color: var(--orange); font-weight: 800; cursor: pointer; }

/* the mock wallet's sheet (a plain browser only) */
.mock-sheet { position: fixed; inset: 0; display: grid; align-items: end; background: rgba(28, 28, 34, .45); z-index: 20; }
.mock-sheet > div { background: var(--paper); border-radius: 26px 26px 0 0; padding: 22px 20px max(22px, env(safe-area-inset-bottom)); max-width: 600px; width: 100%; margin: 0 auto; display: grid; gap: 12px; }
.mock-sheet small { color: var(--ink-soft); }

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

/* the leaderboard */
.board { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.board li { display: grid; grid-template-columns: 2ch auto 1fr auto; align-items: center; gap: 12px; padding: 8px 14px 8px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.board li.me { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.board .rank { font-family: var(--display); font-weight: 800; text-align: center; opacity: .7; }
.board li:nth-child(-n+3) .rank { opacity: 1; color: var(--orange-ink); }
.board .avatar { width: 40px; height: 40px; }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-end { margin-top: 18px; }

/* one bar for the painting and the round */
.timeline { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 18px 0 4px; }
.timeline span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #FFC15E); transition: width .25s linear; }
.timeline-label { margin: 0; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 14px; text-align: right; }
@media (prefers-reduced-motion: reduce) { .timeline span { transition: none; } }

/* ?demo */
.demo-ribbon { margin: 0 0 14px; padding: 8px 14px; border-radius: 14px; background: var(--shell); border: 1px dashed var(--orange); color: var(--orange-ink); font-size: 14px; text-align: center; }
#play #timeline + #field .game { margin-top: 8px; }
