/* Interactive explanation player, version 2 (owner request 2026-11-13). Loaded last.
   Scoped to the workspace panel's interactive explanation, plus two footer overlap fixes. */

body{--v2-focus:#8ab4ff;--v2-focus-bg:#8ab4ff24}
/* ---------- Footer: the centered "Question N of M" pill no longer covers the explanation launchers. */
@media (min-width:901px){
 .bb-footer{display:flex!important;column-gap:14px!important}
 .bb-footer-left{flex:0 1 auto;max-width:none!important;min-width:0;overflow-x:auto;scrollbar-width:none}
 .bb-footer-left::-webkit-scrollbar{display:none}
 .bb-question-menu{position:static!important;transform:none!important;flex:0 0 auto;margin:0 auto!important}
 .bb-footer-right{flex:0 0 auto;margin-left:0!important}
}
@media (min-width:901px) and (max-width:1250px){
 html:root body.bb-mode .bb-footer-left button{min-width:0!important;padding-left:12px!important;padding-right:12px!important}
 html:root body.bb-mode .bb-question-menu{min-width:0!important}
}
/* The analytics pill sits above the question footer instead of on top of its buttons,
   and steps aside while a tool panel is open. */
body.v2-has-footer .analytics-preferences{bottom:calc(var(--bb-footer,64px) + 10px)}
body.v2-has-footer.workspace-fullscreen .analytics-preferences .analytics-settings,
body.v2-has-footer.workspace-docked .analytics-preferences .analytics-settings{display:none}

/* ---------- The explanation fills its panel: no outer scrolling, controls always visible. */
html:root body .workspace-panel .workspace-feature[data-feature="interactive"]{height:100%;min-height:0!important}
html:root body .workspace-panel .v2-player{display:flex!important;flex-direction:column!important;height:100%!important;min-height:0!important;max-height:none!important;overflow:hidden!important}
html:root body .workspace-panel .v2-player>.player-header{position:static!important;flex:0 0 auto!important;min-height:0!important;padding:8px 12px!important;gap:10px!important;grid-template-columns:auto minmax(0,1fr) auto!important}
html:root body .workspace-panel .v2-player>.player-header>div small{display:none!important}
html:root body .workspace-panel .v2-player>.player-header h3{font-size:15px!important;line-height:1.3!important;margin:0!important;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
html:root body .workspace-panel .v2-player>.player-header .view-question{padding:7px 11px!important}
html:root body .workspace-panel .v2-player>.player-body{flex:1 1 auto!important;height:auto!important;min-height:0!important;padding:8px 10px 10px!important;overflow:hidden!important}
html:root body .workspace-panel .v2-player .player-mode[data-mode-panel="desmos"].active{display:flex!important;flex-direction:column;height:100%!important;min-height:0!important}
html:root body .workspace-panel .v2-player .player-mode.player-scroll.active,html:root body .workspace-panel .v2-player .takeaway-mode.active{height:100%!important;overflow:auto!important}

/* Recognition cue: one line until tapped. */
html:root body .workspace-panel .v2-player .mode-intro[data-v2]{display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;align-items:center!important;justify-content:flex-start!important;flex:0 0 auto!important;margin:0 0 8px!important;padding:6px 10px!important;border-radius:10px;cursor:pointer;gap:8px}
html:root body .workspace-panel .v2-player .mode-intro[data-v2]>span{display:none!important}
html:root body .workspace-panel .v2-player .mode-intro[data-v2] p{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html:root body .workspace-panel .v2-player .mode-intro[data-v2]::after{content:'▾';flex:0 0 auto!important;opacity:.6;font-size:12px}
html:root body .workspace-panel .v2-player .mode-intro[data-v2].v2-open p{white-space:normal}
html:root body .workspace-panel .v2-player .mode-intro[data-v2].v2-open::after{content:'▴'}
html:root body .workspace-panel .v2-player .mode-intro[data-v2]:focus-visible{outline:2px solid #8ab4ff;outline-offset:2px}

/* Split: calculator | question + step. */
html:root body .workspace-panel .v2-player .interactive-desmos-explanation{display:flex!important;flex-direction:column!important;flex:1 1 auto!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important}
html:root body .workspace-panel .v2-player .desmos-player-grid{display:grid!important;flex:1 1 auto!important;min-height:0!important;gap:10px!important;grid-template-columns:minmax(0,1.5fr) minmax(330px,1fr)!important;grid-template-rows:minmax(0,1fr)!important}
html:root body .workspace-panel .v2-player .desmos-player-grid>div:first-child{min-height:0!important;height:100%}
html:root body .workspace-panel .v2-player .controlled-desmos-stage{position:relative;height:100%!important;min-height:0!important}
html:root body .workspace-panel .v2-side{display:flex;flex-direction:column;gap:8px;min-height:0!important;min-width:0}
html:root body .workspace-panel .v2-player .desmos-step-copy{flex:1 1 auto!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;margin:0!important}

/* Question beside the calculator. */
.v2-question{flex:0 1 auto!important;max-height:40%;overflow:auto;border:1px solid #ffffff1f;border-radius:12px;background:#ffffff08;padding:0 12px}
.v2-question>summary{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;padding:8px 0;list-style:none;cursor:pointer;background:inherit;font-size:11px;font-weight:900;letter-spacing:.14em;text-transform:uppercase;color:#79c9e9}
.v2-question>summary::-webkit-details-marker{display:none}
.v2-question-toggle::after{content:'Show ▾';letter-spacing:.04em;font-size:11px;opacity:.75}
.v2-question[open] .v2-question-toggle::after{content:'Hide ▴'}
.v2-question-body{padding:0 0 10px;font-size:15px;line-height:1.5}
.v2-question-body p{margin:0 0 8px!important}
.v2-question-body .adapted-question-notice{display:block;font-size:11px;opacity:.6;margin-bottom:4px}
.v2-question-body .question-drawer-options{display:grid;gap:4px;font-size:14px}
.v2-question-body svg,.v2-question-body img{display:block;max-width:100%;max-height:190px;width:auto;height:auto;margin:0 auto 8px}

/* One step card: lighter labels, less boxing. */
html:root body .workspace-panel .v2-player .desmos-step-copy .desmos-current-copy{margin-top:8px!important;padding:10px 12px!important}
html:root body .workspace-panel .v2-player .desmos-step-copy .desmos-current-copy>span{font-size:10px!important;opacity:.75}
html:root body .workspace-panel .v2-player .desmos-full-entry{position:relative}
.v2-copy{margin-left:8px;padding:2px 9px;border:1px solid #ffffff33;border-radius:999px;background:transparent;color:inherit;font-size:11px;font-weight:800;cursor:pointer;vertical-align:middle}
.v2-copy:hover{border-color:currentColor}

/* Pinned controls: Previous · dots · Next. */
html:root body .workspace-panel .v2-footer{display:flex;align-items:center;gap:10px;flex:0 0 auto!important;padding-top:8px;margin-top:8px;border-top:1px solid #ffffff14}
html:root body .workspace-panel .v2-footer .desmos-controls{display:contents!important}
html:root body .workspace-panel .v2-footer .desmos-controls>button:first-child{order:0}
html:root body .workspace-panel .v2-footer .desmos-step-nav{order:1;flex:1 1 auto!important;min-width:0;margin:0!important;max-height:none!important;overflow-x:auto;overflow-y:hidden;flex-wrap:nowrap!important;justify-content:center;scrollbar-width:thin}
html:root body .workspace-panel .v2-footer .desmos-controls>span{order:2;flex:0 0 auto!important;font-size:12px;opacity:.7;white-space:nowrap}
html:root body .workspace-panel .v2-footer .desmos-controls>button:last-child{order:3}
html:root body .workspace-panel .v2-footer .desmos-controls>button{min-height:42px;min-width:108px;padding:9px 16px!important;border-radius:999px!important;font-weight:850!important}
html:root body .workspace-panel .v2-footer .desmos-controls>button:last-child:not(:disabled){background:#fff!important;border-color:#fff!important;color:#071333!important}

/* What changed: native result beside the graph. */
.v2-result{position:absolute;right:12px;bottom:12px;z-index:6;max-width:calc(100% - 24px);padding:6px 13px;border:1px solid #8ab4ff99;border-radius:999px;background:#0b1220ee;color:#cfe0ff;font:800 15px/1.3 system-ui,sans-serif;white-space:pre-wrap;pointer-events:none;box-shadow:0 6px 20px #0006;animation:v2-pop .25s ease-out}
.v2-result[hidden]{display:none}
@keyframes v2-pop{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

/* Show me / Let me try. */
.v2-mode-toggle{display:flex;flex:0 0 auto!important;padding:3px;border-radius:999px;background:#ffffff0d;align-self:flex-start}
.v2-mode-toggle button{padding:6px 13px;border:0;border-radius:999px;background:transparent;color:inherit;opacity:.75;font-size:12px;font-weight:850;cursor:pointer}
.v2-mode-toggle button[aria-pressed="true"]{background:#fff;color:#071333;opacity:1}
.v2-trying .desmos-full-entry code,.v2-trying .desmos-current-copy,.v2-trying .desmos-notation{filter:blur(6px);user-select:none;pointer-events:none;transition:filter .2s}
.v2-trying .v2-copy{display:none}
.v2-trying.v2-hint-1 .desmos-current-copy,.v2-trying.v2-hint-1 .desmos-notation{filter:none;pointer-events:auto;user-select:auto}
.v2-trying.v2-hint-2 .desmos-full-entry code{filter:none;user-select:auto}
.v2-try{margin:8px 0;padding:10px 12px;border:1px solid #8ab4ff66;border-radius:12px;background:#8ab4ff12}
.v2-try p{margin:0!important}
.v2-try-title{font-weight:850}
.v2-try-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.v2-try-actions button,.v2-finish-actions button{padding:7px 14px;border:1px solid #ffffff33;border-radius:999px;background:transparent;color:inherit;font-size:13px;font-weight:850;cursor:pointer}
.v2-try-actions .v2-try-check,.v2-finish-actions .v2-finish-primary{background:#fff;border-color:#fff;color:#071333}
.v2-try-feedback:not(:empty){margin-top:8px!important;color:#ffcf99}
.v2-try-done{color:#9be7a8;font-weight:850}

/* Finish. */
.v2-finish{margin-top:12px;padding:12px;border:1px solid #79c9e966;border-radius:12px;background:#79c9e90f}
.v2-finish-title{margin:0!important;font-weight:850}
.v2-finish-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}

/* ---------- Narrow panels (docked half-screen, phones): stack calculator above the step. */
@container workspace (max-width:899px){
 html:root body .workspace-panel .v2-player .desmos-player-grid{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(210px,46%) minmax(0,1fr)!important}
 html:root body .workspace-panel .v2-player>.player-header{grid-template-columns:auto minmax(0,1fr)!important}
 html:root body .workspace-panel .v2-player>.player-header>div{display:none}
 html:root body .workspace-panel .v2-player>.player-header .player-tabs{justify-self:end}
 .v2-question{max-height:34%}
 html:root body .workspace-panel .v2-footer .desmos-controls>span{display:none}
 html:root body .workspace-panel .v2-footer .desmos-controls>button{min-width:0;padding:9px 14px!important}
 .v2-result{top:10px;bottom:auto;left:10px;right:auto;font-size:14px}
}
@container workspace (max-width:899px){
 html:root body .workspace-panel .workspace-panel-header{min-height:0!important;padding:6px 10px!important}
 html:root body .workspace-panel .workspace-panel-header h2{font-size:12px!important;letter-spacing:.08em!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 html:root body .workspace-panel .workspace-panel-actions button{width:30px!important;height:30px!important;font-size:16px!important}
 html:root body .workspace-panel .v2-player>.player-header{display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center;padding:6px 8px!important;gap:6px!important}
 html:root body .workspace-panel .v2-player>.player-header .view-question{display:none!important}
 html:root body .workspace-panel .v2-player>.player-header{grid-template-columns:minmax(0,1fr)!important}
 html:root body .workspace-panel .v2-player .mode-intro[data-v2]{flex-direction:row!important;flex-wrap:nowrap!important;justify-content:flex-start!important}
 html:root body .workspace-panel .v2-player .mode-intro[data-v2] p{flex:1 1 auto;min-width:0;text-align:left}
 html:root body .workspace-panel .v2-mode-toggle button{padding:5px 11px}
 html:root body .workspace-panel .v2-player>.player-header .player-tabs{justify-self:end;flex-wrap:nowrap}
 html:root body .workspace-panel .v2-player>.player-header .player-tabs button{padding:6px 8px!important;font-size:11px!important;white-space:nowrap}
 html:root body .workspace-panel .v2-player .mode-intro[data-v2]{display:flex!important;align-items:center;margin-bottom:6px!important;padding:4px 8px!important;font-size:12px}
 html:root body .workspace-panel .v2-player .mode-intro[data-v2] p{font-size:12px!important}
 html:root body .workspace-panel .v2-player .desmos-player-grid{grid-template-rows:minmax(220px,52%) minmax(0,1fr)!important}
 html:root body .workspace-panel .v2-question{flex-shrink:0!important;min-height:34px}
 html:root body .workspace-panel .v2-question[open]{flex-shrink:1!important}
 html:root body .workspace-panel .v2-side{gap:6px}
 html:root body .workspace-panel .v2-footer .desmos-controls>button{min-height:40px!important;white-space:nowrap;font-size:13px!important}
 html:root body .workspace-panel .v2-footer{gap:6px}
}
@container workspace (max-width:520px){
 html:root body .workspace-panel .v2-player>.player-body{padding:6px!important}
 html:root body .workspace-panel .v2-player .desmos-player-grid{grid-template-rows:minmax(200px,44%) minmax(0,1fr)!important;gap:6px!important}
 html:root body .workspace-panel .v2-footer .desmos-step-nav button{min-width:30px!important;min-height:30px!important;width:30px;height:30px}
}

/* The workspace panel keeps its dark styling in both site themes, so no light-mode overrides are needed. */

@media (prefers-reduced-motion:reduce){.v2-result{animation:none}.v2-trying .desmos-full-entry code,.v2-trying .desmos-current-copy{transition:none}}

/* Typing reveal: a row's results fade in once its math has been typed out (explanation-v2.js). */
@keyframes v2-reveal-after{from{opacity:0}to{opacity:1}}
@keyframes v2-caret-out{from{opacity:1}to{opacity:0}}
.v2-caret{position:absolute;left:0;top:0;width:2px;height:20px;margin-left:1px;border-radius:1px;background:var(--v2-focus,#2f72dc);pointer-events:none;z-index:2;transition:none}
.v2-caret.v2-caret-done{opacity:0;transition:opacity .2s linear .1s}
