.encyclopedia-host { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; color: #f8fbff; background: #020817; }
.encyclopedia-app, .encyclopedia-app * { box-sizing: border-box; }
.encyclopedia-app button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.encyclopedia-app { width: 100%; height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr); gap: clamp(6px,1vh,12px); padding: max(7px,env(safe-area-inset-top)) max(68px,calc(env(safe-area-inset-right) + 58px)) max(7px,env(safe-area-inset-bottom)) max(68px,calc(env(safe-area-inset-left) + 58px)); background: radial-gradient(circle at 12% 10%,rgba(25,139,255,.29),transparent 31%),radial-gradient(circle at 88% 100%,rgba(129,74,255,.22),transparent 38%),linear-gradient(145deg,#020817,#061d43 58%,#030d22); }
.ency-header { min-height: clamp(52px,8vh,76px); display: grid; grid-template-columns: auto minmax(180px,1fr) auto; align-items: center; gap: 12px; padding: 6px clamp(9px,1.4vw,18px); border: 1px solid rgba(111,201,255,.28); border-radius: clamp(16px,2vw,25px); background: linear-gradient(120deg,rgba(8,46,96,.96),rgba(5,25,61,.94)); box-shadow: inset 0 1px rgba(255,255,255,.1),0 12px 34px #0006; }
.ency-header nav { display: flex; gap: 6px; }
.ency-header nav button { width: clamp(36px,4.2vw,50px); height: clamp(36px,4.2vw,50px); display: grid; place-items: center; padding: 0; color: #fff6d3; border: 1px solid rgba(255,216,107,.72); border-radius: 50%; background: linear-gradient(145deg,#1266b9,#062553); cursor: pointer; }
.ency-header button:hover,.ency-header button:focus-visible { outline: 2px solid white; box-shadow: 0 0 0 3px rgba(255,216,107,.35); }
.ency-header svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ency-brand { min-width: 0; display: flex; align-items: center; gap: 10px; }
.ency-brand > svg { width: clamp(35px,4vw,52px); height: clamp(35px,4vw,52px); flex: 0 0 auto; color: #ffe17a; }
.ency-brand > span { min-width: 0; display: grid; }
.ency-brand small { color: #82ddff; font-size: clamp(.48rem,.72vw,.64rem); font-weight: 900; letter-spacing: .13em; }
.ency-brand strong { overflow: hidden; color: #fff2b8; font: 850 clamp(1.06rem,2.2vw,1.9rem)/1.05 Georgia,serif; text-overflow: ellipsis; white-space: nowrap; }
.ency-count { padding: 6px 11px; color: #d9f3ff; border: 1px solid rgba(116,203,255,.26); border-radius: 999px; background: rgba(9,67,126,.48); font-size: clamp(.56rem,.8vw,.72rem); font-weight: 850; white-space: nowrap; }
.ency-main { min-height: 0; overflow: auto; outline: none; border: 1px solid rgba(95,190,255,.22); border-radius: clamp(18px,2vw,29px); background: linear-gradient(150deg,rgba(5,31,72,.93),rgba(2,14,38,.95)); box-shadow: inset 0 1px rgba(255,255,255,.07),0 18px 45px #0007; }
.ency-intro { position: relative; min-height: clamp(120px,25vh,235px); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: clamp(18px,4vw,50px); overflow: hidden; border-bottom: 1px solid rgba(116,204,255,.17); background: radial-gradient(circle at 82% 24%,rgba(115,84,255,.3),transparent 39%),linear-gradient(130deg,rgba(10,78,146,.57),rgba(3,23,56,.3)); }
.ency-intro > div { position: relative; z-index: 1; max-width: 750px; }
.ency-intro small,.ency-category-page header small { color: #71ddff; font-size: clamp(.54rem,.82vw,.74rem); font-weight: 950; letter-spacing: .15em; }
.ency-intro h1,.ency-category-page h1 { margin: 4px 0 7px; color: #fff0ae; font: 850 clamp(1.45rem,4vw,3.4rem)/1 Georgia,serif; }
.ency-intro p,.ency-category-page header p { max-width: 750px; margin: 0; color: #c7e9f8; font-size: clamp(.72rem,1.25vw,1.02rem); line-height: 1.5; }
.ency-intro > span { opacity: .18; color: #ffe17a; font: 900 clamp(6rem,17vw,15rem)/1 Georgia,serif; transform: rotate(-9deg); }
.ency-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(280px,100%),1fr)); gap: clamp(9px,1.4vw,17px); padding: clamp(13px,2.2vw,28px); }
.ency-card { min-height: clamp(88px,15vh,142px); display: grid; grid-template-columns: clamp(48px,6vw,72px) minmax(0,1fr) auto; align-items: center; gap: clamp(9px,1.2vw,15px); padding: clamp(10px,1.6vw,19px); color: white; border: 1px solid color-mix(in srgb,var(--accent) 62%,#fff); border-radius: clamp(16px,2vw,25px); background: radial-gradient(circle at 0 0,color-mix(in srgb,var(--accent) 28%,transparent),transparent 50%),linear-gradient(145deg,rgba(10,63,120,.9),rgba(4,27,66,.97)); box-shadow: inset 0 1px rgba(255,255,255,.13),0 10px 27px #0005; cursor: pointer; text-align: left; }
.ency-card:hover,.ency-card:focus-visible { outline: 2px solid white; transform: translateY(-2px); box-shadow: inset 0 -4px var(--accent),0 14px 33px #0007,0 0 20px color-mix(in srgb,var(--accent) 25%,transparent); }
.ency-card > b { width: clamp(48px,6vw,72px); aspect-ratio: 1; display: grid; place-items: center; color: #061d43; border: 1px solid #fff9; border-radius: 19px; background: linear-gradient(145deg,#fff,var(--accent)); font-size: clamp(1.15rem,2.7vw,2rem); box-shadow: 0 7px 18px #0005; }
.ency-card > span { min-width: 0; display: grid; gap: 5px; }
.ency-card strong { color: #fff3c5; font: 800 clamp(.9rem,1.5vw,1.22rem) Georgia,serif; }
.ency-card small { color: #b9deef; font-size: clamp(.62rem,.88vw,.76rem); line-height: 1.35; }
.ency-card > i { color: var(--accent); font-size: clamp(1.5rem,3vw,2.3rem); font-style: normal; }
.ency-category { min-height: 100%; display: grid; grid-template-columns: minmax(72px,clamp(72px,13vw,185px)) minmax(0,1fr); }
.ency-category-rail { display: flex; flex-direction: column; gap: 7px; padding: clamp(9px,1.2vw,16px); overflow: auto; border-right: 1px solid rgba(116,204,255,.18); background: rgba(1,14,37,.44); }
.ency-category-rail button { min-height: 49px; display: flex; align-items: center; gap: 8px; padding: 7px 9px; overflow: hidden; color: #b9dbea; border: 1px solid rgba(112,198,240,.19); border-radius: 13px; background: rgba(7,42,86,.66); cursor: pointer; text-align: left; }
.ency-category-rail button b { width: 28px; height: 28px; display: grid; flex: 0 0 auto; place-items: center; color: #07234e; border-radius: 9px; background: #8edfff; }
.ency-category-rail button span { overflow: hidden; font-size: clamp(.56rem,.78vw,.7rem); font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.ency-category-rail button.is-active { color: #fff4c5; border-color: var(--accent); background: color-mix(in srgb,var(--accent) 22%,#082b5f); box-shadow: inset 3px 0 var(--accent); }
.ency-category-page { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr); }
.ency-category-page > header { min-height: clamp(120px,25vh,220px); display: flex; align-items: center; gap: clamp(13px,2vw,25px); padding: clamp(16px,3vw,39px); border-bottom: 1px solid rgba(112,199,244,.17); background: radial-gradient(circle at 5% 30%,color-mix(in srgb,var(--accent) 30%,transparent),transparent 40%); }
.ency-category-page > header > b { width: clamp(67px,10vw,130px); aspect-ratio: 1; display: grid; flex: 0 0 auto; place-items: center; color: #061d43; border: 2px solid #fffd; border-radius: clamp(20px,3vw,35px); background: linear-gradient(145deg,#fff,var(--accent)); box-shadow: 0 12px 35px color-mix(in srgb,var(--accent) 25%,#000); font-size: clamp(1.9rem,5vw,4rem); }
.ency-content { min-height: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(280px,100%),1fr)); align-content: start; gap: 14px; padding: clamp(14px,2.2vw,28px); overflow: auto; }
.ency-empty { grid-column: 1/-1; min-height: clamp(180px,37vh,360px); display: grid; place-items: center; align-content: center; gap: 10px; padding: 24px; text-align: center; border: 1px dashed color-mix(in srgb,var(--accent) 65%,#fff); border-radius: 25px; background: radial-gradient(circle at 50% 30%,color-mix(in srgb,var(--accent) 17%,transparent),transparent 50%),rgba(2,17,43,.48); }
.ency-empty > span { color: var(--accent); font-size: 3rem; }
.ency-empty strong { color: #fff0b1; font: 800 clamp(1.1rem,2vw,1.7rem) Georgia,serif; }
.ency-empty p { max-width: 700px; margin: 0; color: #badfed; font-size: clamp(.67rem,1vw,.86rem); line-height: 1.5; }
.ency-item { display: grid; grid-template-columns: minmax(90px,.35fr) minmax(0,1fr); gap: 12px; padding: 13px; color: white; border: 1px solid rgba(118,202,245,.25); border-radius: 19px; background: rgba(6,44,89,.72); }
.ency-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 13px; }
.ency-item h2 { margin: 0; color: #fff0b1; font: 800 1rem Georgia,serif; }
.ency-item p,.ency-item div div { color: #c3e4f2; font-size: .75rem; line-height: 1.4; }
.ency-item button { min-height: 34px; padding: 6px 11px; color: #06204b; border: 1px solid white; border-radius: 999px; background: #ffe17a; cursor: pointer; font-weight: 850; }
.ency-error { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; padding: 25px; color: white; background: #020817; text-align: center; }
.ency-error strong { color: #ffe17a; font-size: 1.4rem; }
.ency-error button { min-height: 42px; padding: 8px 18px; color: #06204b; border: 0; border-radius: 999px; background: #ffe17a; cursor: pointer; font-weight: 900; }
@media (max-height:570px) and (orientation:landscape) { .encyclopedia-app{gap:4px}.ency-header{min-height:45px;padding-block:4px}.ency-intro{min-height:105px;padding:13px 22px}.ency-intro>span{font-size:6rem}.ency-category-page>header{min-height:105px;padding:12px 20px}.ency-category-page>header>b{width:70px}.ency-empty{min-height:150px}.ency-card{min-height:76px}.ency-content{padding:10px}.ency-category-rail{padding:7px}.ency-category-rail button{min-height:42px} }
@media (max-width:760px) and (orientation:landscape) { .encyclopedia-app{padding-left:max(54px,calc(env(safe-area-inset-left) + 50px));padding-right:max(54px,calc(env(safe-area-inset-right) + 50px))}.ency-count{display:none}.ency-category{grid-template-columns:58px minmax(0,1fr)}.ency-category-rail button{justify-content:center;padding:6px}.ency-category-rail button span{display:none}.ency-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding:9px}.ency-card{grid-template-columns:42px minmax(0,1fr) auto;padding:8px}.ency-card>b{width:42px;border-radius:13px}.ency-card small{display:none} }
@media (prefers-reduced-motion:reduce) { .encyclopedia-app *{transition:none!important;animation:none!important} }
/* Bounded workspace: content never establishes an unbounded percentage height. */
.ency-category{height:100%;min-height:0;overflow:hidden}.ency-category-page{min-height:0;overflow:hidden}.ency-category-page>header{min-height:0;padding:10px 16px;gap:12px}.ency-category-page>header>b{width:44px;border-radius:12px;font-size:1.4rem}.ency-category-page h1{font-size:1.4rem}.ency-category-page header p{font-size:.75rem}.ency-category-rail{min-height:0}.ency-category-rail button{flex-shrink:0}.ency-item{align-self:start}.ency-item:not(:has(img)){grid-template-columns:1fr}
@media(max-width:650px){.encyclopedia-app{padding:6px}.ency-category{grid-template-columns:52px minmax(0,1fr)}.ency-category-rail{padding:4px}.ency-category-rail button{padding:5px;justify-content:center}.ency-category-rail button span{display:none}.ency-category-page>header p,.ency-category-page>header>b{display:none}.ency-count{display:none}.ency-brand strong{font-size:1.1rem}}
.category-quiz{display:inline-block;color:#ffe491;font-size:.75rem;margin-top:5px}

/* External learning material: content-height cards with no remote embeds. */
.lms-media{box-sizing:border-box;min-width:0;max-width:100%;height:auto;align-self:start;margin:20px 0;padding:18px;border:1px solid #c8d7eb;border-radius:16px;background:#eff5ff;color:#182b49;text-align:left;overflow-wrap:anywhere}
.lms-media h3{margin:0 0 5px;color:#182b49}.lms-media-topic{margin:0 0 14px;font-weight:600}
.lms-media-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:12px;align-items:start}
.lms-media .lms-media-link{box-sizing:border-box;display:block;min-width:0;padding:14px;border:1px solid #ccd8e7;border-radius:12px;background:#fff;color:#162e50;text-decoration:none;line-height:1.5;height:auto}
.lms-media-link strong,.lms-media-link span,.lms-media-link small{display:block}.lms-media-link small{font-weight:700;color:#34568b}.lms-media-link p{margin:8px 0 0;font-size:.88rem}
.lms-media a:hover{border-color:#316cc4;text-decoration:underline}.lms-media a:focus-visible{outline:3px solid #d28b0c;outline-offset:3px}
.lms-media .lms-media-search{display:block;margin-top:14px;color:#194f99;font-weight:700;line-height:1.5}.lms-media-search small,.lms-work-video small{display:block;font-weight:400;font-size:.75rem}
.lms-media .lms-media-note{margin:12px 0 0;font-size:.76rem;line-height:1.5;color:#4f6078}.lms-work-video{display:block;margin:7px 0;color:#194f99}
@media(max-width:600px){.lms-media{padding:12px}.lms-media-grid{grid-template-columns:minmax(0,1fr)}}


/* LADYS PATCH-001 — enforce vintage palette and viewport-aware encyclopedia */
.ency-category-page>header{padding:9px 14px;min-height:0}.ency-content{gap:10px;padding:10px 14px;scrollbar-width:thin}.ency-category-rail button{min-height:43px}
.ency-content:has(.reading-reference){display:block;min-height:0;overflow:auto}
.ency-content:has(.reading-reference) .reading-reference{width:100%;max-width:100%}
.ency-item{background:#0a315f;color:#e4f2ff;border-color:#426e93}.ency-item p,.ency-item div div{color:#d5e9f6}
.lms-media{background:#0c315b;color:#e6f2ff;border-color:#537b9d}.lms-media h3,.lms-media-topic{color:#ffe7ab}.lms-media .lms-media-link{background:#163c68;color:#f0e4c9;border-color:#54789c}.lms-media-link small,.lms-media .lms-media-note{color:#c2dbed}.lms-media a{color:#ffe29c}
@media(max-height:750px){.ency-category-page>header{padding:6px 12px}.ency-category-page>header>b{width:39px}.ency-category-page h1{font-size:1.2rem}.ency-content{padding:7px 10px}}
