/* Stella's games: one calm look for every game.
   Soft pastels on cream, a warm brown ink instead of black, big round
   shapes, slow and small movement. Made for a 3½-year-old on an iPad:
   everything she can touch is at least 96 px, nothing flashes, nothing
   moves on its own for long, and nothing needs reading. */

:root {
  --cream: #FFF8EE;
  --paper: #FFFFFF;
  --ink: #5A4038;        /* warm brown, never black */
  --ink-soft: #9C8077;
  --pink: #F7B6C2;
  --pink-deep: #E98AA0;
  --mint: #BDE7D1;
  --mint-deep: #7FC9A4;
  --butter: #FBE29A;
  --butter-deep: #F2C94C;
  --sky: #B9DDF5;
  --sky-deep: #7DBBE6;
  --lilac: #D9C8F0;
  --lilac-deep: #B49BE0;
  --peach: #FFD3B0;
  --cocoa: #B07A55;      /* cookies */
  --chip: #6B4430;       /* chocolate chips */
  --grass: #CFE8B4;
  --shadow: 0 6px 0 rgba(90, 64, 56, 0.12);
  --radius: 28px;
  --slow: 380ms;
  --ease: cubic-bezier(.3, 1.3, .5, 1); /* a soft, gentle bounce */
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Hidden means gone, whatever display a class gives it. */
[hidden] { display: none !important; }
/* Buttons take the warm ink, not the browser's black. */
button { color: var(--ink); }
html, body { height: 100%; margin: 0; }
body {
  background: var(--cream);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* The page of a game: a small home button at the top left, the play area below. */
.stage { position: relative; height: 100%; display: flex; flex-direction: column; }
.topbar { flex: none; height: 96px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.home {
  width: 76px; height: 76px; border: 0; border-radius: 50%;
  background: var(--paper); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer;
}
.home svg { width: 40px; height: 40px; }
.dots { display: flex; gap: 10px; }             /* how far through the rounds, as dots: never a number */
.dots i { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 3px var(--pink); }
.dots i.on { background: var(--pink); }
.play { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 0 20px 24px; }

/* Things to tap: big, round, lifted. */
.tile {
  min-width: 120px; min-height: 120px; border: 0; border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--shadow); color: var(--ink);
  display: grid; place-items: center; font: inherit; font-weight: 700; cursor: pointer;
  transition: transform var(--slow) var(--ease);
}
.tile:active { transform: scale(.94); }
.big { font-size: clamp(72px, 14vmin, 150px); line-height: 1; font-weight: 800; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }

/* Feedback: a little hop for right, a small wiggle for not-quite. */
.hop { animation: hop var(--slow) var(--ease); }
@keyframes hop { 50% { transform: translateY(-14px) scale(1.06); } }
.wiggle { animation: wiggle 420ms ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.glow { box-shadow: 0 0 0 8px var(--butter), var(--shadow); }   /* the hint after two tries */
/* The nudge after a long pause: "your turn", never "this one". Put it on the
   question and on every choice alike, so it singles nothing out. */
.nudge { animation: nudge 1100ms ease-in-out; }
@keyframes nudge { 30% { transform: translateY(-8px); } 60% { transform: translateY(0); } 80% { transform: translateY(-4px); } }
.fade-in { animation: fadein 500ms ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }

/* The end of a game: a sticker for her book. */
.done {
  position: absolute; inset: 0; background: rgba(255, 248, 238, .96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; z-index: 10;
}
.done .sticker { width: min(46vmin, 320px); height: min(46vmin, 320px); animation: settle 900ms var(--ease) both; }
@keyframes settle { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }
.done .again { display: flex; gap: 24px; }

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