/* Math Meridian: the stage, the globe behind everything, the top bar, the first screen, sheets and buttons.
   The match, practice and Daily Five screens are in play.css. Every class starts with mm-. */
.mm { display: flex; flex-direction: column; --mm-hdr: 60px; --mm-bg: #04060f; --mm-panel: #0b1328; --mm-line: #1c2b4a; --mm-text: #dfe9ff; --mm-muted: #8aa3c4; --mm-accent: #55d6ff; --mm-warm: #ffd166; --mm-pink: #ff6b81; --mm-green: #5fe3a1; }
.mm [hidden] { display: none !important; }
.mm-stage { position: relative; width: 100%; height: min(84vh, 800px); height: min(calc(100svh - var(--mm-hdr) - 12px), 800px); min-height: 460px; overflow: hidden; border-radius: 10px; outline: none; color: var(--mm-text); font-size: 15px; line-height: 1.35; background: radial-gradient(120% 90% at 70% 40%, #0a1a3c 0%, #050a1a 55%, #04060f 100%); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.stage.is-immersive .stage-body > .mm { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .mm-stage { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; border-radius: 0; }
.mm-stage *, .mm-stage *::before, .mm-stage *::after { box-sizing: border-box; }
.mm-globe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; transition: opacity .5s ease; }
.mm-globe:active { cursor: grabbing; }
.mm-stage[data-dim="1"] .mm-globe { opacity: .42; }
.mm-stage[data-dim="2"] .mm-globe { opacity: 0; pointer-events: none; }
.mm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- buttons ---------- */
.mm-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--mm-line); background: rgba(11, 19, 40, .86); color: var(--mm-text); font: inherit; font-weight: 650; cursor: pointer; text-align: center; transition: transform .08s ease, border-color .15s ease, background .15s ease, opacity .15s; touch-action: manipulation; }
.mm-btn:hover { border-color: #2f4a7c; background: rgba(16, 28, 58, .95); }
.mm-btn:active { transform: scale(.97); }
.mm-btn:focus-visible, .mm-ibtn:focus-visible, .mm-key:focus-visible, .mm-chipbtn:focus-visible { outline: 2px solid var(--mm-accent); outline-offset: 2px; }
.mm-btn:disabled { opacity: .45; cursor: default; transform: none; }
.mm-btn.mm-go { background: linear-gradient(180deg, #6fdfff, #2fb1e6); border-color: #7fe3ff; color: #031320; }
.mm-btn.mm-go:hover { background: linear-gradient(180deg, #8ae6ff, #45bdee); }
.mm-btn.mm-warm { background: linear-gradient(180deg, #ffdc85, #f3b93f); border-color: #ffe29a; color: #251a02; }
.mm-btn.mm-danger { border-color: rgba(255, 107, 129, .6); color: #ffb3bf; }
.mm-btn.mm-small { min-height: 40px; padding: 0 11px; font-size: 13.5px; border-radius: 10px; }
.mm-ibtn { appearance: none; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--mm-line); background: rgba(11, 19, 40, .8); color: var(--mm-text); cursor: pointer; padding: 0; font: inherit; touch-action: manipulation; }
.mm-ibtn:hover { border-color: #2f4a7c; }
.mm-ibtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mm-ibtn.mm-x { border-color: transparent; background: transparent; font-size: 26px; line-height: 1; color: var(--mm-muted); }
#mm-sound[aria-pressed="true"] .mm-off, #mm-sound[aria-pressed="false"] .mm-on { display: none; }
#mm-sound[aria-pressed="false"] { color: var(--mm-muted); }

/* ---------- top bar, zoom buttons ---------- */
.mm-top { position: absolute; z-index: 6; top: 0; left: 0; right: 0; height: 48px; padding: 4px 8px 4px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.mm-top > * { pointer-events: auto; }
.mm-brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; white-space: nowrap; }
.mm-brand b { font-size: 16px; letter-spacing: .02em; }
.mm-online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mm-muted); overflow: hidden; text-overflow: ellipsis; }
.mm-online i { width: 8px; height: 8px; border-radius: 50%; background: var(--mm-muted); flex: none; }
.mm-online.mm-live i { background: var(--mm-green); box-shadow: 0 0 0 0 rgba(95, 227, 161, .7); animation: mm-ping 2s infinite; }
.mm-online.mm-bad i { background: var(--mm-pink); }
@keyframes mm-ping { 70% { box-shadow: 0 0 0 7px rgba(95, 227, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(95, 227, 161, 0); } }
.mm-tools { display: flex; gap: 6px; }
.mm-zoom { position: absolute; z-index: 4; right: 8px; top: 56px; display: flex; flex-direction: column; gap: 6px; }
.mm-stage[data-dim] .mm-zoom { display: none; }

/* ---------- the layer the screens are drawn on ---------- */
.mm-view { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.mm-view > * { pointer-events: auto; }
.mm-panel { background: rgba(8, 14, 32, .9); border: 1px solid var(--mm-line); border-radius: 14px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ---------- first screen ---------- */
.mm-home { position: absolute; left: 16px; top: 56px; bottom: 16px; width: 356px; display: flex; flex-direction: column; justify-content: center; gap: 10px; pointer-events: none; }
.mm-home > * { pointer-events: auto; }
.mm-hero { margin: 0 2px 4px; }
.mm-hero h2 { margin: 0 0 4px; font-size: 26px; line-height: 1.12; letter-spacing: -.01em; }
.mm-hero p { margin: 0; color: var(--mm-muted); font-size: 14.5px; }
.mm-me { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 12px; border: 1px solid var(--mm-line); background: rgba(8, 14, 32, .82); color: inherit; font: inherit; cursor: pointer; text-align: left; min-height: 44px; }
.mm-me:hover { border-color: #2f4a7c; }
.mm-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; color: #06101f; background: var(--mm-warm); }
.mm-av.mm-c1 { background: #55d6ff; } .mm-av.mm-c2 { background: #ff8fa0; } .mm-av.mm-c3 { background: #5fe3a1; } .mm-av.mm-c4 { background: #c9a5ff; } .mm-av.mm-c5 { background: #ffb86b; } .mm-av.mm-c6 { background: #8fb4ff; } .mm-av.mm-c7 { background: #f2e86d; }
.mm-av.mm-pacer { background: #33466e; color: #cfe0ff; border: 1px dashed #7f9cd0; }
.mm-me-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.mm-me-name small { display: block; font-weight: 500; font-size: 12px; color: var(--mm-muted); }
.mm-rate { flex: none; padding: 3px 9px; border-radius: 999px; background: rgba(85, 214, 255, .12); border: 1px solid rgba(85, 214, 255, .35); color: var(--mm-accent); font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.mm-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mm-menu .mm-wide { grid-column: 1 / -1; }
.mm-big { min-height: 54px; flex-direction: column; gap: 1px; line-height: 1.15; padding: 6px 10px; }
.mm-big b { font-size: 16px; }
.mm-big small { font-weight: 550; font-size: 12px; opacity: .78; }
.mm-big small:empty { display: none; }
.mm-more { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mm-more .mm-btn { padding: 0 4px; font-size: 13.5px; min-height: 42px; }
.mm-more .mm-btn i { font-style: normal; color: var(--mm-accent); margin-left: 3px; font-variant-numeric: tabular-nums; }
.mm-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--mm-muted); margin: 2px 2px 0; }
.mm-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mm-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
.mm-note { font-size: 12.5px; color: var(--mm-muted); margin: 0; }

/* phones and narrow frames: the menu sits along the bottom, the globe above it */
.mm-stage.mm-narrow .mm-home { left: 0; right: 0; top: auto; bottom: 0; width: auto; padding: 26px 12px 12px; gap: 8px; justify-content: flex-end; background: linear-gradient(180deg, rgba(4, 6, 15, 0) 0, rgba(4, 6, 15, .86) 34px, rgba(4, 6, 15, .96) 100%); }
.mm-stage.mm-narrow .mm-hero { display: none; }
.mm-stage.mm-narrow .mm-big { min-height: 50px; }
.mm-stage.mm-narrow .mm-big b { font-size: 15px; }
.mm-stage.mm-short .mm-legend { display: none; }
.mm-stage.mm-narrow .mm-brand b { font-size: 15px; }
.mm-stage.mm-narrow .mm-wordy { display: none; }
/* a phone held sideways: no big heading, the menu starts under the title bar and scrolls inside itself if it must */
.mm-stage.mm-land .mm-hero, .mm-stage.mm-land .mm-legend { display: none; }
.mm-stage.mm-land .mm-home { top: 50px; bottom: 6px; width: 340px; gap: 7px; justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.mm-stage.mm-land .mm-big { min-height: 48px; }
.mm-stage.mm-land .mm-big b { font-size: 15px; }
.mm-stage.mm-land .mm-zoom { top: 52px; }
.mm-stage.mm-narrow .mm-zoom { top: 52px; }

/* ---------- the card for a tapped dot ---------- */
.mm-card { position: absolute; z-index: 7; left: 0; top: 0; min-width: 150px; max-width: 230px; padding: 9px 12px 10px; border-radius: 12px; background: rgba(8, 14, 32, .96); border: 1px solid #2f4a7c; box-shadow: 0 8px 26px rgba(0, 0, 0, .5); pointer-events: none; transform: translate(-50%, calc(-100% - 16px)); font-size: 13px; }
.mm-card::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: inherit; border: inherit; border-top: 0; border-left: 0; transform: translateX(-50%) rotate(45deg); }
.mm-card.mm-below { transform: translate(-50%, 16px); }
.mm-card.mm-below::after { bottom: auto; top: -6px; transform: translateX(-50%) rotate(225deg); }
.mm-card b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-card span { display: block; color: var(--mm-muted); }
.mm-card em { font-style: normal; color: var(--mm-accent); font-weight: 700; }

/* ---------- sheets ---------- */
.mm-sheets { position: absolute; inset: 0; z-index: 30; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); place-items: center; padding: 10px; background: rgba(2, 4, 10, .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.mm-sheet { width: min(100%, 440px); max-height: 100%; display: flex; flex-direction: column; background: #0a1226; border: 1px solid #263a63; border-radius: 16px; box-shadow: 0 18px 60px rgba(0, 0, 0, .6); outline: none; animation: mm-rise .18s ease-out; -webkit-user-select: text; user-select: text; }
.mm-sheet.mm-wide { width: min(100%, 720px); }
@keyframes mm-rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.mm-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 4px 16px; flex: none; }
.mm-sheet-head h3 { margin: 0; font-size: 17px; }
.mm-sheet-body { overflow: auto; overscroll-behavior: contain; padding: 4px 16px 16px; min-height: 0; -webkit-overflow-scrolling: touch; }
.mm-sheet-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 16px 14px; border-top: 1px solid var(--mm-line); flex: none; }
.mm-sheet-foot .mm-btn { flex: 1 1 120px; }
.mm-p { margin: 6px 0 10px; color: #c7d6f3; }
.mm-h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--mm-muted); }
.mm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mm-empty { padding: 18px 8px; text-align: center; color: var(--mm-muted); }
.mm-field { display: flex; gap: 8px; align-items: stretch; margin: 8px 0; }
.mm-input { flex: 1 1 auto; min-width: 0; height: 46px; border-radius: 11px; border: 1px solid #2f4a7c; background: #060c1c; color: var(--mm-text); font: inherit; font-size: 20px; font-weight: 700; letter-spacing: .18em; text-align: center; text-transform: uppercase; padding: 0 10px; outline: none; -webkit-user-select: text; user-select: text; }
.mm-input:focus { border-color: var(--mm-accent); box-shadow: 0 0 0 3px rgba(85, 214, 255, .18); }

/* ---------- toasts, loading ---------- */
.mm-toasts { position: absolute; z-index: 40; top: 54px; left: 50%; transform: translateX(-50%); width: min(92%, 420px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.mm-toast { padding: 8px 14px; border-radius: 16px; background: rgba(10, 18, 38, .96); border: 1px solid #2f4a7c; font-size: 13.5px; font-weight: 600; text-align: center; box-shadow: 0 6px 22px rgba(0, 0, 0, .45); animation: mm-rise .2s ease-out; transition: opacity .3s, transform .3s; }
.mm-toast.mm-good { border-color: rgba(95, 227, 161, .7); color: #b8f5d6; }
.mm-toast.mm-bad { border-color: rgba(255, 107, 129, .7); color: #ffc2cb; }
.mm-toast.mm-out { opacity: 0; transform: translateY(-6px); }
.mm-loading { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: #04060f; color: var(--mm-muted); font-size: 15px; transition: opacity .5s ease; text-align: center; padding: 20px; }
.mm-loading.mm-done { opacity: 0; pointer-events: none; }
.mm-loading span::before { content: ''; display: block; width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid rgba(85, 214, 255, .2); border-top-color: var(--mm-accent); animation: mm-spin 1s linear infinite; }
@keyframes mm-spin { to { transform: rotate(360deg); } }
.mm-banner { position: absolute; z-index: 8; left: 50%; top: 52px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 20px); padding: 6px 8px 6px 14px; border-radius: 12px; background: rgba(40, 14, 22, .96); border: 1px solid rgba(255, 107, 129, .6); font-size: 13.5px; }

/* ---------- maths ---------- */
.mm-m { font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', Georgia, 'Times New Roman', serif; font-size: 1.08em; }
.mm-m i { font-style: italic; padding-right: .04em; }
.mm-nw { white-space: nowrap; }
.mm-fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .14em; line-height: 1.12; font-size: .94em; }
.mm-fn { padding: 0 .28em .05em; border-bottom: .085em solid currentColor; }
.mm-fd { padding: .05em .28em 0; }
.mm-rt { display: inline-flex; align-items: flex-end; white-space: nowrap; }
.mm-rs { display: inline-block; font-size: 1.12em; line-height: 1; transform: translateY(.06em); margin-right: -.03em; }
.mm-rb { display: inline-block; border-top: .08em solid currentColor; padding: .04em .14em 0 .1em; line-height: 1.12; }
.mm-line { margin: 0 0 .32em; }
.mm-line:last-child { margin-bottom: 0; }
.mm-disp { text-align: center; font-size: 1.22em; margin: .4em 0; }
.mm-stage sup, .mm-stage sub { font-size: .68em; line-height: 0; }

@media (prefers-reduced-motion: reduce) { .mm-stage *, .mm-stage *::before { animation: none !important; transition: none !important; } }
