/* ── The one back button ─────────────────────────────────────
   Every page links this file last so it wins over page styles. One element,
   two looks:
   - Mental Math: a round 46px button with just the arrow. The word "Back"
     stays in the markup (font-size:0) so screen readers still say it.
   - Mental Math Kids: a white "Back" pill with the arrow. Switched on by
     .kids (kids-only pages), body.kids-active (index.html) or body.kids-mode
     (crane.html), so a button shared by both versions changes by itself.
   It sits at the top-left of its box; .inbar zeroes the margins where it
   shares a row with a game's top bar. Labels are plain "Back"/"Geri": the
   arrow is drawn here, never typed into the text. */
.mm-back {
  --mm-back-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15.5 5l-7 7 7 7'/%3E%3C/svg%3E");
  position: relative;
  display: grid; place-items: center; flex: none;
  width: 46px; height: 46px; padding: 0;
  margin: 0 auto 14px 0; align-self: flex-start;
  border-radius: 50%;
  background: var(--card, #1a1930);
  border: 1.5px solid rgba(255,255,255,.09);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  color: var(--text, #f1f5f9);
  font: inherit; font-size: 0; line-height: 0;
  text-decoration: none; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, transform .1s;
}
/* The arrow is pinned dead-centre on its own, so the hidden "Back" text
   (a second grid item) can't push it up off the middle. */
.mm-back::before {
  content: ""; width: 22px; height: 22px;
  position: absolute; inset: 0; margin: auto;
  background: currentColor;
  -webkit-mask: var(--mm-back-arrow) center / contain no-repeat;
          mask: var(--mm-back-arrow) center / contain no-repeat;
}
.mm-back:hover { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.mm-back:active { transform: scale(.92); }
.mm-back:focus-visible { outline: 3px solid #38bdf8; outline-offset: 3px; }
.mm-back.inbar { margin: 0; align-self: center; }

/* Kids: the white pill */
.mm-back.kids,
body.kids-active .mm-back,
body.kids-mode .mm-back {
  display: flex; align-items: center; gap: 6px;
  width: fit-content; height: auto; min-height: 44px;
  padding: 0 16px 0 12px;
  border: 0; border-radius: 999px;
  background: #fff; color: #0a3a46;
  box-shadow: 0 4px 0 rgba(10,58,70,.18);
  font-size: .92rem; font-weight: 800; line-height: 1;
}
.mm-back.kids::before,
body.kids-active .mm-back::before,
body.kids-mode .mm-back::before { position: static; margin: 0; width: 18px; height: 18px; background: #2bb3c4; }
.mm-back.kids:hover,
body.kids-active .mm-back:hover,
body.kids-mode .mm-back:hover { background: #f0fbfd; color: #0a3a46; }
.mm-back.kids:active,
body.kids-active .mm-back:active,
body.kids-mode .mm-back:active { transform: translateY(2px) scale(.97); box-shadow: 0 1px 0 rgba(10,58,70,.18); }

@media (prefers-reduced-motion: reduce) { .mm-back { transition: none; } }
