/* Visual polish layer. Scoped to library, course navigation and shared dialogs. */
:root{--mr-bg:#f7f8fa;--mr-surface:#fff;--mr-ink:#202632;--mr-muted:#586474;--mr-border:#e0e4ea;--mr-accent:#a52850;--mr-accent-soft:#fcf1f4;--mr-blue:#3157bc;--mr-soft:#f3f5f8;--mr-ring:#3157bc;--mr-latin:"Segoe UI",Arial,sans-serif}
html[data-theme=light] body.mr-library,html[data-theme=light] body.mr-study{background:var(--mr-bg)!important;color:var(--mr-ink)}
html[data-theme=dark]{--mr-soft:var(--theme-subtle);--mr-ring:#a5c2ff}
html[data-theme=dark][data-color-mode=black]{--theme-bg:#101113;--theme-surface:#191b1f;--theme-subtle:#22252a;--theme-control:#25282d;--theme-hover:#30343b;--theme-border:#393d44;--theme-border-subtle:#393d44;--theme-border-table:#41454d;--theme-border-control:#50555f;--theme-muted:#b9bec7;--theme-text:#f1f2f4;--theme-fa:#e5e7eb;--theme-image-bg:#222427;--theme-control-text:#f1f2f4;--theme-subtle-text:#e9ebef;--theme-footer:#191b1f;--theme-table-heading:#292c32;--theme-table-cell:#202328}
body.mr-library .shell{max-width:1420px;padding:25px 48px 44px}
.mr-library .masthead{gap:28px;margin-bottom:0;padding-bottom:20px;align-items:center}
.mr-library .brand{flex:0 0 auto;gap:11px}.mr-library .brand-mark{width:43px;height:43px}.mr-library .brand-name{font-size:26px;letter-spacing:-.045em}.mr-library .brand-caption{font-size:8.5px;letter-spacing:.13em}
.mr-library .library-heading{flex:1;display:flex;justify-content:center;align-items:center;gap:25px}.mr-library .library-heading h1{font-size:14px;font-weight:700;white-space:nowrap;color:var(--mr-ink)}.mr-library .library-heading a{font-size:13px;color:var(--mr-muted);text-decoration:none;white-space:nowrap}.mr-library .library-heading a:hover{color:var(--mr-accent)}
.mr-library .library-actions :is(button,select){min-height:40px;font-size:13px;font-weight:600;background:var(--mr-surface);color:var(--mr-ink);border:1px solid var(--mr-border);border-radius:8px;box-shadow:none}
.mr-library .mr-intro{padding:28px 0 24px;margin:0;align-items:center;border-bottom:1px solid var(--mr-border)}
.mr-library .mr-intro h2{font-size:clamp(23px,2.2vw,32px);line-height:1.5;letter-spacing:-.04em;margin:0 0 5px;font-weight:800}.mr-library .mr-intro p{font-size:14px;line-height:1.9;color:var(--mr-muted)}
.mr-library .mr-index{display:flex;align-items:center;gap:9px;font-size:12px;color:var(--mr-muted);border:1px solid var(--mr-border);border-radius:8px;background:var(--mr-surface);padding:10px 14px;white-space:nowrap}.mr-library .mr-index:before{content:"";width:7px;height:7px;border-radius:50%;background:var(--mr-accent)}
.mr-library .mr-section-title{margin:24px 0 13px}.mr-library .mr-section-title h2{font-size:19px;font-weight:750}.mr-library .mr-section-title span{font-size:12px}
.mr-library .books{gap:16px}.mr-library .book{border-radius:12px;overflow:hidden;box-shadow:none;transition:transform .18s,border-color .18s,box-shadow .18s}.mr-library .book.active{border-color:var(--mr-border);box-shadow:none}.mr-library .book.active:hover{border-color:var(--mr-accent);box-shadow:0 8px 24px #2026320c;transform:translateY(-3px)}
.mr-library .cover-wrap{aspect-ratio:3/4;background:#f0efed;padding:12px 12px 0}.mr-library .cover-wrap img{width:100%;height:100%;object-fit:contain;border-radius:2px;filter:none}
.mr-library .book-info{padding:14px 13px 12px;gap:4px}.mr-library .level{font-size:16px;font-weight:750;line-height:1.45}.mr-library .type{font-size:12px;color:var(--mr-muted)}
.mr-library .book-footer{border:0;margin-top:9px;min-height:36px;border-radius:7px;padding:7px 10px;background:var(--mr-accent-soft)!important;color:var(--mr-accent);font-size:12px;line-height:1.6}.mr-library .open-arrow{font-size:15px}.mr-library .book:hover .book-footer{background:var(--mr-accent)!important;color:#fff!important}
.mr-library .handout-book{grid-template-columns:108px minmax(0,1fr);min-height:150px}.mr-library .handout-book .cover-wrap{min-height:150px;padding:10px}.mr-library .handout-book .book-info{padding:15px 18px}.mr-library .handout-book .book-footer{border-radius:7px}.mr-library .handout-book .level{font-size:17px}
.mr-library .contact{background:var(--mr-surface)!important;border:1px solid var(--mr-border);color:var(--mr-ink)!important;margin-top:24px;padding:20px 23px}.mr-library .contact h2{font-size:17px}.mr-library .contact p,.mr-library .contact-id{color:var(--mr-muted)!important}.mr-library .telegram{background:var(--mr-accent)!important;color:#fff!important;border-color:var(--mr-accent);font-size:13px}.mr-library .contact-id{margin-top:4px}
.mr-library .seo-overview{font-size:13px;line-height:1.95}.mr-library .seo-overview nav{display:flex;flex-wrap:wrap;direction:ltr;background:transparent!important;gap:14px}
/* Purchase banner and dialogues: same visual language as the library, not a second green theme. */
body .book-access-bar,body .book-access-dialog,body .book-access-gate{background:var(--mr-surface)!important;border-color:var(--mr-border)!important;color:var(--mr-ink)!important;box-shadow:none}
body .book-access-bar{padding:14px 17px;margin-bottom:19px;gap:14px;border-radius:10px}body .book-access-bar p{font-weight:700;font-size:14px;line-height:1.8}body .book-access-bar small{color:var(--mr-muted)!important;font-size:12px}body .book-access-badge{background:var(--mr-accent-soft)!important;color:var(--mr-accent)!important;font-size:11px;padding:3px 8px}
body .book-access-primary{background:#a52850!important;border-color:#a52850!important;color:#fff!important;font-weight:700;box-shadow:none!important;border-radius:8px!important}body .book-access-primary:hover{background:#872041!important}body .book-access-bar-actions{gap:8px}body .book-notice-close{font-size:19px;border:0!important;background:transparent!important;color:var(--mr-muted)!important}
body :is(.book-access-dialog,.account-dialog31){background:var(--mr-surface)!important;color:var(--mr-ink)!important;border:1px solid var(--mr-border)!important;border-radius:14px;padding:24px;box-shadow:0 20px 70px #10182835}body :is(.book-access-dialog,.account-dialog31)::backdrop{background:#10182885;backdrop-filter:blur(2px)}
body .book-access-dialog-head h2{font-size:20px;font-weight:800}body .book-access-festival,body .book-access-price-note{background:var(--mr-soft)!important;color:var(--mr-ink)!important;border-color:var(--mr-border)!important;border-radius:9px}body .book-access-plan{background:var(--mr-surface)!important;color:var(--mr-ink)!important;border-color:var(--mr-border)!important;border-radius:9px;padding:13px 15px}body .book-access-plan:has(input:checked){border-color:var(--mr-accent)!important;background:var(--mr-accent-soft)!important;box-shadow:0 0 0 1px var(--mr-accent)}body .book-access-dialog .book-access-plan input[type=radio]{accent-color:#a52850}body :is(.book-access-plan-body small,.book-access-pay-note,.book-access-prices-caption){color:var(--mr-muted)!important}body .book-access-total{border-color:var(--mr-border)}body .book-access-total strong{color:var(--mr-ink)!important}
/* Study workspace */
.mr-study .top{padding:12px 24px;background:var(--mr-surface);gap:9px;border-bottom:1px solid var(--mr-border);box-shadow:none}.mr-study .top h1{font-size:19px;font-weight:750;color:var(--mr-ink);letter-spacing:-.03em}.mr-study .top :is(button,select,.book-return,.library-back,.top-settings>summary){border-radius:8px;border-color:var(--mr-border);color:var(--mr-ink);background:var(--mr-surface);font-size:13px;min-height:40px;font-weight:600;box-shadow:none}.mr-study .top :is(.library-back,.book-return){color:var(--mr-blue)}.mr-study .top-settings{margin:0;box-shadow:none;border:0}.mr-study .top-settings>summary{display:flex;align-items:center;padding:8px 12px;border:1px solid var(--mr-border)}
.mr-study #sectionNav21{padding:0 24px;background:var(--mr-surface);gap:4px;display:flex;align-items:stretch;overflow-x:auto;scrollbar-width:thin;box-shadow:none;border-bottom:1px solid var(--mr-border)}
.mr-study #sectionNav21 button{width:auto!important;min-height:47px;border:0!important;border-bottom:2px solid transparent!important;background:transparent!important;color:var(--mr-muted)!important;border-radius:0!important;font-weight:600;white-space:nowrap;margin:0!important;padding:8px 13px!important;font-size:14px;box-shadow:none!important;flex-shrink:0}
.mr-study #sectionNav21 button:is(.active,[aria-selected=true],.active-tab){border-bottom-color:var(--mr-blue)!important;color:var(--mr-blue)!important;font-weight:750}.mr-study #sectionNav21 button:hover{background:var(--mr-soft)!important;color:var(--mr-ink)!important}
.mr-study .layout{max-width:1500px}.mr-study .layout>nav{border-color:var(--mr-border);padding:14px 12px;background:var(--mr-surface);border-radius:0}.mr-study .layout>nav button{min-height:42px;border:1px solid transparent;background:transparent;color:var(--mr-ink);font-size:14px;text-align:right;padding:8px 10px;box-shadow:none}.mr-study .layout>nav button:hover{background:var(--mr-soft)}.mr-study .layout>nav button.active{background:var(--m6-surface-e9eefb, #e9eefb)!important;color:#244ba9!important;border-color:var(--m6-border-dce4f8, #dce4f8)!important;font-weight:700;}
html[data-theme=dark] .mr-study .layout>nav button.active{background:var(--theme-control)!important;color:#c0d1ff!important;border-color:var(--theme-border)!important}
.mr-study :is(.a11-main,.b11-main){width:min(1360px,calc(100% - 48px));margin:24px auto 40px;max-width:1360px}.mr-study .main{padding:20px;max-width:1240px}
.mr-study :is(.panel,.hero){background:var(--mr-surface);border:1px solid var(--mr-border);border-radius:12px;box-shadow:none;padding:22px}.mr-study :is(.panel,.hero) h2{font-size:1.38em;font-weight:750;line-height:1.45}.mr-study :is(.panel,.hero) .muted{color:var(--mr-muted)}
.mr-study :is(.search,input[type=search]){border:1px solid var(--mr-border);border-radius:8px;min-height:44px;padding:9px 13px;background:var(--mr-surface);color:var(--mr-ink);margin-bottom:14px}
.mr-study :is(#vocabPane,#vocabSection,#vocab,#words,.vocab-grid) .card,.mr-study #vocabPane .grid .card{background:var(--mr-surface);border-color:var(--mr-border);border-radius:11px;box-shadow:none;padding:16px;min-width:0}.mr-study :is(#vocabPane,#vocabSection) .grid{gap:12px;grid-template-columns:repeat(auto-fit,minmax(min(100%,265px),1fr))}
.mr-study .card .de{font-family:var(--mr-latin);font-weight:750;line-height:1.5}.mr-study .card .fa{font-weight:650;line-height:1.9}.mr-study .card .en{color:var(--mr-muted);font-size:.89em;line-height:1.65}.mr-study .card .ex{background:var(--mr-soft);border-radius:7px;padding:9px 11px;line-height:1.65}.mr-study .card .tr{font-weight:500;line-height:1.9;color:var(--mr-muted)}.mr-study .card .row{gap:7px}.mr-study .card .row button{border-radius:7px;min-height:39px;padding:6px 9px;font-size:.85em;box-shadow:none}
.mr-study .flash .face{border-color:var(--mr-border);border-radius:12px;box-shadow:none}.mr-study .flash .front{font-weight:700}
html[data-theme=dark] .mr-library .book-footer{background:var(--mr-accent-soft)!important;color:var(--mr-accent)!important}html[data-theme=dark] .mr-library .book:hover .book-footer{background:#a52850!important;color:white!important}html[data-theme=dark] body .book-access-plan:has(input:checked){background:var(--theme-control)!important}
@media(max-width:1150px){body.mr-library .shell{padding-inline:26px}.mr-library .books{grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.mr-library .cover-wrap{aspect-ratio:3/4}.mr-library .library-heading{gap:14px}.mr-library .library-heading a{font-size:12px}}
@media(max-width:760px){body.mr-library .shell{padding:16px 14px 30px}.mr-library .masthead{display:grid;grid-template-columns:1fr auto;gap:13px;padding-bottom:13px}.mr-library .brand{grid-row:1;grid-column:1;gap:8px}.mr-library .brand-name{font-size:21px}.mr-library .brand-mark{width:35px;height:35px}.mr-library .brand-caption{font-size:7px}.mr-library .library-heading{grid-column:1/-1;grid-row:2;justify-content:flex-start;gap:17px;flex-wrap:wrap}.mr-library .library-heading h1,.mr-library .library-heading a{font-size:12px}.mr-library .library-actions{grid-row:1;grid-column:2;gap:5px;justify-content:flex-end;flex-wrap:nowrap}.mr-library .library-actions :is(button,select){font-size:11px;min-height:36px;padding:6px 7px;max-width:115px}.mr-library .mr-intro{padding:20px 0 18px;align-items:flex-start}.mr-library .mr-intro h2{font-size:24px}.mr-library .mr-intro p{font-size:13px}.mr-library .mr-index{display:none}.mr-library .mr-section-title{margin:20px 0 11px}.mr-library .mr-section-title h2{font-size:17px}.mr-library .books{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.mr-library .cover-wrap{padding:8px 8px 0}.mr-library .book-info{padding:10px}.mr-library .level{font-size:15px}.mr-library .book-footer{font-size:11px;padding:7px}.mr-library .handout-book{grid-template-columns:90px 1fr;min-height:130px}.mr-library .handout-book .cover-wrap{min-height:130px;padding:8px}.mr-library .handout-book .book-info{padding:12px}.mr-library .handout-book .level{font-size:15px}.mr-library .contact{padding:17px}.mr-study .top{padding:10px 12px;position:relative;gap:6px}.mr-study .top h1{font-size:18px}.mr-study .top :is(button,select,.book-return,.library-back,.top-settings>summary){min-height:39px;font-size:12px}.mr-study #sectionNav21{padding:0 10px;top:0;gap:2px}.mr-study #sectionNav21 button{font-size:13px;padding:8px 11px!important;min-height:44px}.mr-study :is(.a11-main,.b11-main){width:calc(100% - 20px);margin:12px auto 30px}.mr-study .main{padding:10px}.mr-study :is(.panel,.hero){padding:14px}.mr-study .layout>nav{padding:9px;grid-template-columns:repeat(3,minmax(0,1fr))}.mr-study .layout>nav button{font-size:12px;overflow-wrap:anywhere}.mr-study :is(#vocabPane,#vocabSection) .grid{grid-template-columns:1fr}body :is(.book-access-dialog,.account-dialog31){padding:16px}}
@media(max-width:420px){.mr-library .masthead{grid-template-columns:1fr;gap:10px}.mr-library .brand{grid-row:1;grid-column:1}.mr-library .library-actions{grid-row:2;grid-column:1;justify-content:flex-start}.mr-library .library-heading{grid-row:3;grid-column:1;gap:18px}.mr-library .library-actions :is(button,select){max-width:none}.mr-library .mr-intro h2{font-size:22px}}
@media(prefers-reduced-motion:reduce){.mr-library .book{transition:none}.mr-library .book:hover{transform:none}}
/* Explicit light palette: override the old blue-gray global theme without suppressing learning states. */
html[data-theme=light] body.mr-study :is(.top,#sectionNav21,.layout>nav,.hero,.panel,details,dialog){background:var(--m6-surface-ffffff, #ffffff)!important;border-color:var(--mr-border)!important;}
html[data-theme=light] body.mr-study .card:not(.state-known):not(.state-review){background:var(--m6-surface-ffffff, #ffffff)!important;border-color:var(--mr-border)!important;}
html[data-theme=light] body.mr-study .card.state-known{background:var(--m6-surface-f2fbf5, #f2fbf5)!important;border-color:#b2dac2!important;}
html[data-theme=light] body.mr-study .card.state-review{background:var(--m6-surface-fff7f7, #fff7f7)!important;border-color:#e9bdbd!important;}
html[data-theme=light] body.mr-study .card .ex{background:var(--m6-surface-f3f5f8, #f3f5f8)!important;}
.mr-study .card .row button:focus-visible{outline:2px solid var(--mr-ring);outline-offset:2px}
.mr-study #sectionNav21 button:is(.active,[aria-selected=true],.active-tab):hover{color:var(--mr-blue)!important}
@media(max-width:760px){.mr-study .top h1{display:block!important;flex:1 1 100%;width:auto;white-space:normal;text-align:left;margin:0 0 4px!important}.mr-study .top .lesson-label{max-width:100%;flex:1 1 100%}.mr-study .top .lesson-label select{width:100%;max-width:100%;min-width:0}}

/* V5.1: restore the first refinement's readable typography; library only. */
body.mr-library .masthead{gap:20px;padding-bottom:22px}
body.mr-library .brand{min-width:0;gap:12px}
body.mr-library .brand-name{font-size:29px;font-weight:800;letter-spacing:-.055em;line-height:1.08;white-space:nowrap}
body.mr-library .brand-caption{font-size:9px;letter-spacing:.11em;line-height:1.5;white-space:nowrap}
body.mr-library .library-heading{gap:18px;min-width:0;flex-wrap:wrap}
body.mr-library .library-heading h1{font-size:21px;font-weight:750;line-height:1.55;letter-spacing:normal}
body.mr-library .library-heading a{font-size:13px;line-height:1.75;font-weight:500;letter-spacing:normal}
body.mr-library .mr-intro{gap:16px}
body.mr-library .mr-intro h2{font-size:clamp(26px,2.4vw,32px);font-weight:750;line-height:1.6;letter-spacing:normal}
body.mr-library .mr-intro p{font-size:14px;line-height:1.9;letter-spacing:normal}
body.mr-library .mr-section-title h2{font-size:19px;line-height:1.65;font-weight:750;letter-spacing:normal}
body.mr-library .library-actions{min-width:0;flex-wrap:wrap}
body.mr-library .library-actions :is(button,select){font-size:13px;line-height:1.5}
@media(max-width:1150px) and (min-width:761px){
 body.mr-library .masthead{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px 16px}
 body.mr-library .masthead .brand{grid-column:1;grid-row:1;justify-self:start}
 body.mr-library .masthead .library-actions{grid-column:2;grid-row:1;justify-content:flex-end}
 body.mr-library .masthead .library-heading{grid-column:1/-1;grid-row:2;justify-content:flex-start;gap:20px}
}
@media(max-width:760px){
 body.mr-library .masthead{gap:12px 8px}
 body.mr-library .brand-name{font-size:23px}
 body.mr-library .brand-caption{font-size:7px;letter-spacing:.08em}
 body.mr-library .library-heading h1{font-size:18px}
 body.mr-library .library-heading a{font-size:12px}
 body.mr-library .library-actions :is(button,select){font-size:12px;max-width:none}
 body.mr-library .mr-intro h2{font-size:25px}
 body.mr-library .mr-intro p{font-size:13px}
 body.mr-library .mr-section-title h2{font-size:17px}
}
@media(max-width:540px){
 body.mr-library .masthead{grid-template-columns:minmax(0,1fr);gap:12px}
 body.mr-library .masthead .brand{grid-column:1;grid-row:1}
 body.mr-library .masthead .library-actions{grid-column:1;grid-row:2;justify-content:flex-start}
 body.mr-library .masthead .library-heading{grid-column:1;grid-row:3;gap:8px 14px;justify-content:flex-start}
 body.mr-library .mr-intro h2{font-size:23px}
}
