/* The kids section. Big targets, calm spacing, nothing that can be tapped by mistake.
   Colours come from palette.css, except where a game is about colour and brings its own. */

.kids-stars {
  text-align: center;
  font-size: 20px;
  margin: 8px 0 20px;
  color: var(--text-muted);
}

/* The one button a child who cannot read can always use. */
.kids-play-any {
  display: block;
  width: 100%;
  min-height: 72px;
  margin: 0 0 24px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 26px;
  font-weight: 500;
  cursor: pointer;
}

.kids-band {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 4px 0 10px;
}

.kids-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.kids-play-any:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.kids-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  /* A small child aims badly: the whole tile is the target, and it is large. */
  min-height: 120px;
  padding: 16px 10px;
  border-radius: 20px;
  border: 0.5px solid var(--surface-glass-border);
  background: var(--surface-glass);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

.kids-tile:active {
  background: var(--accent);
  color: var(--accent-text);
}

.kids-tile-emoji {
  font-size: 44px;
  line-height: 1;
}

.kids-tile-title {
  text-align: center;
  line-height: 1.25;
}

.kids-back {
  background: none;
  border: none;
  padding: 8px 0;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.kids-ask {
  text-align: center;
  font-size: 22px;
  margin: 8px 0 20px;
}

/* Wrapping, not a fixed two columns: the games in this section offer two, three, four or
   five choices, and a rigid grid left a lone orphan button hanging under a full row. */
.kids-choice {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 320px;
  margin: 0 auto;
}

.kids-choice > .kids-btn {
  flex: 1 1 130px;
}

/* The maze's arrow cross. Laid out as a real direction pad, so where a child presses
   matches the arrow drawn there; the empty spans are the corners. */
.kids-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 16px auto 0;
}

/* The shape a child is asked to find, shown large. */
.kids-sample {
  text-align: center;
  font-size: 64px;
  margin: 0 0 20px;
}

.kids-btn {
  /* Never smaller than this: it is aimed at by a four-year-old, not a mouse. */
  min-height: 84px;
  border: none;
  border-radius: 18px;
  font-size: 34px;
  cursor: pointer;
}

/* No real silhouette art exists, so the target picture is flattened to one tone: its
   outline is still the picture's own shape, never a colour, so the game stays fair for a
   child who cannot tell colours apart.

   The default sky is twilight, so the default silhouette is WHITE: black on that sky is
   invisible, which would leave the game with nothing to match. On the dawn sky it is dark. */
.kids-shadow {
  text-align: center;
  font-size: 56px;
  margin: 8px 0 20px;
  filter: brightness(0) invert(1) opacity(0.7);
}

[data-theme='light'] .kids-shadow {
  filter: brightness(0) opacity(0.6);
}

.kids-status {
  text-align: center;
  font-size: 18px;
  min-height: 28px;
  margin: 18px 0 0;
  color: var(--text-muted);
}

.kids-grid {
  display: grid;
  gap: 12px;
  max-width: 300px;
  margin: 0 auto;
}

.kids-cell {
  aspect-ratio: 1 / 1;
  border: 0.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface-glass);
  font-size: 34px;
  cursor: pointer;
}

.kids-cell.lit {
  background: var(--accent);
}

/* Without this a child taps a cell and absolutely nothing happens until the third tap
   resolves the round — which reads as a broken game and produces more tapping. */
.kids-cell.picked {
  background: var(--accent);
  opacity: 0.55;
}

.kids-round {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border: none;
  border-radius: 50%;
  font-size: 56px;
  line-height: 1;
  color: var(--white);
  cursor: pointer;
  transition: width 0.12s, height 0.12s, border-radius 0.12s;
}

/* The moment to tap is shown by size and shape as well as by colour, so a child who
   cannot tell red from green still sees it change. */
.kids-round.go {
  width: 190px;
  height: 190px;
  border-radius: 28px;
}

/* A colour name printed in its own colour can be nearly invisible — yellow on a light
   background is about 1.9:1. The outline keeps the cue and restores the contrast. */
.kids-ask b {
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--surface-glass);
  border: 1px solid var(--border);
}

/* :active is not :focus — a keyboard or switch user needs a ring they can actually see. */
.kids-tile:focus-visible,
.kids-btn:focus-visible,
.kids-cell:focus-visible,
.kids-round:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

/* Every game control used the browser's default: a light grey box with black text. On the sky
   that is a hole, and an emoji that draws in one colour (❔, 🧱) was black on dark glass. */
.kids-btn,
.kids-cell,
.kids-tile {
  background: var(--surface-glass);
  border: 0.5px solid var(--surface-glass-border);
  color: var(--text);
}


/* ─────────────── The playground among the planets ───────────────
   Same sky, same glass as the rest of the site, but every game tile is a small planet of its
   own colour, the stars are a glowing capsule that hops when a star is won, and every big
   button gives under the finger. The colours are decoration: text always stays on glass. */

.kids-tiles > .kids-tile:nth-child(6n + 1) { --planet: var(--planet-1); }
.kids-tiles > .kids-tile:nth-child(6n + 2) { --planet: var(--planet-2); }
.kids-tiles > .kids-tile:nth-child(6n + 3) { --planet: var(--planet-3); }
.kids-tiles > .kids-tile:nth-child(6n + 4) { --planet: var(--planet-4); }
.kids-tiles > .kids-tile:nth-child(6n + 5) { --planet: var(--planet-5); }
.kids-tiles > .kids-tile:nth-child(6n + 6) { --planet: var(--planet-6); }

.kids-tiles > .kids-tile {
  border-radius: 26px;
  gap: 10px;
  transition: transform 0.12s ease;
}

/* The planet: the emoji sits on a disc with a faint orbit ring round it. */
.kids-tiles .kids-tile-emoji {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  font-size: 40px;
  background: var(--planet);
}

.kids-tile:active {
  transform: scale(0.95);
}

/* The tiles keep their look when pressed instead of all turning the same crimson. */
.kids-tiles > .kids-tile:active {
  background: var(--surface-glass);
  color: var(--text);
}

/* The colour mixing needs color-mix (Safari 16.2+, Chrome 111+). A declaration holding var() is
   accepted when the CSS is read and only fails later, falling back to NOTHING rather than to the
   line above it — so the plain look above stands on its own, and the mixed one only replaces it
   where the browser can do it. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .kids-tiles > .kids-tile {
    border-color: color-mix(in srgb, var(--planet) 55%, var(--surface-glass-border));
    /* A wash of the planet's colour from the top, measured with the text over it in palette.test. */
    background:
      radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--planet) 16%, transparent), transparent 75%),
      var(--surface-glass);
  }

  .kids-tiles .kids-tile-emoji {
    /* Pale in the middle, where the emoji sits, so a red triangle on the orange planet is still a
       red triangle; the planet's full colour shows at the rim and in the glow. */
    background: radial-gradient(circle at 40% 36%, color-mix(in srgb, var(--planet) 22%, var(--white)) 30%, color-mix(in srgb, var(--planet) 75%, var(--white)) 100%);
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--planet) 22%, transparent),
      0 0 26px color-mix(in srgb, var(--planet) 55%, transparent);
  }

  .kids-tiles > .kids-tile:active {
    background:
      radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--planet) 20%, transparent), transparent 80%),
      var(--surface-glass);
  }
}

/* The one big button, on the site's gradient, breathing gently so a child sees where to start. */
.kids-play-any {
  background: var(--accent-gradient);
  box-shadow: var(--glow);
  border-radius: 999px;
  animation: kids-breathe 3.2s ease-in-out infinite;
  transition: transform 0.12s ease;
}

.kids-play-any:active {
  transform: scale(0.96);
}

@keyframes kids-breathe {
  50% { box-shadow: var(--glow), var(--glow); }
}

/* The stars: a capsule, not a line of grey text, and it hops when one is won. */
.kids-stars {
  width: fit-content;
  min-width: 120px;
  margin: 8px auto 20px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--surface-glass-border);
  background: var(--surface-glass);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  box-shadow: var(--glow);
}

.kids-stars.won {
  animation: kids-hop 0.6s ease;
}

@keyframes kids-hop {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) rotate(-4deg); }
  70% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

/* In a game: round, soft buttons that give under the finger. */
.kids-btn,
.kids-cell {
  /* Relative, not a fixed 22px: a maze cell on a 320px phone is about 45px wide, and 22px
     rounded it into a circle, so the corridor no longer read as a path. */
  border-radius: min(22px, 22%);
  transition: transform 0.1s ease;
}

.kids-btn:active,
.kids-cell:active {
  transform: scale(0.93);
}

.kids-back {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--surface-glass-border);
  background: var(--surface-glass);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .kids-play-any,
  .kids-stars.won {
    animation: none;
  }

  .kids-tiles > .kids-tile,
  .kids-play-any,
  .kids-btn,
  .kids-cell,
  .kids-round {
    transition: none;
  }

  .kids-tile:active,
  .kids-play-any:active,
  .kids-btn:active,
  .kids-cell:active {
    transform: none;
  }
}

@media (forced-colors: active) {
  .kids-tiles .kids-tile-emoji,
  .kids-play-any {
    border: 2px solid CanvasText;
  }

  /* A game whose answer IS a colour (find the colour, repeat the colours, wait for the colour)
     must keep its colours in high-contrast mode, or there is nothing left to answer. */
  .kids-btn[style*="background"],
  .kids-cell[style*="background"],
  .kids-round {
    forced-color-adjust: none;
  }
}
