/* Library and community refinement. The home hero and mascot are intentionally untouched. */
.library-toolbar{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin:0 0 24px;max-width:720px}
.library-toolbar>label{font-size:13px;font-weight:500;color:var(--quiet)}
.library-toolbar input{width:100%;min-width:0;min-height:48px;padding:12px 16px;border:1px solid var(--edge);border-radius:13px;background:var(--panel);color:var(--text);font:inherit;font-size:15px;box-shadow:0 2px 8px #00000003}
.library-toolbar input::placeholder{color:var(--quiet)}
.library-toolbar>span{font-size:13px;color:var(--quiet)}
.library-toolbar>span:empty{display:none}
.content[data-page=materias] .heading{align-items:center}
.content[data-page=materias] .heading h1{font-weight:600;letter-spacing:-.65px}
.content[data-page=materias] .folder-gallery{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:20px;align-items:stretch;grid-auto-rows:1fr}
.folder-gallery .folder-tile{display:flex;flex-direction:column;overflow:visible;min-width:0;border-radius:18px;box-shadow:0 3px 12px #00000006}
.folder-gallery .folder-tile[hidden]{display:none}
.folder-gallery .folder-cover{flex-shrink:0;height:auto;aspect-ratio:1.8;min-height:90px;border-radius:17px 17px 0 0;background:var(--folder-color)}
.folder-gallery .folder-cover>span{font-size:52px;filter:none}
.folder-gallery .folder-cover>img{display:block}
.folder-gallery .folder-tile-body{display:flex;flex:1;flex-direction:column;padding:17px!important}
.folder-gallery .folder-tile-body>.actions{margin-top:auto}
.folder-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.folder-gallery .folder-card-heading h3{font-size:17px;font-weight:550;line-height:1.4;margin:2px 0 0}
.folder-gallery .folder-tile-body>p{font-size:12px;margin:8px 0 16px;color:var(--quiet)}
.folder-card-menu{position:relative;flex:none}
.folder-card-menu>summary{display:grid;place-items:center;list-style:none;width:34px;height:34px;border:1px solid transparent;border-radius:9px;font-size:24px;line-height:1;cursor:pointer;color:var(--quiet)}
.folder-card-menu>summary::-webkit-details-marker{display:none}
.folder-card-menu>summary:hover,.folder-card-menu[open]>summary{background:var(--subtle);border-color:var(--edge)}
.folder-card-menu[open]{z-index:6}
.folder-card-menu>div{position:absolute;right:0;top:calc(100% + 5px);width:172px;display:grid;gap:6px;padding:8px;background:var(--panel);border:1px solid var(--edge);border-radius:12px;box-shadow:0 8px 24px #0002}
.folder-card-menu .btn{width:100%;text-align:left;min-height:42px;font-size:13px;font-weight:450;padding:9px!important}
.folder-gallery .folder-tile-body .actions{display:block}
.folder-gallery .folder-tile-body [data-open-study-folder]{width:100%;min-height:42px!important;border-radius:11px;font-size:13px!important;font-weight:500}
.library-import-panel{border:1px solid var(--edge);border-radius:16px;background:var(--panel);margin-bottom:22px;min-width:0}
.library-import-panel>summary{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:18px 20px;list-style:none;cursor:pointer;color:var(--text)}
.library-import-panel>summary::-webkit-details-marker{display:none}
.library-import-panel>summary strong{display:block;font-size:14px;font-weight:500}
.library-import-panel>summary small{display:block;margin-top:4px;color:var(--quiet);font-size:12px}
.library-disclosure{flex:none;color:var(--accent-ink);font-size:22px}
.library-import-panel[open] .library-disclosure{transform:rotate(180deg)}
.library-import-panel .folder-import{margin:0;border:0;border-top:1px solid var(--edge);border-radius:0 0 16px 16px!important;box-shadow:none}
.content[data-page=materias]>.folder-editor{margin-top:26px;background:var(--panel);box-shadow:none}
.content[data-page=materias] .subject-list{gap:12px}
.content[data-page=materias] .subject-row{min-width:0;align-items:center}
.content[data-page=materias] .subject-row .actions{display:flex;gap:7px;flex-wrap:wrap}
.content[data-page=materias] .subject-row strong{font-weight:550}
.content[data-page=materias] .subject-row small{line-height:1.6}

/* A readable feed; chat and league workspaces retain their available width. */
.community-shell .community-scroll{background:var(--page)}
.community-shell .community-feed,.community-scroll>.community-compose,.community-scroll>.community-profile-showcase,.community-scroll>.community-edit-profile{width:100%;max-width:760px;margin-inline:auto}
.community-shell .community-post{padding:22px;border:1px solid var(--edge);border-radius:17px;box-shadow:0 3px 12px #00000004;background:var(--panel);margin:0 0 20px}
.community-shell .community-post-head{align-items:flex-start;gap:12px}
.community-shell .community-person strong{font-weight:550;font-size:14px}
.community-shell .community-person small{font-size:12px;line-height:1.55}
.community-shell .community-text{font-size:15px;line-height:1.75;margin:16px 0}
.community-shell .community-actions{gap:5px;border-color:var(--edge)}
.community-shell .community-actions button{min-height:42px;font-size:13px}
.community-shell .community-fixed-top{padding:14px 22px 0}
.community-shell .community-head{padding-bottom:6px}
.community-shell .community-head>.eyebrow{display:none}
.community-shell .community-head h1{font-size:20px;font-weight:550}
.community-shell .community-feed-tabs{display:flex;overflow-x:auto;gap:8px;border:0;padding:0;scrollbar-width:thin}
.community-shell .community-feed-tabs button{flex:1 0 auto;width:auto;min-width:80px;border:0;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:var(--quiet);padding:12px 14px;font-size:14px;font-weight:500;white-space:nowrap}
.community-shell .community-feed-tabs button.active{color:var(--accent-ink);border-bottom-color:var(--accent);background:transparent}
.community-shell .community-bottom button{font-size:13px;font-weight:500}
@media(min-width:701px){
 .app{grid-template-columns:228px minmax(0,1fr)}
 .sidebar{padding:24px 12px;gap:20px}
 .sidebar .brand{font-size:19px;padding-left:7px;gap:9px}
 .sidebar .nav{gap:3px}
 .sidebar .nav button{padding:9px 10px;font-size:13px;min-height:44px}
 .sidebar .nav .ico{width:29px;height:29px;flex-basis:29px}
 .content[data-page=materias]{padding:32px clamp(22px,3vw,48px) 60px;max-width:1400px}
 .community-shell .community-scroll{padding:24px clamp(18px,3vw,48px)}
 .community-shell .community-scroll:has(.community-chats){padding:0}
}
@media(max-width:1000px) and (min-width:701px){
 .app{grid-template-columns:210px minmax(0,1fr)}
 .content[data-page=materias] .folder-gallery{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
}
@media(max-width:700px){
 .mobile-nav{display:flex;justify-content:space-evenly;overflow:visible;gap:2px;padding:6px 6px max(6px,env(safe-area-inset-bottom));min-height:72px;background:var(--panel);border-color:var(--edge)}
 .mobile-nav button{flex:1 1 0;min-width:0;max-width:100%;min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:5px 2px;font-size:10px;font-weight:500;line-height:1.25;border-radius:12px}
 .mobile-nav button>span:first-child{display:grid;place-items:center;width:27px;height:27px;flex:none}
 .mobile-nav button>span.mobile-nav-label{display:block;width:auto;height:auto;max-width:100%;font-size:10px;line-height:1.25;background:transparent;color:inherit;white-space:nowrap}
 .content[data-page=materias]{padding:22px 14px calc(96px + env(safe-area-inset-bottom))}
 .content[data-page=materias] .heading{gap:14px;align-items:flex-start}
 .content[data-page=materias] .heading h1{font-size:25px}
 .content[data-page=materias] .heading p{font-size:13px}
 .content[data-page=materias] .heading>.btn{min-height:44px;font-size:13px;white-space:normal}
 .library-toolbar{margin-bottom:20px}
 .library-toolbar input{font-size:16px}
 .content[data-page=materias] .folder-gallery{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .folder-gallery .folder-tile-body{padding:12px!important}
 .folder-gallery .folder-card-heading{gap:3px}
 .folder-gallery .folder-card-heading h3{font-size:14px}
 .folder-gallery .folder-cover{min-height:78px}
 .folder-gallery .folder-cover>span{font-size:40px}
 .folder-gallery .folder-tile-body>p{margin:6px 0 12px;font-size:11px}
 .folder-card-menu>summary{width:28px;height:30px;font-size:22px}
 .folder-gallery .folder-tile-body [data-open-study-folder]{font-size:12px!important;padding:8px 9px!important;min-height:42px!important}
 .folder-gallery .folder-open-arrow{width:21px;height:23px;margin-left:5px}
 .library-import-panel>summary{padding:16px}
 .content[data-page=materias] .subject-row{grid-template-columns:36px minmax(0,1fr);gap:10px;padding:15px}
 .content[data-page=materias] .subject-row>.actions{grid-column:1/-1}
 .content[data-page=materias] .subject-row>.actions>.btn:first-child{flex:1}
 .content[data-page=materias] .subject-row .subject-icon{width:36px;height:36px}
 .community-shell .community-fixed-top{padding:10px 12px 0}
 .community-shell .community-head h1{font-size:18px}
 .community-shell .community-feed-tabs{gap:4px;margin:0!important;padding:0!important}
 .community-shell .community-feed-tabs button{min-width:80px;min-height:44px;padding:10px 11px;font-size:13px}
 .community-shell .community-scroll{padding:12px 10px 18px}
 .community-shell .community-post{padding:15px;margin-bottom:14px;border-radius:14px}
 .community-shell .community-person strong{font-size:13px}
 .community-shell .community-person small{font-size:11px}
 .community-shell .community-text{font-size:14px;line-height:1.7}
 .community-shell .community-actions{gap:0}
 .community-shell .community-actions button{font-size:12px;padding:8px 6px}
 /* Keep community shortcuts, while making the main five destinations available. */
 body:has(.community-shell) .mobile-nav{display:flex}
 .main:has(.community-shell){height:calc(100dvh - 72px - env(safe-area-inset-bottom))}
 .community-shell{grid-template-rows:auto auto minmax(0,1fr)}
 .community-shell>.community-fixed-top{grid-row:1}
 .community-shell>.community-bottom{grid-row:2;padding:4px 10px;border-top:0;border-bottom:1px solid var(--edge);box-shadow:none;gap:6px}
 .community-shell>.community-bottom button{display:flex;justify-content:center;align-items:center;gap:6px;min-height:36px;padding:6px;font-size:12px;border-radius:9px}
 .community-shell>.community-bottom button span{font-size:16px}
 .community-shell>.community-scroll{grid-row:3}
 .community-shell .community-scroll:has(.community-chats){padding:0}
}
@media(max-width:359px){
 .content[data-page=materias] .folder-gallery{grid-template-columns:minmax(0,1fr)}
}
@media(prefers-reduced-motion:reduce){.folder-gallery .folder-tile{transition:none}}

/* Approved light navigation: all colors still come from the chosen theme. */
@media(min-width:701px){
 .sidebar{background:color-mix(in srgb,var(--accent) 24%,var(--panel));color:var(--text);border-right:1px solid var(--edge)}
 .sidebar .brand{color:var(--text)}
 .sidebar .brand span[style]{color:var(--accent-ink)!important}
 .sidebar .brand-mark{background:var(--accent);border:0;box-shadow:none;color:#fff}
 .sidebar .nav-label{color:var(--quiet);font-size:10px;letter-spacing:.08em}
 .sidebar .nav button{color:var(--quiet);border:1px solid transparent;border-radius:10px;font-weight:450}
 .sidebar .nav button:hover{color:var(--text);background:var(--subtle);border-color:var(--edge)}
 .sidebar .nav button.active{color:#fff;background:var(--accent);box-shadow:0 3px 9px color-mix(in srgb,var(--accent) 16%,transparent);border-color:var(--accent);font-weight:550}
 .sidebar .nav .ico,.sidebar .nav button[data-go] .ico{background:transparent;color:inherit}
 .sidebar .nav button.active .ico{background:transparent;color:inherit}
 .sidebar .side-bottom{background:var(--subtle);color:var(--text);border-color:var(--edge);box-shadow:none}
 .sidebar .side-bottom p{color:var(--quiet)}
 .sidebar .side-bottom strong{color:var(--text)}
}
/* Existing personalized covers remain intact; the whole cover opens the folder. */
.folder-gallery button.folder-cover{display:grid;width:100%;border:0;padding:0;cursor:pointer;color:var(--text)}
.folder-gallery button.folder-cover:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.community-reading-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:24px;width:100%;max-width:1120px;margin:0 auto;align-items:start}
.community-reading-main{min-width:0;width:100%;max-width:760px;margin:0 auto}
.community-companion{display:none;min-width:0}
.companion-card{border:1px solid var(--edge);background:var(--panel);border-radius:15px;padding:16px;margin-bottom:18px;box-shadow:0 3px 12px #00000003}
.companion-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.companion-heading h2{font-size:14px!important;font-weight:550!important;letter-spacing:-.2px;margin:0}
.companion-heading .link{font-size:11px;font-weight:500;white-space:nowrap}
.companion-card>p,.companion-error{font-size:12px;line-height:1.7;color:var(--quiet);margin:8px 0}
.companion-row{display:flex;align-items:center;gap:10px;min-width:0;width:100%;padding:10px 0;border:0;border-bottom:1px solid var(--edge);background:transparent;color:var(--text);text-align:left;cursor:pointer}
.companion-row:last-child{border-bottom:0}
.companion-row:hover strong{color:var(--accent-ink)}
.companion-row>span:last-child{min-width:0}
.companion-row strong{display:block;font-size:12px;line-height:1.5;font-weight:500;overflow-wrap:anywhere}
.companion-row small{display:block;color:var(--quiet);font-size:11px;line-height:1.5;overflow-wrap:anywhere;margin-top:2px}
.companion-row .community-presence:empty{display:none}
.companion-row .community-avatar,.companion-league-mark{flex:none;width:34px;height:34px;font-size:15px;border-radius:11px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent-ink)}
.companion-row .community-avatar{border-radius:50%}
@media(min-width:1150px){
 .community-reading-layout{grid-template-columns:minmax(0,760px) minmax(210px,260px);gap:24px}
 .community-companion{display:block;position:sticky;top:0}
 .community-reading-main .community-feed{max-width:none}
}
