/* V47 UI correction layer.
   Architecture rule: presentation only. No learning/query/score/statistics logic lives here. */
:root{--mw-v47-night:#241452;--mw-v47-gold:#d8b777;--mw-v47-paper:#f7e7c6}
html{background:#241452}
body.student-active{background:#241452}
/* Mode switch remains one app / one runtime; move it to the left edge as the current product decision. */
#modeSwitch{right:auto!important;left:0!important;top:34%!important;flex-direction:column;gap:4px;transform:translateX(-1px);font-size:11px}
#modeSwitch button{border-radius:0 12px 12px 0!important;padding:8px 7px!important;background:#f5e4c4ed!important;box-shadow:0 3px 12px #0c061d66}
#modeSwitch button[aria-pressed=true]{background:#6f4c91!important;color:#fff0d0!important}
/* Student library: keep current approved art, but all content is rendered by R17 StudentLibrary. */
#studentLibrary .sl-list{background:#f5e3bf url("student-ui/assets/list_fullbleed_r24.b6a3105a39430cc5b.webp") center/100% 100% no-repeat;border:0;border-radius:0;padding:clamp(10px,2.5vw,14px);box-shadow:none}
#studentLibrary .sl-book{background-image:url("assets/shared/3151cd9c76efff5b468122af.webp");width:min(100%,420px);filter:drop-shadow(0 10px 18px #0a061e88)}
#studentLibrary .sl-word{font-family:Georgia,'Times New Roman',serif;font-size:clamp(24px,7.5vw,37px);font-weight:700}
#studentLibrary .sl-meaning{font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;font-weight:400;color:#554451}
#studentLibrary .sl-grade-bar button{position:relative;min-width:54px;background:transparent!important;border:0!important;color:#5c4165!important;padding-top:42px;box-shadow:none!important}
#studentLibrary .sl-grade-bar button::before{content:'';position:absolute;top:0;left:50%;width:42px;height:42px;transform:translateX(-50%);background:center/contain no-repeat}
#studentLibrary .sl-grade-bar [data-value=good]::before{background-image:url("student-ui/assets/btn_good.b6a3105a39430cc5b.webp")}
#studentLibrary .sl-grade-bar [data-value=bad]::before{background-image:url("student-ui/assets/btn_bad.b6a3105a39430cc5b.webp")}
#studentLibrary .sl-grade-bar [data-value=undo]::before{background-image:url("student-ui/assets/btn_undo.b6a3105a39430cc5b.webp")}
/* Rule detail reuses the R17 rule object; only the presentation becomes the preferred parchment. */
#studentLibrary .sl-rule-shade{background:#11082ed9;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px)}
#studentLibrary .sl-rule-dialog{position:relative;width:min(88vw,370px);height:min(88dvh,760px);max-height:760px;aspect-ratio:1/2;border:0;border-radius:0;padding:13% 16% 12%;background:transparent url("student-ui/assets/rule_scroll.b6a3105a39430cc5b.webp") center/contain no-repeat;color:#4d3624;box-shadow:none}
#studentLibrary .sl-rule-dialog::before{content:'';position:absolute;inset:0;pointer-events:none}
#studentLibrary .sl-rule-dialog>*{position:relative;z-index:1}
#studentLibrary .sl-rule-dialog>[data-sl=rule-close]{margin-top:auto}
/* Dictation: R17 original controls/events remain in the DOM; only the scene/container art changes. */
body.student-active[data-student-page=dictate] .ss-dict-workspace{background:#241452 url("student-ui/assets/dictation/castle_scene.b6a3105a39430cc5b.webp") center/cover no-repeat;border-radius:0}
body.student-active[data-student-page=dictate] .ss-dict-board{background-image:url("student-ui/assets/dictation/board.b6a3105a39430cc5b.webp");width:min(96%,calc((100dvh - 170px - env(safe-area-inset-top) - env(safe-area-inset-bottom))* .6666667));max-width:520px}
body.student-active[data-student-page=dictate] .ss-builder-handle{background:#694788;color:#fff0cc;border-color:#d6aa70;box-shadow:0 0 12px #8b65b866}
body.student-active[data-student-page=dictate] #ssBuilderDrawer{background:#f6e5c3 url("student-ui/assets/dictation/drawer_parchment.b6a3105a39430cc5b.webp") center/100% 100% no-repeat;border:0;box-shadow:0 12px 28px #09041daa}
body.student-active[data-student-page=dictate] .ss-output-actions .dictation-top-actions button{background:#f7e7c8;border-color:#b98b58;color:#5b3b62}
/* Growth: keep the R17 live statistic DOM and current observatory presentation. */
body.student-active[data-student-page=growth] .ss-growth{background:#241452 url("student-ui/assets/starfield_bg.b6a3105a39430cc5b.webp") center/cover no-repeat}
body.student-active[data-student-page=growth] .ss-observatory-sheet{background:#f7e7c6 url("student-ui/assets/growth/growth_scroll_3x5.b6a3105a39430cc5b.webp") center/100% 100% no-repeat;border:0;box-shadow:none;color:#543b31}
/* Integration notice is development-only; keep it readable without covering nav. */
#integrationNotice{bottom:calc(env(safe-area-inset-bottom) + 72px)!important;left:12%!important;right:12%!important;border-radius:10px;padding:4px 8px;opacity:.9}
/* The category overlay is presentation state inside StudentLibrary; its directory data still comes from HandbookNavigation. */
#studentLibrary .v47-rule-stage{left:50%;top:50%;width:min(88vw,390px);height:min(132vw,585px);max-height:78dvh;transform:translate(-50%,-50%);animation:v47RuleLift .42s cubic-bezier(.2,.8,.2,1) both}
@keyframes v47RuleLift{from{opacity:.2;transform:translate(-50%,-46%) scale(.72)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
#studentLibrary .sl-resume-overlay{position:absolute;z-index:6;left:50%;bottom:2.2%;transform:translateX(-50%);width:auto;min-height:32px;padding:4px 12px;font-size:10px;background:#f7e6c6dd;color:#51365f;border:1px solid #c69d67;border-radius:14px}

/* V53: foreground detail owns input; hidden directory retains its place. */
#studentLibrary .sl-rule-shade{position:fixed;inset:0;z-index:90;background:#110d24e8}
#studentLibrary .sl-rule-dialog{--sl-scroll-width:min(88vw,370px,44dvh);width:var(--sl-scroll-width);height:calc(var(--sl-scroll-width)*2);max-height:88dvh;padding:calc(var(--sl-scroll-width)*.30) calc(var(--sl-scroll-width)*.17) calc(var(--sl-scroll-width)*.22)}
#studentLibrary .rule-overlay[hidden]{display:none!important}
#studentLibrary .rule-directory-list button{background:#fff0d3e8;color:#49324f;border-color:#bea37d}
#studentLibrary .rule-directory-list .rule-info small{color:#6f5862}
#studentLibrary .rule-directory-return{background:#6c4888;color:#fff3dc;min-height:40px}
