/* Stone Stack: the whole first screen is one soft scene you can tap. First-party CSS, no images or fonts.
   The sky, floor and outline follow Meadow and Dusk (both skies are calm and light enough to read dark outlines on);
   the stone colours are fixed so they read the same in both. The only strong warm colour on this page is the site's own
   911 button in the 988/911 bar. */
:root {
  --ss-sky-top: #cfe3ea; --ss-sky-bottom: #f1ead6; --ss-ground: #d8c9a2; --ss-stroke: #26332f;
  /* The shared shell's awning, tag and main-action colour become a muted teal on this page. */
  --pop-red: #3f7f7a; --accent: #1f5652; --accent-ink: #ffffff;
}
/* Dusk keeps the dark page colours but the sky stays calm and mid-tone, never dark. */
[data-calm-theme="dusk"] { --ss-sky-top: #8fa9b6; --ss-sky-bottom: #d2c4aa; --ss-ground: #b9a888; --ss-stroke: #1d2926; }
html[data-calm-theme="dusk"] { --muted: #D0DCD9; }
.hint { color: var(--muted); font-size: 1.15rem; }

/* Top bar: Leave in the top left corner, Settings in the top right, both big with strong borders. */
.game-header { margin: 0; padding: .75rem .75rem .25rem; background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.game-header::before { display: none; }
.game-header .top-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem; margin: 0; }
.game-header h1 { margin: .25rem 0 0; font-size: 1.6rem; }
.game-header .leave.button, .game-header .calm-toggle { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-width: 6rem; min-height: 4rem; padding: .5rem 1.1rem; font-size: 1.35rem; font-weight: 700; border: 4px solid var(--ink); border-radius: var(--radius-sm); }
.game-header .calm-toggle { box-shadow: none; }
/* Two columns so Settings always stays in the top right corner, whatever the font: "← Back to games" takes the space
   left over and wraps to two lines on a narrow phone. The Settings panel opens across the full width below. */
.game-header .top-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.game-header .top-row > .leave.button { justify-self: start; max-width: 9.5rem; text-align: center; line-height: 1.15; }
.game-header .top-row .calm-toggle { justify-self: end; }
.game-header .top-row .calm-panel { grid-column: 1 / -1; }
.calm-button { min-height: 3.5rem; min-width: 5rem; font-size: 1.2rem; border-width: 4px; }
.calm-check { min-height: 3.5rem; font-size: 1.2rem; }
.calm-panel input[type="checkbox"], .calm-panel input[type="radio"] { width: 2rem; height: 2rem; }

/* The shared readable layer pads the page column by 5rem at the bottom; here the page is split around the full-width scene. */
main > .game-shell.below { padding-top: 1rem; padding-bottom: 1rem; }
.game-footer > .game-shell { padding-top: 0; padding-bottom: 3rem; }
.game-footer nav a { display: inline-flex; align-items: center; min-height: 3.5rem; padding: 0 .5rem; font-size: 1.25rem; }
details > summary { cursor: pointer; min-height: 3.5rem; font-size: 1.3rem; display: flex; align-items: center; font-weight: 700; }

/* The first screen is the drop target: scene, buttons, hint and the 988 line. Tapping any empty part of it places a stone.
   Heights come from the screen height, not the newer ratio property, so it also works on iOS Safari 14. */
.screen { cursor: pointer; touch-action: pan-y pinch-zoom; /* scrolls up and down and still pinch-zooms (WCAG 1.4.4) */ -webkit-tap-highlight-color: transparent; }
.screen > * { margin-left: .75rem; margin-right: .75rem; }
.screen > .stage { margin-left: 0; margin-right: 0; }
.stage { position: relative; width: 100%; height: calc(100vh - 21rem); min-height: 15rem; overflow: hidden;
  background: linear-gradient(180deg, var(--ss-sky-top), var(--ss-sky-bottom)); border-top: var(--line) solid var(--border); border-bottom: var(--line) solid var(--border); }
.stage:focus { outline: 5px solid var(--focus); outline-offset: -8px; box-shadow: inset 0 0 0 9px var(--halo); }
.scene { width: 100%; height: 100%; }
.scene-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ground { fill: var(--ss-ground); stroke: var(--ss-stroke); stroke-width: 3; }
.stone path { stroke: var(--ss-stroke); stroke-width: 3; stroke-linejoin: round; }
.c-grey path { fill: #8d857b; }
.c-sand path { fill: #cdb98f; }
.c-slate path { fill: #5f7078; }
.c-moss path { fill: #6f7f4f; }
.c-teal path { fill: #4f8a85; }
.c-pale path { fill: #ece6d8; }

/* Very large targets for every age: the main buttons are at least 72px tall, other controls at least 56px. */
.actions { margin-top: 1rem; margin-bottom: .75rem; gap: .75rem; flex-wrap: wrap; }
.actions button { min-height: 4.5rem; font-size: 1.3rem; flex: 1 1 6rem; }
.actions #place { flex: 1 1 100%; min-height: 5rem; font-size: 1.5rem; }

/* One gentle wobble, then still. The stone appears where it rests (no falling, no vertical movement) and rocks once about
   its base. Calm motion, and the device's reduced-motion setting, remove all of it. */
@keyframes stone-wobble {
  0% { transform: rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  40% { transform: rotate(-3deg); }
  75% { transform: rotate(1.5deg); }
  100% { transform: rotate(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduced"]) .stone.is-new .body { transform-box: fill-box; transform-origin: 50% 100%; animation: stone-wobble 1s ease-in-out both; }
}

/* The 988 line is plain HTML right under the scene. */
.support-strip { margin-top: 0; margin-bottom: 1rem; padding: .85rem 1rem; color: var(--ink); background: var(--note); border: 3px solid var(--border); border-radius: var(--radius-sm); font-size: 1.15rem; }
.support-strip a { display: inline-flex; align-items: center; justify-content: center; min-width: 4rem; min-height: 3.5rem; font-weight: 900; font-size: 1.4rem; }
.below .optional-note { margin-bottom: 1.5rem; }
@media (forced-colors: active) { .stage { border-color: CanvasText; } .stone path, .ground { stroke: CanvasText; fill: Canvas; } }
