.mfl-trainer-intro { max-width: 920px; }
.mfl-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: -8px 0 22px;
}
.mfl-rules span {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.38;
}
.mfl-rules strong { display: block; margin-bottom: 2px; color: var(--text); font-size: .85rem; }

.mfl-trainer-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.mfl-trainer-topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.mfl-stat,
.mfl-timer-stat {
  min-height: 70px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border-right: 1px solid var(--line);
}
.mfl-timer-stat { background: #f8f9f3; }
.mfl-stat:last-child { border-right: 0; }
.mfl-stat span,
.mfl-timer-stat span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.mfl-stat strong,
.mfl-timer-stat strong { font-size: 1.52rem; letter-spacing: -.04em; }
.mfl-timer-stat em { color: var(--muted); font-size: .7rem; font-style: normal; font-weight: 700; }
.mfl-timer-track { height: 5px; background: #eceee5; }
.mfl-timer-track span { display: block; width: 100%; height: 100%; background: var(--accent); transform-origin: left center; transition: width .1s linear, background .15s ease; }
.mfl-timer-track span.is-low { background: #ffbb64; }

.mfl-game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(315px, .42fr);
  min-height: 610px;
}
.mfl-plan-panel { min-width: 0; padding: 22px; border-right: 1px solid var(--line); }
.mfl-answer-panel { padding: 22px; background: #fbfcf8; }
.mfl-plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.mfl-plan-head h2 { margin: 0; font-size: 1.2rem; }
.mfl-round-tools { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.mfl-round-tools strong { color: var(--text); }
.mfl-reset { padding: 8px 11px; }

.mfl-canvas-wrap {
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.mfl-svg { display: block; width: 100%; max-width: 100%; height: auto; min-height: 430px; }
.mfl-plan-note { margin: 9px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.5; }

.mfl-gwb-layer { fill: #f1f2ed; stroke: #aeb4a8; stroke-width: 1.1; }
.mfl-gwb-layer-alt { fill: #e8ece4; }
.mfl-track-core { fill: #f4f8cd; stroke: #20261f; stroke-width: 2.2; }
.mfl-track-rib { stroke: rgba(32, 38, 31, .22); stroke-width: 1.2; }
.mfl-material-label {
  fill: #30372e;
  font-size: 12px;
  font-weight: 950;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(255,255,255,.85);
  stroke-width: 3px;
  stroke-linejoin: round;
  letter-spacing: -.02em;
}
.mfl-track-label { font-size: 13px; }
.mfl-board-label { font-size: 11px; }
.mfl-target-edge { stroke: #a9be18; stroke-width: 5; }
.mfl-dim { stroke: #60675c; stroke-width: 1.5; }
.mfl-dim-extension { stroke: #b5bab0; stroke-width: 1.1; }
.mfl-dim-tick { stroke: #60675c; stroke-width: 2; }
.mfl-target-dim { stroke: #8ba013; stroke-width: 2.2; }
.mfl-target-tick { stroke: #8ba013; stroke-width: 3; }
.mfl-dim-text {
  fill: #30372e;
  font-size: 16px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 5px;
  stroke-linejoin: round;
}
.mfl-dim-text.is-target { fill: #68740c; font-size: 25px; font-weight: 950; }
.mfl-sketch-caption { fill: #72786e; font-size: 11px; font-weight: 900; letter-spacing: .075em; }
.mfl-face-label { fill: #6f756b; font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.mfl-dim-end-label { fill: #6f756b; font-size: 8px; font-weight: 850; letter-spacing: .045em; text-anchor: middle; }
.mfl-target-caption { fill: #68740c; font-size: 10px; font-weight: 900; letter-spacing: .055em; text-anchor: middle; }
.mfl-axis-line { stroke: #4c5549; stroke-width: 2; stroke-dasharray: 8 7; }
.mfl-axis-pill { fill: #f4f6ef; stroke: #d9ddd2; stroke-width: 1.2; }
.mfl-axis-label { fill: #30372e; font-size: 11px; font-weight: 950; letter-spacing: .07em; text-anchor: middle; }
.mfl-assembly-box rect { fill: #f8f9f4; stroke: #d9ddd2; stroke-width: 1.1; }
.mfl-assembly-title { fill: #30372e; font-size: 10px; font-weight: 950; letter-spacing: .065em; }
.mfl-assembly-text { fill: #62695f; font-size: 8.5px; font-weight: 800; }

.mfl-answer-panel > .section-kicker { margin-bottom: 8px; }
.mfl-answer-display {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}
.mfl-answer-display strong { font-size: 2rem; letter-spacing: -.045em; }
.mfl-quick-rule {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid #dde2cf;
  border-radius: 12px;
  background: #f8f9f3;
}
.mfl-quick-rule strong { color: #707b0d; font-size: .61rem; letter-spacing: .07em; }
.mfl-quick-rule span { color: var(--muted); font-size: .69rem; line-height: 1.42; }


.mfl-entry-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 11px; }
.mfl-entry-part {
  min-height: 64px;
  padding: 9px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.mfl-entry-part span { display: block; color: var(--muted); font-size: .59rem; font-weight: 900; letter-spacing: .06em; }
.mfl-entry-part strong { display: block; margin-top: 2px; font-size: 1.48rem; line-height: 1; }
.mfl-entry-part.is-active { border-color: #91a20e; background: #f8fadf; box-shadow: 0 0 0 2px rgba(169, 190, 24, .12); }
.mfl-entry-part:disabled { opacity: .5; cursor: default; }

.mfl-pad-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 8px 1px 5px; }
.mfl-pad-heading span { color: var(--text); font-size: .6rem; font-weight: 900; letter-spacing: .055em; }
.mfl-pad-heading small { color: var(--muted); font-size: .57rem; }
.mfl-whole-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mfl-whole-pad button,
.mfl-fraction-pad button {
  min-height: 38px;
  border: 1px solid #cfd3ca;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: .76rem;
  font-weight: 850;
  cursor: pointer;
}
.mfl-whole-pad button:hover:not(:disabled),
.mfl-fraction-pad button:hover:not(:disabled) { background: #f4f6ef; }
.mfl-whole-pad button[data-action] { color: var(--muted); font-size: .66rem; }
.mfl-fraction-heading { margin-top: 9px; }
.mfl-fraction-pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mfl-fraction-pad button { min-width: 0; font-size: .68rem; }
.mfl-fraction-pad button.is-selected { border-color: #778116; background: var(--accent); color: #1f251e; }
.mfl-whole-pad button:disabled,
.mfl-fraction-pad button:disabled { opacity: .48; cursor: default; }

.mfl-feedback {
  margin-top: 11px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: .75rem;
  line-height: 1.48;
}
.mfl-feedback strong { font-weight: 900; }
.mfl-feedback.is-correct { background: #f3f7d8; border-color: #d7e77d; }
.mfl-feedback.is-wrong { background: #fff4f1; border-color: #efc8bf; }
.mfl-feedback.is-summary { background: #f6f7f2; }
.mfl-why { margin-top: 7px; }
.mfl-why summary { cursor: pointer; color: #555b4f; font-weight: 850; }
.mfl-why p { margin: 7px 0 0; color: #555b4f; }
.mfl-primary { width: 100%; min-height: 47px; margin-top: 11px; }
.mfl-trainer-shell + .resource-inline-callout { margin-top: 22px; }

@media (max-width: 980px) {
  .mfl-game-grid { grid-template-columns: 1fr; }
  .mfl-plan-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .mfl-answer-panel { background: #fff; }
  .mfl-answer-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr); column-gap: 16px; align-items: start; }
  .mfl-answer-panel > .section-kicker,
  .mfl-answer-display,
  .mfl-quick-rule,
  .mfl-feedback,
  .mfl-primary { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .mfl-trainer-page { padding-top: 30px; }
  .mfl-trainer-intro { margin-bottom: 18px; }
  .mfl-trainer-intro h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .mfl-trainer-intro .lede { font-size: .89rem; line-height: 1.5; }
  .mfl-rules { grid-template-columns: 1fr 1fr; gap: 7px; margin: -2px 0 14px; }
  .mfl-rules span { padding: 9px 10px; font-size: .65rem; }
  .mfl-rules strong { font-size: .73rem; }

  .mfl-trainer-shell { border-radius: 15px; }
  .mfl-stat,
  .mfl-timer-stat {
    min-height: 49px;
    gap: 3px;
    padding: 8px 4px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .mfl-stat span,
  .mfl-timer-stat span { font-size: .53rem; letter-spacing: .035em; }
  .mfl-stat strong,
  .mfl-timer-stat strong { font-size: 1.1rem; line-height: 1; }
  .mfl-timer-stat em { display: none; }
  .mfl-timer-track { height: 4px; }

  .mfl-plan-panel { padding: 10px; }
  .mfl-plan-head { align-items: center; gap: 8px; }
  .mfl-plan-head .section-kicker { margin-bottom: 2px; font-size: .56rem; }
  .mfl-plan-head h2 { font-size: .88rem; line-height: 1.25; }
  .mfl-round-tools { gap: 7px; font-size: .58rem; }
  .mfl-reset { padding: 6px 5px; border: 0; background: transparent; color: var(--muted); font-size: .57rem; text-decoration: underline; text-underline-offset: 2px; }
  .mfl-canvas-wrap { margin-top: 8px; border-radius: 12px; }
  .mfl-svg { min-height: 0; }
  .mfl-plan-note { margin-top: 5px; font-size: .6rem; }
  .mfl-dim-text { font-size: 15px; stroke-width: 4px; }
  .mfl-dim-text.is-target { font-size: 23px; }
  .mfl-material-label { font-size: 10px; stroke-width: 2.5px; }
  .mfl-track-label { font-size: 11px; }
  .mfl-board-label { font-size: 9px; }
  .mfl-assembly-text { font-size: 8px; }

  .mfl-answer-panel { display: block; padding: 9px 10px 12px; }
  .mfl-answer-panel > .section-kicker { display: none; }
  .mfl-answer-display { min-height: 50px; margin-bottom: 6px; padding: 6px 10px; }
  .mfl-answer-display strong { font-size: 1.55rem; }
  .mfl-quick-rule { margin-bottom: 7px; padding: 8px 9px; }
  .mfl-quick-rule span { font-size: .61rem; }
  .mfl-entry-parts { gap: 6px; margin-bottom: 7px; }
  .mfl-entry-part { min-height: 48px; padding: 6px; border-radius: 10px; }
  .mfl-entry-part span { font-size: .52rem; }
  .mfl-entry-part strong { font-size: 1.2rem; }
  .mfl-pad-heading { margin: 6px 1px 4px; }
  .mfl-pad-heading span { font-size: .54rem; }
  .mfl-pad-heading small { font-size: .51rem; }
  .mfl-whole-pad { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .mfl-whole-pad button,
  .mfl-fraction-pad button { min-height: 34px; font-size: .67rem; }
  .mfl-whole-pad button[data-action] { font-size: .56rem; }
  .mfl-fraction-pad { gap: 5px; }
  .mfl-fraction-pad button { font-size: .61rem; }
  .mfl-feedback { margin-top: 7px; padding: 8px 9px; font-size: .67rem; }
  .mfl-primary { min-height: 43px; margin-top: 7px; }
}

@media (max-width: 390px) {
  .mfl-rules span { font-size: .61rem; }
  .mfl-plan-head h2 { font-size: .82rem; }
  .mfl-round-tools > span { display: none; }
  .mfl-assembly-text { font-size: 8px; }
}
