:root{color-scheme:light;--ink:#273c35;--muted:#67766d;--line:#d7ddd5;--accent:#355a49;--paper:#fbfaf6;--wash:#eff1e9}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:15px/1.7 -apple-system,BlinkMacSystemFont,'Hiragino Sans','Noto Sans JP',sans-serif}button,input,select,textarea{font:inherit;color:inherit}button{cursor:pointer;background:transparent;border:1px solid var(--line);border-radius:6px;padding:8px 13px;line-height:1.5}button:hover{background:var(--wash)}button:disabled{opacity:.5;cursor:default}button.primary{background:var(--accent);border-color:var(--accent);color:white}button.quiet{border-color:transparent;padding:5px 7px;color:var(--muted)}button.danger{color:#994a40}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid #658769;outline-offset:3px}input,select,textarea{border:1px solid #c6cfc4;border-radius:5px;background:#fffefa;padding:9px 11px;min-width:0;width:100%;font-size:16px}textarea{resize:vertical;line-height:1.8;min-height:100px}input[type=checkbox]{width:19px;height:19px;accent-color:var(--accent)}label{display:block;font-size:13px;color:var(--muted)}label input,label textarea,label select{display:block;margin-top:5px;color:var(--ink)}h1,h2,h3,p{margin-top:0}h1{font-size:28px;font-weight:500;letter-spacing:.03em;margin-bottom:18px}h2{font-size:20px;font-weight:500}h3{font-size:16px;font-weight:600;margin-bottom:12px}p{margin-bottom:13px}.eyebrow{font:10px/1.5 Georgia,serif;letter-spacing:.14em;color:var(--muted)}.apphead{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:19px 30px 12px;border-bottom:1px solid var(--line)}nav{display:flex;gap:5px;margin-top:6px}nav button{border:0;border-radius:0;color:var(--muted);padding:6px 10px}nav button[aria-current=page]{border-bottom:2px solid var(--accent);color:var(--ink)}.variants{display:flex;gap:4px}.variants button{font-size:12px;padding:7px 10px}.variants button[aria-pressed=true]{background:var(--wash);border-color:#9baea0}.notice{padding:8px 30px;margin:0;background:#f0f1e9;color:var(--muted);font-size:11px}.notice button{font-size:11px;border:0;padding:3px 6px;text-decoration:underline;text-underline-offset:3px}main{max-width:1180px;margin:0 auto;padding:30px 36px 70px}.editor-layout{display:grid;grid-template-columns:155px minmax(0,1fr);gap:36px}.sidebar{border-right:1px solid var(--line);padding-right:22px}.sidebar select{font-size:14px}.symbols{display:flex;flex-direction:column;margin-top:14px;gap:2px}.symbols button{text-align:left;border:0;font-size:13px;padding:6px 9px}.symbols button[aria-current=true]{background:#e9eee4;color:#2e513b}.mobile-symbol{display:none}.toolbar{display:flex;align-items:end;gap:12px;margin-bottom:20px}.toolbar label{flex:1;max-width:310px}.toolbar button{flex:none}.title-line{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:20px}.title-line h1{margin:0}.muted,.small{color:var(--muted);font-size:12px}.glyph{display:inline-block;font-size:33px;min-width:40px}.overview{margin-bottom:24px}.overview textarea{min-height:160px}.category-block{padding:22px 0;border-top:1px solid var(--line)}.category-heading{display:flex;gap:10px;align-items:baseline;justify-content:space-between}.entry-columns{display:grid;grid-template-columns:1fr 1fr;gap:22px}.entry-columns textarea{min-height:124px}.keyword-edit{display:flex;align-items:center;gap:4px;margin-bottom:6px}.keyword-edit input{padding:6px 9px}.keyword-edit button{padding:6px;border:0}.batchmode{display:flex;align-items:center;gap:7px;margin:8px 0;font-size:11px}.batchmode select{font-size:12px;width:auto;padding:3px 7px}.preview{font-size:12px;color:var(--accent);white-space:pre-wrap;overflow-wrap:anywhere;min-height:20px}.source-field{margin-top:12px}.source-field input{font-size:13px}.supplement{padding:15px 0;border-top:1px dotted var(--line)}.supplement p{white-space:pre-wrap}.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:20px}.savebar{position:sticky;bottom:0;background:#fbfaf6f5;border-top:1px solid var(--line);padding:12px 0;margin-top:24px;display:flex;gap:8px;align-items:center;z-index:1}.savebar span{margin-left:auto}details{margin-top:15px}summary{cursor:pointer;color:var(--accent);font-size:13px;padding:7px 0;list-style-position:outside;margin-left:14px}.add-category{display:flex;align-items:end;gap:10px;padding:15px 0}.add-category label{flex:1}.empty{color:var(--muted);padding:22px 0;font-size:14px}.manager{max-width:850px;margin:auto}.manager section{padding:28px 0;border-top:1px solid var(--line)}.row{display:flex;align-items:center;gap:8px;padding:9px 0}.row input{flex:1}.row .grow{flex:1}.row small{color:var(--muted);font-size:11px}.checkrow{display:flex;align-items:center;gap:8px;padding:7px 0;color:var(--ink)}.checkrow span{flex:1}.mapping{padding:8px 0;border-bottom:1px dotted var(--line)}.reading{max-width:760px;margin:auto}.reading textarea{min-height:120px}.results{display:flex;gap:12px;margin:28px 0 40px}.results button{border-color:transparent;border-radius:8px;padding:14px 18px;font-size:20px;background:#f0f2ea}.results button:hover{background:#e4ebdf}.reading label{margin-top:20px}.inline-check{display:flex;align-items:center;gap:8px}.searchbar{display:flex;gap:8px}.search-results{padding-top:15px}.search-result{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:12px 0}.search-result small{display:block;color:var(--muted)}
dialog{border:0;padding:0;background:var(--paper);color:var(--ink);width:min(590px,calc(100vw - 48px));max-height:85dvh;border-radius:12px;box-shadow:0 22px 90px #18291f40;overflow:auto}dialog::backdrop{background:#17251d60;backdrop-filter:blur(2px)}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:22px 28px 13px;position:sticky;top:0;background:var(--paper);z-index:2;border-bottom:1px solid var(--line)}.dialog-head h2{margin:0;font-size:25px}.dialog-head button{border:0;font-size:24px;line-height:1;padding:8px}.dialog-body{padding:20px 28px 28px}.ref-controls{display:flex;gap:8px;align-items:center;margin-bottom:17px}.ref-controls select{flex:1;font-size:14px}.ref-controls button{flex:none}.ref-group{margin:24px 0}.ref-group:first-child{margin-top:0}.ref-group h3{letter-spacing:.04em;font-size:14px;border-bottom:1px solid var(--line);padding-bottom:8px}.ref-group h3 small{font-size:11px;font-weight:400;letter-spacing:0;color:var(--muted);margin-left:10px}.term{display:flex;align-items:baseline;gap:12px;justify-content:space-between;padding:6px 0}.term strong{font-weight:500;font-size:17px;overflow-wrap:anywhere;min-width:0}.provenance{border:0;padding:3px 0 3px 8px;color:var(--muted);font-size:11px;text-align:right;flex-shrink:0;max-width:55%}.prose{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.9}.prose-wrap{padding:12px 0}.prose-wrap .caption{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:11px;margin-bottom:7px}.prose-wrap details{margin:0}.prose-wrap summary{font-size:12px}.long-preview{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;margin-bottom:4px}.ref-footer{border-top:1px solid var(--line);padding-top:17px;display:flex;gap:12px;justify-content:space-between;align-items:center}.ref-footer button{font-size:13px}.origin{padding:18px 0;border-bottom:1px solid var(--line)}.origin h3{margin-bottom:8px}.origin p{white-space:pre-wrap;overflow-wrap:anywhere}.origin small{display:block;color:var(--muted)}#aux{width:min(560px,calc(100vw - 40px))}#toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#294736;color:white;padding:9px 17px;border-radius:6px;z-index:100;font-size:13px;max-width:90%;pointer-events:none}#toast:empty{display:none}.error{color:#a8493b;font-size:12px}.helper{font-size:12px;color:var(--muted);margin-top:5px}a{color:var(--accent)}
@media(max-width:700px){.apphead{padding:13px 16px;align-items:flex-start;flex-direction:column;gap:8px}.apphead>div:first-child{width:100%}.apphead nav{justify-content:space-between}.variants{width:100%}.variants button{flex:1}.notice{padding:8px 16px}main{padding:22px 18px 48px}.editor-layout{display:block}.sidebar{border:0;padding:0;display:flex;gap:8px;margin-bottom:20px}.sidebar>label{flex:1}.symbols{display:none}.mobile-symbol{display:block}.toolbar{gap:8px}.toolbar button{font-size:12px;padding:9px}.title-line h1{font-size:24px}.entry-columns{grid-template-columns:1fr;gap:15px}.overview textarea{min-height:165px}.savebar{flex-wrap:wrap}.savebar span{font-size:10px}.row{flex-wrap:wrap}.row input{flex:1 1 180px}.row button{font-size:12px}.results{gap:3px}.results button{padding:14px 8px;font-size:17px}.searchbar{flex-wrap:wrap}.searchbar input{flex:1 1 100%}.term{gap:8px}.provenance{max-width:52%;font-size:10px}dialog{width:100%;max-width:none;max-height:90dvh;margin:auto 0 0;border-radius:16px 16px 0 0;box-shadow:0 -10px 55px #18291f30}.dialog-head{padding:20px 21px 12px}.dialog-body{padding:18px 21px 25px}.dialog-head h2{font-size:23px}#aux{width:100%;max-width:none;max-height:88dvh}.ref-footer{gap:8px}.ref-footer button{font-size:12px;padding:8px 10px}.ref-controls{flex-wrap:wrap}.ref-controls select{min-width:180px}.ref-controls button{font-size:12px}.checkrow{font-size:13px}.add-category{flex-wrap:wrap}.add-category label{min-width:180px}.ref-group{margin:20px 0}.glyph{font-size:30px;min-width:32px}}

/* Quick addition uses the existing dialog with a separately scrolling form. */
#reference.is-composing{width:min(640px,calc(100vw - 48px));height:min(760px,85dvh);overflow:hidden}
#reference.is-composing #ref-content{height:100%;display:flex;flex-direction:column;min-height:0}
#reference.is-composing .dialog-head{position:static;flex:none}
#reference.is-composing .dialog-head h2{font-size:21px}
#quick-entry-form{display:flex;flex-direction:column;flex:1;min-height:0}
.quick-scroll{overflow:auto;overscroll-behavior:contain;padding:18px 26px 22px;flex:1;min-height:0;scroll-padding-block:16px}
.quick-field{margin-bottom:18px;min-width:0}
.quick-label-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.quick-label-row label{color:var(--muted);font-size:13px;flex:1}
.quick-label-row button{font-size:12px;min-height:38px;flex:none}
.quick-creator{padding:12px 0 6px;border-bottom:1px solid var(--line);margin-bottom:10px}
.quick-creator .actions{margin-top:10px}
.quick-creator button{font-size:13px;min-height:40px}
.quick-creator p{margin:6px 0;font-size:11px}
.quick-layout-switch{display:flex;gap:6px;margin:4px 0 18px}
.quick-layout-switch button{font-size:11px;padding:5px 9px;min-height:32px;border-color:transparent;color:var(--muted)}
.quick-layout-switch button[aria-pressed=true]{background:var(--wash);color:var(--accent);border-color:var(--line)}
.quick-scroll textarea[name=body]{min-height:145px}
.quick-scroll textarea[name=keywordInput]{min-height:94px}
.quick-scroll .entry-columns textarea{min-height:145px}
.quick-scroll details{margin:0 0 16px}
.quick-scroll details[open]>summary{margin-bottom:12px}
.quick-savebar{flex:none;padding:12px 26px 16px;border-top:1px solid var(--line);background:var(--paper)}
.quick-savebar .actions{margin:8px 0 0;gap:8px}
.quick-savebar button{font-size:13px;min-height:42px}
.quick-target{font-size:12px;line-height:1.6;color:var(--muted);margin:0;overflow-wrap:anywhere}
.quick-target strong{font-weight:500;color:var(--ink)}
.quick-target small{display:block;font-size:11px;color:var(--accent)}
.quick-savebar .error{margin:7px 0 0}
.quick-discard p{font-size:12px;margin:8px 0 0;color:#994a40}
#quick-keyword-preview{font-size:11px}
@media(max-width:700px){
 #reference.is-composing{width:100%;height:90dvh;max-height:90dvh}
 #reference.is-composing .dialog-head{padding:13px 18px 10px}
 #reference.is-composing .dialog-head h2{font-size:18px}
 .quick-scroll{padding:14px 18px 18px}
 .quick-savebar{padding:10px 18px max(10px,env(safe-area-inset-bottom))}
 .quick-savebar .actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}
 .quick-savebar [data-quick=cancel]{grid-column:1/-1;min-height:30px;padding:3px}
 .quick-label-row button{min-height:42px;padding:7px 0 7px 6px;font-size:12px}
 .quick-target{font-size:11px}
 .quick-layout-switch button{min-height:36px}
 .quick-field{margin-bottom:15px}
 .quick-scroll textarea[name=body]{min-height:130px}
}
@media(max-height:620px){
 #reference.is-composing{height:94dvh;max-height:94dvh}
 #reference.is-composing .dialog-head{padding:9px 18px}
 .quick-savebar{padding-block:7px}
 .quick-scroll textarea[name=body]{min-height:85px}
}

/* Reference shell: only its card scrolls. The compact close action is a sibling. */
#reference.reference-shell,#reference.reference-shell.is-composing{padding:0;border:0;background:transparent;box-shadow:none;overflow:visible;height:fit-content;margin:auto;max-height:calc(100dvh - 32px);width:min(590px,calc(100vw - 48px));border-radius:0}
#reference.reference-shell.is-composing{width:min(640px,calc(100vw - 48px))}
#reference .reference-card{width:100%;min-height:0;overflow:auto;overscroll-behavior:contain;max-height:calc(100dvh - 48px);border-radius:12px;background:var(--paper);box-shadow:0 22px 90px #18291f40}
#reference.is-composing .reference-card{height:min(760px,85dvh);overflow:hidden}
#reference .reference-desktop-close{display:grid;place-items:center;min-width:44px;min-height:44px;flex:none}
#reference .reference-external-close{display:none}
#reference.is-composing:has(.quick-close-confirm) .reference-card{height:auto}
#reference.is-composing:has(.quick-close-confirm) #ref-content{height:auto;max-height:inherit}
.quick-close-confirm{padding:20px 26px 24px;overflow:auto;min-height:0;overscroll-behavior:contain}
.quick-close-confirm p{font-size:14px}
.quick-close-confirm button{min-height:44px;font-size:13px}
.quick-close-confirm .actions{gap:10px}
.quick-savebar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px;align-items:center}
.quick-savebar .quick-target{grid-column:1;grid-row:1}
.quick-savebar>.actions{display:flex;grid-column:2;grid-row:1;margin:0}
.quick-savebar>.error{grid-column:1/-1;grid-row:2;margin:0}
.quick-savebar button[type=submit]{min-width:88px;min-height:44px}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 #reference.reference-shell,#reference.reference-shell.is-composing{width:calc(100vw - 24px);max-width:580px;max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));margin:auto auto calc(12px + env(safe-area-inset-bottom));height:fit-content}
 #reference.reference-shell[open]{display:flex;flex-direction:column;align-items:center;gap:12px}
 #reference .reference-card{flex:0 1 auto;max-height:calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-radius:16px}
 #reference.is-composing .reference-card{height:min(760px,calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)))}
 #reference .reference-desktop-close{display:none}
 #reference .reference-external-close{display:grid;place-items:center;flex:0 0 auto;width:48px;height:48px;min-width:48px;min-height:48px;padding:0;border:1px solid #c3cfc3;border-radius:50%;background:var(--paper);color:var(--ink);font-size:26px;line-height:1;box-shadow:0 3px 15px #17251d24}
 #reference .reference-external-close:hover{background:var(--wash)}
 .quick-savebar{grid-template-columns:minmax(0,1fr);gap:6px;padding-bottom:10px}
 .quick-savebar>.actions{grid-column:1;grid-row:2;display:flex}
 .quick-savebar>.error{grid-row:3}
 .quick-savebar button[type=submit]{width:100%}
 .quick-close-confirm{padding:18px 20px 22px}
 .quick-close-confirm .actions{display:flex;flex-direction:column;align-items:stretch}
}

/* Copy hierarchy: retain labels for assistive technology without repeating headings. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.apphead nav{margin-top:0}
.preview:empty{display:none}
.category-block{padding:18px 0}
.category-heading{justify-content:flex-start}
.keyword-edit button{font-size:12px;white-space:nowrap;flex:none}
.prose-wrap .caption .provenance{margin-left:auto}
#quick-source-details label,#entry-form .overview details label{margin-top:5px}

/* The initial B form needs less height; expanded fields retain the full editor. */
@media(min-width:701px) and (min-height:501px){
 #reference.is-composing .reference-card:has(#quick-category-details):not(:has(#quick-category-details[open],#quick-source-details[open],.quick-creator)){height:min(640px,85dvh)}
}

/* Local-test data tools appear only in management; reference layout is unchanged. */
.storage-error{margin:0;padding:10px 30px;background:#f5e9df;color:#8e4236;font-size:13px;overflow-wrap:anywhere}
.storage-error[hidden]{display:none}.storage-error button{font-size:12px;margin-left:10px}
.notice a{font-size:11px;margin-left:9px}
.file-label{display:inline-flex;flex-direction:column;gap:6px}input[type=file]{font-size:13px;padding:5px;background:transparent;border:0;max-width:100%}
#data-tools .actions{align-items:flex-start;margin:12px 0}#data-tools details{margin-top:18px}
#data-tools .toolbar{margin-top:10px}.import-record{padding:8px 0;border-bottom:1px solid var(--line)}
.import-record summary{overflow-wrap:anywhere}.import-record summary small{margin-left:8px;color:var(--muted)}
.import-diff{display:grid;grid-template-columns:1fr 1fr;gap:16px}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;max-width:100%;line-height:1.6}#import-error{white-space:pre-wrap}
#recovery-list .grow small{display:block;font-size:11px;color:var(--muted)}
@media(max-width:700px){.storage-error{padding:10px 16px}.import-diff{grid-template-columns:1fr}.notice{line-height:2}#data-tools .toolbar{flex-wrap:wrap}}

.quick-savebar:has(>.error){max-height:60%;overflow:auto;overscroll-behavior:contain}

textarea.short-text{min-height:2.65rem;height:2.65rem;resize:vertical;line-height:1.4}.keyword-edit textarea{flex:1;min-width:0}
.origin small,.supplement small{white-space:pre-wrap}
