.bottom-nav{grid-template-columns:repeat(4,minmax(0,1fr))}
#entry-main.selection-screen{display:flex;flex-direction:column;gap:14px;overflow:hidden;min-height:0;padding-bottom:14px;scrollbar-gutter:auto}
.selection-header{flex:none}.selection-header .eyebrow{margin:0 0 5px}.selection-header h1{font-size:28px;margin:0 0 5px}.selection-header>p:last-child{font-size:13px;color:var(--muted);margin:0;line-height:1.5}
.selection-search{display:flex;align-items:center;gap:9px;background:#fffdfa;border:1px solid var(--line);border-radius:13px;min-height:44px;padding:0 13px;flex:none}.selection-search>span{font-size:26px;color:var(--muted);line-height:1}.selection-search input{min-width:0;width:100%;height:44px;border:0;background:transparent;outline:none;font:inherit;font-size:14px;color:var(--ink)}.selection-search:focus-within{outline:2px solid var(--green);outline-offset:1px}
.selection-library{min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;flex:1;scrollbar-width:thin;border:1px solid var(--line);border-radius:20px;background:#fffdfa}.selection-level+.selection-level{border-top:1px solid var(--line)}
.selection-level-toggle{width:100%;display:flex;align-items:center;gap:14px;text-align:left;padding:18px;border:0;background:#edf2e1;color:var(--ink);cursor:pointer;min-height:86px}.selection-level:nth-child(2) .selection-level-toggle{background:#e6f0f6}.selection-level-toggle>span:nth-child(2),.selection-theme>span:nth-child(2){flex:1;min-width:0}.selection-level-toggle strong{font-size:18px;font-weight:650;display:block}.selection-level-toggle small,.selection-theme small{display:block;font-size:12px;color:var(--muted);margin-top:6px;line-height:1.4}.selection-level-badge{display:grid;place-items:center;background:#fffdfa;border:1px solid #d8e1c5;border-radius:14px;width:46px;height:46px;font-weight:700;flex:none}.selection-chevron{font-size:26px;color:var(--green);flex:none;line-height:1}
.selection-theme{display:flex;align-items:center;gap:14px;min-height:76px;padding:13px 20px;border-top:1px solid #eeeede}.selection-theme:hover{background:#f7f8f0}.selection-theme strong{font-size:15px;font-weight:550;line-height:1.5;display:block;overflow-wrap:anywhere}.selection-theme-number{width:32px;height:32px;flex:none;background:#f0f3e7;border-radius:50%;display:grid;place-items:center;font-size:12px;color:var(--muted)}.selection-footnote{flex:none;color:var(--muted);font-size:11px;margin:0;text-align:center;line-height:1.4}
.selection-word-header{display:flex;align-items:center;gap:12px;flex:none;min-height:42px}.selection-word-header .back-link{white-space:nowrap;font-size:13px;margin:0;min-height:44px;display:flex;align-items:center}.selection-word-header h1{font-size:20px;line-height:1.4;margin:0;flex:1;overflow-wrap:anywhere;font-weight:650}.selection-scope{font-size:12px;border-radius:8px;padding:5px 8px;background:#e6edda;flex:none}
.selection-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border:1px solid var(--line);border-radius:13px;background:#fffdfa;flex:none;overflow:hidden}.selection-tabs button{border:0;border-right:1px solid var(--line);background:transparent;color:var(--muted);padding:10px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:3px;min-height:63px}.selection-tabs button:last-child{border-right:0}.selection-tabs strong{font-size:20px;font-weight:550}.selection-tabs span{font-size:12px}.selection-tabs [aria-selected=true]{background:#e7eed8;color:var(--green);box-shadow:inset 0 -3px var(--green)}
.selection-word-list{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin;background:#fffdfa;border:1px solid var(--line);border-radius:14px}.selection-group{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;background:#f0f2e8;padding:0 15px;color:var(--muted);position:sticky;top:0;z-index:1}.selection-group label{display:flex;align-items:center;gap:17px;cursor:pointer;min-height:44px;flex:1}.selection-group small{font-size:12px}.selection-word{display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;border-bottom:1px solid #efefe6;min-height:65px;padding-left:15px}.selection-word:last-child{border-bottom:0}.selection-word.is-selected{background:#f5f8ed}.selection-word-choice{display:flex;align-items:center;gap:17px;cursor:pointer;min-width:0;min-height:65px;padding:10px 0}.selection-word-choice>span{min-width:0;flex:1}.selection-word-choice strong{display:block;font-size:18px;font-weight:500;line-height:1.4;overflow-wrap:anywhere}.selection-word-choice small{display:block;color:var(--muted);font-size:12px;line-height:1.5;margin-top:3px;overflow-wrap:anywhere}.selection-screen input[type=checkbox]{appearance:none;-webkit-appearance:none;width:23px;height:23px;border:1.5px solid #96a67d;border-radius:50%;margin:0;background:#fffdfa;flex:none;cursor:pointer;display:grid;place-items:center}.selection-screen input[type=checkbox]:checked{background:var(--green);border-color:var(--green)}.selection-screen input[type=checkbox]:checked:after{content:'✓';color:white;font-size:15px;line-height:1}.selection-screen input[type=checkbox]:indeterminate:after{content:'−';color:var(--green);font-size:20px}.selection-screen input:focus-visible{outline:3px solid #9eb17b;outline-offset:3px}.selection-word-detail{width:44px;min-height:48px;font-size:25px;border:0;background:transparent;color:var(--muted);cursor:pointer}.selection-word-info{grid-column:1/-1;border-top:1px dashed var(--line);padding:12px 12px 14px 40px;color:var(--muted);font-size:12px;line-height:1.6}.selection-word-info>span{display:inline-block;margin-right:12px}.selection-word-info p{margin:6px 0}.selection-word-info button{border:1px solid var(--line);border-radius:9px;min-height:36px;background:#edf2e1;color:var(--green);padding:6px 12px;cursor:pointer}.selection-empty{color:var(--muted);font-size:14px;line-height:1.7;padding:24px;text-align:center}
.selection-footer{flex:none}.selection-footer .notice{font-size:12px;margin:0 0 8px}.selection-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;color:var(--muted);font-size:12px}.selection-tools label{display:flex;align-items:center;gap:7px;min-height:32px}.selection-tools select{font:inherit;color:var(--ink);border:1px solid var(--line);border-radius:8px;background:#fffdfa;padding:5px;min-height:32px}.selection-tools input[type=checkbox]{width:18px;height:18px}.selection-actions{display:grid;grid-template-columns:72px 72px minmax(0,1fr);gap:10px}.selection-actions button{min-height:47px;border:1px solid var(--line);border-radius:12px;background:#edf2e1;color:var(--green);font:inherit;font-size:14px;cursor:pointer;padding:10px}.selection-actions .primary-button{margin:0;min-width:0;background:var(--orange,#f98c53);color:#342b23;border-color:transparent;display:flex;align-items:center;justify-content:center;gap:8px}.selection-actions .primary-button span{font-weight:450;font-size:12px}.selection-screen button:disabled{opacity:.45;cursor:default}
@media(max-width:600px){#entry-main.selection-screen{gap:10px}.selection-header h1{font-size:25px}.selection-header>p:last-child{font-size:12px}.selection-word-header{gap:9px}.selection-word-header h1{font-size:17px}.selection-actions{grid-template-columns:58px 58px minmax(0,1fr);gap:8px}.selection-word-choice strong{font-size:18px}.selection-tabs button{padding:7px;min-height:57px}.selection-tabs strong{font-size:19px}.selection-theme{padding:12px 15px;gap:12px}.selection-level-toggle{padding:15px}.selection-tools{margin-bottom:7px}}
@media(max-height:650px){#entry-main.selection-screen{gap:8px;padding-top:6px;padding-bottom:8px}.selection-header h1{font-size:23px}.selection-header .eyebrow{font-size:10px;margin-bottom:3px}.selection-search{min-height:40px}.selection-search input{height:40px}.selection-word-header h1{font-size:16px}.selection-tabs button{padding:5px;min-height:50px}.selection-tabs strong{font-size:18px}.selection-tabs span{font-size:11px}.selection-tools{margin-bottom:5px}.selection-actions button{min-height:44px;padding:8px}.selection-word-choice{min-height:61px}.selection-word{min-height:61px}}
@media(min-width:650px) and (max-height:450px){.entry-shell:has(.selection-screen){--header-height:50px;--nav-height:58px}#entry-main.selection-screen{gap:6px}.selection-header>p:last-child,.selection-header .eyebrow{display:none}.selection-word-header{min-height:32px}.selection-word-header .back-link{min-height:32px}.selection-search,.selection-search input{min-height:34px;height:34px}.selection-tabs{position:absolute;width:270px;right:max(32px,env(safe-area-inset-right));top:calc(56px + env(safe-area-inset-top))}.selection-tabs button{min-height:32px;padding:4px;flex-direction:row;justify-content:center;gap:7px}.selection-word-header,.selection-header{padding-right:285px}.selection-footer{display:flex;align-items:center;gap:14px}.selection-tools{margin:0;flex:1}.selection-actions{flex:1.4}.selection-footer .notice{position:absolute;bottom:108px;background:var(--paper);padding:6px}}

/* Compact library: the available viewport belongs to search and word selection. */
.entry-shell:has(> #entry-main.selection-screen){grid-template-rows:minmax(0,1fr) auto}
.entry-shell:has(> #entry-main.selection-screen)>.entry-header{display:none}
.entry-shell:has(> #entry-main.selection-screen)>#entry-main{grid-row:1;gap:7px;padding:12px var(--page-pad) max(8px,env(safe-area-inset-bottom))}
.entry-shell:has(> #entry-main.selection-screen)>#entry-nav{grid-row:2}
.selection-screen .selection-header{padding:0}
.selection-screen .selection-header h1{font-size:18px;font-weight:650;line-height:1.3;letter-spacing:.6px;margin:0 0 3px}
.selection-screen .selection-header>p:last-child{display:block;font-size:12px;line-height:1.4;margin:0}
.selection-screen .selection-search{min-height:38px;gap:7px;padding:0 10px;border-radius:10px}
.selection-screen .selection-search input{height:38px;min-height:0;font-size:13px}
.selection-screen .selection-search>span{font-size:22px}
.selection-screen .selection-library{border-radius:14px}
.selection-screen .selection-level-toggle{min-height:64px;padding:10px 13px;gap:11px}
.selection-screen .selection-level-toggle strong{font-size:16px;line-height:1.35}
.selection-screen .selection-level-toggle small,.selection-screen .selection-theme small{font-size:11px;margin-top:3px;line-height:1.35}
.selection-screen .selection-level-badge{width:36px;height:36px;border-radius:11px;font-size:14px}
.selection-screen .selection-chevron{font-size:21px}
.selection-screen .selection-theme{min-height:52px;padding:8px 13px;gap:11px}
.selection-screen .selection-theme strong{font-size:14px;line-height:1.35}
.selection-screen .selection-theme-number{width:27px;height:27px;font-size:11px}
.selection-screen .selection-footnote{font-size:10px;line-height:1.35;padding:0}
.selection-screen .selection-word-header{gap:9px;min-height:36px;padding:0}
.selection-screen .selection-word-header .back-link{font-size:12px;min-height:36px}
.selection-screen .selection-word-header h1{font-size:16px;line-height:1.3}
.selection-screen .selection-scope{font-size:11px;padding:4px 7px}
.selection-screen .selection-tabs{position:static;width:auto;border-radius:10px}
.selection-screen .selection-tabs button{min-height:40px;padding:6px;flex-direction:row;justify-content:center;gap:6px}
.selection-screen .selection-tabs strong{font-size:16px}
.selection-screen .selection-tabs span{font-size:11px}
.selection-screen .selection-word-list{border-radius:11px}
.selection-screen .selection-group{min-height:34px;padding:0 11px;gap:8px;font-size:12px}
.selection-screen .selection-group label{min-height:34px;gap:11px}
.selection-screen .selection-group small{font-size:10px}
.selection-screen .selection-word{min-height:48px;padding-left:11px}
.selection-screen .selection-word-choice{min-height:48px;padding:6px 0;gap:11px}
.selection-screen .selection-word-choice strong{font-size:15px;line-height:1.3}
.selection-screen .selection-word-choice small{font-size:11px;line-height:1.35;margin-top:2px}
.selection-screen input[type=checkbox]{width:20px;height:20px}
.selection-screen .selection-word-detail{min-height:44px;font-size:21px}
.selection-screen .selection-word-info{padding:8px 11px 10px 31px;font-size:11px}
.selection-screen .selection-tools{font-size:11px;gap:8px;margin-bottom:5px}
.selection-screen .selection-tools{flex-wrap:wrap}
.selection-bulk{display:flex;align-items:center;gap:3px}
.selection-bulk button{border:1px solid var(--line);border-radius:7px;background:var(--card,#fffdfa);color:var(--green);font:inherit;font-size:11px;min-height:32px;padding:4px 6px;white-space:nowrap;cursor:pointer}
.selection-screen .selection-tools input[type=checkbox]{width:18px;height:18px}
.selection-screen .selection-actions{gap:7px}
.selection-screen .selection-actions button{min-height:44px;padding:7px;font-size:12px}
.selection-screen .selection-actions .primary-button span{font-size:11px}
@media(min-width:1024px) and (hover:hover) and (pointer:fine){
 .entry-shell:has(> #entry-main.selection-screen){grid-template-rows:minmax(0,1fr)}
 .entry-shell:has(> #entry-main.selection-screen)::before,.entry-shell:has(> #entry-main.selection-screen)::after{grid-row:1}
 .entry-shell:has(> #entry-main.selection-screen)>#entry-main{grid-column:2;grid-row:1;padding:18px 28px 12px}
 .entry-shell:has(> #entry-main.selection-screen)>#entry-nav{grid-column:1;grid-row:1;padding-top:18px}
}

/* Word and meaning share a baseline, with room for complete longer meanings. */
.selection-screen:has(.selection-word-list) .selection-search input{font-size:12.5px}
.selection-screen:has(.selection-word-list) .selection-tabs strong{font-size:15px}
.selection-screen:has(.selection-word-list) .selection-tabs span{font-size:10.5px}
.selection-screen .selection-group{font-size:11px;min-height:28px}
.selection-screen .selection-group label{min-height:28px}
.selection-screen .selection-word,.selection-screen .selection-word-choice{min-height:36px}
.selection-screen .selection-word-choice{padding:4px 0}
.selection-screen .selection-word-detail{min-height:36px}
.selection-screen .selection-word-choice>span{display:flex;align-items:baseline;column-gap:12px}
.selection-screen .selection-word-choice strong{flex:0 1 auto;max-width:55%;min-width:0;font-size:14px;line-height:1.4}
.selection-screen .selection-word-choice small{flex:1;min-width:0;margin:0;font-size:10.5px;line-height:1.45}

/* The concrete word picker keeps its theme back link and uses the full screen. */
.entry-shell:has(> #entry-main.selection-screen .selection-word-list){grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
.entry-shell:has(> #entry-main.selection-screen .selection-word-list)>#entry-nav{display:none}
.entry-shell:has(> #entry-main.selection-screen .selection-word-list)>#entry-main{grid-column:1;grid-row:1}
.entry-shell:has(> #entry-main.selection-screen .selection-word-list)::before,.entry-shell:has(> #entry-main.selection-screen .selection-word-list)::after{display:none}
@media(max-height:450px){
 .entry-shell:has(> #entry-main.selection-screen)>#entry-main{gap:5px;padding-top:7px;padding-bottom:6px}
 .selection-screen .selection-header h1{font-size:16px;margin-bottom:1px}
 .selection-screen .selection-header>p:last-child{font-size:11px}
 .selection-screen .selection-search,.selection-screen .selection-search input{min-height:34px;height:34px}
 .selection-screen .selection-word-header,.selection-screen .selection-word-header .back-link{min-height:30px}
 .selection-screen .selection-tabs button{min-height:32px;padding:4px}
}

