/* Model Lab (Enterprise 8). Colours are semantic tokens from tokens.generated.css; sizes follow the grade system. */
.e8ml { margin: 1rem 0; color: var(--e8-ink); }
.e8ml-head h2 { margin: 0 0 .3rem; }
.e8ml-head p { margin: 0 0 1rem; color: var(--e8-ink-soft); max-width: 62ch; }
.e8ml-picker { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.e8ml-chip { min-height: var(--gs-target, 44px); padding: .35rem .9rem; border-radius: 999px; border: 2px solid var(--e8-line); background: var(--e8-surface); color: var(--e8-ink); font: inherit; font-weight: 700; cursor: pointer; }
.e8ml-chip[aria-pressed="true"] { border-color: var(--e8-ink); background: var(--e8-ink); color: var(--e8-surface); }
.e8ml-chip:focus-visible, .e8ml-btn:focus-visible, .e8ml-visual:focus-visible, .e8ml-text:focus-visible { outline: 3px solid var(--e8-focus); outline-offset: 2px; }
.e8ml-domain-number { border-left: 8px solid var(--e8-domain-number); }
.e8ml-domain-operations { border-left: 8px solid var(--e8-domain-operations); }
.e8ml-domain-fractions { border-left: 8px solid var(--e8-domain-fractions); }
.e8ml-domain-ratio { border-left: 8px solid var(--e8-domain-ratio); }
.e8ml-domain-algebra { border-left: 8px solid var(--e8-domain-algebra); }
.e8ml-domain-geometry { border-left: 8px solid var(--e8-domain-geometry); }
.e8ml-domain-data { border-left: 8px solid var(--e8-domain-data); }
.e8ml-domain-measurement { border-left: 8px solid var(--e8-domain-measurement); }
.e8ml-lessonbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; align-items: center; }
.e8ml-workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; padding: 1rem; background: var(--e8-surface-2); border: 1px solid var(--e8-line); border-radius: 14px; }
.e8ml-visual { grid-column: 1; background: var(--e8-surface); border: 1px solid var(--e8-line); border-radius: 12px; padding: .6rem; display: grid; gap: .6rem; justify-items: center; overflow: auto; }
.e8ml-visual svg { width: 100%; max-width: 520px; height: auto; touch-action: manipulation; }
.e8ml-visual svg .cell, .e8ml-visual svg .point { cursor: pointer; }
.e8ml-three-shell { width: 100%; min-width: 0; }
.e8ml-three-stage { width: 100%; overflow: hidden; border: 1px solid #d5dfdc; border-radius: 14px; background: #f7f4ec; color: #17324d; box-shadow: 0 12px 28px rgba(23,50,77,.09); }
.e8ml-three-toolbar { display: flex; gap: .45rem; overflow-x: auto; padding: .65rem; border-bottom: 1px solid #d5dfdc; background: #fffdf8; scrollbar-width: thin; }
.e8ml-three-btn, .e8ml-three-piece { min-height: 44px; flex: 0 0 auto; padding: .45rem .75rem; border: 1px solid #9aafae; border-radius: 9px; background: #fff; color: #17324d; font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.e8ml-three-btn:hover, .e8ml-three-piece:hover { background: #e4f3f0; }
.e8ml-three-btn[aria-pressed="true"], .e8ml-three-piece[aria-pressed="true"] { border-color: #176f6b; background: #d6eeeb; box-shadow: inset 0 0 0 1px #176f6b; }
.e8ml-three-btn:focus-visible, .e8ml-three-piece:focus-visible, .e8ml-three-canvas:focus-visible, .e8ml-2d-fallback summary:focus-visible, .e8ml-three-parts summary:focus-visible { outline: 3px solid #236cc0; outline-offset: 2px; }
.e8ml-three-viewport { position: relative; height: 370px; overflow: hidden; background: radial-gradient(ellipse at 50% 24%, #ffffff 0, #f7f4ec 68%, #e8efec 100%); }
.e8ml-three-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.e8ml-three-canvas:active { cursor: grabbing; }
.e8ml-three-status { min-height: 1.5rem; margin: 0; padding: .6rem .8rem 0; color: #24323f; font-size: .94rem; }
.e8ml-three-caption { margin: 0; padding: .2rem .8rem .75rem; color: #566b73; font-size: .84rem; }
.e8ml-three-dimensions { display: flex; flex-wrap: wrap; gap: .55rem; padding: .3rem .8rem .75rem; }
.e8ml-three-dimensions span { display: flex; align-items: baseline; gap: .35rem; padding: .35rem .65rem; border: 1px solid #d1dfdc; border-radius: 8px; background: rgba(255,255,255,.82); }
.e8ml-three-dimensions strong { color: #176f6b; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.e8ml-three-dimensions small { color: #566b73; }
.e8ml-three-parts { margin: 0 .8rem .8rem; border-top: 1px solid #d5dfdc; }
.e8ml-three-parts summary, .e8ml-2d-fallback summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: #17324d; font-weight: 700; }
.e8ml-three-piece-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: .35rem 0 .65rem; }
.e8ml-three-piece { min-width: 44px; padding: .35rem; }
.e8ml-2d-fallback { width: 100%; padding: 0 .8rem; border-top: 1px solid #d5dfdc; }
.e8ml-2d-model { display: grid; justify-items: center; gap: .5rem; padding: .25rem 0 .75rem; }
.e8ml-three-key { display: inline-flex; gap: .35rem; align-items: center; color: #24323f; font-size: .9rem; }
.e8ml-three-key i { width: .8rem; height: .8rem; border-radius: 3px; background: #1fa6a2; }
.e8ml-three-key.is-constant i { background: #d6a83d; }
.e8ml-linked { grid-column: 2; display: grid; gap: .6rem; align-content: start; }
.e8ml-linked p { margin: 0; line-height: 1.5; }
.e8ml-tag { display: inline-block; margin-right: .4rem; padding: .05rem .5rem; border-radius: 999px; background: var(--e8-info-tint); color: var(--e8-info); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.e8ml-eq { font: 700 1.05rem ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.e8ml-table { border-collapse: collapse; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.e8ml-table th, .e8ml-table td { border: 1px solid var(--e8-line); padding: .25rem .6rem; text-align: left; }
.e8ml-table th { background: var(--e8-surface-sunk); }
.e8ml-alert { color: var(--e8-incorrect); background: var(--e8-incorrect-tint); padding: .4rem .6rem; border-radius: 8px; }
.e8ml-controls, .e8ml-toolbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.e8ml-btn { min-height: var(--gs-target, 44px); padding: .35rem .9rem; border-radius: 10px; border: 2px solid var(--e8-ink); background: var(--e8-surface); color: var(--e8-ink); font: inherit; font-weight: 700; cursor: pointer; }
.e8ml-btn:hover:not(:disabled) { background: var(--e8-info-tint); }
.e8ml-btn:disabled { opacity: .55; cursor: not-allowed; }
.e8ml-primary { background: var(--e8-ink); color: var(--e8-surface); }
.e8ml-primary:hover:not(:disabled) { background: var(--e8-info); }
.e8ml-quiet { border-color: var(--e8-line); font-weight: 600; }
.e8ml-note { grid-column: 1 / -1; min-height: 1.4rem; margin: 0; color: var(--e8-hint); background: transparent; font-weight: 700; }
.e8ml-note:not(:empty) { background: var(--e8-hint-tint); padding: .4rem .6rem; border-radius: 8px; }
.e8ml-lesson, .e8ml-solver { margin-top: 1rem; padding: 1rem; border: 2px solid var(--e8-line); border-radius: 14px; background: var(--e8-surface); }
.e8ml-lesson-title, .e8ml-solver h3 { margin: 0 0 .6rem; }
.e8ml-steps { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .8rem; }
.e8ml-steps li { padding: .15rem .7rem; border-radius: 999px; background: var(--e8-surface-sunk); color: var(--e8-ink-soft); font-weight: 700; font-size: .85rem; }
.e8ml-steps li.done { background: var(--e8-mastery-demonstrated-tint); color: var(--e8-mastery-demonstrated); }
.e8ml-steps li[aria-current="step"] { background: var(--e8-ink); color: var(--e8-surface); }
.e8ml-q { margin: 0 0 .6rem; font-size: 1.1rem; font-weight: 700; line-height: 1.45; }
.e8ml-why { margin: .5rem 0; padding: .5rem .7rem; border-radius: 8px; background: var(--e8-info-tint); color: var(--e8-info); }
.e8ml-why:empty { display: none; }
.e8ml-choices, .e8ml-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.e8ml-label { font-weight: 700; display: block; margin: .4rem 0 .2rem; }
.e8ml-text { min-height: var(--gs-target, 44px); padding: .4rem .6rem; border: 2px solid var(--e8-ink); border-radius: 8px; font: inherit; background: var(--e8-surface); color: var(--e8-ink); width: 100%; box-sizing: border-box; }
.e8ml-short { width: 11rem; }
.e8ml-count { margin: .3rem 0; color: var(--e8-ink-soft); font-size: .9rem; }
.e8ml-frames { margin: .4rem 0; }
.e8ml-frames summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.e8ml-frames .e8ml-btn { display: block; margin: .3rem 0; text-align: left; }
.e8ml-done { padding: .6rem .8rem; background: var(--e8-correct-tint); color: var(--e8-correct); border-radius: 10px; }
.e8ml-done h3 { margin: 0 0 .3rem; }
@media (max-width: 760px) {
  .e8ml-workspace { grid-template-columns: 1fr; padding: .6rem; }
  .e8ml-linked { grid-column: 1; }
  .e8ml-short { width: 100%; }
}
@media (max-width: 560px) {
  .e8ml-three-viewport { height: 300px; }
  .e8ml-three-toolbar { gap: .35rem; padding: .5rem; }
  .e8ml-three-btn { padding-inline: .62rem; }
}
@media (prefers-reduced-motion: reduce) { .e8ml *, .e8ml *::before, .e8ml *::after { animation: none !important; transition: none !important; } }
