/* Only the global grammar page opts in. Existing lesson layouts stay intact. */
#grammar{--gl-top:80px;--gl-height:calc(100dvh - 110px);color:#17335e}
#grammar .gl-heading{margin:0 0 14px;padding:0 2px}
#grammar .gl-heading h1{font-size:27px;margin:0 0 4px;color:#17396d}
#grammar .gl-heading p{font-size:14px;margin:0;color:#62738d}
#grammar .gl-layout{display:grid;grid-template-columns:310px minmax(0,1fr);gap:18px;align-items:start}
#grammar .gl-directory{position:sticky;top:var(--gl-top);max-height:var(--gl-height);display:flex;flex-direction:column;min-width:0;background:#fff;border:1px solid #dee7f2;border-radius:17px;box-shadow:0 6px 22px #1d355008;padding:14px 10px 9px;overflow:hidden}
#grammar .gl-sidebar-heading{font-size:18px;margin:0 4px 12px;line-height:1.4}
#grammar .gl-directory-body{display:flex;flex-direction:column;min-height:0}
#grammar .gl-filters{display:grid;gap:8px;padding:0 4px 9px}
#grammar .gl-search{width:100%;min-width:0;border:1px solid #d4dfed;background:#fff;color:#24446f;border-radius:9px;font:inherit;font-size:13px;padding:9px 10px;min-height:38px}
#grammar .gl-filter-row{display:flex;gap:6px;min-width:0}
#grammar .gl-filter-row select{flex:1;min-width:0}
#grammar .gl-clear{border:1px solid #d4dfed;border-radius:8px;background:#f5f8fc;color:#315781;font-size:12px;padding:5px 9px;cursor:pointer}
#grammar .gl-filter-status{font-size:12px;color:#647795;padding:0 5px 7px;display:flex;justify-content:space-between;gap:5px}
#grammar .gl-directory-list{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#c4d4e9 transparent;padding:2px}
#grammar .gl-item{border:1px solid transparent;border-bottom-color:#edf1f6;background:#fff;border-radius:10px;width:100%;padding:11px 7px;display:grid;grid-template-columns:32px minmax(0,1fr) auto;gap:8px;align-items:start;text-align:left;color:#18375f;cursor:pointer;margin-bottom:3px}
#grammar .gl-item:hover{background:#f6f9ff;border-color:#d9e5f4}
#grammar .gl-item.is-active{background:#eaf2ff;border-color:#c5d9fa;box-shadow:inset 3px 0 #1b56b1}
#grammar .gl-number{border-radius:9px;min-height:33px;display:grid;place-items:center;font-size:13px;font-weight:750}
#grammar .gl-color-0{background:#e0edff;color:#0c57be}
#grammar .gl-color-1{background:#fce8ee;color:#c62d55}
#grammar .gl-color-2{background:#efe8fd;color:#7840bd}
#grammar .gl-color-3{background:#def4ea;color:#0b7453}
#grammar .gl-item-copy{min-width:0;display:grid;gap:4px}
#grammar .gl-item-copy strong{font-size:13px;line-height:1.45;overflow-wrap:anywhere}
#grammar .gl-item-copy>span{font-size:12px;line-height:1.5;color:#627594;overflow-wrap:anywhere}
#grammar .gl-lesson{border:1px solid #dce6f2;border-radius:7px;font-size:10px;white-space:nowrap;padding:3px 4px;color:#516c91;background:#ffffffb3;margin-top:2px}
#grammar .gl-directory-hint{font-size:11px;color:#788ba6;text-align:center;margin:8px 0 0}
#grammar .gl-detail{min-width:0;scroll-margin-top:var(--gl-top);outline:none}
#grammar .gl-context{display:flex;justify-content:space-between;gap:10px;align-items:center;font-size:12px;color:#657b98;padding:0 3px 9px;line-height:1.5}
#grammar .gl-context>span:first-child{min-width:0}
#grammar .gl-context>span:last-child{white-space:nowrap}
#grammar-grid,#grammar-grid>.lesson15-study{display:block;margin:0;max-width:none;min-width:0}
#grammar .l15-card-header h2{font-size:22px}
#grammar .l15-progress{display:none} /* Global progress is above the component. */
#grammar .l15-reference-sections{grid-template-columns:repeat(2,minmax(0,1fr))}
#grammar .gl-empty{font-size:14px;line-height:1.7;color:#607391;padding:20px 12px}
#grammar .gl-pager{display:flex;gap:10px;justify-content:space-between;align-items:center;margin-top:10px;font-size:12px;color:#6d809b}
#grammar .gl-pager button{border:1px solid #ceddf0;background:#fff;color:#17427b;border-radius:9px;padding:8px 12px;font-weight:650;cursor:pointer;min-height:38px}
#grammar .gl-pager button:disabled{opacity:.4;cursor:default}
#grammar button:focus-visible,#grammar input:focus-visible,#grammar select:focus-visible{outline:3px solid #3379e9;outline-offset:2px}
#grammar .gl-mobile-toggle{display:none}
@media(min-width:901px) and (max-width:1150px){
 #grammar .gl-layout{grid-template-columns:280px minmax(0,1fr);gap:12px}
 #grammar .l15-study-columns{grid-template-columns:1fr}
 #grammar .l15-qa{padding:12px 0 0;border-left:0;border-top:1px solid #e7edf4}
}
@media(max-width:900px){
 #grammar .gl-layout{grid-template-columns:minmax(0,1fr);gap:12px}
 #grammar .gl-heading h1{font-size:23px}
 #grammar .gl-directory{position:static;max-height:none;padding:10px}
 #grammar .gl-sidebar-heading{display:none}
 #grammar .gl-mobile-toggle{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:3px 4px;border:0;background:#fff;color:#17396d;font-weight:700;text-align:left;min-height:32px;cursor:pointer}
 #grammar .gl-mobile-toggle:after{content:'⌃';font-size:18px}
 #grammar .gl-collapsed .gl-mobile-toggle:after{content:'⌄'}
 #grammar .gl-collapsed .gl-directory-body{display:none}
 #grammar .gl-directory-body{padding-top:10px}
 #grammar .gl-directory-list{max-height:350px}
 #grammar .gl-context{flex-wrap:wrap;gap:4px}
}
@media(max-width:700px){
 #grammar .l15-reference-sections{grid-template-columns:1fr}
 #grammar .l15-card-header h2{font-size:20px}
 #grammar .gl-heading p{font-size:13px;line-height:1.6}
 #grammar .gl-pager{gap:6px}
 #grammar .gl-pager button{font-size:12px;padding:7px 9px}
}
