.multiplication-quiz-view {
  --mq-ink: #173d42;
  --mq-paper: #fffdf5;
  --mq-teal: #0d756e;
  --mq-coral: #e85d45;
  --mq-mustard: #f4b942;
  --mq-blue: #3979ad;
  --mq-line: rgba(23, 61, 66, .14);
}

.multiplication-quiz-view .play-card {
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 24px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
  padding: 24px;
  color: var(--mq-ink);
  border: 1px solid rgba(23, 61, 66, .12);
  background:
    radial-gradient(circle at 4% 2%, rgba(244, 185, 66, .20), transparent 21%),
    radial-gradient(circle at 96% 7%, rgba(13, 117, 110, .15), transparent 25%),
    #f6f2e7;
  box-shadow: 0 24px 70px rgba(23, 61, 66, .14);
}

.multiplication-quiz-view .top-copy { max-width: 760px; margin-inline: auto; }
.multiplication-quiz-view .playground {
  display: block;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}
.multiplication-quiz-view .cheer { color: var(--mq-teal); letter-spacing: .12em; }
.multiplication-quiz-view .equation { margin: 7px 0 10px; color: var(--mq-ink); font-size: 16px; line-height: 1.2; letter-spacing: 0; }
.multiplication-quiz-view .instruction { max-width: 720px; margin: 0 auto 16px; line-height: 1.28; }
.mq-progress { display: grid; justify-items: center; gap: 7px; font-family: inherit; }
.mq-progress b { font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 5.2vw, 42px); }
.mq-progress > span { display: flex; gap: 7px; }
.mq-progress i { display: grid; width: 27px; height: 27px; place-items: center; color: #667477; border: 2px solid rgba(23,61,66,.20); border-radius: 50%; background: #fff; font-size: 12px; font-style: normal; font-weight: 950; }
.mq-progress i.done { color: #fff; border-color: var(--mq-teal); background: var(--mq-teal); }
.mq-progress i.current { color: var(--mq-ink); border-color: var(--mq-mustard); background: var(--mq-mustard); box-shadow: 0 0 0 4px rgba(244,185,66,.19); }
.mq-progress small { color: #667477; font-size: 12px; font-weight: 850; }

.mq-shell { width: 100%; }
.mq-memory-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  color: #dff9f3;
  border-radius: 14px;
  background: var(--mq-ink);
  font-size: 13px;
}
.mq-memory-ribbon b { color: #fff; letter-spacing: .04em; }
.mq-memory-ribbon em { margin-left: auto; padding: 3px 8px; color: var(--mq-ink); border-radius: 999px; background: var(--mq-mustard); font-style: normal; font-weight: 900; }
.mq-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #71e1b9; box-shadow: 0 0 0 5px rgba(113,225,185,.13); }

.mq-workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 16px; align-items: stretch; }
.mq-question-card,
.mq-scratch-card,
.mq-result { border: 1px solid var(--mq-line); border-radius: 24px; background: var(--mq-paper); box-shadow: 0 13px 30px rgba(23,61,66,.08); }
.mq-question-card { position: relative; min-height: 520px; padding: 23px; overflow: hidden; }
.mq-question-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(23,61,66,.033) 1px, transparent 1px); background-size: 100% 30px; opacity: .45; }
.mq-question-card > * { position: relative; z-index: 1; }
.mq-question-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 15px; }
.mq-role, .mq-representation { padding: 5px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 950; }
.mq-role { color: #fff; background: var(--mq-teal); }
.mq-role-adjacent, .mq-role-anticipatory { color: var(--mq-ink); background: var(--mq-mustard); }
.mq-role-transfer { background: var(--mq-blue); }
.mq-representation { color: #596b6d; background: #edf0e8; }
.mq-kid-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 760px; margin: 0 auto 18px; padding: 0; list-style: none; }
.mq-kid-steps li { display: flex; min-height: 45px; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid rgba(13,117,110,.17); border-radius: 12px; background: #eef8f4; text-align: left; font-size: 13px; font-weight: 850; line-height: 1.2; }
.mq-kid-steps span { display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; color: #fff; border-radius: 50%; background: var(--mq-teal); font-size: 12px; font-weight: 950; }
.mq-question-card h2 { max-width: 760px; margin: 0 auto 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 4.6vw, 36px); line-height: 1.18; }

.mq-big-sum, .mq-factor-chain, .mq-partials, .mq-place-grid, .mq-two-step, .mq-groups, .mq-compare-story, .mq-balance {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px auto 20px; padding: 14px; border: 2px solid rgba(13,117,110,.18); border-radius: 18px; background: rgba(255,255,255,.78); font-variant-numeric: tabular-nums;
}
.mq-big-sum { font-family: Georgia, serif; font-size: 38px; }
.mq-factor-chain span, .mq-partials span, .mq-groups span { min-width: 50px; padding: 8px 11px; border-radius: 11px; background: #e6f4ef; font-weight: 950; }
.mq-factor-chain b, .mq-partials b, .mq-two-step b { color: var(--mq-coral); font-size: 22px; }
.mq-place-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.mq-place-grid span { padding: 12px 8px; border-left: 1px dashed var(--mq-line); font-weight: 900; }
.mq-place-grid span:first-child { border-left: 0; }
.mq-two-step span { padding: 8px 10px; border-radius: 10px; background: #fdf1d0; font-weight: 850; }
.mq-groups em { color: #647477; font-style: normal; }
.mq-balance i { display: block; width: 74px; height: 4px; background: var(--mq-coral); transform: rotate(-4deg); }
.mq-balance span { font-size: 23px; font-weight: 950; }
.mq-compare-story { position: relative; justify-content: space-around; }
.mq-compare-story span { min-width: 90px; padding: 10px; border-radius: 13px; background: #e7f3ee; font-weight: 950; }
.mq-compare-story i { width: 54px; border-top: 3px dotted var(--mq-coral); }
.mq-compare-story b { color: var(--mq-coral); }
.mq-stamp { display: table; margin: 11px auto 20px; padding: 8px 13px; color: var(--mq-coral); border: 3px double var(--mq-coral); transform: rotate(-2deg); font-weight: 950; letter-spacing: .12em; }
.mq-number-line { position: relative; display: flex; justify-content: space-between; max-width: 440px; margin: 34px auto 27px; border-top: 4px solid var(--mq-ink); }
.mq-number-line span { transform: translateY(-29px); font-weight: 900; }
.mq-number-line b { position: absolute; left: var(--spot); top: 9px; transform: translateX(-50%); }
.mq-number-line i { position: absolute; left: var(--spot); top: -9px; width: 14px; height: 14px; border-radius: 50%; background: var(--mq-coral); transform: translateX(-50%); }

.mq-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.mq-choices button { min-height: 58px; padding: 10px 12px; color: var(--mq-ink); border: 2px solid rgba(23,61,66,.16); border-radius: 15px; background: #fff; box-shadow: 0 4px 0 rgba(23,61,66,.10); font-family: inherit; font-size: 18px; font-weight: 950; cursor: pointer; transition: transform .14s ease, border-color .14s ease; }
.mq-choices button:hover:not(:disabled), .mq-choices button:focus-visible { transform: translateY(-2px); border-color: var(--mq-teal); }
.mq-choices button.hc-correct { color: #fff; border-color: var(--mq-teal); background: var(--mq-teal); }
.mq-choices button.hc-wrong { color: #91382d; border-color: #edb7ad; background: #fff0ed; box-shadow: none; }
.mq-hint-slot { min-height: 24px; }
.mq-help-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; color: #667477; }
.mq-help { padding: 9px 12px; color: var(--mq-teal); border: 1px solid rgba(13,117,110,.28); border-radius: 11px; background: #eaf6f2; font-weight: 900; cursor: pointer; }
.mq-help:disabled { opacity: .5; }
.mq-continue { width: 100%; margin-top: 16px; padding: 13px; color: #fff; border: 0; border-radius: 13px; background: var(--mq-coral); font-weight: 950; cursor: pointer; }

.mq-scratch-card { min-height: 0; } /* look comes from the shared .kk-pad (scratch-pad.css) */
body.mq-is-drawing, body.mq-is-drawing * { user-select: none !important; }

.mq-why { margin: 14px 0 0; padding: 10px 13px; color: #536769; border: 1px dashed rgba(23,61,66,.25); border-radius: 13px; background: rgba(255,253,245,.75); text-align: left; }
.mq-why summary { cursor: pointer; font-weight: 900; }
.mq-why p { margin: 9px 0 4px; }
.mq-why small { line-height: 1.45; }

.mq-loading { display: flex; min-height: 280px; align-items: center; justify-content: center; gap: 13px; font-weight: 900; }
.mq-loading i { width: 26px; height: 26px; border: 4px solid rgba(13,117,110,.18); border-top-color: var(--mq-teal); border-radius: 50%; animation: mq-spin .7s linear infinite; }
.mq-result { padding: 22px; text-align: left; }
.mq-result-hero { display: flex; align-items: center; gap: 15px; padding: 17px; color: #fff; border-radius: 18px; background: var(--mq-ink); }
.mq-result-hero > span { color: var(--mq-mustard); font-size: 42px; }
.mq-result-hero small, .mq-result-hero strong { display: block; }
.mq-result-hero strong { margin-top: 3px; font-family: Georgia, serif; font-size: 27px; }
.mq-next-focus { margin: 14px 0; padding: 15px; border-left: 6px solid var(--mq-coral); border-radius: 12px; background: #fff0e9; }
.mq-next-focus small, .mq-next-focus b { display: block; }
.mq-next-focus b { margin: 3px 0; font-size: 20px; }
.mq-next-focus p { margin: 4px 0 0; }
.mq-skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mq-skill-card { padding: 12px; border: 1px solid var(--mq-line); border-radius: 13px; background: #fff; }
.mq-skill-card.focus { border-color: var(--mq-coral); box-shadow: inset 4px 0 var(--mq-coral); }
.mq-skill-card span { float: right; padding: 2px 6px; border-radius: 999px; color: var(--mq-teal); background: #e9f5f0; font-size: 10px; font-weight: 950; }
.mq-skill-card b { display: block; padding-right: 54px; }
.mq-skill-card i { display: block; height: 7px; margin: 10px 0 5px; overflow: hidden; border-radius: 999px; background: #e7e9e3; }
.mq-skill-card i em { display: block; height: 100%; border-radius: inherit; background: var(--mq-teal); }
.mq-skill-card small { color: #687678; }
.mq-transfer-note { margin: 14px 0 0; color: #536769; }

@keyframes mq-spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
  .multiplication-quiz-view .play-card { padding: 14px; }
  .mq-workspace { grid-template-columns: 1fr; }
  .mq-question-card { min-height: auto; padding: 18px 14px; }
  .mq-scratch-card { min-height: auto; }
}

@media (max-width: 460px) {
  .mq-memory-ribbon em { margin-left: 0; }
  .mq-choices { grid-template-columns: 1fr; }
  .mq-choices button { min-height: 52px; font-size: 17px; }
  .mq-place-grid { grid-template-columns: 1fr; }
  .mq-place-grid span { border-left: 0; border-top: 1px dashed var(--mq-line); }
  .mq-place-grid span:first-child { border-top: 0; }
  .mq-help-row { align-items: flex-start; flex-direction: column; }
  .mq-kid-steps { grid-template-columns: 1fr; gap: 5px; }
  .mq-kid-steps li { min-height: 38px; }
  .mq-skill-grid { grid-template-columns: 1fr; }
}

/* Show your working: optional. The answers never wait for the pad. */
.mq-kid-steps[hidden] { display: none; }
.mq-retry-note { min-height: 0; margin: 8px 0 0; color: #91382d; font-size: 17px; font-weight: 900; }
.mq-retry-note:empty { display: none; }
.mq-pad-wrap { position: relative; }
.mq-work-slot:empty { display: none; }
.mq-work-slot { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 8px 10px; border: 1px solid var(--mq-line); border-radius: 12px; background: rgba(255,253,245,.96); box-shadow: 0 4px 14px rgba(23,61,66,.12); text-align: left; }
.mq-work-slot > * { margin: 0; }
.mq-work-ask, .mq-work-note { flex: 1 1 170px; margin: 0; color: var(--mq-ink); font-size: 14px; line-height: 1.3; }
.mq-work-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.mq-work-actions button { min-height: 40px; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.mq-work-check { color: #fff; border: 0; background: var(--mq-teal); }
.mq-work-skip { color: var(--mq-ink); border: 1px solid var(--mq-line); background: #fff; }

/* Fit one screen on iPad and phone: compact frame; JS (fitWorkspace) sizes the pad to the height left. */
main:has(.multiplication-quiz-view:not(.hidden)) { padding-top: 8px; }
.multiplication-quiz-view .activities-button { min-height: 36px; margin-bottom: 6px; }
.multiplication-quiz-view .play-card { min-height: 0; padding: 12px 14px 14px; }
.multiplication-quiz-view .cheer { display: none; }
.multiplication-quiz-view .equation { margin: 0 0 8px; }
.mq-progress { grid-auto-flow: column; align-items: center; justify-content: center; gap: 12px; }
.mq-progress b { font-size: clamp(20px, 3.4vw, 26px); }
.mq-progress small { display: none; }
.multiplication-quiz-view .instruction { display: none; }
.mq-memory-ribbon { margin: 0 0 8px; padding: 6px 12px; font-size: 12px; }
.mq-question-card { min-height: 0; padding: 14px 18px 16px; }
.mq-question-card header { height: auto; margin-bottom: 8px; padding: 0; border: 0; background: none; } /* the site-wide `header` bar style must not reach this */
.mq-question-card h2 { margin: 0 auto 10px; }
.mq-question-card h2.mq-long-prompt { font-size: clamp(21px, 3vw, 27px); line-height: 1.25; }
.mq-big-sum, .mq-factor-chain, .mq-partials, .mq-place-grid, .mq-two-step, .mq-groups, .mq-compare-story, .mq-balance { margin: 8px auto 10px; padding: 10px; }
.mq-big-sum { font-size: 32px; }
.mq-stamp { margin: 6px auto 10px; }
.mq-number-line { margin: 30px auto 24px; }
.mq-choices { margin-top: 8px; gap: 8px; }
.mq-choices button { min-height: 52px; }
.mq-help-row { margin-top: 6px; }
.mq-scratch-card { min-height: 0; padding: 12px; }
@media (min-width: 801px) and (max-width: 1000px) {
  .mq-workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-height: 1000px) {
  .multiplication-quiz-view .instruction { display: block; margin: 0 auto 10px; font-size: 15px; }
}
@media (max-width: 800px) {
}
@media (max-width: 600px) {
  body:has(.multiplication-quiz-view:not(.hidden)) header { height: 52px; }
  .multiplication-quiz-view .play-card { width: calc(100vw - 12px); padding: 8px; border-radius: 22px; }
  .mq-memory-ribbon > span:not(.mq-live-dot) { display: none; }
  .mq-memory-ribbon { padding: 5px 10px; }
  .mq-question-card { padding: 12px; border-radius: 18px; }
  .mq-question-card header { margin-bottom: 4px; }
  .mq-question-card h2 { font-size: 24px; margin-bottom: 8px; }
  .mq-scratch-card { padding: 10px; border-radius: 18px; }
  .mq-help-row { display: none; }
  .mq-workspace { gap: 8px; }
  .mq-why { margin-top: 8px; }
}
@media (max-width: 460px) {
  .mq-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mq-choices.mq-choices-long { grid-template-columns: 1fr; }
}
/* Phone held sideways: keep question and pad side by side. */
@media (max-height: 500px) and (orientation: landscape) {
  .mq-workspace { grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr); }
  .mq-question-card h2 { font-size: 22px; }
  .mq-memory-ribbon { display: none; }
}

@media (max-width: 600px) { .mq-question-card .mq-why { display: none; } }
.mq-question-card .mq-why { margin-top: 10px; padding: 6px 10px; font-size: 14px; }
