.engine-choice-heading,.tutor-heading,.tutor-actions,.tutor-edit,.tutor-views {
  display:flex;
  align-items:center;
  gap:.6rem;
}
.engine-choice-heading,.tutor-heading {justify-content:space-between}
.tutor-switch {
  display:inline-flex;align-items:center;gap:.45rem;min-height:2.6rem;
  white-space:nowrap;cursor:pointer;font-size:.875rem;
}
.tutor-switch input {
  padding:0;margin:0;width:1.05rem;height:1.05rem;min-height:0;
  accent-color:var(--ink);cursor:pointer;
}
.engine-choice-heading .tutor-switch {margin-block:-.4rem}
.tutor-dialog {
  --tutor-blue:#234768;--tutor-light:#e6eff6;
  margin:auto;width:min(52rem,calc(100% - 1.25rem));max-width:none;
  max-height:calc(100dvh - 1.25rem);overflow:auto;overscroll-behavior:contain;
  padding:clamp(.9rem,2.7vw,1.6rem);
}
.tutor-heading {align-items:flex-start;border-bottom:1px solid var(--line);padding-bottom:.7rem}
#tutor-meta,#tutor-board-state {color:var(--muted);font-size:.82rem;line-height:1.4}
#tutor-title {margin:.2rem 0 0;font:normal clamp(1.5rem,3.8vw,2rem)/1.12 var(--serif);outline:none}
.tutor-heading button,.tutor-actions button,.tutor-edit button {font-size:.875rem}
.tutor-layout {display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:1.3rem;align-items:start;margin-top:.8rem}
.tutor-figure,.tutor-exercise {min-width:0}
.tutor-views {gap:.25rem;background:var(--soft);border-radius:7px;padding:3px;width:fit-content;margin:0 auto .2rem}
.tutor-views button {border-color:transparent;min-height:2.2rem;padding:.25rem .7rem;font-size:.875rem}
.tutor-views button[aria-pressed=true] {background:white;border-color:#b7b7b7}
.tutor-score {display:flex;justify-content:center;flex-wrap:wrap;gap:.2rem 1rem;margin:.3rem 0;font-size:.875rem;font-variant-numeric:tabular-nums}
.tutor-score span::before {display:inline-block;content:"";border:1px solid var(--ink);border-radius:50%;width:.6rem;height:.6rem;background:var(--ink);margin-right:.3rem}
.tutor-score span+span::before {background:white}
#tutor-board {display:block;width:100%;height:auto;max-height:48dvh;touch-action:manipulation}
#tutor-board .grid-hit {cursor:default}
#tutor-board[data-editing=true] .grid-hit {cursor:pointer}
#tutor-board .cell.selected-square {fill:#cddfe9}
#tutor-board .selected-piece {stroke:var(--tutor-blue)}
#tutor-board .legal-dot {fill:var(--tutor-blue)}
#tutor-board .cell.tutor-counted {fill:#dce9f2}
#tutor-board .turn-arrow path {fill:var(--tutor-blue)}
#tutor-board .turn-arrow circle {stroke:var(--tutor-blue)}
#tutor-board .turn-arrow text {fill:var(--tutor-blue)}
#tutor-board-state {text-align:center;min-height:1.2em}
.tutor-steps {display:flex;flex-wrap:wrap;justify-content:center;gap:.2rem;margin-top:.45rem}
.tutor-steps button,.tutor-steps span {font-size:.8rem;line-height:1.25;white-space:nowrap;padding:.25rem .32rem}
.tutor-steps button {border-color:transparent;min-height:2.25rem}
.tutor-steps button[aria-pressed=true] {background:var(--tutor-light);border-color:#b8cbd9}
.tutor-steps .changed {color:var(--tutor-blue);font-weight:650}
.tutor-steps sup {font-size:.68rem;margin-right:.14rem}
.tutor-edit {justify-content:center;margin-top:.4rem}
.tutor-edit button {min-height:2.3rem;padding:.3rem .7rem}
.tutor-exercise {padding:.65rem 0 0}
#tutor-instruction,#tutor-reason,#tutor-feedback {font-size:1rem;line-height:1.5}
#tutor-instruction:not([hidden]) {margin-bottom:.9rem}
.tutor-exercise fieldset {margin:0;padding:0;border:0;min-width:0}
#tutor-question {font:normal 1.25rem/1.25 var(--serif);margin:0 0 .7rem;padding:0}
#tutor-fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}
#tutor-fields label {display:grid;gap:.25rem;font-size:.875rem}
#tutor-fields input {width:100%;min-width:0;font-size:1rem;min-height:2.7rem;padding:.45rem .6rem;font-variant-numeric:tabular-nums}
#tutor-fields input[aria-invalid=true] {border:2px solid #974322}
.tutor-actions {flex-wrap:wrap;margin-top:.8rem}
#tutor-feedback:not(:empty) {margin-top:.8rem}
#tutor-result {margin-top:.55rem}
#tutor-comparison table {width:100%;border-collapse:collapse;font-size:1rem;font-variant-numeric:tabular-nums}
#tutor-comparison th,#tutor-comparison td {text-align:right;padding:.45rem .25rem;border-bottom:1px solid var(--line);white-space:nowrap}
#tutor-comparison th:first-child {text-align:left;white-space:normal}
#tutor-comparison thead th {font-size:.875rem;font-weight:600}
#tutor-comparison tbody th {font-size:.875rem;font-weight:500}
#tutor-comparison caption {color:var(--muted);font-size:.8rem;text-align:right;caption-side:bottom;padding:.3rem 0}
#tutor-reason:not(:empty) {margin:.55rem 0}
#tutor-breakdown summary {font-size:.875rem;cursor:pointer;padding:.45rem 0}
#tutor-sums p {margin:.35rem 0;font-size:.875rem;line-height:1.5}
@media(max-width:620px) and (min-height:551px) {
  .tutor-dialog {width:calc(100% - .75rem);max-height:calc(100dvh - .75rem)}
  .tutor-layout {grid-template-columns:1fr;gap:.35rem;margin-top:.5rem}
  #tutor-board {max-height:39dvh}
  #tutor-instruction:not([hidden]) {margin-bottom:.45rem}
  .tutor-exercise {padding-top:.35rem}
}
@media(max-height:550px) and (orientation:landscape) {
  .tutor-dialog {padding:.6rem .9rem}
  .tutor-layout {gap:1rem;margin-top:.4rem}
  .tutor-heading {padding-bottom:.4rem}
  #tutor-board {max-height:51dvh}
  .tutor-exercise {padding-top:.25rem}
  .room-heading .tutor-switch {font-size:.75rem;gap:.25rem}
}
@media(max-width:380px) {
  .engine-choice-heading h1 {font-size:1.2rem}
  .tutor-switch {font-size:.81rem}
  .tutor-steps {gap:0}
}
.tutor-edit button[aria-pressed=true]{background:var(--tutor-light);border-color:#b8cbd9}
#tutor-dialog:has(#coach-panel:not([hidden])) .tutor-layout {display:none}
.coach-practice-grid{display:grid;grid-template-columns:1.15fr 1fr;gap:1rem;padding-top:.8rem}
#coach-board{width:100%;max-height:48dvh;display:block;touch-action:manipulation}
#coach-state,#coach-notation{font-size:.875rem;text-align:center;line-height:1.5}
#coach-question{font-size:1.05rem;line-height:1.45;margin:.5rem 0}
#coach-feedback:not(:empty){margin:.75rem 0;line-height:1.5}
#coach-score:not([hidden]){display:flex;flex-wrap:wrap;align-items:end;gap:.5rem}
#coach-score label{width:5rem;font-size:.875rem}
#coach-score input{font-size:1rem}
#coach-board .coach-mark{fill:#bdd6e6}
@media(max-width:620px) and (min-height:551px){.coach-practice-grid{grid-template-columns:1fr;gap:.3rem}#coach-board{max-height:39dvh}}

#tutor-guidance{margin-top:.8rem}
#tutor-stage{font-size:.875rem;font-weight:650;margin-bottom:.2rem;color:var(--muted)}
#tutor-instruction{margin:0}
#tutor-takeaway:not(:empty){font-size:1rem;line-height:1.5}
#tutor-dialog:has(#coach-panel:not([hidden])) #tutor-guidance{display:none}
#tutor-next{min-height:44px}
