.study-nav{display:flex;gap:6px;align-items:center;border:1px solid var(--line);background:#eceee3;border-radius:15px;padding:5px;width:max-content;max-width:100%;margin:24px 0 30px}.study-nav button,.editor-tabs button,.journal-filters button{border:0;background:transparent;border-radius:10px;color:var(--muted);padding:10px 20px;min-height:44px;font:inherit;font-size:13px}.study-nav button[aria-current],.editor-tabs button[aria-pressed=true]{background:var(--white);box-shadow:0 2px 3px #183f3609;color:var(--ink);font-weight:500}.study-nav button>span{margin-inline-start:9px}.count{background:#dce5d6;border-radius:6px;font-size:11px;padding:0 6px}.study-editor{position:sticky;top:22px}.study-editor h2{font-size:20px;margin:0}.editor-tabs{display:flex;gap:3px;background:#f0f1e7;border-radius:10px;padding:3px;margin:16px 0}.editor-tabs button{flex:1;font-size:12px;padding:7px}.symbol-tools{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.symbol-tools button{border:1px solid #dfe3d7;border-radius:7px;background:var(--white);padding:3px 10px;min-height:34px;color:var(--ink);font-family:inherit;font-size:12px}.symbol-tools button[data-symbol]{direction:ltr;font-family:Georgia,serif}.symbol-tools button:hover{background:#e9eee2}#study-answer{min-height:300px;font-size:16px}.answer-preview{min-height:300px;padding:17px;border:1px solid #dce0d6;border-radius:13px;background:#fcfcf7;overflow-wrap:anywhere;white-space:pre-wrap}.answer-preview mjx-container{white-space:normal}.self-check{border-top:1px dashed var(--line);padding:14px 0 0;margin-top:8px}.self-check summary{cursor:pointer;font-size:13px;display:flex;justify-content:space-between;gap:12px;list-style:none}.self-check summary::after{content:'+';margin-inline-start:auto}.self-check[open] summary::after{content:'−'}.self-check summary>span{font-size:11px;color:var(--muted)}.self-check .quiet{margin:8px 0}.self-check label{display:flex;gap:9px;align-items:flex-start;font-size:12px;padding:7px 0;cursor:pointer}.self-check input{accent-color:var(--ink);margin-top:7px;width:15px;height:15px;flex-shrink:0}.editor-actions{display:flex;justify-content:space-around;gap:6px;flex-wrap:wrap;margin-top:8px}.editor-actions button{margin:0;font-size:11px}.local-note{font-size:11px;color:var(--muted);line-height:1.9;margin:10px 0 0}.explore-card summary{display:flex;justify-content:space-between;align-items:center;cursor:pointer;list-style:none}.explore-card summary>span:first-child{display:flex;flex-direction:column;gap:4px}.explore-card summary strong{font-size:19px;font-weight:500;color:var(--ink)}.details-arrow{font-size:23px;color:#91a182}.explore-card[open] .details-arrow{transform:rotate(45deg)}.explore-card .helper{margin:16px 0}.explore-card svg{width:100%;display:block;overflow:visible;direction:ltr}.explore-card svg text{font:12px Georgia,serif;fill:#49634a}.explore-card svg .svg-area{font:20px Georgia,serif;fill:var(--ink)}.slider-label{display:flex;justify-content:space-between;font-size:12px;margin-top:15px}.slider-label bdi{font-family:Georgia,serif;font-size:15px}#length-slider{width:100%;accent-color:var(--ink);cursor:pointer;min-height:34px;margin:0}.slider-ends{direction:ltr;display:flex;justify-content:space-between;font-size:10px;color:var(--muted)}.explore-values{display:flex;justify-content:space-between;gap:8px;border-top:1px solid var(--line);padding-top:12px;margin-top:12px;font-size:12px}.explore-values bdi{font-family:Georgia,serif;margin-inline-start:6px}.explore-observation{font-size:12px;color:#506b4f;line-height:1.9;background:#eef2e7;border-radius:9px;padding:9px 12px}.hints-card h2{margin:4px 0 10px;font-size:19px;font-weight:500}.hints-card .text-button{margin:0;padding:4px 0}.hints-card .helper{min-height:50px;margin-bottom:8px}.journal-heading{display:flex;justify-content:space-between;gap:15px;align-items:center}.journal-heading h2{font-size:28px;margin:4px 0}.journal-heading .button{width:auto;white-space:nowrap;align-self:flex-start}.journal-search{width:100%;font:inherit;font-size:14px;background:var(--white);color:var(--text);border:1px solid var(--line);border-radius:12px;min-height:49px;padding:11px 16px;margin:6px 0 14px}.journal-search:focus{outline:2px solid #517b63;outline-offset:1px}.journal-filters{display:flex;gap:6px;flex-wrap:wrap}.journal-filters button{border:1px solid var(--line);font-size:12px;padding:6px 14px;min-height:38px}.journal-filters button[aria-pressed=true]{background:var(--ink);color:var(--white);border-color:var(--ink)}.journal-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.journal-entry{display:flex;flex-direction:column;gap:9px;padding:22px;min-width:0}.journal-entry .entry-top{display:flex;justify-content:space-between;align-items:center;gap:10px}.journal-entry h3{font-size:16px;font-weight:500;margin:0;color:var(--ink)}.journal-entry .entry-preview{font-size:13px;line-height:1.9;color:var(--muted);margin:0;overflow-wrap:anywhere;white-space:pre-wrap;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.journal-entry .entry-meta{font-size:10px;color:var(--muted);margin:0;overflow-wrap:anywhere}.journal-entry button{margin:4px 0 0;align-self:flex-start;padding:5px 0}.journal-empty{text-align:center;padding:45px 20px;background:#eeeee2;border:1px dashed #d8ddcc;border-radius:16px;color:var(--muted);font-size:14px}.study-boundary{display:flex;align-items:center;gap:13px;border-top:1px solid var(--line);margin-top:32px;padding-top:22px;color:var(--muted)}.study-boundary>span{font-size:25px;color:#9baf8f}.study-boundary p{font-size:11px;line-height:1.9;margin:0;flex:1}.study-boundary a{flex-shrink:0;font-size:11px}dialog{border:1px solid var(--line);border-radius:22px;background:var(--white);color:var(--text);width:min(620px,calc(100% - 32px));max-height:85dvh;padding:26px;box-shadow:0 25px 80px #183f3626}dialog::backdrop{background:#183f3666;backdrop-filter:blur(3px)}dialog h2{font-size:19px;margin:0}dialog pre{font:15px/2 Plex,'Segoe UI',sans-serif;white-space:pre-wrap;overflow-wrap:anywhere;border:1px solid var(--line);background:#f8f8f0;border-radius:12px;padding:17px;max-height:42dvh;overflow:auto}.close-button{border:0;border-radius:50%;width:34px;height:34px;background:#eef0e5;color:var(--ink);font-size:24px}.study-boundary+.footer{margin-top:20px}@media(max-width:760px){.study-nav{width:100%;margin:20px 0 23px}.study-nav button{flex:1;padding:9px 10px;font-size:12px}.study-editor{position:static}#study-answer,.answer-preview{min-height:270px}.study-editor .card-top{gap:6px}.study-editor h2{font-size:18px}.study-editor .saved-label{font-size:9px}.journal-heading{align-items:flex-start}.journal-heading h2{font-size:23px}.journal-heading .button{font-size:11px;min-height:42px;padding:8px 12px}.journal-list{grid-template-columns:1fr}.journal-entry{padding:20px}.study-boundary{flex-wrap:wrap;gap:8px}.study-boundary p{min-width:220px}.study-boundary a{margin:0;flex-basis:100%;text-align:right}.explore-card svg{max-height:235px}.editor-actions button{min-height:44px}.answer-preview{font-size:15px}dialog{padding:20px}.self-check label{padding:9px 0}}
.jump-editor{margin-top:18px}
/* Only reading fragments change direction/containment; the editor and layout
   retain their existing geometry. Long formulae scroll within their card. */
.math-reading{min-width:0}
.study-editor{min-width:0}
.math-fragment{direction:ltr;unicode-bidi:isolate;display:inline-block;max-width:100%;vertical-align:middle;white-space:normal;overflow-x:auto;overflow-y:hidden}
.math-fragment.math-display{display:block;text-align:center}
.math-fragment mjx-container[jax=SVG]{max-width:none}
.math-fragment mjx-container svg{max-width:none}
.math-fragment.math-display mjx-container{display:block;width:max-content;margin-inline:auto!important;padding-block:2px}
.journal-entry .entry-preview.math-reading:has(.math-fragment){display:block;-webkit-line-clamp:unset}

/* Arabic prose keeps its direction and baseline; equations are isolated LTR.
   A display block replaces one adjacent source break in the reading layer. */
.math-reading{unicode-bidi:isolate;text-align:start}
.math-fragment{vertical-align:baseline;overflow:visible}
.math-fragment.math-display{overflow-x:auto;overflow-y:hidden;padding-block:2px}
.math-fragment.math-overflow{overflow-x:auto;overflow-y:hidden;vertical-align:middle;padding-block:2px}
.math-source-literal{direction:ltr;unicode-bidi:isolate;white-space:pre-wrap;overflow-wrap:anywhere}
.math-punctuation{font-family:Plex,'Segoe UI',sans-serif}
.math-layout-break{display:none}
.math-fragment:has(>.math-punctuation){white-space:nowrap}

.math-fragment.math-display{white-space:nowrap}
.math-display>.math-content{display:inline-block}
.math-display>.math-punctuation{display:inline-block}
.math-fragment.math-display mjx-container{display:inline-block;width:auto;margin-inline:0!important}

/* The surrounding cards keep their geometry. Text and inline math share the
   former answer area; keyboard space exists only while the panel is open. */
.visual-document{position:relative;min-height:300px;padding:17px;border:1px solid #dce0d6;border-radius:13px;background:#fcfcf7;font:16px/2 Plex,'Segoe UI',sans-serif;color:var(--text);outline:none;white-space:pre-wrap;overflow-wrap:anywhere;word-wrap:break-word;font-variant-ligatures:none}
.visual-document:focus-within,.visual-document:focus{outline:2px solid #517b63;outline-offset:1px}
.visual-document p{margin:0;min-height:2em;direction:rtl;unicode-bidi:isolate;text-align:start}
.visual-document:has(>p:only-child>br:only-child)::before{content:attr(data-placeholder);color:var(--muted);pointer-events:none;float:right;height:0}
.visual-document .ProseMirror-selectednode{outline:2px solid #8da586;border-radius:5px}
.visual-document .visual-math{display:inline-block;direction:ltr;unicode-bidi:isolate;vertical-align:baseline;max-width:100%;margin-inline:3px;white-space:nowrap}
.visual-math math-field{display:inline-block;direction:ltr;max-width:100%;min-width:38px;padding:2px 4px;border:1px solid #dfe5d9;border-radius:7px;background:#f4f6ee;color:var(--ink);font-size:1.1em;--caret-color:#153f36;--selection-background-color:#dce8dc;--contains-highlight-background-color:#e3ebdb}
.visual-math math-field::part(menu-toggle),.visual-math math-field::part(virtual-keyboard-toggle){display:none}
.visual-math math-field:focus-within{border-color:#517b63}
.visual-document .ProseMirror-hideselection *::selection{background:transparent}
.visual-document .ProseMirror-gapcursor{display:none}
#continue-prose{background:#e9eee2;color:var(--ink)}
.symbol-tools button{min-height:38px}
body{--keyboard-accent-color:#153f36;--keyboard-toolbar-background:#eef1e7;--keyboard-toolbar-text:#244c40;--keycap-background:#fffefa;--keycap-text:#244c40;--keycap-primary-background:#153f36;--keycap-primary-text:#fffefa;--keycap-height:42px;--keycap-font-size:19px;--keycap-gap:3px;--keyboard-zindex:1000}
body.study-keyboard-open{padding-bottom:calc(var(--study-keyboard-height,0px) + 24px)}
@media(max-width:760px){.visual-document{min-height:270px;font-size:16px}.symbol-tools button{min-height:42px;padding-inline:9px}}

/* Scoped additions inside the existing question and answer cards. */
.problem-picker{display:flex;flex-direction:column;gap:5px;margin-bottom:18px}.problem-picker label{font-size:11px;color:var(--muted)}
.problem-picker select,.review-controls select,#review-step-picker{font:inherit;font-size:12px;min-height:44px;max-width:100%;min-width:0;color:var(--ink);background:#fcfcf7;border:1px solid var(--line);border-radius:9px;padding:8px 11px}
#problem-source{margin:10px 0;font-size:10px}.ladder-question{width:100%;max-width:200px;min-width:0;direction:ltr}.ladder-question text{font:14px Georgia,serif;fill:#49634a}
.step-review{border-top:1px dashed var(--line);margin:12px 0 20px;padding-top:15px;min-width:0}.step-review h3{font-size:15px;font-weight:500;color:var(--ink);margin:0 0 5px}.step-review>.quiet{font-size:11px;margin:5px 0 9px}
.review-controls{display:flex;gap:8px;align-items:stretch}.review-controls select{flex:1;width:0}.review-controls .button{width:auto;min-height:44px;white-space:nowrap;margin:0;padding:8px 14px;font-size:12px}
#review-picker-wrap{font-size:12px;margin-top:10px}#review-picker-wrap label{display:block}#review-step-picker{width:100%;margin-top:5px}
#review-output{margin-top:12px;background:#f1f4eb;border-inline-start:3px solid #809b77;border-radius:10px;padding:13px;min-width:0;overflow-wrap:anywhere}#review-output[data-outcome=NEEDS_REVIEW]{background:#f8f1e9;border-color:#af8864}
#review-output h4,.entry-review h3{font-size:15px;color:var(--ink);font-weight:500;margin:5px 0 10px}#review-output p,.entry-review p{font-size:12px;line-height:1.9;margin:8px 0}#review-output .quiet{font-size:10px}#review-output .text-button{font-size:12px;margin:5px 0}
.review-quote{background:#fffefa;border-radius:8px;padding:9px;min-width:0}.review-original{font-size:10px;color:var(--muted);margin-top:9px}.review-original summary{cursor:pointer}.review-original pre{font:12px/1.7 monospace;direction:ltr;unicode-bidi:isolate;white-space:pre-wrap;overflow-wrap:anywhere;background:#fffefa;padding:8px;border-radius:7px;max-height:120px;overflow:auto}
.entry-review{border-top:1px dashed var(--line);padding-top:10px;margin-top:14px}.review-controls select:focus,.problem-picker select:focus{outline:2px solid #517b63;outline-offset:1px}
@media(max-width:380px){.review-controls{flex-wrap:wrap}.review-controls select{flex-basis:100%;width:100%}.review-controls .button{width:100%}}

/* Unit contexts reuse the same cards and controls. */
.unit-coverage{font-size:10px;color:var(--muted);line-height:1.8}
.unit-study-note{font-size:11px;line-height:1.9;background:#f0f3e9;border-inline-start:2px solid #9baf8f;padding:9px 11px;border-radius:7px;margin:10px 0 15px}
.unit-question-svg{width:100%;max-width:210px;min-width:0;direction:ltr;flex-shrink:1}.unit-question-svg text{font:12px Georgia,serif;fill:#49634a}
.question-visual:has(.unit-question-svg) .givens{min-width:0;flex:1}.question-visual:has(.unit-question-svg) .givens>div{margin-block:5px}.question-visual:has(.unit-question-svg) .givens span{display:block;font-size:9px;direction:rtl}.question-visual:has(.unit-question-svg) [data-tex]{direction:ltr;unicode-bidi:isolate;max-width:100%;overflow-x:auto}
.explore-values>span{min-width:0;overflow-wrap:anywhere}
/* The approved chapter plots stay within the existing illustration area. */
.chapter-question-svg{max-width:100%}.chapter-question-svg:has(+.givens){max-width:210px}
.chapter-plot-content{overflow:hidden!important;direction:ltr;unicode-bidi:isolate;max-width:100%}
.question-visual:has(.chapter-question-svg){min-width:0}.question-card[data-problem-id^="book-2025-3-"] .edition{overflow-wrap:anywhere}
.rectangle-journey{margin:18px 0;padding:16px;background:#eef2e7;border:1px solid #dfe5d6;border-radius:14px;min-width:0}.rectangle-journey h3{font-size:18px;margin:4px 0}.rectangle-journey h4{font-size:16px;margin:17px 0 6px}.rectangle-journey p{line-height:1.9}.rectangle-stages{list-style:none;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:14px 0}.rectangle-stages li{min-width:0}.rectangle-stages button{width:100%;min-height:44px;text-align:start;white-space:normal;border:1px solid #d8dfcf;border-radius:9px;background:#fbfcf7;color:var(--ink);padding:9px;font:inherit;font-size:13px}.rectangle-stages button[aria-current=step]{border-color:#618267;background:#fff;box-shadow:inset 0 0 0 1px #618267}.rectangle-stages span{display:block;font-size:11px;line-height:1.8;color:var(--muted);padding:3px}.rectangle-followup{margin:14px 0;padding:14px;background:#f0f3e9;border-radius:12px;min-width:0}.rectangle-followup>button{max-width:100%;white-space:normal;margin:4px 0}.rectangle-followup [data-state=CHECKED]{color:#184f40}.rectangle-followup [data-state=PARTIAL],.rectangle-followup [data-state=TASK_MISMATCH]{color:#795b35}.rectangle-followup summary{cursor:pointer;min-height:44px;padding-block:10px;font-size:13px}.rectangle-followup ol{padding-inline-start:20px}.rectangle-followup li{padding:8px 0;border-top:1px dashed #d8dfcf;font-size:12px;line-height:1.9;overflow-wrap:anywhere}.rectangle-history-quote{padding:8px;background:#fff;border-radius:8px;min-width:0;overflow-x:auto}.rectangle-history-quote .math-source-literal{white-space:pre-wrap}.rectangle-followup .quiet,.rectangle-journey .quiet{font-size:12px}

.rectangle-journey #rectangle-stage-prompt{font-size:15px;line-height:1.85;margin:10px 0}.rectangle-journey #rectangle-steps>summary{display:flex;justify-content:space-between;align-items:center;min-height:44px;cursor:pointer;font-size:13px;border-bottom:1px solid #dce4d3}.rectangle-journey #rectangle-stage-limit{line-height:1.8}.rectangle-followup #rectangle-stage-status{font-size:14px;line-height:1.9}.rectangle-journey .section-tag{font-size:11px}
