/* Color-only alignment with the bound Davis Math reference. Classic layout,
   control positions and mathematical identity remain independent. */
:root{--davis-ink:#182e39;--davis-teal:#176256;--davis-muted:#536773;--davis-soft:#eaf3ef;--davis-gold:#e9bc72}
body.classic-host,body.classic-player{background:#176256;color:#fff}.classic-player .question-panel,.classic-player .ready{background:#176256}.classic-player .learner-bar,.classic-reward-strip{background:#104d44}.classic-host-head,.classic-code-banner,.classic-lobby-goal,.classic-wallet-stage,.classic-live-note{background:#104d44}.classic-wallet-stage strong{background:#182e39}.classic-host-head>button,.classic-host-tools>summary{background:#176256}.classic-reward strong{background:#182e39}.classic-reward small{color:#fff}.classic-reward:not(:last-child):after{color:#e9bc72}.classic-player .answer-choice{background:#f5f6f5;color:#182e39;border-color:#bfd2cc}.classic-player .answer-choice:nth-child(2){background:#eaf3ef}.classic-player .answer-choice:nth-child(3){background:#e4ebf1}.classic-player .answer-choice:nth-child(4){background:#f7ecd9}.classic-player .answer-choice:hover:enabled{background:#dcece5;color:#182e39;filter:none}.classic-ready .ready>#shop-open{background:#e9bc72;color:#182e39}.classic-ready .ready>#return{background:#104d44;color:#fff}.classic-ready .ready .accepted-gain{background:#176256}.classic-player #answer-form button{background:#104d44;border-color:#bfd2cc}.classic-host :focus-visible,.classic-player :focus-visible{outline:3px solid #e9bc72;outline-offset:-4px}.classic-player .answer-choice:focus-visible,.classic-ready .ready>#shop-open:focus-visible{outline-color:#182e39}.classic-lobby-line #start{background:#176256;border:1px solid #fff}.classic-ended .classic-rank{background:#e9bc72;color:#182e39}.dashboard-nav [aria-current=page],.dashboard-create,.dashboard-filters [aria-pressed=true]{background:#176256;border-color:#176256}.dashboard-launch{background:#176256}.dashboard-preview{background:#182e39}body.teacher-dashboard{background:#f5f6f5;color:#182e39}
body.join-entry{background:#f5f6f5;color:#182e39}body.join-entry .join-dialog{background:#fff;border-color:#d6dfdf}body.join-entry .join-wordmark{color:#176256}body.join-entry #join-form button{background:#176256;color:#fff}body.join-entry .join-private-note{color:#536773}
#teaching.xp-red-screen,#teaching.xp-red-screen::backdrop{background:#182e39}#teaching.xp-red-screen button{color:#104d44}#teaching.xp-red-screen .attempt strong{color:#182e39}#teaching.xp-red-screen button:focus-visible,#teaching.xp-red-screen summary:focus-visible,#teaching.xp-red-screen input:focus-visible{outline-color:#182e39}
.music-controls{border-top:1px solid #d6dfdf;padding-top:12px;display:grid;gap:8px;color:#182e39}.music-controls button{background:#176256;color:white;min-height:44px}.music-controls label{font-size:14px}.music-controls input[type=range]{width:100%;min-height:44px;accent-color:#176256}.music-controls small{font-size:12px;color:#536773}.music-controls summary{min-height:44px;display:flex;align-items:center;text-decoration:underline}.music-controls a{color:#176256}
/* Navy focus on pale controls; gold remains visible on dark teal buttons. */
.classic-menu-body :focus-visible,.classic-shop-open #shop-back:focus-visible,.classic-shop-open #classic-shop-overview:focus-visible,.classic-shop-open .classic-tier:focus-visible{outline:3px solid #182e39;outline-offset:-4px}.classic-menu-body #music-toggle:focus-visible{outline-color:#e9bc72}
.classic-shop-open #shop{background:#f5f6f5;color:#182e39}.classic-player .classic-tier-detail>h3{background:#182e39}.classic-player .classic-tier-detail>h3 .small{color:#fff}.classic-player .classic-tier-detail>.next-benefit{background:#176256}.classic-player .classic-tier-detail>[data-upgrade]{background:#176256;color:#fff}.classic-player .classic-tier-detail>[data-upgrade]:disabled{background:#d6dfdf;color:#536773}.classic-tier{background:#182e39;color:#fff;border-color:#d6dfdf}.classic-tier[aria-pressed=true]{background:#176256;box-shadow:inset 0 0 0 3px #e9bc72}.classic-shop-open .classic-tier:focus-visible{outline-color:#e9bc72}.classic-category-icon,.classic-category:nth-child(2) .classic-category-icon,.classic-category:nth-child(3) .classic-category-icon,.classic-category:nth-child(4) .classic-category-icon{background:#176256;color:#fff}
/* Additive head-math kit representations. */
.t2-expression{font-size:clamp(1.55rem,4.5vw,2.6rem);line-height:1.5;overflow-wrap:anywhere}.t2-expression sup{font-size:.6em}.t2-table{border-collapse:collapse;margin:.6rem auto;font-size:1.3rem}.t2-table th,.t2-table td{padding:.35rem .9rem;border:1px solid #a1b4af}.t2-graph{display:block;width:min(100%,320px);height:auto;margin:auto;background:#fff;color:#182e39}.t2-grid{stroke:#dce5e1;stroke-width:1}.t2-axis{stroke:#182e39;stroke-width:1.5;fill:none}.t2-line{stroke:#176256;stroke-width:3}.t2-point{fill:#182e39}.t2-graph text{font-size:16px;fill:#182e39}.t2-context{max-width:38ch;margin:auto;font-size:1.25rem}.t2-teaching{width:100%;color:#182e39}.t2-original{border-bottom:1px solid #a1b4af;padding:.4rem}.t2-original small{display:block;font-size:.8rem}.t2-original .t2-expression{font-size:1.3rem}.t2-original .t2-graph{max-height:180px}.t2-step{padding:.8rem .3rem}.t2-step p{font-size:1.2rem;margin:.2rem}.t2-next{min-height:44px;margin:.5rem}
.classic-player .question-panel>.term2-graph-question{height:250px;min-height:250px;background:#fff;color:#182e39;padding:4px 12px}.classic-player .term2-graph-question .t2-graph{height:242px;width:auto;max-width:100%}.classic-player .term2-graph-question+.answer-choices{min-height:270px;grid-template-rows:repeat(2,minmax(120px,1fr))}.preview-choices{display:flex;gap:.8rem;flex-wrap:wrap}.preview-choices>span{padding:.5rem;border:1px solid #a1b4af;border-radius:6px}
.classic-player .term2-choices .answer-choice{min-width:0;white-space:normal;overflow-wrap:anywhere}.classic-player .term2-choices .choice-value{display:block;min-width:0;max-width:100%;font-size:clamp(20px,3vw,30px);white-space:normal;overflow-wrap:anywhere}

/* Parameterized Opus Term2 scenes are vertically stacked mathematical stages. */
.visual:has(>.opus-term2-original){display:block}
.visual:has(>.opus-term2-original)>.xt-root{width:100%;max-width:560px;margin-inline:auto}

/* Preserve the authored Term2 SVG and its original-problem anchor in a vertical flow. */
.visual:is([data-term2-renderer="claude-opus-term2-v1"],[data-term2-renderer="opus-primitives-mental-adaptation-v1"]){display:block}
.visual:is([data-term2-renderer="claude-opus-term2-v1"],[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.t2-root{width:100%;max-width:560px;margin-inline:auto}

/* Long worked examples scroll in normal flow; actions never cover the math. */
#teaching:has(#teach-visual:is([data-term2-renderer="claude-opus-term2-v1"],[data-term2-renderer="opus-primitives-mental-adaptation-v1"])) .coach-controls{position:static;box-shadow:none}
#teaching:has(#teach-visual:is([data-term2-renderer="claude-opus-term2-v1"],[data-term2-renderer="opus-primitives-mental-adaptation-v1"])) #teach-description,#teaching:has(#teach-visual:is([data-term2-renderer="claude-opus-term2-v1"],[data-term2-renderer="opus-primitives-mental-adaptation-v1"])) #teach-timeline{display:none}

.classic-host-head #host-music-controls{position:relative;display:block;border:0;padding:0;color:#fff}.classic-host-head #host-music-controls>summary{min-height:44px;padding:0 16px;border-radius:6px;background:#176256;color:#fff;font-size:14px;font-weight:700;text-decoration:none;cursor:pointer}.host-music-body{position:absolute;right:0;top:calc(100% + 8px);z-index:20;width:min(280px,calc(100vw - 24px));padding:16px;border-radius:8px;background:#fff;color:#182e39;box-shadow:0 10px 25px #0004;display:grid;gap:10px;box-sizing:border-box}.host-music-body button{width:100%}
/* Keep the actual source and its one action visible together on Chromebook screens. */
@media(min-width:900px){
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root{max-width:400px}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]:has(>.opus-term2-original>.t2-graph){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);align-items:start;gap:12px}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]:has(>.opus-term2-original>.t2-graph)>.opus-term2-original{min-width:0}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]:has(>.opus-term2-original>.t2-graph)>.t2-bar{grid-column:1/-1}
}

.host-music-credit{display:grid;gap:8px}

/* One-action feedback: reserve the viewport for the actual source and final cue. */
#teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:4px 8px;width:min(900px,calc(100vw - 16px));max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:12px 16px}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>*{min-width:0;grid-column:1/-1}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-title{grid-column:1;grid-row:1;margin:0;font-size:21px;align-self:center}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-top{grid-column:2;grid-row:1;align-items:center;justify-content:flex-end;text-align:right}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-top>.eyebrow{display:none}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-top>span:last-child{font-size:12px;line-height:1.2}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teaching-goal{grid-row:2;margin:0;padding:4px 8px}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.attempt{grid-column:1;grid-row:3;margin:0;flex-wrap:wrap;gap:4px;align-self:center}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-loss{grid-column:2;grid-row:3;margin:0;padding:4px 8px;font-size:12px;align-self:center}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-status{grid-row:4;margin:0;line-height:1.3}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-visual{grid-row:5;margin:0;min-height:0}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-caption:empty{display:none}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent{grid-column:1;grid-row:6}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent summary{display:flex;align-items:center;min-height:44px;margin:0}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent[open]{grid-column:1/-1}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.motion{grid-column:2;grid-row:6;margin:0;min-height:44px}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent[open]~.motion{grid-row:7}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-controls{grid-row:8;margin:0;padding:4px 0;box-shadow:none;position:static}
#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-controls button{min-height:44px}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.opus-term2-original{padding:4px 8px}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.opus-term2-original-compact{display:none}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.opus-term2-original>.t2-expression{font-size:24px;line-height:1.3}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root{max-width:320px;padding:6px 0}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root>.t2-q{margin:0 0 4px;line-height:1.25}
.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root>.t2-cue{margin:4px 0 0;min-height:1.35em}
@media(min-width:700px){
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]){grid-template-columns:repeat(4,minmax(0,1fr))}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-title,#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.attempt{grid-column:1/3}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-top,#teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>#teach-loss{grid-column:3/5}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent{grid-column:1;grid-row:6}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.motion{grid-column:2;grid-row:6}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-controls{grid-column:3/5;grid-row:6;align-self:start}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent[open]{grid-column:1/-1}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.text-equivalent[open]~.motion{grid-column:1/3;grid-row:7}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):has(>.text-equivalent[open])>.coach-controls{grid-row:7}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]:has(>.opus-term2-original:not(.opus-term2-original-compact)){display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,1fr);align-items:start;gap:8px}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]:has(>.opus-term2-original:not(.opus-term2-original-compact))>.t2-bar{grid-column:1/-1}
}
@media(max-width:500px){
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]){width:calc(100vw - 8px);max-width:calc(100vw - 8px);max-height:calc(100dvh - 8px);padding:4px}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-controls .primary{flex-basis:auto;order:0;padding:8px 12px}
 #teaching:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"])>.coach-controls .quiet{flex:1 1 0}
 .visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root>.t2-q,.visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]>.t2-root>.t2-cue{padding-inline:6px}
}

/* Bound context for newly reviewed prerequisite models keeps units and domains visible. */
.mental-source-prompt{margin:4px 0;font-size:16px;line-height:1.4;white-space:normal;overflow-wrap:anywhere;color:var(--ink,#182e39)}

/* The lobby toolbar sits at the bottom, so its music panel opens upward. */
.classic-lobby .host-music-body{top:auto;bottom:calc(100% + 8px);max-height:calc(100dvh - 84px);overflow:auto}

/* Fit one-step questions and all four choices inside short Chromebook content areas. */
@media(min-width:900px) and (max-height:800px){
 .classic-player .question-panel:has(>.term2-choices){height:calc(100dvh - 120px);min-height:340px}
 .classic-player .question-panel:has(>.term2-choices)>.problem{height:clamp(104px,28dvh,180px);min-height:104px}
 .classic-player .question-panel:has(>.term2-choices)>.term2-graph-question{height:250px;min-height:250px}
 .classic-player .question-panel>.term2-choices{min-height:176px;grid-template-rows:repeat(2,minmax(88px,1fr))}
 .classic-player .term2-choices .answer-choice{padding:12px 32px}
}
/* A wide, short screen has room beside graphs and tables without shrinking labels. */
@media(min-width:900px) and (max-height:600px){
 .classic-player .question-panel:has(>.term2-graph-question, >.problem .t2-table):has(>.term2-choices){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
 .classic-player .question-panel:has(>.term2-graph-question, >.problem .t2-table):has(>.term2-choices)>#question-title{grid-column:1/-1;margin:10px 12px}
 .classic-player .question-panel:has(>.term2-graph-question, >.problem .t2-table):has(>.term2-choices)>.problem{grid-column:1;grid-row:2;width:100%;height:100%;min-height:250px;align-self:stretch}
 .classic-player .question-panel:has(>.term2-graph-question, >.problem .t2-table)>.term2-choices{grid-column:2;grid-row:2}
}

/* Table headers must keep dark labels against their pale cell background. */
.classic-player .question-panel .t2-table th{color:#182e39;background:#eaf3ef}

/* Completed one-action feedback keeps the saved response and source visible on short laptops.
   The completed step bar is replaced by the existing Watch again control.
   The taller reciprocal scene also uses this header during playback so its final cue can be seen. */
@media(min-width:900px) and (max-height:600px){
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move])){padding:8px 16px;gap:2px 8px;grid-template-rows:auto minmax(44px,auto) auto auto auto}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teach-title{grid-column:1/3;grid-row:1}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teaching-goal{grid-column:3/5;grid-row:1;align-self:center}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.attempt{grid-column:1/3;grid-row:2}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.coach-top{grid-column:3/5;grid-row:2;align-self:start}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teach-loss{grid-column:3/5;grid-row:2;align-self:end}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teach-visual{grid-column:1/-1;grid-row:3}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teach-visual>.t2-root{padding-block:0}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):has(#teach-return:not([hidden]))>#teach-visual>.t2-bar{display:none}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.text-equivalent{grid-column:1;grid-row:4}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.motion{grid-column:2;grid-row:4}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.coach-controls{grid-column:3/5;grid-row:4}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.text-equivalent[open]{grid-column:1/-1}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>.text-equivalent[open]~.motion{grid-column:1/3;grid-row:5}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move])):has(>.text-equivalent[open])>.coach-controls{grid-row:5}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move]))>#teach-status{grid-column:1/-1;grid-row:6}
 #teaching[open]:has(>#teach-visual[data-term2-renderer="opus-primitives-mental-adaptation-v1"]):is(:has(#teach-return:not([hidden])),:has([data-kc-reciprocal-move])):has(#teach-return:not(:disabled))>#teach-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
 /* Keep the reciprocal source, moving exponent and final cue in the visible work area.
    Manual controls use the otherwise empty source column; the completion gate is unchanged. */
 #teaching:has([data-kc-reciprocal-move]) #teach-visual>.t2-root{grid-column:2;grid-row:1/3}
 #teaching:has([data-kc-reciprocal-move]) #teach-visual>.t2-root>.t2-svg{max-height:270px}
 #teaching:has([data-kc-reciprocal-move]) #teach-visual>.t2-bar{grid-column:1;grid-row:2;align-self:start}
}
