/* ==== JPM KIT v1 — base visual dos jogos (sincronizado; regras do jogo vêm depois do "fim da base") ==== */
.jpm-game[data-game="matematica"] {
  --g-glass: rgba(23, 27, 52, .72);
  --g-accent: var(--primary, #6046FF);
  font-family: inherit;
  color: var(--ink, #172033);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  container-type: size;
  font-size: clamp(11px, 2.1cqw, 17px);
}
.jpm-game[data-game="matematica"] [hidden] { display: none; }
.jpm-game[data-game="matematica"] button { font: inherit; color: inherit; cursor: pointer; }
.jpm-game[data-game="matematica"] button:focus-visible { outline: 3px solid var(--ink, #172033); outline-offset: 2px; }
.jpm-game[data-game="matematica"] .g-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.jpm-game[data-game="matematica"] .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* HUD numa faixa só */
.jpm-game[data-game="matematica"] .g-hud { position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; pointer-events: none; }
.jpm-game[data-game="matematica"] .g-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: var(--r-pill, 999px); background: var(--g-glass); color: var(--surface, #fff); font-weight: 900; font-size: clamp(13px, 2.3cqw, 19px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jpm-game[data-game="matematica"] .g-chip--right { margin-left: auto; }
.jpm-game[data-game="matematica"] .g-chip--warn { background: var(--coral, #FF6868); }
.jpm-game[data-game="matematica"] .g-ico { width: 1.2em; height: 1.2em; flex: none; }
.jpm-game[data-game="matematica"] .g-bar { position: relative; width: clamp(70px, 18cqw, 180px); height: .7em; border-radius: var(--r-pill, 999px); background: rgba(255, 255, 255, .25); overflow: hidden; }
.jpm-game[data-game="matematica"] .g-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--yellow, #FFD43B); transition: width .2s linear; }
.jpm-game[data-game="matematica"] .g-hearts { display: flex; gap: 4px; padding: 6px 10px; border-radius: var(--r-pill, 999px); background: var(--g-glass); }
.jpm-game[data-game="matematica"] .g-heart { width: clamp(16px, 3cqw, 26px); height: clamp(16px, 3cqw, 26px); color: var(--coral, #FF6868); transition: transform .2s, opacity .2s; }
.jpm-game[data-game="matematica"] .g-heart.is-lost { color: rgba(255, 255, 255, .35); transform: scale(.85); }

/* telas */
.jpm-game[data-game="matematica"] .g-screen { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 12px; }
.jpm-game[data-game="matematica"] .g-intro, .jpm-game[data-game="matematica"] .g-over, .jpm-game[data-game="matematica"] .g-paused { background: rgba(23, 27, 52, .32); }
.jpm-game[data-game="matematica"] .g-intro { background: linear-gradient(90deg, rgba(23, 27, 52, .38), rgba(23, 27, 52, .05) 70%); justify-items: start; padding-left: 6cqw; }
.jpm-game[data-game="matematica"] .g-card { width: min(92%, 420px); padding: clamp(14px, 3.4cqw, 28px); border-radius: var(--r-card, 16px); background: var(--surface, #fff); color: var(--ink, #172033); text-align: center; box-shadow: var(--shadow2, 0 18px 44px rgba(23, 32, 51, .16)); }
.jpm-game[data-game="matematica"] .g-intro .g-card { width: min(56%, 400px); }
.jpm-game[data-game="matematica"] .g-card--small { width: auto; padding: 16px 22px; }
.jpm-game[data-game="matematica"] .g-kicker { margin: 0; font-size: clamp(10px, 1.8cqw, 13px); font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted, #606B80); }
.jpm-game[data-game="matematica"] .g-title { margin: 4px 0 6px; font-size: clamp(20px, 4.6cqw, 34px); line-height: 1.05; letter-spacing: -.04em; font-weight: 900; }
.jpm-game[data-game="matematica"] .g-text { margin: 0 0 14px; color: var(--muted, #606B80); font-weight: 600; font-size: clamp(12px, 2.2cqw, 16px); }
.jpm-game[data-game="matematica"] .g-btn { min-height: 46px; padding: 0 26px; border: 0; border-radius: var(--r-pill, 999px); background: var(--g-accent); color: var(--surface, #fff); font-weight: 900; font-size: clamp(15px, 2.6cqw, 19px); box-shadow: 0 8px 18px rgba(23, 32, 51, .22); transition: transform .12s; }
.jpm-game[data-game="matematica"] .g-btn:active { transform: scale(.96); }
.jpm-game[data-game="matematica"] .g-btn--ghost { background: var(--bg, #F3F6FA); color: var(--ink, #172033); box-shadow: inset 0 0 0 2px var(--line, #E3E8EF); }
.jpm-game[data-game="matematica"] .g-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.jpm-game[data-game="matematica"] .g-results { display: flex; justify-content: center; gap: clamp(12px, 4cqw, 30px); margin: 10px 0; }
.jpm-game[data-game="matematica"] .g-num { display: block; font-size: clamp(20px, 4.4cqw, 32px); font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.jpm-game[data-game="matematica"] .g-lbl { font-size: clamp(11px, 1.8cqw, 13px); color: var(--muted, #606B80); font-weight: 700; }
.jpm-game[data-game="matematica"] .g-best { margin: 0 0 14px; font-weight: 800; color: var(--g-accent); min-height: 1.2em; }
.jpm-game[data-game="matematica"] .g-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 8px; font-size: clamp(22px, 5cqw, 36px); }
.jpm-game[data-game="matematica"] .g-star { width: 1em; height: 1em; color: var(--line, #E3E8EF); }
.jpm-game[data-game="matematica"] .g-star.is-on { color: var(--yellow, #FFD43B); }

.jpm-game[data-game="matematica"] .g-ready { pointer-events: none; align-content: center; gap: 12px; }
.jpm-game[data-game="matematica"] .g-howto { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.jpm-game[data-game="matematica"] .g-howto-item { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill, 999px); background: var(--g-glass); color: var(--surface, #fff); font-weight: 700; font-size: clamp(12px, 2.1cqw, 16px); }
.jpm-game[data-game="matematica"] .g-key { padding: 3px 9px; border-radius: 8px; background: var(--surface, #fff); color: var(--ink, #172033); font-weight: 900; }
.jpm-game[data-game="matematica"] .g-touch-only { display: none; }
.jpm-game[data-game="matematica"] .g-count { font-size: clamp(48px, 14cqw, 120px); font-weight: 900; color: var(--surface, #fff); text-shadow: 0 6px 0 rgba(23, 27, 52, .35); line-height: 1; animation: matematica-pop .8s ease-out infinite; }
@keyframes matematica-pop { from { transform: scale(1.25); opacity: .4; } 30% { transform: scale(1); opacity: 1; } }

/* botões de toque */
.jpm-game[data-game="matematica"] .g-touch { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 10px; pointer-events: none; }
.jpm-game[data-game="matematica"] .g-touch-group { display: flex; gap: 10px; align-items: flex-end; }
.jpm-game[data-game="matematica"] .g-tbtn { pointer-events: auto; width: clamp(52px, 13cqw, 80px); height: clamp(52px, 13cqw, 80px); border: 0; border-radius: 50%; background: rgba(23, 27, 52, .45); color: var(--surface, #fff); display: grid; place-items: center; touch-action: none; font-weight: 900; font-size: clamp(11px, 2cqw, 14px); }
.jpm-game[data-game="matematica"] .g-tbtn svg { width: 55%; height: 55%; }
.jpm-game[data-game="matematica"] .g-tbtn--action { background: rgba(96, 70, 255, .78); }
.jpm-game[data-game="matematica"] .g-tbtn.is-on, .jpm-game[data-game="matematica"] .g-tbtn:active { transform: scale(.94); background: rgba(96, 70, 255, .9); }

/* aviso curto no meio da tela (+10, Combo!, Errou) */
.jpm-game[data-game="matematica"] .g-toast { position: absolute; left: 50%; top: 22%; z-index: 3; transform: translateX(-50%); padding: .4em 1em; border-radius: var(--r-pill, 999px); background: var(--surface, #fff); color: var(--ink, #172033); font-weight: 900; font-size: clamp(14px, 3cqw, 24px); white-space: nowrap; box-shadow: var(--shadow2, 0 18px 44px rgba(23, 32, 51, .16)); pointer-events: none; animation: matematica-toast .9s ease-out forwards; }
.jpm-game[data-game="matematica"] .g-toast.is-good { background: var(--green, #46D68C); color: var(--surface, #fff); }
.jpm-game[data-game="matematica"] .g-toast.is-bad { background: var(--coral, #FF6868); color: var(--surface, #fff); }
@keyframes matematica-toast { from { opacity: 0; transform: translate(-50%, 10px) scale(.9); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -12px) scale(1); } }

@media (pointer: coarse) {
  .jpm-game[data-game="matematica"] .g-touch-only { display: inline-flex; }
}
@container (max-width: 520px) {
  .jpm-game[data-game="matematica"] .g-intro { justify-items: center; padding-left: 12px; background: rgba(23, 27, 52, .3); }
  .jpm-game[data-game="matematica"] .g-intro .g-card { width: min(92%, 400px); }
}
@media (prefers-reduced-motion: reduce) {
  .jpm-game[data-game="matematica"] .g-count, .jpm-game[data-game="matematica"] .g-toast { animation: none; }
}
/* ==== fim da base ==== */

/* jogo */
.jpm-game[data-game="matematica"] { --g-accent: #4C6FE8; --mt-glass: rgba(30, 45, 110, .66); --mt-ink: #24326E; --mt-gold: #FFC928; --mt-ok: #2FBF71; --mt-bad: #FF5D6C; --mt-c1: #5B83F0; --mt-c2: #FF7FA6; }
.jpm-game[data-game="matematica"] .g-panel { position: absolute; pointer-events: none; }

/* HUD */
.jpm-game[data-game="matematica"] .mt-hud { gap: 6px; padding: 8px 10px; }
.jpm-game[data-game="matematica"] .mt-hud .g-chip { background: var(--mt-glass); }
.jpm-game[data-game="matematica"] .mt-hud .g-chip--warn { background: var(--coral, #FF6868); }
.jpm-game[data-game="matematica"] .mt-ico { display: inline-flex; }
.jpm-game[data-game="matematica"] .mt-lv { pointer-events: auto; border: 0; cursor: pointer; }
.jpm-game[data-game="matematica"] .mt-hud .mt-combo { background: #FF8A3D; }

/* quadro da conta */
.jpm-game[data-game="matematica"] .mt-board { z-index: 3; left: 50%; top: clamp(6px, 1.6cqh, 14px); transform: translateX(-50%); width: max-content; max-width: min(64cqw, 640px); display: grid; justify-items: center; gap: .15em; padding: .3em 1em .4em; border-radius: clamp(14px, 2.6cqw, 26px); background: #fff; color: var(--mt-ink); text-align: center; box-shadow: 0 10px 28px rgba(30, 45, 110, .28), inset 0 -5px 0 rgba(76, 111, 232, .14); transition: background .15s, color .15s; }
.jpm-game[data-game="matematica"] .mt-board p { margin: 0; }
.jpm-game[data-game="matematica"] .mt-story { max-width: 34em; font-weight: 800; font-size: clamp(12px, 2.3cqw, 21px); line-height: 1.25; text-wrap: balance; }
.jpm-game[data-game="matematica"] .mt-expr { font-weight: 900; font-size: clamp(24px, 5.6cqw, 54px); line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.jpm-game[data-game="matematica"] .mt-expr.is-small { font-size: clamp(19px, 4.3cqw, 42px); }
.jpm-game[data-game="matematica"] .mt-q { display: inline-grid; place-items: center; min-width: 1.15em; height: 1.05em; margin: 0 .08em; padding: 0 .12em; border-radius: .22em; background: #FFF3C4; color: #C98A00; box-shadow: inset 0 0 0 .07em #FFC928; vertical-align: -.06em; line-height: 1; }
.jpm-game[data-game="matematica"] .mt-tip { font-weight: 700; font-size: clamp(10px, 1.9cqw, 16px); color: #6A78B8; }
.jpm-game[data-game="matematica"] .mt-board.is-ok { background: var(--mt-ok); color: #fff; }
.jpm-game[data-game="matematica"] .mt-board.is-bad { box-shadow: 0 0 0 4px var(--mt-bad), 0 10px 28px rgba(30, 45, 110, .28); animation: matematica-shake .35s; }

/* pistas visuais (bolinhas) */
.jpm-game[data-game="matematica"] .mt-hint { --d: clamp(5px, 1.3cqw, 12px); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: calc(var(--d) * .8); max-width: 100%; }
.jpm-game[data-game="matematica"] .mt-grp { display: inline-grid; grid-template-columns: repeat(5, var(--d)); gap: calc(var(--d) * .35); padding: calc(var(--d) * .45); border-radius: calc(var(--d) * .8); background: #EEF2FF; box-shadow: inset 0 0 0 2px #CCD6FF; }
.jpm-game[data-game="matematica"] .mt-grp.is-wide { grid-template-columns: repeat(10, var(--d)); }
.jpm-game[data-game="matematica"] .mt-grp i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--mt-c1); }
.jpm-game[data-game="matematica"] .mt-grp.c2 i { background: var(--mt-c2); }
.jpm-game[data-game="matematica"] .mt-grp i.is-x { background: #D7DCEA; box-shadow: inset 0 0 0 2px #FF8A96; }
.jpm-game[data-game="matematica"] .mt-grp i.is-o { background: transparent; box-shadow: inset 0 0 0 2px var(--mt-c1); }
.jpm-game[data-game="matematica"] .mt-op { font-weight: 900; font-size: calc(var(--d) * 2); color: var(--mt-ink); }

/* conta resolvida (erro) */
.jpm-game[data-game="matematica"] .mt-fix { z-index: 3; right: clamp(8px, 2cqw, 20px); top: 50%; transform: translateY(-62%); width: min(42cqw, 400px); display: grid; justify-items: center; gap: .25em; padding: .55em .9em .65em; border-radius: 20px; background: rgba(255, 255, 255, .97); color: var(--mt-ink); text-align: center; box-shadow: 0 0 0 4px #FFD8DD, 0 14px 34px rgba(30, 45, 110, .3); animation: matematica-up .25s cubic-bezier(.3, 1.5, .5, 1); }
.jpm-game[data-game="matematica"] .mt-fix p { margin: 0; }
.jpm-game[data-game="matematica"] .mt-fix-no { font-weight: 800; font-size: clamp(11px, 2cqw, 16px); color: #C23A4B; }
.jpm-game[data-game="matematica"] .mt-fix-eq { font-weight: 900; font-size: clamp(18px, 4cqw, 36px); line-height: 1.05; color: var(--mt-ok); white-space: nowrap; }
.jpm-game[data-game="matematica"] .mt-fix-how { font-weight: 800; font-size: clamp(11px, 2.1cqw, 18px); line-height: 1.25; }
.jpm-game[data-game="matematica"] .mt-fix-go { margin-top: .1em; padding: .2em .8em; border-radius: 999px; background: #FFF3C4; color: #8A5A00; font-weight: 900; font-size: clamp(10px, 1.8cqw, 14px); }

/* avisos */
.jpm-game[data-game="matematica"] .g-toast { top: auto; bottom: clamp(84px, 30cqh, 220px); }
.jpm-game[data-game="matematica"] .g-toast.is-combo { background: #FF8A3D; color: #fff; }

/* abertura */
.jpm-game[data-game="matematica"] .mt-intro .g-card { width: min(44%, 380px); }
.jpm-game[data-game="matematica"] .mt-row { margin-top: 10px; }
.jpm-game[data-game="matematica"] .mt-row .g-btn--ghost { min-height: 42px; padding: 0 18px; font-size: clamp(13px, 2.2cqw, 16px); }

/* preparação */
.jpm-game[data-game="matematica"] .mt-ready { background: rgba(30, 45, 110, .28); }
.jpm-game[data-game="matematica"] .mt-level { margin: 0; padding: .2em .9em; border-radius: 999px; background: #fff; color: var(--g-accent); font-weight: 900; font-size: clamp(13px, 2.8cqw, 22px); }
.jpm-game[data-game="matematica"] .mt-level-name { margin: 0; color: #fff; font-weight: 900; font-size: clamp(22px, 5.6cqw, 48px); letter-spacing: -.03em; text-shadow: 0 4px 0 rgba(30, 45, 110, .35); text-align: center; line-height: 1.05; }
.jpm-game[data-game="matematica"] .mt-step { padding: 4px 12px 4px 4px; background: var(--mt-glass); }
.jpm-game[data-game="matematica"] .mt-step .g-key { min-width: 1.6em; text-align: center; color: var(--g-accent); }
.jpm-game[data-game="matematica"] .mt-ready-tip { margin: 0; max-width: 90%; color: #fff; font-weight: 800; font-size: clamp(12px, 2.3cqw, 18px); text-align: center; text-shadow: 0 2px 0 rgba(30, 45, 110, .45); }

/* fim */
.jpm-game[data-game="matematica"] .mt-over-card { max-height: calc(100cqh - 16px); overflow-y: auto; overscroll-behavior: contain; }
.jpm-game[data-game="matematica"] .mt-note { margin: 0 0 4px; padding: .25em .8em; border-radius: 999px; display: inline-block; font-weight: 900; font-size: clamp(12px, 2.1cqw, 16px); }
.jpm-game[data-game="matematica"] .mt-note.is-gold { background: #FFF1C2; color: #8A5A00; }
.jpm-game[data-game="matematica"] .mt-note.is-try { background: #FFE9EC; color: #B3263A; border-radius: 14px; }
.jpm-game[data-game="matematica"] .mt-missed { margin: 0 0 6px; }
.jpm-game[data-game="matematica"] .mt-missed-t { margin: 0 0 4px; font-weight: 800; font-size: clamp(11px, 1.9cqw, 14px); color: var(--muted, #606B80); }
.jpm-game[data-game="matematica"] .mt-missed-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.jpm-game[data-game="matematica"] .mt-mf { padding: .12em .6em; border-radius: 8px; background: #EEF2FF; color: var(--mt-ink); font-weight: 900; font-size: clamp(12px, 2cqw, 16px); white-space: nowrap; }
.jpm-game[data-game="matematica"] .mt-link { margin-top: 8px; padding: 6px 10px; border: 0; background: none; color: var(--g-accent); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

/* fases */
.jpm-game[data-game="matematica"] .mt-lv-card { width: min(96%, 840px); max-height: calc(100cqh - 20px); display: flex; flex-direction: column; padding: clamp(10px, 2.2cqw, 20px); }
.jpm-game[data-game="matematica"] .mt-lv-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.jpm-game[data-game="matematica"] .mt-lv-head .g-title { margin: 0; }
.jpm-game[data-game="matematica"] .mt-lv-total { display: inline-flex; align-items: center; gap: 4px; padding: .2em .7em; border-radius: 999px; background: #FFF4E0; color: #B87800; font-weight: 900; }
.jpm-game[data-game="matematica"] .mt-lv-total svg { width: 1.1em; height: 1.1em; color: var(--mt-gold); }
.jpm-game[data-game="matematica"] .mt-lv-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-top: 8px; padding: 2px 4px; text-align: left; }
.jpm-game[data-game="matematica"] .mt-opts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 4px; }
.jpm-game[data-game="matematica"] .mt-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 6px; border: 0; border-radius: 999px; background: var(--bg, #F3F6FA); box-shadow: inset 0 0 0 2px var(--line, #E3E8EF); font-weight: 800; font-size: clamp(12px, 2cqw, 15px); }
.jpm-game[data-game="matematica"] .mt-sw { position: relative; width: 2.6em; height: 1.5em; border-radius: 999px; background: #C9CFDA; transition: background .15s; flex: none; }
.jpm-game[data-game="matematica"] .mt-sw::after { content: ""; position: absolute; left: .18em; top: .18em; width: 1.14em; height: 1.14em; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.jpm-game[data-game="matematica"] .mt-switch[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--g-accent); background: #EEF2FF; }
.jpm-game[data-game="matematica"] .mt-switch[aria-checked="true"] .mt-sw { background: var(--g-accent); }
.jpm-game[data-game="matematica"] .mt-switch[aria-checked="true"] .mt-sw::after { transform: translateX(1.1em); }
.jpm-game[data-game="matematica"] .mt-lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(98px, 17cqw, 140px), 1fr)); gap: 8px; padding-bottom: 4px; }
.jpm-game[data-game="matematica"] .mt-sec { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 2px 0; font-weight: 900; font-size: clamp(12px, 2.2cqw, 16px); color: var(--mt-ink); }
.jpm-game[data-game="matematica"] .mt-sec-note { font-weight: 700; font-size: .82em; color: var(--muted, #606B80); }
.jpm-game[data-game="matematica"] .mt-wdot { width: .9em; height: .9em; border-radius: 4px; }
.jpm-game[data-game="matematica"] .mt-lvb { display: grid; gap: 3px; justify-items: center; padding: 8px 6px 6px; border: 0; border-radius: 14px; background: var(--bg, #F3F6FA); box-shadow: inset 0 0 0 2px var(--line, #E3E8EF); }
.jpm-game[data-game="matematica"] .mt-lvb.is-next { box-shadow: inset 0 0 0 3px var(--g-accent); background: #EEF2FF; }
.jpm-game[data-game="matematica"] .mt-lvb.is-locked { opacity: .55; cursor: default; }
.jpm-game[data-game="matematica"] .mt-lvn { display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 9px; color: #fff; font-weight: 900; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.jpm-game[data-game="matematica"] .w0 { background: #46B866; }
.jpm-game[data-game="matematica"] .w1 { background: #E58A2E; }
.jpm-game[data-game="matematica"] .w2 { background: #E0668F; }
.jpm-game[data-game="matematica"] .w3 { background: #2FA6B8; }
.jpm-game[data-game="matematica"] .w4 { background: #7A5EF0; }
.jpm-game[data-game="matematica"] .mt-lvn svg { width: 1em; height: 1em; }
.jpm-game[data-game="matematica"] .mt-lvb.is-locked .mt-lvn { background: #9AA3B5; }
.jpm-game[data-game="matematica"] .mt-lvname { font-size: clamp(10px, 1.7cqw, 13px); font-weight: 800; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center; text-align: center; }
.jpm-game[data-game="matematica"] .mt-lvstars { display: flex; gap: 1px; }
.jpm-game[data-game="matematica"] .mt-lvstar { width: clamp(12px, 2.2cqw, 17px); height: clamp(12px, 2.2cqw, 17px); color: #D5DBE5; }
.jpm-game[data-game="matematica"] .mt-lvstar.is-on { color: var(--mt-gold); }

@keyframes matematica-up { from { opacity: 0; transform: translateY(-55%) scale(.92); } to { opacity: 1; transform: translateY(-62%) scale(1); } }
@keyframes matematica-shake { 0%, 100% { transform: translateX(-50%); } 25% { transform: translateX(calc(-50% - 8px)); } 75% { transform: translateX(calc(-50% + 8px)); } }

@container (max-width: 520px) {
  .jpm-game[data-game="matematica"] .mt-intro .g-card { width: min(92%, 400px); }
}
@container (max-width: 760px) {
  .jpm-game[data-game="matematica"] .mt-board { top: clamp(26px, 13cqh, 46px); max-width: 74cqw; }
  .jpm-game[data-game="matematica"] .mt-fix { top: 56%; }
}
@container (max-height: 460px) {
  .jpm-game[data-game="matematica"] .mt-hud { padding: 5px 6px; gap: 4px; }
  .jpm-game[data-game="matematica"] .g-chip { padding: 3px 9px 3px 6px; font-size: clamp(11px, 2.2cqw, 15px); }
  .jpm-game[data-game="matematica"] .g-card { padding: 10px 14px; }
  .jpm-game[data-game="matematica"] .g-title { font-size: clamp(17px, 4cqw, 26px); margin: 2px 0 4px; }
  .jpm-game[data-game="matematica"] .g-text { margin-bottom: 8px; font-size: clamp(11px, 2cqw, 14px); }
  .jpm-game[data-game="matematica"] .g-btn { min-height: 40px; padding: 0 18px; font-size: clamp(13px, 2.4cqw, 16px); }
  .jpm-game[data-game="matematica"] .mt-row { margin-top: 6px; }
  .jpm-game[data-game="matematica"] .g-stars { margin: 0 0 2px; font-size: clamp(18px, 4.4cqw, 28px); }
  .jpm-game[data-game="matematica"] .g-results { margin: 4px 0; }
  .jpm-game[data-game="matematica"] .g-num { font-size: clamp(16px, 3.6cqw, 24px); }
  .jpm-game[data-game="matematica"] .g-best { margin: 0 0 6px; font-size: clamp(11px, 2cqw, 14px); }
  .jpm-game[data-game="matematica"] .mt-board { padding: .2em .8em .3em; }
}
@container (max-height: 300px) {
  .jpm-game[data-game="matematica"] .mt-hud { padding: 3px 4px; gap: 3px; }
  .jpm-game[data-game="matematica"] .mt-hud .g-chip { padding: 2px 7px 2px 5px; font-size: 11px; gap: 3px; }
  .jpm-game[data-game="matematica"] .mt-board { top: 27px; max-width: 76cqw; border-radius: 12px; padding: 1px 8px 2px; gap: 1px; }
  .jpm-game[data-game="matematica"] .mt-expr { font-size: 20px; }
  .jpm-game[data-game="matematica"] .mt-expr.is-small { font-size: 16px; }
  .jpm-game[data-game="matematica"] .mt-story { font-size: 10.5px; line-height: 1.2; }
  .jpm-game[data-game="matematica"] .mt-tip { font-size: 9.5px; }
  .jpm-game[data-game="matematica"] .mt-hint { --d: 4px; }
  .jpm-game[data-game="matematica"] .mt-fix { right: 4px; width: 46cqw; padding: 3px 6px 4px; gap: 1px; border-radius: 12px; box-shadow: 0 0 0 3px #FFD8DD; }
  .jpm-game[data-game="matematica"] .mt-fix-no { font-size: 9.5px; }
  .jpm-game[data-game="matematica"] .mt-fix-eq { font-size: 15px; }
  .jpm-game[data-game="matematica"] .mt-fix-how { font-size: 10px; }
  .jpm-game[data-game="matematica"] .mt-fix-go { font-size: 9px; }
  .jpm-game[data-game="matematica"] .g-toast { bottom: 64px; font-size: 13px; }
  .jpm-game[data-game="matematica"] .g-screen { padding: 6px; }
  .jpm-game[data-game="matematica"] .g-intro .g-text { display: none; }
  .jpm-game[data-game="matematica"] .mt-over-card { width: min(96%, 460px); padding: 6px 10px; }
  .jpm-game[data-game="matematica"] .mt-over-card .g-kicker { display: none; }
  .jpm-game[data-game="matematica"] .mt-over-card .g-title { font-size: 16px; margin: 0; }
  .jpm-game[data-game="matematica"] .mt-note { font-size: 11px; margin: 0; }
  .jpm-game[data-game="matematica"] .mt-missed { display: none; }
  .jpm-game[data-game="matematica"] .g-stars { font-size: 18px; margin: 0; }
  .jpm-game[data-game="matematica"] .g-results { margin: 0 0 2px; gap: 14px; }
  .jpm-game[data-game="matematica"] .g-num { font-size: 15px; }
  .jpm-game[data-game="matematica"] .g-lbl { font-size: 10px; }
  .jpm-game[data-game="matematica"] .g-best { margin: 0 0 3px; font-size: 11px; min-height: 0; }
  .jpm-game[data-game="matematica"] .mt-over .g-btn { min-height: 36px; font-size: 13px; padding: 0 14px; }
  .jpm-game[data-game="matematica"] .mt-over .mt-row { margin-top: 2px; }
  .jpm-game[data-game="matematica"] .mt-link { font-size: 11px; padding: 2px; margin-top: 0; }
  .jpm-game[data-game="matematica"] .mt-lv-card { padding: 6px 8px; max-height: calc(100cqh - 10px); }
  .jpm-game[data-game="matematica"] .mt-lv-head .g-title { font-size: 15px; }
  .jpm-game[data-game="matematica"] .mt-lv-scroll { margin-top: 4px; }
  .jpm-game[data-game="matematica"] .mt-switch { min-height: 36px; font-size: 11px; padding: 2px 10px 2px 4px; }
  .jpm-game[data-game="matematica"] .mt-sec { margin: 4px 2px 0; font-size: 12px; }
  .jpm-game[data-game="matematica"] .mt-sec-note { display: none; }
  .jpm-game[data-game="matematica"] .mt-lv-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 5px; }
  .jpm-game[data-game="matematica"] .mt-lvb { padding: 4px 3px; gap: 1px; }
  .jpm-game[data-game="matematica"] .mt-lvname { min-height: 0; font-size: 10px; }
  .jpm-game[data-game="matematica"] .mt-lv-card .mt-row { margin-top: 4px; }
  .jpm-game[data-game="matematica"] .mt-lv-card .g-btn--ghost { min-height: 32px; font-size: 12px; }
  .jpm-game[data-game="matematica"] .mt-level { font-size: 12px; }
  .jpm-game[data-game="matematica"] .mt-level-name { font-size: 20px; }
  .jpm-game[data-game="matematica"] .mt-step { font-size: 11px; padding: 2px 8px 2px 2px; }
  .jpm-game[data-game="matematica"] .mt-ready { gap: 6px; }
  .jpm-game[data-game="matematica"] .mt-ready-tip { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .jpm-game[data-game="matematica"] .mt-fix, .jpm-game[data-game="matematica"] .mt-board.is-bad { animation: none; }
}
