/* Reasonwell Arcade — shared shell for the math games.
   Each game sets --accent, --accent-2, --deep, --banner-sky, --banner-ground
   (and optionally --f-display) from its palette; everything else is shared.
   Light "field day" by default, a dusk palette in dark mode. */
@import url('../../../_kit/fonts.css');

:root {
  --accent: #2F7DD1; --accent-2: #F2B134; --deep: #17324A; --accent-ink: #14161C;
  --banner-sky: #CFE6F5; --banner-ground: #9CCB6B;
  --ground: #F6F3EC; --panel: #FFFFFF; --panel-2: #F1EEE6; --board: #FFFFFF;
  --ink: #1C1F26; --ink-2: #464B57; --ink-3: #5E6472; --line: rgba(28, 31, 38, .13);
  --good: #1E8A57; --good-bg: #E1F4EA; --try: #6A44C9; --try-bg: #EFE9FC; --bad: #C2402F; --bad-bg: #FBE9E6;
  --focus: #6A44C9;
  --shadow: 0 1px 0 rgba(28, 31, 38, .08), 0 10px 26px rgba(28, 31, 38, .10);
  --shadow-lift: 0 2px 0 rgba(28, 31, 38, .10), 0 18px 40px rgba(28, 31, 38, .16);
  --r: 22px;
  --f-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --f-ui: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --f-math: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #14161D; --panel: #1D2029; --panel-2: #252935; --board: #FBF9F4;
    --ink: #EEF0F6; --ink-2: #BCC1CF; --ink-3: #969CAD; --line: rgba(220, 226, 240, .14);
    --good: #4FCB8C; --good-bg: rgba(79, 203, 140, .14); --try: #B39BFF; --try-bg: rgba(179, 155, 255, .14); --bad: #FF8A78; --bad-bg: rgba(255, 138, 120, .14);
    --focus: #FFC65C;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .4); --shadow-lift: 0 2px 0 rgba(0, 0, 0, .45), 0 20px 44px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #14161D; --panel: #1D2029; --panel-2: #252935; --board: #FBF9F4;
  --ink: #EEF0F6; --ink-2: #BCC1CF; --ink-3: #969CAD; --line: rgba(220, 226, 240, .14);
  --good: #4FCB8C; --good-bg: rgba(79, 203, 140, .14); --try: #B39BFF; --try-bg: rgba(179, 155, 255, .14); --bad: #FF8A78; --bad-bg: rgba(255, 138, 120, .14);
  --focus: #FFC65C;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .4); --shadow-lift: 0 2px 0 rgba(0, 0, 0, .45), 0 20px 44px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--f-ui); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only, .rw-sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: none; }
/* focus the kit moved on after a tap or click (Next, the last hint): no ring until a key is pressed; keyboard users always see it */
.ar-quiet-focus:focus-visible, .ar-quiet-focus:focus-visible * { outline: none !important; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.015em; line-height: 1.05; margin: 0; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.ar-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 720px) { .ar-wrap { padding-inline: 28px; } }
.ar-screen { display: block; padding-bottom: 40px; animation: arIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes arIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* top bar */
.ar-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 9px max(16px, calc((100vw - 1120px) / 2 + 28px));
  background: color-mix(in srgb, var(--ground) 95%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.ar-tb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.ar-tb svg { width: 18px; height: 18px; flex: none; }
.ar-tb.icon { flex: none; width: 44px; min-width: 44px; padding: 0; justify-content: center; }
.ar-tb.icon svg { width: 21px; height: 21px; }
.ar-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; min-height: 44px; }
.ar-brand b { display: block; font-family: var(--f-display); font-size: 1.22rem; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-brand > span:last-child { min-width: 0; }
.ar-brand small { display: block; font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; white-space: nowrap; }
.ar-emblem { display: grid; place-items: center; width: 38px; height: 38px; flex: none; }
.ar-emblem svg { width: 100%; height: 100%; display: block; }
.ar-emblem.big { width: 76px; height: 76px; }
.ar-space { flex: 1; }
.ar-stars { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; }
.ar-stars svg { width: 18px; height: 18px; color: #E8A317; display: block; flex: none; }
.ar-stars, .ar-stars > * { flex: none; }
@media (max-width: 560px) { .hide-sm { display: none; } .ar-brand small { display: none; } .ar-tb:not(.icon) { padding: 0 11px; } }
/* narrow phones: a long title wraps to two lines instead of shrinking to "Tw…" */
@media (max-width: 400px) { .ar-top { gap: 8px; } .ar-brand { gap: 8px; } .ar-brand b { white-space: normal; font-size: 1.02rem; line-height: 1.04; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: normal; } .ar-stars { padding: 0 10px; } }
@media (max-width: 350px) { .ar-brand .ar-emblem { display: none; } }

/* buttons */
.ar-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 54px; padding: 0 24px; border-radius: 16px; border: 2px solid var(--deep);
  background: var(--accent-2); color: var(--accent-ink); font-weight: 800; font-size: 1.04rem; text-decoration: none; box-shadow: 0 4px 0 var(--deep); transition: transform .1s ease, box-shadow .1s ease, filter .2s; }
.ar-btn:hover { filter: brightness(1.05); }
.ar-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.ar-btn svg { width: 20px; height: 20px; flex: none; }
.ar-btn[disabled] { background: var(--panel-2); color: var(--ink-3); border-color: var(--line); box-shadow: 0 4px 0 var(--line); cursor: not-allowed; filter: none; }
.ar-btn-quiet { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.ar-btn-hint { background: var(--try-bg); color: var(--try); border-color: color-mix(in srgb, var(--try) 45%, transparent); box-shadow: 0 3px 0 color-mix(in srgb, var(--try) 30%, transparent); }
.ar-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* home */
.ar-hero { position: relative; isolation: isolate; overflow: hidden; margin: 14px auto 0; max-width: 1120px; border-radius: 0 0 34px 34px; min-height: clamp(360px, 42vw, 460px); display: grid; align-items: end; }
@media (min-width: 1150px) { .ar-hero { border-radius: 34px; } }
.ar-banner { position: absolute; inset: 0; background: var(--banner-sky); }
.ar-banner svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ar-hero-text { position: relative; z-index: 1; padding-block: 34px 30px; display: grid; gap: 10px; justify-items: start; }
.ar-hero-text > * { max-width: 34rem; }
.ar-chip { display: inline-block; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .88); color: #1C1F26; font-weight: 700; font-size: .8rem; letter-spacing: .02em; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); }
.ar-hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); color: #fff; text-shadow: 0 3px 0 var(--deep), 0 8px 26px rgba(0, 0, 0, .25); }
.ar-tagline { margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.25rem); font-weight: 600; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .45); max-width: 30rem; }
.ar-hero-text::before { content: ''; position: absolute; inset: -40px -40px 0 -40px; background: linear-gradient(0deg, color-mix(in srgb, var(--deep) 60%, transparent), transparent 85%); z-index: -1; }
.ar-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ar-daily-banner { margin-top: 16px; display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 18px; background: color-mix(in srgb, var(--accent-2) 22%, var(--panel)); border: 1.5px solid color-mix(in srgb, var(--accent-2) 60%, transparent); }
.ar-daily-banner svg { width: 26px; height: 26px; flex: none; }
.ar-daily-banner b { display: block; }
.ar-daily-banner span { color: var(--ink-2); font-size: .94rem; }
.ar-daily-banner > div { flex: 1 1 auto; min-width: 0; }
.ar-daily-link { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); color: var(--ink); font-weight: 800; font-size: .92rem; text-decoration: none; }
.ar-daily-link:hover { border-color: var(--ink-3); }
@media (max-width: 560px) { .ar-daily-banner { flex-wrap: wrap; } .ar-daily-link { flex-basis: 100%; justify-content: center; } }
.ar-home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 26px; margin-top: 26px; align-items: start; }
@media (max-width: 900px) { .ar-home-grid { grid-template-columns: 1fr; } }
.ar-section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ar-section-h h2 { font-size: 1.7rem; }
.ar-section-h p { margin: 0; color: var(--ink-2); font-weight: 600; }
.ar-trail { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.ar-trail::before { content: ''; position: absolute; left: 39px; top: 30px; bottom: 30px; border-left: 3px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ar-level-btn { position: relative; width: 100%; display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 20px; text-align: left; background: var(--panel); border: 1.5px solid var(--line); box-shadow: var(--shadow); color: var(--ink); transition: transform .2s var(--spring), border-color .2s; }
.ar-level-btn:hover:not([aria-disabled="true"]) { transform: translateX(4px); border-color: var(--accent); }
.ar-level.is-next .ar-level-btn { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow); }
.ar-level.locked .ar-level-btn { cursor: not-allowed; background: var(--panel-2); border-style: dashed; box-shadow: none; }
.ar-lnum { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; border: 2.5px solid var(--deep); box-shadow: 0 3px 0 var(--deep); }
.ar-level.locked .ar-lnum { background: var(--panel); color: var(--ink-3); border-color: var(--ink-3); box-shadow: none; }
.ar-lnum svg { width: 20px; height: 20px; }
.ar-lbody { display: grid; gap: 2px; min-width: 0; }
.ar-lbody b { font-family: var(--f-display); font-size: 1.14rem; }
.ar-lbody small { color: var(--ink-2); font-size: .92rem; }
.ar-lstars { display: flex; gap: 2px; margin-top: 2px; }
.ar-lstars > span[aria-hidden] { display: flex; gap: 2px; }
.ar-lstars i { width: 20px; height: 20px; color: color-mix(in srgb, var(--ink-3) 35%, transparent); }
.ar-lstars i.on { color: #E8A317; }
.ar-lstars svg { width: 100%; height: 100%; display: block; }
.ar-note { color: var(--ink-2); font-size: .92rem; margin: 12px 0 0; }
.ar-side { display: grid; gap: 16px; }
.ar-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.ar-panel h2 { font-size: 1.25rem; }
.ar-panel p { color: var(--ink-2); margin: 10px 0 0; }
.ar-howto { margin: 10px 0 0; padding-left: 1.3em; display: grid; gap: 8px; color: var(--ink-2); }
.ar-howto li::marker { font-weight: 800; color: var(--accent); }
.ar-howto b { color: var(--ink); }
details.ar-grownups summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
details.ar-grownups summary::after { content: '+'; font: 800 1.4rem var(--f-display); color: var(--ink-3); }
details.ar-grownups[open] summary::after { content: '–'; }
details.ar-grownups summary::-webkit-details-marker { display: none; }
.ar-ccss { font-size: .88rem; }
.ar-ccss span, .ar-ccss a { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); font-family: var(--f-math); font-size: .8rem; color: var(--ink); }
/* the standards links are spaced out a little, so each is easy to hit */
.ar-ccss a { text-decoration: underline; text-underline-offset: 2px; margin: 3px 2px; min-height: 30px; display: inline-flex; align-items: center; }
.ar-ccss-note { font-size: .84rem; color: var(--ink-2); }
.ar-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; font-size: .92rem; }
.ar-check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* play */
.ar-play-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 16px; padding-top: 16px; scroll-margin-top: 80px; }
.ar-eyebrow { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.ar-play-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin-top: 2px; }
.ar-linknote { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; font-weight: 600; max-width: 60ch; }
.ar-rounds { display: flex; gap: 6px; }
.ar-rounds i { width: 30px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink-3) 25%, transparent); transition: background .3s; }
.ar-rounds i.now { background: var(--accent-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 40%, transparent); }
.ar-rounds i.done { background: var(--good); }
.ar-rounds i.helped { background: var(--try); }
.ar-board { margin-top: 14px; border-radius: 28px; background: var(--board); color: #1C1F26; border: 1px solid rgba(28, 31, 38, .12); box-shadow: var(--shadow-lift); padding: clamp(14px, 2.6vw, 26px); position: relative; overflow: clip;
  --ink: #1C1F26; --ink-2: #464B57; --ink-3: #5E6472; --line: rgba(28, 31, 38, .13); --panel: #FFFFFF; --panel-2: #F1EEE6;
  --good: #1E8A57; --good-bg: #E1F4EA; --try: #6A44C9; --try-bg: #EFE9FC; --bad: #C2402F; --bad-bg: #FBE9E6; --focus: #6A44C9; }
.ar-board::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
/* Night: the board stays a light work surface (every game's art is drawn for one), dimmed as a whole so it
   doesn't glare against the dark page; dimming everything together keeps its text contrast */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ar-board { filter: brightness(.84); } }
:root[data-theme="dark"] .ar-board { filter: brightness(.84); }
.ar-coach { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 18px; background: #F4F2EC; border: 1.5px solid rgba(28, 31, 38, .1); min-height: 64px; transition: background .25s, border-color .25s; }
.ar-coach-mark { width: 58px; height: 58px; flex: none; margin: -8px 0 -6px; }
.ar-coach-mark svg { width: 100%; height: 100%; display: block; }
.ar-coach-text { flex: 1; margin: 0; font-size: clamp(1.02rem, 1.9vw, 1.2rem); font-weight: 600; line-height: 1.4; }
.ar-coach.is-good { background: #E3F5EB; border-color: #9ED3B6; }
.ar-coach.is-try { background: #FFF1EC; border-color: #F2B8A8; }
.ar-coach.is-hint { background: #F0EAFE; border-color: #C8B7F4; }
/* narrow phones: a tighter instruction line so the board starts higher */
@media (max-width: 380px) { .ar-coach { gap: 8px; padding: 7px 10px 7px 7px; min-height: 0; } .ar-coach-mark { width: 40px; height: 40px; margin: -4px 0; } .ar-coach-text { font-size: .94rem; line-height: 1.32; } }
.ar-speak { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(28, 31, 38, .14); background: #fff; display: grid; place-items: center; color: #1C1F26; }
.ar-speak svg { width: 22px; height: 22px; }
/* read-aloud off: no speaker button anywhere */
:root[data-read-aloud="off"] .ar-speak { display: none !important; }
.ar-stage { position: relative; margin: 16px 0 6px; min-height: 200px; display: grid; place-items: center; }
.ar-why { max-width: 760px; margin: 10px auto 0; scroll-margin-bottom: 170px; scroll-margin-top: 80px; }
.ar-why details { background: #FFF8E6; border: 1.5px solid #F1D48E; border-radius: 16px; padding: 4px 16px; }
/* the explanation folds after a first-try solve: its heading reads as a control, with a Show / Hide pill and a
   turning arrow, so it's plain that it opens */
.ar-why summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; }
.ar-why summary::-webkit-details-marker { display: none; }
.ar-why summary::after { content: 'Show \25BE'; content: 'Show \25BE' / ''; flex: none; padding: 5px 12px; border-radius: 999px; border: 1.5px solid #D9B25A; background: #fff; color: #6B4E12; font: 800 .82rem var(--f-ui); }
.ar-why details[open] > summary::after { content: 'Hide \25B4'; content: 'Hide \25B4' / ''; }
.ar-why summary:hover::after { background: #FFF3CF; }
.ar-why ol { margin: 0 0 12px; padding-left: 1.3em; display: grid; gap: 4px; }
/* the dock: feedback and the action buttons stay together and in reach while the board scrolls */
/* sticky on phones only: on wider screens the dock sits under the board, so it never covers it */
.ar-dock { position: relative; z-index: 5; display: grid; gap: 10px; margin: 14px calc(-1 * clamp(14px, 2.6vw, 26px)) calc(-1 * clamp(14px, 2.6vw, 26px)); padding: 14px clamp(14px, 2.6vw, 26px) clamp(14px, 2.6vw, 22px); background: linear-gradient(180deg, color-mix(in srgb, var(--board) 0%, transparent), var(--board) 22px); }
.ar-board .ar-actions { margin-top: 0; }
/* room below the board, so the page can always scroll to keep the buttons still when feedback appears above them */
.ar-wrap:has(> .ar-board) { padding-bottom: min(30vh, 260px); }
.ar-say { margin: 0 auto; width: min(100%, 760px); display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 16px 6px 8px; border-radius: 16px; border: 1.5px solid; font-size: clamp(1rem, 1.8vw, 1.12rem); font-weight: 600; line-height: 1.4; box-shadow: 0 6px 18px rgba(28, 31, 38, .12); }
.ar-say[hidden] { display: none; }
.ar-say-face { width: 46px; height: 46px; margin: -6px 0 -4px; }
.ar-say-face svg { width: 100%; height: 100%; display: block; }
.ar-say-text { margin: 0; }
.ar-say.is-good { background: #E3F5EB; border-color: #9ED3B6; color: #12432B; }
.ar-say.is-try { background: #FFF1EC; border-color: #F2B8A8; color: #6B2414; }
.ar-say.is-hint { background: #F0EAFE; border-color: #C8B7F4; color: #3A2378; }
.ar-say.pop { animation: sayPop .35s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes sayPop { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.ar-tip { margin: 0 0 12px; padding: 4px 14px; border-radius: 14px; background: #FFF8E6; border: 1.5px solid #F1D48E; }
.ar-tip summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.ar-tip summary > span { min-width: 0; }
.ar-tip summary::-webkit-details-marker { display: none; }
.ar-tip summary::after { content: '+'; flex: none; margin-left: auto; padding-left: 10px; font: 800 1.3rem var(--f-display); color: #5E6472; }
.ar-tip[open] summary::after { content: '–'; }
/* folded on phones and short screens: one line, the child can open it */
.ar-tip:not([open]) summary > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ar-tip:not([open]) { margin-bottom: 10px; padding-block: 2px; }
.ar-tip .ar-howto { margin: 0 0 10px; color: #464B57; }
/* phones, and short laptop screens (a Chromebook under its browser bar): the dock rides the bottom edge so feedback stays next to the button pressed */
@media (max-width: 640px), (max-height: 800px) { .ar-dock { position: sticky; bottom: env(safe-area-inset-bottom, 0px); } }
/* an open explanation on a phone: the dock follows it instead of covering it */
.ar-dock.ar-dock-free { position: relative; }
/* a sticky dock on a short screen keeps its padding lean, so it covers as little of the board as possible */
@media (max-height: 800px) { .ar-dock { padding-top: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); gap: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--board) 0%, transparent), var(--board) 8px); } .ar-board .ar-actions .ar-btn { min-height: 48px; } }
@media (max-width: 560px) { .ar-board .ar-actions { flex-wrap: nowrap; } .ar-board .ar-actions .ar-btn { flex: 1 1 0; min-width: 0; padding: 4px 10px; white-space: normal; line-height: 1.12; text-align: center; overflow-wrap: anywhere; } .ar-say { font-size: .98rem; padding: 4px 10px 4px 6px; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; } .ar-say-face { width: 38px; height: 38px; } .ar-coach-mark { width: 50px; height: 50px; } }

/* the host: greets on the home screen, cheers on results, sends postcards */
.ar-host { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 16px; padding: 10px 18px 10px 10px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ar-host-face { width: 96px; height: 96px; }
.ar-host-face svg { width: 100%; height: 100%; display: block; }
.ar-host-name { font-size: .84rem; color: var(--ink-2); }
.ar-host-name b { font-family: var(--f-display); font-size: 1.05rem; color: var(--ink); }
.ar-host-say { position: relative; margin: 6px 0 0; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--line)); font-weight: 600; font-size: 1.05rem; line-height: 1.45; }
.ar-host-say::before { content: ''; position: absolute; left: -8px; top: 16px; width: 12px; height: 12px; background: inherit; border-left: inherit; border-bottom: inherit; transform: rotate(45deg); }
@media (max-width: 560px) { .ar-host { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; } .ar-host-face { width: 72px; height: 72px; } .ar-host-say { font-size: .98rem; } }
.ar-stamp.has-host { overflow: hidden; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.ar-stamp.has-host svg { width: 86%; height: 86%; margin-top: -10px; }
.ar-host-cheer { margin: -4px 0 0; max-width: 46ch; font-size: 1.05rem; color: var(--ink); }
.ar-host-cheer b { font-family: var(--f-display); }
.ar-postcard { margin: 6px 0 0; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: center; max-width: 520px; padding: 14px 16px; text-align: left; border-radius: 10px; color: #3E3424; background: repeating-linear-gradient(-45deg, #FFF8E8 0 12px, #FBF1DA 12px 24px); border: 1px solid #E7D7AE; box-shadow: 0 10px 24px rgba(28, 31, 38, .14); transform: rotate(-1.2deg); }
.ar-postcard-stamp { width: 88px; height: 88px; padding: 4px; background: #fff; border: 3px dashed var(--accent); border-radius: 6px; }
.ar-postcard-stamp svg { width: 100%; height: 100%; display: block; }
.ar-postcard figcaption { display: grid; gap: 4px; }
.ar-postcard b { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: #6B5B3A; }
.ar-postcard span { font-style: italic; line-height: 1.45; }
.ar-postcard a { font-size: .88rem; font-weight: 700; color: #6B3A1A; display: inline-flex; align-items: center; min-height: 44px; justify-self: start; }
@media (prefers-reduced-motion: reduce) { .ar-postcard { transform: none; } }
/* the day's route on a daily stop's results */
.ar-route { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ar-route li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--panel); border: 1.5px solid var(--line); text-align: left; }
.ar-route li.here { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.ar-route-em { width: 34px; height: 34px; flex: none; }
.ar-route-em svg { width: 100%; height: 100%; display: block; }
.ar-route small { display: block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.ar-route b { font-size: .95rem; }
.ar-route-st { width: 22px; height: 22px; flex: none; color: var(--good); }
.ar-route-st svg { width: 100%; height: 100%; display: block; }

/* results */
.ar-results { display: grid; justify-items: center; text-align: center; gap: 14px; padding-block: 34px 20px; }
.ar-results h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
/* a daily stop's results: the way on sits right under the stars, and rides the bottom edge while the rest scrolls */
.ar-results.is-daily { padding-top: 22px; gap: 12px; }
.ar-results.is-daily .ar-stamp { width: 124px; height: 124px; }
.ar-next-dock { position: sticky; bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 6; width: 100%; display: flex; justify-content: center; }
.ar-next-dock .ar-btn { box-shadow: 0 4px 0 var(--deep), 0 10px 26px rgba(28, 31, 38, .22); }
.ar-next-dock > .ar-btn-quiet { display: none; }
@media (max-height: 720px), (max-width: 380px) { .ar-results.is-daily { padding-top: 14px; gap: 10px; } .ar-results.is-daily .ar-stamp { width: 96px; height: 96px; } .ar-results.is-daily .ar-stamp > span { bottom: 6px; font-size: .64rem; letter-spacing: .08em; } .ar-results.is-daily .ar-stamp-long { display: none; } .ar-results.is-daily h1 { font-size: 2rem; } .ar-results.is-daily .ar-bigstars i { width: 46px; height: 46px; } .ar-results.is-daily .ar-lede { font-size: 1rem; } }
.ar-lede { margin: 0; color: var(--ink-2); font-size: 1.1rem; max-width: 40ch; }
.ar-stamp { position: relative; width: 150px; height: 150px; display: grid; place-items: center; border-radius: 50%; background: var(--panel); border: 3px dashed var(--accent); box-shadow: var(--shadow-lift); }
.ar-stamp svg { width: 62%; height: 62%; }
.ar-stamp > span { position: absolute; bottom: 12px; padding: 1px 8px; border-radius: 999px; background: var(--panel); font: 800 .72rem var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.ar-stamp.go { animation: stampIn .8s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes stampIn { 0% { transform: scale(1.7) rotate(-14deg); opacity: 0; } 60% { transform: scale(.94) rotate(3deg); opacity: 1; } 100% { transform: rotate(-3deg); } }
.ar-bigstars { display: flex; gap: 10px; }
.ar-bigstars i { width: 58px; height: 58px; color: color-mix(in srgb, var(--ink-3) 30%, transparent); }
.ar-bigstars i.on { color: #F2B134; animation: starPop .6s var(--spring) both; animation-delay: calc(.35s + var(--k) * .18s); filter: drop-shadow(0 3px 0 #B57A08); }
.ar-bigstars svg { width: 100%; height: 100%; display: block; }
@keyframes starPop { from { transform: scale(.2) rotate(-60deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* modal */
.ar-scrim { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(14, 16, 22, .55); backdrop-filter: blur(3px); animation: arIn .2s ease both; }
.ar-modal { width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; border-radius: 24px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lift); }
.ar-modal h2 { font-size: 1.6rem; margin-bottom: 10px; }
.ar-howto-modal { display: grid; gap: 8px; justify-items: start; }
.ar-howto-modal .ar-actions { justify-content: flex-start; margin-top: 10px; }
.ar-setting-note { margin: -4px 0 8px; color: var(--ink-2); font-size: .92rem; }
.ar-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.ar-setting > div:first-child, .ar-setting-switch > span:first-child { font-weight: 700; }
/* the whole Sounds row is the switch's target (the switch itself is 56 × 32) */
.ar-setting-switch { cursor: pointer; min-height: 44px; }
.ar-setting small { display: block; font-weight: 500; color: var(--ink-2); font-size: .84rem; }
.ar-seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.ar-seg button { min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: .9rem; }
.ar-seg button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.ar-switch { appearance: none; -webkit-appearance: none; position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--panel-2); border: 1.5px solid var(--ink-3); margin: 0; cursor: pointer; }
.ar-switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--ink-3); transition: transform .2s var(--spring); }
.ar-switch:checked { background: var(--accent); border-color: var(--accent); }
.ar-switch:checked::after { transform: translateX(22px); background: #fff; }

.ar-foot { margin-top: 30px; border-top: 1px solid var(--line); padding-block: 20px 30px; color: var(--ink-2); font-size: .9rem; }
.ar-foot .ar-wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.ar-burst { position: fixed; z-index: 80; width: 12px; height: 12px; pointer-events: none; color: var(--accent-2); }
.ar-burst svg { width: 100%; height: 100%; display: block; }
.ar-burst i { display: block; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }

/* number pad (shared) */
.np { display: grid; gap: 10px; width: min(100%, 300px); }
.np-display { min-height: 70px; border-radius: 16px; background: #fff; border: 2.5px solid var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 25%, transparent); display: flex; align-items: center; justify-content: center; font: 800 2rem var(--f-math); color: #1C1F26; }
.np-display:focus-visible { outline: 3px solid var(--focus, #6A44C9); outline-offset: 3px; }
.np-display.is-empty::before { content: attr(data-ph); content: attr(data-ph) / ''; font: 600 1rem var(--f-ui); color: #5E6472; }
/* a keyboard on the pad: the empty answer box says how typing works (in the box itself, so nothing moves) */
.np-display.is-empty:focus-visible::before { content: 'Type the number, then press Enter'; content: 'Type the number, then press Enter' / ''; }
.np:has(.np-keys :focus-visible) .np-display.is-empty::before { content: 'Or type the number, then Enter'; content: 'Or type the number, then Enter' / ''; }
.np-display.is-empty:focus-visible::before, .np:has(.np-keys :focus-visible) .np-display.is-empty::before { font-size: .9rem; line-height: 1.2; text-align: center; padding: 0 6px; }
.np-display.is-empty::after { content: ''; width: 2px; height: 1.2em; margin-left: 4px; background: #6A44C9; animation: npBlink 1.1s steps(1) infinite; }
@keyframes npBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .np-display.is-empty::after { animation: none; } }
:root[data-motion="reduced"] .np-display.is-empty::after { animation: none; }
.np-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np-k { min-height: 54px; border-radius: 14px; border: 1.5px solid rgba(28, 31, 38, .15); background: #fff; color: #1C1F26; font: 800 1.35rem var(--f-math); box-shadow: 0 2px 0 rgba(28, 31, 38, .15); }
.np-k:active { transform: translateY(2px); box-shadow: none; }
.np-fn { background: #F1EEE6; font-size: 1.1rem; }
.np-k[disabled] { opacity: .5; }
/* dragging on boards never selects text */
.ar-board svg, .ar-board [role="application"], .ar-board [role="slider"] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* the static page a crawler or a browser without JavaScript sees; the app replaces it on load.
   It waits a moment before showing, so a normal load goes straight to the app without a flash. */
.ar-fallback { max-width: 760px; margin: 0 auto; padding: 48px 16px 64px; animation: arFallbackIn 0s linear .8s both; }
@keyframes arFallbackIn { from { visibility: hidden; } to { visibility: visible; } }
.ar-fallback h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 6px 0 14px; }
.ar-fallback h2 { font-size: 1.3rem; margin: 28px 0 10px; }
.ar-fallback p { margin: 0 0 14px; color: var(--ink-2); max-width: 64ch; }
.ar-fallback-kicker { font-weight: 800; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.ar-fallback-links { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 0; margin: 18px 0 0; list-style: none; }
.ar-fallback-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.ar-fallback a { font-weight: 700; color: var(--ink); text-underline-offset: 3px; }
.ar-fallback noscript p { margin-top: 18px; }

/* a set left part-way: the home screen offers it back */
.ar-continue-note { margin: 0; color: #fff; font-weight: 600; text-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.ar-lbody .ar-lgoing { color: var(--try); font-weight: 700; }
/* the coach after a reload: neutral, like the instruction line */
.ar-say.is-back { background: var(--panel-2, #F1EEE6); border-color: rgba(28, 31, 38, .16); color: #1C1F26; }
.ar-board .ar-say.is-back { background: #F3F0E8; }
/* a button resting for a moment after a press (a quick second press is ignored): it looks it */
.ar-btn.ar-resting { filter: saturate(.6) brightness(.95); opacity: .78; cursor: progress; transform: none; }
/* this browser won't save */
.ar-warn { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--try-bg); color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--try) 35%, transparent); font-weight: 600; max-width: 760px; }
.ar-results .ar-warn { margin-inline: auto; }
.ar-nosave { font-weight: 700; color: var(--ink); }
.ar-foot-links { display: inline-flex; flex-wrap: wrap; gap: 0 18px; }
.ar-foot-links a { display: inline-flex; align-items: center; min-height: 44px; }
.ar-foot a { color: inherit; text-underline-offset: 3px; }

/* embedded on a site page (?embed=1): the page around the frame has its own footer and links */
.ar-embed .ar-foot { display: none; }
.ar-embed .ar-screen { padding-bottom: 24px; }
