/* Map Quiz (docs/map-quiz-game-spec.md): flat map in the site palette, for grades 4 to adult. */
.mq-head { max-width: 980px; margin: 6px auto 8px; padding: 0 16px; text-align: center; }
.mq-head h1 { font-size: 28px; font-weight: 800; margin: 4px 0 2px; color: var(--text-primary); }
.mq-head p { margin: 0; color: var(--text-secondary); font-size: 15px; }

.mq { max-width: 980px; margin: 0 auto 18px; background: #fff; border: 1px solid #dfe5ec; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 24px -16px rgba(20, 40, 70, .35); }
.mq-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #2f5d8a; color: #fff; flex-wrap: wrap; }
.mq-prompt { flex: 1 1 260px; font-size: 20px; min-width: 0; }
.mq-ask { opacity: .8; font-size: 15px; }
.mq-prompt b { font-weight: 800; font-size: 24px; }
.mq-prompt.done .mq-ask { display: none; }
.mq-prompt.idle .mq-ask { visibility: hidden; }
.mq-prompt b { display: inline-block; transform-origin: left center; }
.mq-prompt b.pulse { animation: mq-pulse .7s ease-in-out 2; }
@keyframes mq-pulse { 50% { transform: scale(1.04); text-shadow: 0 0 10px rgba(255, 255, 255, .45); } }
@media (prefers-reduced-motion: reduce) { .mq-prompt b.pulse { animation: none; } }
.mq-retry { display: inline-block; vertical-align: 4px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: #f0b43c; color: #3a2a05; font-size: 12.5px; font-weight: 800; opacity: 0; transform: translateY(2px); transition: opacity .15s, transform .15s; }
.mq-retry.on { opacity: 1; transform: none; }
.mq-prompt.done .mq-retry, .mq-prompt.idle .mq-retry { display: none; }
.mq-stats { display: flex; gap: 6px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mq-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); white-space: nowrap; }
.mq-clock svg { opacity: .85; }
.mq-tools { display: flex; gap: 6px; }
.mq-tools button { display: inline-flex; align-items: center; justify-content: center; padding: 0; width: 34px; height: 34px; font-weight: 700; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); color: #fff; font-size: 16px; cursor: pointer; }

.mq-stage { position: relative; background: #eaf3fb; }
/* never taller than the screen under the menu bar and the prompt bar: tall regions letterbox, centred */
#mq-map { display: block; width: 100%; height: auto; max-height: calc(100vh - 150px); max-height: calc(100svh - 150px); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer; }
#mq-map.zoomed { touch-action: none; cursor: grab; }
#mq-map path { stroke: #fff; stroke-width: var(--sw, .8); stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#mq-map path.pl { fill: #d9e1ea; transition: fill .15s; }
#mq-map path.pl:hover { fill: #c3d0de; }
#mq-map path.off { fill: #f3f5f7; pointer-events: none; }
#mq-map path.g, #mq-map path.g:hover { fill: #49a86f; }
#mq-map path.a, #mq-map path.a:hover { fill: #f0b43c; }
#mq-map path.r, #mq-map path.r:hover { fill: #dd5a52; }
#mq-map path.wrong { animation: mq-wrong .65s; }
#mq-map path.blink { animation: mq-blink .4s 3; }
@keyframes mq-wrong { 0%, 60% { fill: #f19b94; } }
@keyframes mq-blink { 50% { fill: #dd5a52; } }
#mq-map .tiny { fill: rgba(47, 93, 138, .06); stroke: #2f5d8a; stroke-dasharray: 2 2; pointer-events: none; }
#mq-map .tiny.g { fill: rgba(73, 168, 111, .35); stroke: #49a86f; }
#mq-map .tiny.a { fill: rgba(240, 180, 60, .35); stroke: #f0b43c; }
#mq-map .tiny.r { fill: rgba(221, 90, 82, .35); stroke: #dd5a52; }

.mq-tip { position: absolute; transform: translate(-50%, -140%); background: #1f2d3d; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 14px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.mq-tip.on { opacity: 1; }

.mq-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(234, 243, 251, .72); padding: 12px; }
.mq-over[hidden] { display: none; }
.mq-card { background: #fff; border-radius: 16px; padding: 20px 24px; max-width: 460px; width: 100%; text-align: center; box-shadow: 0 12px 32px -12px rgba(20, 40, 70, .45); }
.mq-card h2 { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.mq-card p { margin: 0 0 14px; color: var(--text-secondary); }
.mq-go { font-size: 18px; padding: 12px 36px; }
.mq-result { padding: 18px 22px 12px; max-width: 420px; }
.mq-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #6b7c8f; }
.mq-rmap { font-weight: 800; color: var(--text-primary); font-size: 19px; margin: 2px 0 12px; }
.mq-graded[hidden], .mq-psum[hidden] { display: none; }
.mq-name { display: block; text-align: left; margin: 0 auto 12px; max-width: 300px; }
.mq-name span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7c8f; margin: 0 0 4px 2px; }
.mq-name input { box-sizing: border-box; width: 100%; font: inherit; font-size: 18px; font-weight: 700; padding: 8px 12px; border: 1.5px solid #c9d4df; border-radius: 10px; text-align: center; color: var(--text-primary); background: #f8fafc; }
.mq-card .mq-namehint { margin: -6px auto 12px; max-width: 300px; font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.mq-name input:focus { outline: none; border-color: #2f5d8a; background: #fff; box-shadow: 0 0 0 3px rgba(47, 93, 138, .15); }
.mq-ring { position: relative; width: 124px; height: 124px; margin: 0 auto 10px; --c: #2f5d8a; }
.mq-ring.hi { --c: #3f9a63; } .mq-ring.mid { --c: #d99a1e; } .mq-ring.lo { --c: #d0534b; }
.mq-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mq-ring circle { fill: none; stroke-width: 10; }
.mq-ring-bg { stroke: #e9eef3; }
.mq-ring-fg { stroke: var(--c); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .9s ease-out; }
.mq-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mq-ring b { font-size: 34px; font-weight: 800; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
.mq-hero { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 10px; }
.mq-hero .mq-ring { margin: 0; }
.mq-timebox { display: flex; flex-direction: column; align-items: flex-start; min-width: 104px; }
.mq-tlabel { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7c8f; }
.mq-timebox b { font-size: 40px; font-weight: 800; line-height: 1.05; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mq-newbest { margin-top: 4px; padding: 2px 9px; border-radius: 999px; background: #fff4d6; color: #8a5a00; font-size: 12.5px; font-weight: 800; }
.mq-newbest[hidden] { display: none; }
.mq-ring b.w3 { font-size: 28px; letter-spacing: -.02em; }
.mq-best[hidden] { display: none; }
.mq-best { font-size: 13px; color: var(--text-secondary); margin: -4px 0 10px; font-weight: 600; }
.mq-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.mq-chips span { background: #eef3f8; color: #3c5269; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.mq-psum { margin: 0 0 12px; color: var(--text-secondary); font-size: 15px; }
.mq-missed { margin-bottom: 14px; }
.mq-mlabel { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7c8f; margin-bottom: 6px; }
.mq-tags { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; max-height: 84px; overflow: auto; }
.mq-tags span { background: #fdecea; color: #a33a33; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.mq-perfect { color: #3f9a63; font-weight: 800; }
.mq-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mq-btns .btn[hidden] { display: none; }
.mq-btns:has(.btn[hidden]) { grid-template-columns: 1fr; }
.mq-btns .btn { justify-content: center; text-decoration: none; padding: 10px 12px; font-size: 14.5px; }
.mq-next { display: block; margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #eef3f8; color: #2f5d8a; font-weight: 800; font-size: 14.5px; text-decoration: none; }
.mq-next:hover { background: #e3ecf5; }
.mq-printlink { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 700; color: #2f5d8a; text-decoration: none; }
.mq-printlink:hover { text-decoration: underline; }
.mq-brand { margin-top: 10px; padding-top: 8px; border-top: 1px solid #eef1f4; font-size: 11.5px; color: #8a99a8; letter-spacing: .03em; }

/* full screen (and the iPhone fallback): the map fills the screen */
.mq:fullscreen, .mq.mq-fake-full { max-width: none; width: 100vw; height: 100vh; margin: 0; border-radius: 0; display: flex; flex-direction: column; }
.mq.mq-fake-full { position: fixed; inset: 0; z-index: 1000; }
.mq:fullscreen .mq-stage, .mq.mq-fake-full .mq-stage { flex: 1; display: flex; align-items: center; }
.mq:fullscreen #mq-map, .mq.mq-fake-full #mq-map { max-height: 100%; }

.mq-info { max-width: 820px; margin: 10px auto 30px; padding: 0 20px; color: var(--text-secondary); line-height: 1.6; }
.mq-info h2 { font-size: 21px; font-weight: 800; color: var(--text-primary); margin: 26px 0 8px; }
.mq-info h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 14px 0 4px; }
.mq-info a { color: #2f5d8a; }
.mq-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 8px 22px; }
.mq-group h3 { margin-top: 6px; }
.mq-group ul { list-style: none; margin: 0; padding: 0; font-size: 14.5px; }
.mq-group li span { color: var(--text-muted); font-size: 13px; }
.mq-group li span::before { content: '· '; }
.mq-more { padding-left: 18px; }

.mq-worldbox { max-width: 980px; margin: 8px auto 6px; padding: 0 16px; }
.mq-world { display: block; width: 100%; height: auto; background: #eaf3fb; border-radius: 16px; }
.mq-world .mq-grey { fill: #eef1f4; stroke: #fff; stroke-width: .4; }
.mq-reg path { fill: var(--rc); stroke: #fff; stroke-width: .4; transition: filter .15s, opacity .15s; }
a.mq-reg:hover path, a.mq-reg:focus path { filter: brightness(.85) saturate(1.2); }
.mq-hsec { max-width: 820px; margin: 18px auto 0; padding: 0 20px; }
.mq-hsec h2 { font-size: 19px; font-weight: 800; margin: 0 0 8px; color: var(--text-primary); }
.mq-hsec .mq-hub { margin: 0 0 6px; padding: 0; }
.mq-hsec:last-of-type { margin-bottom: 36px; }
.mq-hub { max-width: 820px; margin: 14px auto 36px; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.mq-hcard { display: block; padding: 16px 18px; background: #fff; border: 2px solid #2f5d8a; border-radius: 14px; text-decoration: none; color: inherit; }
.mq-hcard b { display: block; color: #2f5d8a; font-size: 17px; }
.mq-hcard span { color: var(--text-secondary); font-size: 14px; }
.mq-hcard:hover { background: #e3ecf5; }

@media (max-width: 640px) {
  /* the map is short on a phone: the result card becomes a full-screen sheet so nothing is cut off */
  #mq-end { position: fixed; inset: 0; z-index: 1001; background: rgba(31, 45, 61, .45); overflow-y: auto; align-items: center; padding: 14px; }
  .mq-result { padding: 16px 16px 10px; }
  .mq-ring { width: 108px; height: 108px; }
  .mq-ring b { font-size: 30px; }
  .mq-rmap { margin-bottom: 10px; }
  .mq { border-radius: 0; border-left: 0; border-right: 0; }
  .mq-head h1 { font-size: 22px; }
  .mq-bar { padding: 8px 10px; gap: 6px 10px; }
  .mq-prompt b { font-size: 20px; }
  .mq-stats { gap: 5px; font-size: 12.5px; }
  .mq-pill { padding: 4px 8px; }
  .mq-lbl { display: none; }   /* phone: "92%" instead of "Score 92%", so the pills and tools share one row */
  .mq-tools { gap: 4px; }
  .mq-tools button { width: 30px; height: 30px; }
  .mq-tools svg { width: 16px; height: 16px; }
  .mq-ring b.w3 { font-size: 25px; }
}
