body.multiplicacion-algoritmica-page {
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0.18) 1px, transparent 2px),
    radial-gradient(circle at 82% 20%, rgba(253, 224, 71, 0.14) 0, rgba(253, 224, 71, 0.14) 1.2px, transparent 2px),
    radial-gradient(circle at 78% 74%, rgba(45, 212, 191, 0.16) 0, rgba(45, 212, 191, 0.16) 1.2px, transparent 2px),
    linear-gradient(150deg, #071a24 0%, #0e3347 44%, #0d7168 72%, #f59e0b 120%);
  background-size: 220px 220px, 260px 260px, 280px 280px, cover;
  background-attachment: fixed;
}

body.multiplicacion-algoritmica-page .app-main {
  position: relative;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

body.mult-result-open {
  overflow: hidden;
}

.mult-hero {
  width: min(1160px, 94%);
  margin: 0 auto 1.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.95fr);
  gap: 1rem;
  align-items: stretch;
}

.mult-hero-copy,
.mult-hero-visual,
.mult-controls,
.mult-main-card,
.mult-result-panel {
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 55px rgba(3, 10, 22, 0.28);
  backdrop-filter: blur(8px);
}

.mult-hero-copy {
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(245, 250, 255, 0.88));
  padding: 1.5rem 1.5rem 1.35rem;
}

.mult-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mult-hero h1 {
  margin: 0.85rem 0 0.65rem;
  color: #082f49;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.mult-hero p {
  margin: 0;
  color: #33506b;
  font-size: 1rem;
  line-height: 1.55;
  max-width: 60ch;
}

.mult-hero-pills {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.mult-hero-pills span,
.mult-level-badge,
.mult-guided-label,
.mult-eval-help span,
.mult-result-mark {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  font-size: 0.72rem;
}

.mult-hero-pills span {
  border-radius: 999px;
  background: rgba(8, 47, 73, 0.06);
  color: #0f3d5c;
  padding: 0.45rem 0.72rem;
}

.mult-hero-visual {
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.06)),
    linear-gradient(160deg, rgba(8, 47, 73, 0.94), rgba(14, 116, 144, 0.9));
  padding: 1.5rem;
  display: grid;
  align-content: center;
  justify-items: center;
  color: #f8fffe;
  position: relative;
  overflow: hidden;
}

.mult-hero-visual::before {
  content: "";
  position: absolute;
  inset: -20% auto auto -18%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  filter: blur(8px);
}

.mult-hero-equation {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: clamp(1.85rem, 4.8vw, 3rem);
  font-weight: 900;
  z-index: 1;
}

.mult-hero-sign {
  color: #fbbf24;
}

.mult-hero-number {
  text-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.mult-hero-strip {
  margin-top: 1rem;
  display: flex;
  gap: 0.65rem;
  z-index: 1;
}

.mult-hero-strip span,
.mult-hero-result {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.45rem 0.85rem;
  font-weight: 800;
}

.mult-hero-result {
  margin-top: 0.85rem;
  color: #ffedc7;
  font-size: 1rem;
}

.mult-shell {
  width: min(1160px, 94%);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.mult-controls,
.mult-main-card,
.mult-result-panel {
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 247, 255, 0.92));
}

.mult-controls {
  padding: 1.25rem 1.4rem;
}

.mult-controls-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.mult-controls-head h2 {
  margin: 0;
  color: #082f49;
  font-size: 1.15rem;
}

.mult-controls-head p {
  margin: 0.3rem 0 0;
  color: #4c6681;
}

.mult-level-badge {
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(253, 224, 71, 0.3));
  color: #9a5800;
  padding: 0.45rem 0.8rem;
}

.mult-level-tabs {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.mult-level-tab {
  border: 1px solid rgba(7, 89, 133, 0.16);
  border-radius: 18px;
  background: linear-gradient(145deg, #f8fcff, #ecf6ff);
  color: #174a69;
  padding: 0.9rem 1rem;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(15, 59, 85, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mult-level-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 59, 85, 0.12);
}

.mult-level-tab.is-active {
  border-color: rgba(245, 158, 11, 0.7);
  background: linear-gradient(145deg, #fff8ea, #ffe7aa);
  color: #8a5100;
}

.mult-controls .game-status {
  margin: 1rem 0 0;
  min-height: 1.5rem;
}

.mult-controls-actions,
.mult-actions,
.mult-result-actions {
  margin-top: 1rem;
}

.mult-layout.hidden {
  display: none;
}

.mult-main-card {
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
}

.mult-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
}

.mult-hud-stat,
.mult-hud-center {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  padding: 0.75rem 0.9rem;
}

.mult-hud-stat {
  display: grid;
  gap: 0.15rem;
}

.mult-hud-right {
  justify-items: end;
}

.mult-hud-label {
  color: #5f7488;
  font-size: 0.82rem;
}

.mult-heart {
  display: inline-block;
  margin-right: 0.12rem;
  font-size: 1.1rem;
}

.mult-heart.on {
  color: #ef4444;
  animation: multHeartPulse 0.42s ease;
}

.mult-heart.off {
  color: #cbd5e1;
}

.mult-progress-wrap {
  display: grid;
  gap: 0.35rem;
}

.mult-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #33506b;
  font-size: 0.85rem;
  font-weight: 700;
}

.mult-progress-track {
  height: 13px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.92);
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.12);
}

.mult-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #f59e0b);
  transition: width 240ms ease;
}

.mult-problem-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.4rem;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(135deg, #f8fcff, #eef7ff);
  padding: 1.1rem 1.1rem 1rem;
}

.mult-problem-panel.mult-round-correct {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.22);
  animation: multRoundCorrectPulse 360ms ease;
}

.mult-problem-panel.mult-round-wrong {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.mult-hit-chip {
  position: absolute;
  right: 0.8rem;
  top: 0.7rem;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 900;
  z-index: 3;
  color: #fff;
  animation: multHitChipIn 840ms ease forwards;
}

.mult-hit-chip.success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.mult-hit-chip.error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.mult-correct-sparkle {
  position: absolute;
  top: 55%;
  color: #f59e0b;
  font-size: 1.05rem;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.42);
  z-index: 2;
  pointer-events: none;
  animation: multSparkleFly 900ms ease-out forwards;
}

.mult-problem-title {
  color: #082f49;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.mult-problem-text {
  margin: 0;
  color: #48657f;
}

.mult-workspace {
  display: grid;
  gap: 1rem;
}

.mult-guided-steps {
  display: grid;
  gap: 0.85rem;
}

.mult-guide-step-box,
.mult-eval-help,
.mult-eval-panel,
.mult-final-answer,
.mult-result-card {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.mult-guide-step-box {
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.mult-guide-step-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mult-guide-step-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0.22rem 0.5rem;
  background: linear-gradient(135deg, #16a34a, #65a30d);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.mult-guide-step-head strong {
  color: #0f172a;
  font-size: 1.02rem;
}

.mult-step-helper {
  margin: 0;
  color: #475569;
  font-size: 0.93rem;
}

.mult-decompose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.mult-decompose-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(145deg, #f8fbff, #eef7ff);
  padding: 0.8rem;
  display: grid;
  gap: 0.35rem;
}

.mult-decompose-card h4 {
  margin: 0;
  color: #0f172a;
  font-size: 1.25rem;
}

.mult-decompose-card p {
  margin: 0;
  color: #334155;
  font-weight: 700;
}

/* ── Interactive second decompose card (PASO 1) ─────────────────────── */

.mult-decompose-card--input {
  background: linear-gradient(145deg, #fffbeb, #fef9c3);
  border-color: rgba(234, 179, 8, 0.4);
}

.mult-deco-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mult-deco-plus {
  font-size: 1.1rem;
  font-weight: 700;
  color: #64748b;
}

.mult-deco-input {
  width: 68px;
  height: 36px;
  border: 1.5px solid rgba(148, 163, 184, 0.55);
  border-radius: 8px;
  background: #fff;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.mult-deco-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.mult-deco-input.is-correct {
  border-color: #16a34a;
  background: #f0fff4;
}

.mult-deco-input.is-wrong {
  border-color: #ef4444;
  background: #fff5f5;
}

.mult-deco-feedback {
  min-height: 1.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
}

.mult-deco-feedback.is-ok {
  color: #16a34a;
}

.mult-deco-feedback.is-error {
  color: #dc2626;
}

.mult-deco-actions {
  display: flex;
  justify-content: flex-end;
}

.mult-deco-check-btn {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

.btn.mult-deco-done {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
  pointer-events: none;
}

/* ── Locked step (before PASO 1 is confirmed) ────────────────────────── */

.mult-step-locked {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.4);
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.mult-step-locked::after {
  content: "Completa el Paso 1 para desbloquear";
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  padding: 0.2rem 0;
}

.mult-grid-shell {
  border-radius: 16px;
  border: 1px dashed rgba(20, 184, 166, 0.45);
  background: linear-gradient(145deg, #ecfeff, #f8fafc);
  padding: 0.75rem;
  overflow-x: auto;
}

.mult-grid-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.mult-grid-table th,
.mult-grid-table td {
  border: 1px solid rgba(99, 102, 241, 0.45);
  text-align: center;
  padding: 0.55rem;
}

.mult-grid-table thead th {
  background: #eef2ff;
  color: #3730a3;
  font-weight: 900;
}

.mult-grid-table tbody th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 900;
}

.mult-grid-cell {
  background: #fff;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.mult-grid-cell.is-correct {
  background: linear-gradient(135deg, #effef5, #f0fdf4);
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.4);
}

.mult-grid-cell.is-wrong {
  background: linear-gradient(135deg, #fff5f5, #fef2f2);
  box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.35);
}

.mult-partial-input {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  width: 100%;
  min-width: 88px;
  background: #fff;
  color: #0f172a;
  padding: 0.55rem;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.mult-partial-input:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.mult-correct-hint {
  display: block;
  margin-top: 0.35rem;
  color: #b91c1c;
  font-size: 0.78rem;
  font-weight: 800;
}

.mult-compose-box {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(145deg, #f9fafb, #f8fafc);
  padding: 0.8rem;
  display: grid;
  gap: 0.65rem;
}

.mult-compose-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.mult-preview-item {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  padding: 0.35rem 0.62rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.mult-preview-item span {
  color: #475569;
  font-size: 0.88rem;
}

.mult-preview-item strong {
  color: #0f172a;
  font-weight: 800;
}

.mult-compose-total {
  border-radius: 12px;
  border: 1px solid rgba(14, 116, 144, 0.25);
  background: linear-gradient(135deg, #ecfeff, #fef3c7);
  padding: 0.6rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mult-compose-total span {
  color: #475569;
}

.mult-compose-total strong {
  color: #0f172a;
  font-size: 1.12rem;
}

.mult-step-input,
.mult-final-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #fff;
  color: #0f172a;
  padding: 0.9rem 1rem;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.mult-step-input:focus,
.mult-final-input:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.16);
}

.mult-step-input.is-correct,
.mult-final-input.is-correct {
  border-color: rgba(34, 197, 94, 0.65);
  background: #f0fff7;
}

.mult-step-input.is-wrong,
.mult-final-input.is-wrong {
  border-color: rgba(239, 68, 68, 0.65);
  background: #fff5f5;
}

.mult-eval-panel {
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

.nb-workspace {
  container-type: inline-size;
}

.nb-layout {
  display: grid;
  grid-template-columns: 1fr auto auto 1fr;
  column-gap: 0.5rem;
  align-items: stretch;
}

.nb-callouts {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.nb-callout {
  position: relative;
  border-radius: 8px;
  padding: 0.55rem 0.7rem 0.6rem;
}

.nb-callout-1 { background: #fce7f3; }
.nb-callout-2 { background: #ecfccb; }
.nb-callout-3 { background: #dbeafe; }
.nb-callout-4 { background: #f3e8ff; }

/* Speech-bubble connector arrows pointing toward the board */
.nb-callouts-left .nb-callout-3::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-left: 12px solid #dbeafe;
}

.nb-callouts-left .nb-callout-4::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-left: 12px solid #f3e8ff;
}

.nb-callouts-right .nb-callout-1::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right: 12px solid #fce7f3;
}

.nb-callouts-right .nb-callout-2::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right: 12px solid #ecfccb;
}

.nb-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.73rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.04em;
}

.nb-callout-1 .nb-badge { background: #ec4899; }
.nb-callout-2 .nb-badge { background: #65a30d; }
.nb-callout-3 .nb-badge { background: #2563eb; }
.nb-callout-4 .nb-badge { background: #9333ea; }

.nb-callout p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.35;
}

.nb-board {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: visible;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background:
    linear-gradient(to right, rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    #fbfdff;
  background-size: 36px 36px;
}

/* Problem row inside the board: same structure as algo-rows */
.nb-problem-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.1rem;
}

/* Multiplier with D/U markers: sits in its own grid column between board and right callouts.
   margin-top aligns its digit cells with the board's first-row cells:
   board cells start at: border(1px) + padding-top(0.85rem) from layout top;
   du-row total height = 18px; so margin = 0.85rem+1px-18px = calc(0.85rem - 17px) */
.nb-mier-zone {
  align-self: start;
  margin-top: calc(0.85rem - 17px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  overflow: visible;
}

.nb-mier-inline {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nb-du-row {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.nb-du {
  width: 34px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  font-weight: 900;
}

.nb-d { color: #2563eb; }
.nb-u { color: #e11d48; }

.nb-dot {
  font-size: 1.4rem;
  font-weight: 900;
  color: #334155;
  padding: 0 0.1rem;
  line-height: 1;
  align-self: center;
}

.nb-board-line {
  align-self: stretch;
  border-top: 2px solid rgba(15, 23, 42, 0.5);
  margin: 0.15rem 0;
}

.nb-algo-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nb-sign {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  font-size: 1rem;
  font-weight: 900;
  color: #334155;
}

.nb-plus {
  color: #0369a1;
}

.nb-algo-cells {
  display: flex;
  gap: 2px;
}

.nb-result-row .nb-input {
  background: linear-gradient(145deg, #f0fff4, #fff);
}

.nb-cell {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.45);
  border-radius: 3px;
  background: #fff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  font-family: "Consolas", "Courier New", monospace;
  flex-shrink: 0;
}

/* Empty spacer: invisible but maintains alignment space */
.nb-empty {
  visibility: hidden;
}

.nb-blank {
  background: rgba(226, 232, 240, 0.5);
  border: 1px dashed rgba(100, 116, 139, 0.35);
}

.nb-input {
  padding: 0;
  text-align: center;
  cursor: text;
}

.nb-input:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

.nb-input.is-correct {
  border-color: rgba(34, 197, 94, 0.7);
  background: #f0fff7;
}

.nb-input.is-wrong {
  border-color: rgba(239, 68, 68, 0.7);
  background: #fff5f5;
}

@media (max-width: 720px) {
  .nb-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .nb-callouts-left {
    grid-column: 1;
    grid-row: 2;
  }

  .nb-board {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .nb-mier-zone {
    grid-column: 2;
    grid-row: 1;
    margin-top: calc(0.85rem - 17px);
  }

  .nb-callouts-right {
    grid-column: 2;
    grid-row: 2;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mult-eval-help {
  padding: 1rem;
  background: linear-gradient(135deg, #f0fdff, #fff7ed);
}

.mult-eval-help span {
  display: inline-flex;
  color: #0f766e;
  margin-bottom: 0.4rem;
}

.mult-eval-help p {
  margin: 0;
  color: #38546d;
  font-size: 1rem;
}

.mult-final-answer {
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.mult-final-answer span {
  color: #334155;
  font-weight: 800;
}

.mult-eval-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.mult-eval-tips div {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  padding: 0.9rem;
  display: grid;
  gap: 0.2rem;
  text-align: center;
}

.mult-eval-tips strong {
  font-size: 1.1rem;
  color: #082f49;
}

.mult-eval-tips span {
  color: #64748b;
  font-size: 0.88rem;
}

.mult-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.mult-result-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.mult-result-modal.hidden {
  display: none;
}

.mult-result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 15, 25, 0.58);
  backdrop-filter: blur(2px);
}

.mult-result-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 94vw);
  padding: 1.2rem;
  animation: multModalIn 220ms ease;
}

.mult-result-hero {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.mult-result-mark {
  color: #0f766e;
}

.mult-result-hero h2 {
  margin: 0;
  color: #082f49;
  font-size: 1.6rem;
}

.mult-result-message {
  margin: 0;
  color: #4c6681;
}

.mult-result-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, #fff7d6, #ffe8a5);
  padding: 0.36rem 0.75rem;
}

.mult-result-pill span {
  color: #8a5807;
  font-size: 0.76rem;
}

.mult-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.mult-result-card {
  padding: 0.85rem;
  display: grid;
  gap: 0.25rem;
  text-align: center;
}

.mult-result-card span {
  color: #64748b;
  font-size: 0.88rem;
}

.mult-result-card strong {
  color: #082f49;
  font-size: 1.25rem;
}

.mult-result-card.success {
  background: linear-gradient(135deg, #f0fff4, #ecfdf5);
}

.mult-result-card.danger {
  background: linear-gradient(135deg, #fff1f1, #fff7f7);
}

.mult-result-card.warning {
  background: linear-gradient(135deg, #fff9e7, #fff4cc);
}

@keyframes multHeartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes multModalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes multRoundCorrectPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes multHitChipIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

@keyframes multSparkleFly {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.8);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -38px) scale(1.2);
  }
}

@media (max-width: 900px) {
  .mult-hero {
    grid-template-columns: 1fr;
  }

  .mult-decompose-grid {
    grid-template-columns: 1fr;
  }

  .mult-eval-tips,
  .mult-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mult-abbrev-row {
    grid-template-columns: 1fr;
  }

  .mult-algorithm-board {
    width: 100%;
  }

  .mult-ref-step-layout {
    min-height: auto;
    gap: 0.7rem;
  }

  .mult-ref-callout {
    position: static;
    width: 100%;
  }

  .mult-ref-callout::after {
    display: none;
  }

  .mult-ref-center-wrap {
    order: -1;
    width: 100%;
  }

  .mult-algo-row {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .mult-algo-row .mult-abbrev-input,
  .mult-algo-line {
    width: 100%;
  }

  .mult-digit-row-display,
  .mult-digit-row-input {
    width: 100%;
  }

  .mult-hud {
    grid-template-columns: 1fr;
  }

  .mult-hud-right {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .mult-hero-copy,
  .mult-hero-visual,
  .mult-controls,
  .mult-main-card,
  .mult-result-panel {
    border-radius: 22px;
  }

  .mult-hero,
  .mult-shell {
    width: min(100%, 94%);
  }

  .mult-hero-strip {
    flex-wrap: wrap;
    justify-content: center;
  }

  .mult-level-tabs,
  .mult-eval-tips,
  .mult-result-grid {
    grid-template-columns: 1fr;
  }

  .mult-actions,
  .mult-result-actions {
    flex-direction: column;
  }

  .mult-actions .btn,
  .mult-result-actions .btn {
    width: 100%;
  }
}

/* ── Wrong-answer feedback modal ─────────────────────────────────────── */

.mult-fb-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.mult-fb-modal.hidden {
  display: none;
}

.mult-fb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 10, 10, 0.55);
  backdrop-filter: blur(3px);
}

.mult-fb-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 94vw);
  background: #fff;
  border-radius: 16px;
  border-top: 4px solid #ef4444;
  padding: 1.5rem 1.6rem 1.4rem;
  display: grid;
  gap: 1rem;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  animation: multModalIn 200ms ease;
}

.mult-fb-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mult-fb-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 1.1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mult-fb-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #b91c1c;
}

.mult-fb-op {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

.mult-fb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.mult-fb-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.mult-fb-list li.is-wrong {
  background: #fff1f1;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mult-fb-list li.is-correct {
  background: #f0fff4;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.mult-fb-list .fb-label {
  color: #334155;
  font-weight: 600;
}

.mult-fb-list .fb-yours {
  color: #ef4444;
  font-weight: 700;
  font-family: "Consolas", monospace;
  text-decoration: line-through;
}

.mult-fb-list .fb-correct {
  color: #16a34a;
  font-weight: 700;
  font-family: "Consolas", monospace;
}

.mult-fb-list .fb-ok {
  color: #16a34a;
  font-size: 1rem;
}

.mult-fb-next-btn {
  width: 100%;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  font-size: 1rem;
}
