/* Games costume, r1 (proposal for Mo). The games layer over the AmbientOS Core: load after tokens.css and
   ambi-theme.css and set data-multitude="play" on <html> (PLΔY, play.slate-hq.uk; "games" still matches). Everything here is scoped to the costume; the canvas,
   glass, bar and rails stay the Core's own. Web first: desktop 1440 leads, mobile 390 follows; pointer, keyboard
   and touch all work, with 72px targets throughout.
   Copyright (c) 2026 Slate HQ Ltd. All rights reserved and asserted. */

/* ---- Costume tokens ---- */
:root:is([data-multitude="games"], [data-multitude="play"]) {
  /* Allo at high roundness for small readers (ROND 0 to 100). */
  --aos-font-round: 96;
  /* The resting canvas, a touch brighter for play: the same cyan to pink. */
  --aos-canvas-a: #cdeff8;
  --aos-canvas-b: #f6f5fb;
  --aos-canvas-c: #f9d3e3;

  /* Play colours: the canvas pastels and the prism's hues, mid-tone so they read on light and dark. Fills, never glows. */
  --g-leaf: #3f9a6e;
  --g-sky: #3f86d1;
  --g-coral: #e0675b;
  --g-sun: #e2a83a;
  --g-plum: #8466cc;
  --g-teal: #2f8f86;
  --g-rose: #d9668f;
  --g-lilac: #8f86c4;
  --g-ring: var(--g-teal);            /* the today ring */
  --g-ring-track: color-mix(in srgb, var(--aos-ink) 10%, transparent);
  --g-right: #2f7a4f;                 /* a found sound: always with the star or tick glyph */

  /* Type: Allo, heavier, bigger. Every instruction is also spoken; text is for grown-ups and early readers. */
  --g-font: var(--aos-font);
  --g-text-hero: 64px;
  --g-text-title: 40px;
  --g-text-section: 28px;
  --g-text-label: 22px;
  --g-text-body: 19px;
  --g-text-small: 16px;
  --g-weight-display: 760;
  --g-weight-label: 650;
  --g-letter-tile-size: 136px;        /* the picture-letter inside a tile */

  /* Shape: larger radii than adult cards. */
  --g-radius-tile: 32px;
  --g-radius-card: 36px;
  --g-radius-sheet: 40px;
  --g-radius-button: 999px;

  /* Targets: 72px for touch, kept for pointer too. */
  --g-target: 72px;
  --g-gap: 16px;

  /* Focus: a solid two-ring outline in ink, never a glow. */
  --g-focus: 0 0 0 4px var(--aos-ground), 0 0 0 8px var(--aos-ink);
  --g-press: .96;
}
:root:is([data-multitude="games"], [data-multitude="play"])[data-theme="dark"] {
  --aos-canvas-a: #22404a;
  --aos-canvas-b: #20232f;
  --aos-canvas-c: #48304a;
  --g-leaf: #5fb88c; --g-sky: #6aa6e6; --g-coral: #ec8a7f; --g-sun: #e8bb5c; --g-plum: #a790e2;
  --g-teal: #5cb8ad; --g-rose: #e58aaa; --g-lilac: #aba3dc; --g-right: #6fcf97;
}
@media (prefers-color-scheme: dark) {
  :root:is([data-multitude="games"], [data-multitude="play"]):not([data-theme="light"]) {
    --aos-canvas-a: #22404a; --aos-canvas-b: #20232f; --aos-canvas-c: #48304a;
    --g-leaf: #5fb88c; --g-sky: #6aa6e6; --g-coral: #ec8a7f; --g-sun: #e8bb5c; --g-plum: #a790e2;
    --g-teal: #5cb8ad; --g-rose: #e58aaa; --g-lilac: #aba3dc; --g-right: #6fcf97;
  }
}
@media (max-width: 760px) {
  :root:is([data-multitude="games"], [data-multitude="play"]) { --g-text-hero: 44px; --g-text-title: 32px; --g-text-section: 24px; --g-letter-tile-size: 96px; }
}

/* ---- Type ---- */
:is([data-multitude="games"], [data-multitude="play"]) .g-hero-title { font: var(--g-weight-display) var(--g-text-hero)/1.02 var(--g-font); letter-spacing: -.03em; margin: 0; }
:is([data-multitude="games"], [data-multitude="play"]) .g-title { font: var(--g-weight-display) var(--g-text-title)/1.08 var(--g-font); letter-spacing: -.015em; margin: 0; }
:is([data-multitude="games"], [data-multitude="play"]) .g-section { font: 720 var(--g-text-section)/1.15 var(--g-font); letter-spacing: -.02em; margin: 0; }
:is([data-multitude="games"], [data-multitude="play"]) .g-label { font: var(--g-weight-label) var(--g-text-label)/1.2 var(--g-font); }
:is([data-multitude="games"], [data-multitude="play"]) .g-body { font: 450 var(--g-text-body)/1.5 var(--g-font); color: var(--aos-ink-2); margin: 0; }
:is([data-multitude="games"], [data-multitude="play"]) .g-small { font: 500 var(--g-text-small)/1.4 var(--g-font); color: var(--aos-ink-2); }

/* ---- Shared interaction: every pressable piece ---- */
.g-press {
  -webkit-tap-highlight-color: transparent; cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform var(--aos-dur-control) var(--aos-ease-spring), background-color var(--aos-dur-control) ease, box-shadow var(--aos-dur-control) ease;
}
.g-press:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-press:active { transform: scale(var(--g-press)); }
@media (hover: hover) and (pointer: fine) {
  .g-press:hover { transform: translateY(-3px); box-shadow: var(--aos-shadow-lift); }
  .g-press:focus-visible:hover { box-shadow: var(--g-focus), var(--aos-shadow-lift); }
}

/* ---- Letter tile: a picture-letter on glass ---- */
.g-letter-tile {
  all: unset; box-sizing: border-box; position: relative;
  display: grid; place-items: center; aspect-ratio: 1; min-width: var(--g-target); min-height: var(--g-target);
  border-radius: var(--g-radius-tile); padding: 10px;
  background: var(--aos-glass-tile);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
  backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
}
.g-letter-tile img, .g-letter-tile svg { width: min(100%, var(--g-letter-tile-size)); height: auto; display: block; overflow: visible; }
@media (hover: hover) and (pointer: fine) { .g-letter-tile:hover { background: var(--aos-glass-chrome); } }
.g-letter-tile[aria-pressed="true"] { background: var(--aos-glass-chrome); box-shadow: inset 0 0 0 4px var(--aos-ink); }
.g-letter-tile.is-right { background: var(--aos-glass-chrome); box-shadow: inset 0 0 0 4px var(--g-right); }
.g-badge {   /* a found sound wears a star, never a colour alone */
  position: absolute; top: -10px; right: -10px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--g-right); color: #fff; box-shadow: 0 0 0 4px var(--aos-ground);
}
.g-badge svg { width: 24px !important; height: 24px !important; }
.g-letter-tile.is-try { animation: g-wobble .5s var(--aos-ease-smooth); }   /* try again: a wobble, never a red cross */
@keyframes g-wobble { 20% { transform: rotate(-4deg); } 50% { transform: rotate(3deg); } 80% { transform: rotate(-1deg); } }

/* ---- Sound tile: a sound to hear and match (ck, ff, ll, ss) ---- */
.g-sound-tile {
  all: unset; box-sizing: border-box; position: relative;
  display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 12px 20px 12px 14px;
  border-radius: var(--g-radius-tile); background: var(--aos-glass-tile);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
  backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
}
.g-sound-tile .g-sound-tile__speaker {
  flex: none; width: var(--g-target); height: var(--g-target); border-radius: 50%; display: grid; place-items: center;
  background: var(--aos-ink); color: var(--aos-ground);
}
.g-sound-tile .g-sound-tile__speaker svg { width: 34px; height: 34px; }
.g-sound-tile .g-sound-tile__glyph { width: 108px; height: auto; display: block; }
@media (hover: hover) and (pointer: fine) { .g-sound-tile:hover { background: var(--aos-glass-chrome); } }
.g-sound-tile.is-playing .g-sound-tile__speaker { background: var(--g-sky); color: #fff; }
.g-bars { display: inline-flex; gap: 4px; align-items: center; height: 28px; }
.g-bars i { width: 5px; border-radius: 3px; background: currentColor; height: 30%; }
.is-playing .g-bars i { animation: g-bar 900ms ease-in-out infinite; }
.is-playing .g-bars i:nth-child(2) { animation-delay: -300ms; } .is-playing .g-bars i:nth-child(3) { animation-delay: -600ms; }
@keyframes g-bar { 0%, 100% { height: 30%; } 50% { height: 100%; } }

/* ---- Today ring: HEΔLTHi's ring, now the day's play ---- */
.g-ring {
  --g-ring-value: 60;  /* 0 to 100 */
  position: relative; flex: none; width: 132px; height: 132px; display: grid; place-items: center;
  font: 760 34px/1 var(--g-font); font-variant-numeric: tabular-nums;
}
.g-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--g-ring) 0 calc(var(--g-ring-value) * 1%), var(--g-ring-track) calc(var(--g-ring-value) * 1%) 100%);
  -webkit-mask: radial-gradient(circle, transparent 50px, #000 51px); mask: radial-gradient(circle, transparent 50px, #000 51px);
}
.g-ring__stars { display: flex; gap: 2px; justify-content: center; margin-top: 6px; color: var(--g-sun); }
.g-ring__stars svg { width: 16px; height: 16px; }
.g-ring--small { width: 84px; height: 84px; font-size: 22px; }
.g-ring--small::before { -webkit-mask: radial-gradient(circle, transparent 31px, #000 32px); mask: radial-gradient(circle, transparent 31px, #000 32px); }

/* ---- Big button: capsule, 72px tall ---- */
.g-big-button {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: var(--g-target); min-width: var(--g-target); padding: 0 30px; border-radius: var(--g-radius-button);
  font: var(--g-weight-label) var(--g-text-label)/1 var(--g-font);
  background: var(--aos-ink); color: var(--aos-ground);
}
.g-big-button svg { width: 32px; height: 32px; flex: none; }
.g-big-button--glass { background: var(--aos-glass-chrome); color: var(--aos-ink); box-shadow: var(--aos-shadow-bar);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate)); backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate)); }
.g-big-button--round { padding: 0; width: var(--g-target); }
@media (hover: hover) and (pointer: fine) {
  .g-big-button:hover { background: color-mix(in srgb, var(--aos-ink) 86%, var(--aos-ground)); }
  .g-big-button--glass:hover { background: var(--aos-glass-menu); }
}

/* ---- Guide cue: the guide is speaking. A sound mark and bars; words underneath are for the grown-up. ---- */
.g-cue {
  position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 12px 20px 12px 12px;
  border-radius: 28px; background: var(--aos-glass-chrome); box-shadow: var(--aos-shadow-bar);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate)); backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
  font: 600 var(--g-text-body)/1.3 var(--g-font); color: var(--aos-ink); white-space: nowrap;
}
.g-cue::before {   /* the tail points at the guide, to the left */
  content: ""; position: absolute; left: -9px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%) rotate(45deg);
  background: inherit; border-radius: 4px;
}
.g-cue__sound { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--g-sky); color: #fff; }
.g-cue__sound svg { width: 26px; height: 26px; }

/* ---- Guide and friends ---- */
.g-guide { width: 180px; height: auto; display: block; }
.g-guide--small { width: 112px; }
.g-creature { width: 100%; max-width: 148px; height: auto; display: block; }
.g-sticker { width: 100%; max-width: 120px; height: auto; display: block; }
.g-sticker.is-new { animation: g-pop 600ms var(--aos-ease-spring); }
@keyframes g-pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }

/* ---- Mouth card ---- */
.g-mouth-card {
  display: grid; justify-items: center; gap: 10px; padding: 18px 18px 16px; border-radius: var(--g-radius-card);
  background: var(--aos-glass-tile);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate)); backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
}
.g-mouth-card { min-width: 0; }
.g-mouth-card img { width: 100%; max-width: 140px; height: auto; display: block; }
.g-mouth-card b { font: 760 40px/1 var(--g-font); }

/* ---- Grown-ups gate: open play for the child; the account (tracked like Fourth Take) sits behind a hold that
   a pre-reader will not finish by chance. ---- */
.g-parent-gate {
  display: grid; gap: 18px; padding: 28px; border-radius: var(--g-radius-sheet);
  background: var(--aos-glass-sheet); box-shadow: var(--aos-shadow-float);
  -webkit-backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate)); backdrop-filter: blur(var(--aos-glass-blur)) saturate(var(--aos-glass-saturate));
}
.g-parent-gate__head { display: flex; align-items: center; gap: 14px; }
.g-parent-gate__icon { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--aos-fill-2); color: var(--aos-ink); }
.g-parent-gate__icon svg { width: 32px; height: 32px; }
.g-hold {                           /* press and hold: the ring fills over three seconds */
  --g-hold: 0;                       /* 0 to 100, set by script while held */
  all: unset; box-sizing: border-box; position: relative; display: inline-flex; align-items: center; gap: 14px;
  min-height: var(--g-target); padding: 0 28px 0 8px; border-radius: var(--g-radius-button);
  background: var(--aos-ink); color: var(--aos-ground); font: var(--g-weight-label) 20px/1 var(--g-font);
}
.g-hold__ring { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--aos-ground) 0 calc(var(--g-hold) * 1%), color-mix(in srgb, var(--aos-ground) 22%, transparent) calc(var(--g-hold) * 1%) 100%);
  -webkit-mask: radial-gradient(circle, transparent 21px, #000 22px); mask: radial-gradient(circle, transparent 21px, #000 22px); }
.g-hold__wrap { position: relative; width: 56px; height: 56px; display: grid; place-items: center; }
.g-hold__wrap svg { position: absolute; width: 24px; height: 24px; }
.g-account-line { display: flex; align-items: center; gap: 10px; font: 500 var(--g-text-small)/1.4 var(--g-font); color: var(--aos-ink-2); }

@media (prefers-reduced-motion: reduce) {
  .g-letter-tile.is-try, .g-sticker.is-new, .is-playing .g-bars i { animation: none; }
  .g-press:hover { transform: none; }
}
@media (forced-colors: active) {
  .g-letter-tile, .g-sound-tile, .g-mouth-card, .g-parent-gate { border: 2px solid CanvasText; }
}

/* ---- PLΔY wordmark (r2): wordmark-play-clean.svg inlined with data-svg, letters take the Core ink in both schemes;
   the guide in the Δ keeps its own face. Size with height on .g-wordmark. */
.g-wordmark { display: inline-block; height: 56px; aspect-ratio: 480 / 200; flex: none; line-height: 0; }
.g-wordmark svg { width: 100%; height: 100%; display: block; }
.g-wordmark .wm-ink { stroke: var(--aos-ink); }
.g-wordmark--small { height: 40px; }
