/* Family Math Expedition — tokens, page chrome, buttons and shared blocks.
 * Brand palette matches the Fluency Lab (publisher.css). Text/background pairs are WCAG AA (4.5:1) or better. */
:root {
  color-scheme: light;
  --navy: #17324d;
  --navy-2: #234a6f;
  --ink: #1d2f40;
  --muted: #4a5d6e;
  --line: #d3dde5;
  --paper: #f7f4ec;
  --card: #fff;
  --teal: #1fa6a2;
  --teal-ink: #0b6b68;
  --teal-tint: #e3f4f3;
  --amber: #f2c15b;
  --amber-ink: #7a5200;
  --amber-tint: #fdf3d8;
  --coral: #d8613c;
  --coral-ink: #a3401f;
  --coral-tint: #fbe9e2;
  --blue: #2f6db0;
  --blue-ink: #1f5190;
  --blue-tint: #e5eef8;
  --focus: #b34700;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible", "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --r: 18px;
  --r-lg: 28px;
  --lift: 0 1px 0 rgba(23, 50, 77, 0.06), 0 14px 32px -18px rgba(23, 50, 77, 0.38);
  --gutter: clamp(16px, 4vw, 32px);
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.55 var(--sans);
  overflow-wrap: break-word;
}
h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}
ol,
ul {
  padding: 0;
  list-style: none;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  color: var(--navy);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
a {
  color: var(--blue-ink);
  text-underline-offset: 3px;
}
[tabindex="-1"]:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.es {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-weight: 500;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0;
}
.btn .es,
.option .es,
.routine .es,
.listen .es {
  color: inherit;
  opacity: 0.88;
  font-size: 0.88em;
}
.skip {
  position: absolute;
  left: 8px;
  top: -80px;
  z-index: 50;
  background: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
}
.skip:focus {
  top: 8px;
}

/* ---- chrome ---- */
.top {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  border-radius: 12px;
}
.brand:hover span {
  text-decoration: underline;
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.lang {
  display: inline-flex;
  border: 2px solid var(--navy);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.lang button {
  font: 700 15px/1 var(--sans);
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.lang button + button {
  border-left: 1px solid var(--line);
}
.lang button[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 15px/1 var(--sans);
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.help-btn[aria-expanded="true"] {
  background: var(--amber-tint);
}
.help-panel {
  position: absolute;
  z-index: 40;
  right: var(--gutter);
  top: calc(100% - 4px);
  width: min(380px, calc(100vw - 2 * var(--gutter)));
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: var(--r);
  box-shadow: var(--lift);
  padding: 18px;
  display: grid;
  gap: 12px;
}
.help-panel[hidden] {
  display: none;
}
.help-title {
  font-size: 22px;
}
.help-list {
  display: grid;
  gap: 2px;
}
.help-links {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.route-nav {
  --pct: 0%;
  position: relative;
  max-width: 1080px;
  margin: 0 auto 8px;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.route-nav::before,
.route-nav::after {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + 22px);
  right: calc(var(--gutter) + 22px);
  top: 21px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.route-nav::after {
  background: var(--teal);
  right: auto;
  width: calc((100% - 2 * var(--gutter) - 44px) * var(--pct) / 100);
  transition: width 0.5s ease;
}
.rn {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 700 13px/1.2 var(--sans);
  cursor: pointer;
  min-height: 44px;
}
.rn-n {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: #fff;
  color: var(--navy);
  font: 700 18px var(--serif);
}
.rn.is-done .rn-n {
  background: var(--teal-ink);
  border-color: var(--teal-ink);
  color: #fff;
}
.rn.is-here .rn-n {
  border-color: var(--navy);
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(242, 193, 91, 0.35);
}
.rn.is-here {
  color: var(--navy);
}
.rn-check {
  width: 22px;
  height: 22px;
  display: block;
}
.rn-name {
  max-width: 100%;
  text-align: center;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.rn.is-here .rn-name {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}
@media (min-width: 720px) {
  .rn-name {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}
.banner {
  max-width: 1080px;
  margin: 8px auto;
  padding: 12px var(--gutter);
  background: var(--amber-tint);
  border: 1px solid var(--amber);
  border-radius: 14px;
  width: calc(100% - 2 * var(--gutter));
}
.banner[hidden] {
  display: none;
}
.confirm {
  background: #fff;
  border: 2px solid var(--navy);
  display: grid;
  gap: 12px;
}
#content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px var(--gutter) 48px;
  outline: none;
}
.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter) 40px;
  color: var(--muted);
  font-size: 15px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
}
.toast[hidden] {
  display: none;
}
.noscript {
  max-width: 640px;
  margin: 24px auto;
  padding: 16px;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 20px;
  border-radius: 14px;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  font: 700 17px/1.25 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.btn:hover {
  background: var(--blue-tint);
}
.btn:active {
  transform: translateY(1px);
}
.btn-label {
  text-align: center;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 0 -2px #0d2033;
}
.btn-primary:hover {
  background: var(--navy-2);
}
.btn-primary.is-soft {
  background: #fff;
  color: var(--navy);
  box-shadow: none;
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.btn-quiet:hover {
  background: rgba(23, 50, 77, 0.06);
}
.btn-big {
  min-height: 60px;
  padding-inline: 28px;
  font-size: 19px;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-ico,
.ico {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: none;
}
.btn-ico svg,
.ico svg {
  width: 100%;
  height: 100%;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}
.listen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--navy);
  font: 700 15px var(--sans);
  cursor: pointer;
}
.listen[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
html[data-no-speech] .listen {
  display: none;
}

/* ---- blocks ---- */
.block {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.block-title {
  font-size: clamp(22px, 4.6vw, 30px);
}
.block-help,
.lead2 {
  color: var(--muted);
  max-width: 62ch;
}
.note {
  color: var(--muted);
  font-size: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(16px, 3vw, 28px);
  box-shadow: var(--lift);
}
.chip {
  display: inline-block;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-ink);
  font: 700 14px var(--sans);
}
.state {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px;
  border-radius: var(--r);
  background: #fff;
  border: 1px dashed var(--line);
}
.state-error {
  display: grid;
  border-color: var(--coral);
  background: var(--coral-tint);
}
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 4px solid var(--teal-tint);
  border-top-color: var(--teal-ink);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
