/* The Create group (batch 5b): Paint Studio, the Colouring Book and My Thoughts. Loaded after games.css by those three pages.
   Every control is a real button; the busy ones (24 colours, brushes, stamps) are at least 44px and the main buttons use --tap.
   No movement is needed to see anything: Calm mode and reduced motion only switch off the sparkle brush and the replay's pacing. */

.game-stage { --dense: 44px; }
.game-stage .game-feedback { margin: var(--space-3) 0; }

/* ---------- buttons shared by the three pages ---------- */
.create-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin: var(--space-4) 0; }
.create-actions .btn { padding: 0 var(--space-4); }

.tool {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: var(--tap); min-height: var(--tap); padding: var(--space-2) var(--space-3);
  border: 3px solid #e3dccb; border-radius: var(--radius-m); background: #fff; color: var(--ink);
  font-weight: 800; font-size: var(--fs-xs); cursor: pointer;
}
.tool__icon { font-size: 1.6rem; line-height: 1; }
.tool:hover { border-color: var(--sun-deep); }
.tool[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-deep); box-shadow: inset 0 -3px 0 var(--sun-deep); }
.tool[aria-disabled="true"] { opacity: 0.45; cursor: default; }

/* a grid of small choices (brushes, sizes, stamps, shapes, pages): wraps, never scrolls sideways */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--dense), 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
.pick-grid--wide { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.pick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: var(--dense); min-height: var(--dense); padding: var(--space-1) var(--space-2);
  border: 3px solid #e3dccb; border-radius: var(--radius-s); background: #fff; color: var(--ink);
  font-weight: 800; font-size: var(--fs-xs); line-height: 1.1; cursor: pointer;
}
.pick-btn:hover { border-color: var(--sun-deep); }
.pick-btn[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-deep); box-shadow: inset 0 -3px 0 var(--sun-deep); }
.pick-btn[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.pick-btn__icon { font-size: 1.5rem; line-height: 1; }
.pick-btn img { width: 44px; height: 44px; object-fit: contain; }

/* colour swatches: round, at least 44px, the chosen one has a thick ring and a tick */
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
@media (min-width: 560px) { .swatches { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.swatch-btn {
  position: relative; aspect-ratio: 1; min-width: var(--dense); min-height: var(--dense); width: 100%;
  border: 3px solid var(--ink); border-radius: 50%; cursor: pointer; padding: 0;
}
.swatch-btn[aria-pressed="true"] { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--focus); }
.swatch-btn[aria-pressed="true"]::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.4rem; font-weight: 900; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.swatch-btn--none { background: #fff; }
.swatch-btn--none::before { content: ""; position: absolute; inset: 8%; border-top: 3px solid var(--try); transform: rotate(-45deg) translateY(50%) ; transform-origin: center; top: 42%; }

.panel-title { margin: var(--space-3) 0 var(--space-1); font-size: var(--fs-s); font-weight: 900; color: var(--ink-soft); }

/* ---------- Paint Studio ---------- */
.paint { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .paint { grid-template-columns: minmax(0, 640px) minmax(0, 1fr); } }
.paint__frame {
  position: relative; width: 100%; max-width: 640px; aspect-ratio: 4 / 3; margin: 0 auto;
  border: 4px solid var(--ink); border-radius: var(--radius-m); background: #fff; overflow: hidden; box-shadow: var(--shadow-1);
}
.paint__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.paint__canvas--paint { touch-action: none; cursor: crosshair; }
.paint__canvas--paint:focus-visible { outline: 4px solid var(--focus); outline-offset: -8px; border-radius: 0; }
.paint__frame.is-locked .paint__canvas--paint { cursor: default; }
.paint__cursor, .paint__start { position: absolute; pointer-events: none; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; }
.paint__cursor { border: 3px solid var(--try); background: rgba(255, 255, 255, 0.55); }
.paint__cursor.is-down { background: var(--try); }
.paint__start { border: 3px solid var(--focus); background: rgba(63, 169, 245, 0.45); }
.paint__help { margin: var(--space-2) auto 0; max-width: 640px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-soft); text-align: center; }
.paint__side { min-width: 0; }
.paint__toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.paint__panel[hidden] { display: none; }
.mixer { margin: var(--space-2) 0; padding: var(--space-3); border: 3px dashed #e3dccb; border-radius: var(--radius-m); background: #fff; }
.mixer[hidden] { display: none; }
.mixer__row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
.mixer__slot { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--fs-xs); }
.mixer__chip { display: inline-block; width: 40px; height: 40px; border: 3px solid var(--ink); border-radius: 50%; background: #fff; }
.mixer__result { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 800; }
.mixer__result .mixer__chip { width: 52px; height: 52px; }

/* the "are you sure?" question, in pictures only */
.confirm-pics { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin: var(--space-3) auto; padding: var(--space-3); max-width: 420px; border: 4px solid var(--sun-deep); border-radius: var(--radius-l); background: #fff; }
.confirm-pics[hidden] { display: none; }
.confirm-pics__ask { font-size: 2.6rem; line-height: 1; }
.confirm-pics .btn { min-width: 88px; font-size: 2rem; }

/* ---------- Colouring Book ---------- */
.colouring { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .colouring { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); } }
.colouring__svg { display: block; width: 100%; max-width: 480px; aspect-ratio: 1; margin: 0 auto; border: 4px solid var(--ink); border-radius: var(--radius-m); background: #fff; box-shadow: var(--shadow-1); }
.region { cursor: pointer; }
.region:hover { stroke-width: 5; }
.region.is-picked, .region:focus-visible { stroke: var(--focus); stroke-width: 6; outline: none; }
.colouring__svg.is-locked .region { cursor: default; }
.picture-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-3); }
.picture-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: var(--tap); padding: var(--space-1) var(--space-2); border: 3px solid #e3dccb; border-radius: var(--radius-s); background: #fff; color: var(--ink); font-weight: 800; font-size: var(--fs-xs); cursor: pointer; }
.picture-pick svg { width: 56px; height: 56px; }
.picture-pick[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-deep); box-shadow: inset 0 -3px 0 var(--sun-deep); }
.colouring__status { margin: var(--space-2) 0; font-weight: 800; color: var(--ink-soft); text-align: center; min-height: 1.5em; }

/* ---------- My Thoughts ---------- */
.strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3); margin: var(--space-4) 0; font-size: var(--fs-l); font-weight: 900; }
.strip__gap {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-width: 132px; min-height: 96px; padding: var(--space-2) var(--space-3);
  border: 4px dashed var(--ink-soft); border-radius: var(--radius-m); background: #fff; color: var(--ink); font-size: var(--fs-s); font-weight: 800; cursor: pointer;
}
.strip__gap.is-active { border-color: var(--focus); background: #e8f4ff; box-shadow: 0 0 0 4px rgba(63, 169, 245, 0.35); }
.strip__gap.is-filled { border-style: solid; border-color: var(--good); }
.strip__gap .face { width: 64px; height: 64px; }
.strip__emoji { font-size: 2.4rem; line-height: 1; }
.thought__ask { margin: var(--space-3) 0; font-size: var(--fs-m); font-weight: 900; text-align: center; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; padding: 0; list-style: none; }
.card-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); width: 100%; min-height: 112px; padding: var(--space-2); border: 4px solid #e3dccb; border-radius: var(--radius-m); background: #fff; color: var(--ink); font-weight: 800; font-size: var(--fs-xs); line-height: 1.15; text-align: center; cursor: pointer; }
.card-btn:hover { border-color: var(--sun-deep); }
.card-btn[aria-pressed="true"] { background: var(--sun); border-color: var(--sun-deep); }
.card-btn .face { width: 68px; height: 68px; }
.card-btn__emoji { font-size: 2.6rem; line-height: 1; }
.card-btn img { width: 68px; height: 68px; object-fit: contain; }
.card-btn .swatch { width: 68px; height: 68px; }
.thought__sentence { margin: var(--space-3) 0; font-size: var(--fs-m); font-weight: 900; text-align: center; min-height: 1.5em; }
.drawing-picks { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin: var(--space-3) 0; }
.drawing-picks[hidden] { display: none; }
.drawing-pick { padding: 0; width: 120px; border: 4px solid #e3dccb; border-radius: var(--radius-s); background: #fff; cursor: pointer; overflow: hidden; }
.drawing-pick[aria-pressed="true"] { border-color: var(--good); box-shadow: 0 0 0 4px rgba(19, 128, 61, 0.35); }
.drawing-pick img { display: block; width: 100%; height: auto; }
.thought__picture { display: block; max-width: 200px; height: auto; margin: var(--space-2) auto; border: 4px solid var(--ink); border-radius: var(--radius-s); }
.thought__picture[hidden] { display: none; }
.face { display: block; }

@media (max-width: 400px) {
  .strip__gap { min-width: 112px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
}

/* Calm mode and reduced motion: no pop, no wobble on these pages (the buttons themselves never move on their own) */
html.calm .game-stage .btn--wobble { animation: none; }

/* ---------- Story Maker (batch 5d) ---------- */
.story { margin: var(--space-4) auto; max-width: 720px; }
.story[hidden] { display: none; }
.story__title { margin: 0 0 var(--space-2); font-size: var(--fs-m); font-weight: 900; text-align: center; }
.story__pages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.story-page { padding: var(--space-3); border: 4px solid #e3dccb; border-radius: var(--radius-m); background: #fff; }
.story-page__title { margin: 0 0 var(--space-1); font-size: var(--fs-s); font-weight: 900; color: var(--ink-soft); }
.story-page__text { margin: 0 0 var(--space-2); font-size: var(--fs-m); font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.story-page__picture { display: block; max-width: 160px; width: 100%; height: auto; margin: 0 0 var(--space-2); border: 3px solid var(--ink); border-radius: var(--radius-s); }
.story-page__buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.story-page__buttons .btn { min-height: var(--dense); }
.story-page__buttons .btn[aria-disabled="true"] { opacity: 0.45; }

/* ---------- Music Patterns (batch 5d): every bar and pad has a letter or name, a colour AND a key; nothing moves ---------- */
.music__status { min-height: 1.6em; margin: 0 auto var(--space-2); text-align: center; font-size: var(--fs-m); font-weight: 800; }
.music__nosound { max-width: 560px; margin: 0 auto var(--space-3); padding: var(--space-2) var(--space-3); border: 3px solid var(--sun-deep); border-radius: var(--radius-m); background: #fff8e1; text-align: center; font-weight: 700; }
.music__nosound[hidden] { display: none; }
.music__pattern { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); min-height: var(--dense); margin: 0 auto var(--space-3); padding: 0; }
.pattern-chip { display: grid; place-items: center; min-width: var(--dense); min-height: var(--dense); padding: 0 var(--space-2); border: 3px solid var(--ink); border-radius: var(--radius-s); font-weight: 900; color: var(--ink); }
.pattern-chip--empty { border-style: dashed; border-color: #b9ad90; background: #fff; color: var(--ink-soft); }
.music__keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); width: 100%; max-width: 760px; margin: 0 auto var(--space-3); }
@media (min-width: 640px) { .music__keys[data-instrument="xylophone"] { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.music__keys[data-instrument="drums"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }
.note {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 112px; min-width: var(--tap); padding: var(--space-2) var(--space-1);
  border: 4px solid var(--ink); border-radius: var(--radius-m); color: var(--ink); font-weight: 900; cursor: pointer;
}
.music__keys[data-instrument="drums"] .note { min-height: 120px; }
.note__key { font-size: var(--fs-xs); font-weight: 800; }
.note__icon { font-size: 1.8rem; line-height: 1; }
.note__name { font-size: 1.6rem; line-height: 1.1; }
.note[aria-disabled="true"] { cursor: default; }
.note--red, .pattern-chip.note--red { background: #ffcdd2; }
.note--orange, .pattern-chip.note--orange { background: #ffe0b2; }
.note--yellow, .pattern-chip.note--yellow { background: #fff9c4; }
.note--green, .pattern-chip.note--green { background: #c8e6c9; }
.note--teal, .pattern-chip.note--teal { background: #b2dfdb; }
.note--blue, .pattern-chip.note--blue { background: #bbdefb; }
.note--purple, .pattern-chip.note--purple { background: #e1bee7; }
.note--pink, .pattern-chip.note--pink { background: #f8bbd0; }
.note.is-lit { box-shadow: 0 0 0 4px #fff, 0 0 0 9px var(--ink); color: #fff; }
.note--red.is-lit { background: #c62828; }
.note--orange.is-lit { background: #bf360c; }
.note--yellow.is-lit { background: #ffd600; color: var(--ink); }
.note--green.is-lit { background: #2e7d32; }
.note--teal.is-lit { background: #00695c; }
.note--blue.is-lit { background: #1565c0; }
.note--purple.is-lit { background: #6a1b9a; }
.note--pink.is-lit { background: #ad1457; }
.music__keyhelp { margin: 0 auto var(--space-3); max-width: 560px; text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-soft); }
.create-actions .btn[aria-disabled="true"] { opacity: 0.5; }

/* ---------- Real-world Missions (batch 5d) ---------- */
.mission { max-width: 560px; margin: var(--space-4) auto; padding: var(--space-4); border: 4px solid var(--good); border-radius: var(--radius-l); background: #fff; text-align: center; }
.mission__emoji { margin: 0; font-size: 3.4rem; line-height: 1.1; }
.mission__text { margin: var(--space-2) 0; font-size: var(--fs-l); font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.mission__with { margin: var(--space-2) 0 0; font-size: var(--fs-s); font-weight: 700; color: var(--ink-soft); }
.mission__week { margin: 0 auto var(--space-3); text-align: center; font-size: var(--fs-s); font-weight: 800; color: var(--good); }
.mission__week[hidden] { display: none; }
