/* =========================================================
   Math Universe · core.css
   Shared structure for every page. Colours, fonts and
   decoration come from each world's theme file through the
   custom properties declared here.
   ========================================================= */
body {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f1f3f8; --text: #1f2333; --muted: #5b6175;
  --primary: #3d5afe; --primary-ink: #ffffff; --accent: #ff5a5f; --accent-ink: #ffffff;
  --good: #149f6c; --bad: #e0444a; --warn: #e89a0c; --line: rgba(20, 24, 40, .14);
  --radius: 14px; --radius-sm: 9px; --btn-radius: 999px;
  --shadow: 0 8px 24px rgba(20, 24, 40, .12);
  --font-body: 'Lexend', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-head: var(--font-body);
  --font-math: 'Noto Sans Math', 'Cambria Math', 'STIX Two Math', 'Segoe UI Symbol', 'Apple Symbols', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --card-bg: var(--surface); --card-border: 1px solid var(--line); --card-shadow: var(--shadow); --card-radius: var(--radius);
  --top-bg: color-mix(in srgb, var(--surface) 90%, transparent); --top-text: var(--text); --top-border: 1px solid var(--line);
  --stage-bg: var(--bg); --stage-head-bg: var(--surface);
  --input-bg: var(--surface); --input-border: 1.5px solid var(--line);
  --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.563rem; --fs-2xl: 1.953rem; --fs-3xl: 2.441rem; --fs-4xl: 3.052rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.55; min-height: 100vh; }
body.mu-noscroll { overflow: hidden; }
img, canvas { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.hide { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.math { font-family: var(--font-math); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.center { text-align: center; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 1.1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: .75rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: .9rem; }
.big { font-size: var(--fs-xl); }
.huge { font-size: var(--fs-3xl); font-weight: 700; }
.kbd { font-family: var(--font-mono); font-size: .85em; padding: .05em .4em; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }

/* ---------- top bar ---------- */
.mu-top { position: sticky; top: 0; z-index: 60; background: var(--top-bg); color: var(--top-text); border-bottom: var(--top-border); backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3); }
.mu-top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: .4rem; padding: .5rem 1.1rem; }
.mu-logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; text-decoration: none; color: inherit; font-family: var(--font-head); font-size: 1.12rem; margin-right: auto; white-space: nowrap; }
.mu-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary); color: var(--primary-ink); font-size: 1.35rem; font-family: var(--font-math); line-height: 1; }
.mu-links { display: flex; gap: .15rem; align-items: center; }
.mu-link { display: inline-flex; gap: .35rem; align-items: center; padding: .42rem .7rem; border-radius: 999px; text-decoration: none; color: inherit; font-size: .9rem; white-space: nowrap; border: 0; background: none; list-style: none; }
.mu-link::-webkit-details-marker { display: none; }
.mu-link:hover, .mu-link[aria-current="page"] { background: color-mix(in srgb, currentColor 13%, transparent); }
.mu-dd { position: relative; }
.mu-dd > summary { cursor: pointer; }
.mu-dd-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 270px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.22); padding: .4rem; display: grid; gap: .15rem; z-index: 70; }
.mu-dd-item { display: flex; gap: .7rem; align-items: center; padding: .55rem .7rem; border-radius: 10px; text-decoration: none; color: inherit; }
.mu-dd-item:hover, .mu-dd-item[aria-current="page"] { background: var(--surface-2); }
.mu-dd-item b { display: block; font-size: .95rem; }
.mu-dd-item small { color: var(--muted); }
.mu-dd-ico { font-size: 1.5rem; width: 1.8rem; text-align: center; }
.mu-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); background: color-mix(in srgb, currentColor 6%, transparent); font-size: .86rem; font-weight: 600; white-space: nowrap; }
.mu-icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); background: transparent; font-size: 1.05rem; }
.mu-burger { display: none; }
.mu-drawer { position: fixed; inset: 56px 0 auto 0; z-index: 59; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line); box-shadow: 0 20px 40px rgba(0,0,0,.25); padding: 1rem 1.1rem 1.4rem; max-height: calc(100vh - 56px); overflow: auto; }
.mu-drawer h4 { margin: .6rem 0 .4rem; font-size: .95rem; color: var(--muted); }
.mu-drawer a { display: flex; gap: .7rem; align-items: center; padding: .6rem .5rem; border-radius: 10px; text-decoration: none; color: inherit; }
.mu-drawer a:hover { background: var(--surface-2); }
@media (max-width: 980px) { .mu-links { display: none; } .mu-burger { display: inline-grid; } }
@media (max-width: 420px) { .mu-logo span:last-child { display: none; } }

/* ---------- sub navigation (section jump bar) ---------- */
.subnav { position: sticky; top: 55px; z-index: 40; display: flex; gap: .4rem; overflow-x: auto; padding: .6rem 1.1rem; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav button { flex: 0 0 auto; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; white-space: nowrap; }

/* ---------- activity sections & cards ---------- */
.act-section { padding: 2.2rem 0 .6rem; scroll-margin-top: 110px; }
.act-section-head { display: flex; align-items: baseline; gap: .4rem 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.act-section-head h2 { font-size: var(--fs-2xl); display: flex; align-items: center; gap: .55rem; margin: 0; }
.sec-note { color: var(--muted); margin: 0; max-width: 62ch; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 1rem; }
.act-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; text-align: left; padding: 1.05rem 1.1rem 1.2rem; background: var(--card-bg); border: var(--card-border); border-radius: var(--card-radius); box-shadow: var(--card-shadow); color: var(--text); transition: transform .14s ease, box-shadow .14s ease; }
.act-card:hover { transform: translateY(-3px); }
.act-icon { font-size: 2.1rem; line-height: 1.1; margin-bottom: .25rem; }
.act-title { font-family: var(--font-head); font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.act-desc { color: var(--muted); font-size: .9rem; line-height: 1.42; }
.act-tag { position: absolute; top: .7rem; right: .7rem; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.1rem; border-radius: var(--btn-radius); border: 2px solid transparent; font-weight: 600; line-height: 1.15; background: var(--surface-2); color: var(--text); text-decoration: none; transition: transform .08s ease, filter .15s ease, background .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-good { background: var(--good); color: #fff; }
.btn-ghost { background: transparent; border-color: color-mix(in srgb, currentColor 32%, transparent); }
.btn-sm { padding: .36rem .75rem; font-size: .87rem; }
.btn-lg { padding: .85rem 1.45rem; font-size: 1.1rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.inp, .sel, textarea.inp { width: 100%; padding: .6rem .8rem; border-radius: var(--radius-sm); border: var(--input-border); background: var(--input-bg); color: var(--text); min-width: 0; }
.inp:focus, .sel:focus { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 0; border-color: var(--primary); }
.inp.sm { width: 6rem; padding: .45rem .6rem; }
.inp.xs { width: 4.2rem; padding: .4rem .45rem; text-align: center; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.field-label { font-weight: 600; }
.field small { color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-btn { border: 0; background: transparent; padding: .42rem .9rem; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg-btn.on { background: var(--primary); color: var(--primary-ink); }
.mu-slider { display: grid; grid-template-columns: auto 1fr 3.5rem; align-items: center; gap: .6rem; font-size: .92rem; }
.mu-slider .ms-label { font-weight: 600; min-width: 1.5rem; }
.mu-slider output { font-family: var(--font-mono); text-align: right; font-weight: 600; }
.mu-slider input[type="range"] { width: 100%; accent-color: var(--primary); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.panel h3 { font-size: 1.1rem; margin-bottom: .6rem; }
.note { padding: .75rem 1rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); border-left: 4px solid var(--primary); }
.okay { color: var(--good); font-weight: 600; }
.oops { color: var(--bad); font-weight: 600; }
.tbl { border-collapse: collapse; width: 100%; font-size: .93rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-2); }
.tbl.num td, .tbl.num th { text-align: center; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .32rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .86rem; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 .12em; font-variant-numeric: tabular-nums; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .2em; }
.frac > span:last-child { padding: 0 .2em; }
.steps { counter-reset: st; list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 2rem 1fr; gap: .6rem; align-items: start; }
.steps li::before { content: counter(st); display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: .85rem; }
.hl { background: color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 4px; padding: 0 .15em; }
canvas.plot { width: 100%; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); touch-action: none; }

/* ---------- stage (full-screen activity) ---------- */
.mu-stage { position: fixed; inset: 0; z-index: 100; background: var(--stage-bg); color: var(--text); display: flex; flex-direction: column; animation: muIn .22s ease; }
.mu-stage.out { animation: muOut .18s ease forwards; }
.mu-stage-head { display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem; border-bottom: 1px solid var(--line); background: var(--stage-head-bg); flex-wrap: wrap; }
.mu-stage-title { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; flex: 1 1 200px; min-width: 0; }
.mu-stage-icon { font-size: 1.4rem; }
.mu-stage-status { display: flex; gap: .6rem; align-items: center; font-weight: 600; flex-wrap: wrap; }
.mu-stage-help { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.mu-stage-help > div { max-width: 860px; margin: 0 auto; }
.mu-stage-body { flex: 1; overflow: auto; padding: 1.3rem 1rem 3rem; overscroll-behavior: contain; }
.stage-in { max-width: 1040px; margin: 0 auto; }
.stage-in.narrow { max-width: 720px; }
.mu-error { color: var(--bad); text-align: center; padding: 2rem; }
@keyframes muIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes muOut { to { opacity: 0; transform: translateY(14px); } }

/* ---------- modal ---------- */
.mu-modal-back { position: fixed; inset: 0; z-index: 200; background: rgba(10, 12, 25, .55); display: grid; place-items: center; padding: 1rem; animation: muFade .18s ease; }
.mu-modal { width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: calc(var(--radius) + 4px); box-shadow: 0 30px 60px rgba(0,0,0,.35); overflow: hidden; }
.mu-modal.wide { width: min(900px, 100%); }
.mu-modal-head { display: flex; align-items: center; gap: .5rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.mu-modal-head h3 { margin: 0; flex: 1; font-size: 1.2rem; }
.mu-modal-body { padding: 1.1rem; overflow: auto; }
.mu-modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); }
.mu-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1rem; }
@keyframes muFade { from { opacity: 0; } }

/* ---------- toast, floaters, confetti ---------- */
.mu-toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 300; display: grid; gap: .5rem; pointer-events: none; width: min(92vw, 420px); }
.mu-toast { display: flex; gap: .6rem; align-items: center; padding: .7rem 1rem; border-radius: 14px; background: #1d1b2f; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-weight: 600; animation: muToast .3s cubic-bezier(.2, 1.4, .4, 1); }
.mu-toast.out { opacity: 0; transform: translateY(10px); transition: .35s; }
.mu-toast-i { font-size: 1.4rem; }
@keyframes muToast { from { opacity: 0; transform: translateY(20px) scale(.9); } }
.mu-floater { position: fixed; z-index: 310; pointer-events: none; font-weight: 800; font-size: 1.6rem; transform: translate(-50%, 0); animation: muFloat 1s ease-out forwards; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
@keyframes muFloat { to { transform: translate(-50%, -70px); opacity: 0; } }
#mu-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 305; }
.mu-shake { animation: muShake .4s; }
@keyframes muShake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.mu-pop { animation: muPop .35s; }
@keyframes muPop { 50% { transform: scale(1.12); } }

/* ---------- multiple-choice runner ---------- */
.mcq { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.2rem; }
.mcq-top { display: flex; align-items: center; gap: .8rem 1.2rem; flex-wrap: wrap; }
.mcq-info { display: flex; gap: .9rem; font-weight: 700; flex-wrap: wrap; }
.mcq-bar { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 120px; }
.mcq-bar > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .35s ease; }
.mcq-prompt { font-size: var(--fs-xl); font-weight: 600; text-align: center; min-height: 3.2em; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .6rem; }
.mcq-choices { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: .85rem; }
.mcq-choice { padding: .95rem 1rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); font-size: var(--fs-lg); font-weight: 600; min-height: 64px; transition: transform .1s, border-color .15s; display: flex; align-items: center; justify-content: center; gap: .4rem; text-align: center; }
.mcq-choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.mcq-choice.good { background: var(--good); color: #fff; border-color: var(--good); animation: muPop .35s; }
.mcq-choice.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.mcq-choice.gone { visibility: hidden; }
.mcq-choices.size-xl .mcq-choice { font-size: 2.3rem; min-height: 100px; }
.mcq-choices.size-md .mcq-choice { font-size: 1.05rem; min-height: 56px; justify-content: flex-start; text-align: left; }
.mcq-feedback { text-align: center; min-height: 1.6em; color: var(--muted); }
.mcq-feedback .x { display: block; margin-top: .3rem; color: var(--text); }
.mcq-tools { display: flex; gap: .5rem; justify-content: center; }
@media (max-width: 600px) { .mcq-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mcq-choices.one { grid-template-columns: 1fr; } .mcq-choices.size-md { grid-template-columns: 1fr; } }

/* ---------- results ---------- */
.mu-results { max-width: 520px; margin: 1.5rem auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.res-stars { font-size: 3.4rem; letter-spacing: .15em; color: color-mix(in srgb, var(--text) 18%, transparent); }
.res-stars .on { color: #ffc531; text-shadow: 0 3px 0 #e09b00; display: inline-block; animation: muPop .5s; }
.res-score { font-size: var(--fs-3xl); font-weight: 800; margin: 0; }
.res-best { color: var(--muted); font-weight: 600; }
.res-actions { display: flex; gap: .7rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }

/* ---------- speed runner & numpad ---------- */
.speed { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; align-items: stretch; text-align: center; }
.speed-hud { display: flex; justify-content: space-between; font-weight: 700; gap: .5rem; flex-wrap: wrap; }
.speed-timebar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.speed-timebar i { display: block; height: 100%; background: var(--primary); transition: width 1s linear; }
.speed-q { font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 800; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.speed-input { font-size: 2rem; text-align: center; padding: .5rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--input-bg); font-weight: 700; font-variant-numeric: tabular-nums; }
.speed-input.good { border-color: var(--good); }
.speed-input.bad { border-color: var(--bad); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.np-key { padding: .85rem 0; font-size: 1.4rem; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.np-key:active { transform: scale(.95); }
.np-enter { grid-column: span 3; background: var(--primary); color: var(--primary-ink); }

/* ---------- shared tool panels (grapher, matrix, stats, bases) ---------- */
.gx { display: grid; grid-template-columns: minmax(260px, 330px) 1fr; gap: 1.2rem; align-items: start; }
.gx-side { display: grid; gap: .6rem; }
.gx-list { display: grid; gap: .5rem; }
.gx-row { display: grid; grid-template-columns: 22px auto 1fr auto; gap: .45rem; align-items: center; }
.gx-row small { grid-column: 1 / -1; }
.gx-sw { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .2); padding: 0; }
.gx-y { font-weight: 600; }
.gx-sliders { display: grid; gap: .3rem; padding: .6rem; border: 1px dashed var(--line); border-radius: 8px; }
.gx-roots { font-size: .9rem; margin-top: .5rem; }
@media (max-width: 860px) { .gx { grid-template-columns: 1fr; } }
.mat { border-collapse: separate; border-spacing: .5rem .2rem; border-left: 2.5px solid currentColor; border-right: 2.5px solid currentColor; border-radius: 8px; padding: .1rem .2rem; font-family: var(--font-mono); font-size: 1.05rem; margin: .4rem 0; }
.mat td { text-align: center; min-width: 2.2rem; }
.mat.sm { font-size: .85rem; }
.mx-grid { display: grid; gap: .3rem; margin: .7rem 0; justify-content: start; }
.mx-bracket { border-left: 2.5px solid var(--text); border-right: 2.5px solid var(--text); border-radius: 8px; padding: 0 .4rem; display: inline-block; }
.mx-out { margin-top: .6rem; padding: 1rem; background: #fff; border: 1.5px solid var(--line); border-radius: 8px; min-height: 4rem; }
.mx-steps summary { cursor: pointer; font-weight: 600; margin-top: .6rem; }
.stat-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin: .6rem 0 1rem; }
.stat-cells .stat { text-align: left; background: #fff; border: 1px solid var(--line); }
.stat-cells .stat small { display: block; color: var(--muted); font-size: .78rem; }
.stat-cells .stat b { font-family: var(--font-mono); font-size: 1.15rem; }
figure.panel { margin: 0; }
.bits { display: flex; flex-wrap: wrap; gap: .3rem; margin: .7rem 0; }
.bit { display: grid; place-items: center; width: 3rem; padding: .35rem 0; border-radius: 6px; border: 1.5px solid var(--line); background: #fff; font-family: var(--font-mono); }
.bit b { font-size: 1.3rem; }
.bit small { font-size: .65rem; color: var(--muted); }
.bit.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.bit.on small { color: rgba(255,255,255,.75); }

/* ---------- printing ---------- */
.mu-print-root { display: none; }
@media print {
  body.mu-printing > *:not(.mu-print-root) { display: none !important; }
  body.mu-printing .mu-print-root { display: block !important; }
  body.mu-printing { background: #fff !important; color: #000 !important; }
  .no-print { display: none !important; }
}

/* ---------- footer ---------- */
.mu-foot { margin-top: 3rem; padding: 2rem 1.1rem 2.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.mu-foot .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; justify-content: space-between; align-items: center; }
.mu-foot a { color: inherit; }
.mu-foot nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }

/* ---------- progress modal ---------- */
.prog-level { display: flex; align-items: center; gap: 1rem; }
.prog-badge { font-size: 2.6rem; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); }
.prog-bar { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: .5rem 0; }
.prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .55rem; margin-top: .6rem; }
.badge { padding: .6rem .4rem; border-radius: 12px; text-align: center; border: 1px solid var(--line); font-size: .78rem; line-height: 1.25; }
.badge b { display: block; font-size: 1.7rem; margin-bottom: .2rem; }
.badge.locked { opacity: .38; filter: grayscale(1); }
.stat-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
.stat { flex: 1 1 100px; padding: .7rem; border-radius: 12px; background: var(--surface-2); text-align: center; }
.stat b { display: block; font-size: 1.4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- related rooms strip (age worlds) ---------- */
.mu-related { margin-top: 3rem; }
.mu-related h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.rel-card { display: grid; gap: .2rem; padding: .9rem 1rem; background: var(--card-bg); border: var(--card-border); border-radius: var(--card-radius); box-shadow: var(--card-shadow); color: var(--text); text-decoration: none; transition: transform .15s; }
.rel-card:hover { transform: translateY(-3px); }
.rel-i { font-size: 1.6rem; line-height: 1.2; }
.rel-card b { font-size: 1.05rem; }
.rel-card small { color: var(--muted); }
