/* Three complete palettes. All components inherit one color source. */
html[data-theme="light"],html[data-theme="light"] body{--bg:#f6f8fb;--panel:#ffffff;--ink:#202b3a;--sub:#536174;--line:#c4cdda;--brand:#1d4f91;--soft:#e9eff7;--sel:#dce8f8;--warn:#9a3919;--mark:#ffe59b;--primaryInk:#ffffff;--header:#203b60;color-scheme:light;}
html[data-theme="eye"],html[data-theme="eye"] body{--bg:#f2f1e5;--panel:#fbfaf2;--ink:#28372c;--sub:#526253;--line:#bfc9b8;--brand:#245c45;--soft:#e3ebdc;--sel:#d8e6d1;--warn:#8c3e1d;--mark:#f4dfa0;--primaryInk:#ffffff;--header:#294c3b;color-scheme:light;}
html[data-theme="dark"],html[data-theme="dark"] body{--bg:#141b26;--panel:#1d2838;--ink:#e9eff7;--sub:#b9c7d9;--line:#4b5d75;--brand:#a8c9ff;--soft:#293b53;--sel:#354c6e;--warn:#ffbf9d;--mark:#695522;--primaryInk:#112039;--header:#182a43;color-scheme:dark;}
html[data-theme],html[data-theme] body{--fg:var(--ink);--text:var(--ink);--muted:var(--sub);--muted-text:var(--sub);--border:var(--line);--bg2:var(--panel);--card:var(--panel);--acc:var(--brand);--acc2:var(--brand);--accent:var(--brand);--primary:var(--brand);--surface:var(--panel);--surface2:var(--soft);--brand2:var(--brand);--focus:var(--brand);--chip:var(--soft);--hi:var(--mark);--danger:var(--warn);--ok:var(--brand);--ui-elevated:var(--panel);--ui-hover:var(--soft);--ui-header:var(--header);--ui-header-muted:#d8e4f2;--radius:10px;background:var(--bg);color:var(--ink);}
html[data-theme] body :is(.box,.tabs,.panel,.card,.pane-heading,.reader-toolbar,dialog,.footnote-dialog,#study-toolbar,.menu-pop){background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body :is(input,select,textarea,button){color:var(--ink);border-color:var(--line);}
html[data-theme] body :is(input,select,textarea){background:var(--panel);}
html[data-theme] body button{background:var(--soft);}
html[data-theme] body :is(.primary,button:not([class])#read,button:not([class])#load-commentary,.quiet.on,.chip.on,.v9b.on){background:var(--brand);color:var(--primaryInk);border-color:var(--brand);}
html[data-theme] body :is(.secondary,.quiet,.mini,.icon-button,.tab,.seg,.fname,.chip){background:var(--panel);color:var(--ink);}
html[data-theme] body :is(.secondary:hover,.quiet:hover,.mini:hover,.tab:hover,.chip:hover){background:var(--soft);color:var(--ink);}
html[data-theme] body .tabs .tab.active,html[data-theme] body .theme-swatch.active{background:var(--soft);color:var(--brand);border-color:var(--brand);}
html[data-theme] body :is(.quiet.on,.chip.on){background:var(--brand);color:var(--primaryInk);}
html[data-theme] body :is(.small,.subtle,.range,.file-path,.footnote-source-wording,.c-size,.c-date,.c-type){color:var(--sub);}
html[data-theme] body a{color:var(--brand);}
html[data-theme] body .topbar{background:var(--header);color:#f7faff;}
html[data-theme] body .topbar :is(button,a,.brand,.brand strong){background:transparent;color:#f7faff;border-color:#aec0d4;}
html[data-theme] body .topbar :is(small,.contact-mail,.contact-label){color:#d8e4f2;}
html[data-theme] body :is(.version-controls,.layer-controls,.notice,.scope,.selbar){background:var(--soft);color:var(--ink);border-color:var(--line);}
html[data-theme] body :is(.version-controls label,.layer-controls legend,.footnote-anchor){color:var(--brand);}
html[data-theme] body .verse button{background:transparent;color:var(--brand);}
html[data-theme] body :is(.verse.selected,.row.sel){background:var(--sel);}
html[data-theme] body :is(.error,.danger,.warn){color:var(--warn);}
html[data-theme] body button:disabled{opacity:.65;cursor:default;}
html[data-theme] body :is(button,input,select,a):focus-visible{outline:2px solid var(--focus);outline-offset:2px;}
html[data-theme] body mark{background:var(--mark);color:var(--ink);}
html[data-theme] body input[type=checkbox],html[data-theme] body input[type=radio]{accent-color:var(--brand);}
html[data-theme] body .theme-swatch .preview{border:1px solid var(--line);}
html[data-ldt-motion=reduce] *,html[data-ldt-motion=reduce] *:before,html[data-ldt-motion=reduce] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
html[data-ldt-density=compact] :is(.box,.reader-toolbar,.pane-heading){padding:.55rem}
#verses,#commentary,#counsel-content,.counsel-body{font-size:var(--ldt-reading-size,18px);line-height:var(--ldt-reading-line,1.85)}
.ldt-tool-strip{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0}.ldt-tool-strip button,.ldt-tool-strip a{font-size:13px;padding:5px 10px;border-radius:6px}
#ldt-tools-panel{position:fixed;inset:0;z-index:2147483000;background:#0007;display:grid;place-items:center;padding:12px}#ldt-tools-panel[hidden]{display:none}
#ldt-tools-panel>section{box-sizing:border-box;width:min(690px,100%);max-height:90vh;overflow:auto;background:var(--panel);color:var(--fg);border:1px solid var(--border);border-radius:12px;padding:16px}
#ldt-tools-panel header{display:flex;align-items:center;justify-content:space-between;gap:8px}#ldt-tools-panel h2{font-size:18px;margin:0}#ldt-tools-panel fieldset{border:1px solid var(--border);border-radius:7px;margin:12px 0;padding:10px}
#ldt-tools-panel label{display:inline-flex;align-items:center;gap:6px;margin:5px}#ldt-tools-panel input[type=number]{width:70px}#ldt-tools-panel pre{white-space:pre-wrap;word-break:break-word;font-size:12px;max-height:220px;overflow:auto}
#theme-grid-quick{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.theme-swatch{border:2px solid transparent;border-radius:8px;padding:5px;cursor:pointer;font-size:13px}.theme-swatch.active{border-color:var(--acc)}.theme-swatch .preview{height:32px;border-radius:5px}
.ldt-access-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:6px 0}.ldt-access-row a{overflow-wrap:anywhere}#addon-message{min-height:1.5em;color:var(--acc2)}

html[data-theme] body :is(button,input,select,a,.chip,.tab){transition:none;}

html[data-theme] body input::placeholder,html[data-theme] body textarea::placeholder{color:var(--sub);opacity:1;}

/* Standalone Main readers retain their layout, with the same semantic palette. */
html[data-theme] body #t378-orig-root{background:var(--bg);color:var(--ink);}
html[data-theme] body #t378-orig-root .hd,html[data-theme] body #t378-body .card{background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body #t378-orig-root .hd button,html[data-theme] body #t378-orig-root button.t283u-ed{background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body #t378-orig-root .hd button:hover,html[data-theme] body #t378-body .lex{background:var(--soft);border-color:var(--line);}
html[data-theme] body #t378-orig-root .muted,html[data-theme] body #t378-body .sec,html[data-theme] body #t378-body th{color:var(--sub);}
html[data-theme] body #t378-body .gloss{color:var(--ink);}
html[data-theme] body #t378-body .str{color:var(--brand);}
html[data-theme] body #t378-body :is(th,td){border-color:var(--line);}
html[data-theme] body #t378-orig-root button.t283u-ed.on{background:var(--brand);color:var(--primaryInk);border-color:var(--brand);}
html[data-theme] body #r602-cbook.t538 .t538-tabs button.on{background:var(--brand);color:var(--primaryInk);border-color:var(--brand);}
html[data-theme] body #r602-cbook.t538 :is(.t538-it small,.t538-crumb,.t538-grp,.t538-empty,.t538-stat){color:var(--sub);opacity:1;}
html[data-theme] body #ldt-tts-dock{background:var(--panel);color:var(--ink);border-color:var(--line);backdrop-filter:none;-webkit-backdrop-filter:none;}
html[data-theme] body #ldt-tts-dock :is(button,select){background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body #ldt-tts-dock button.on{background:var(--brand);color:var(--primaryInk);border-color:var(--brand);}
html[data-theme] body #ldt-tts-dock .tts-meta{color:var(--sub);opacity:1;}
html[data-theme] body .console-layout :is(.console-editor,.controls,.export,details){background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body .console-layout :is(label,.small,#progress){color:var(--sub);}
html[data-theme] body .console-layout .current{background:var(--soft);color:var(--ink);border-color:var(--brand);}
html[data-theme] body #file-dialog :is(.lv,.textpv){background:var(--panel);color:var(--ink);border-color:var(--line);}
html[data-theme] body #file-dialog :is(.lv-bar,.lv-sel,.lv-q,.lv-pin){background:var(--panel);color:var(--ink);border-color:var(--line);}

/* A click-through shade preserves fixed controls, native dialogs and TTS layout. */
#ldt-page-brightness-shade{position:fixed;inset:0;background:#000;opacity:0;pointer-events:none!important;z-index:2147483647;user-select:none;touch-action:none;}
#ldt-page-brightness-shade[hidden]{display:none!important;}
#ldt-tools-panel .ldt-brightness-control{display:flex;flex-wrap:wrap;gap:8px;max-width:100%;}
#ldt-tools-panel #ldt-page-brightness{flex:1 1 140px;min-width:100px;max-width:280px;accent-color:var(--brand);}
#ldt-page-brightness-value{min-width:3em;font-variant-numeric:tabular-nums;}
#ldt-tools-panel .ldt-chinese-tools{border:1px solid var(--line);padding:8px;border-radius:7px;}
#ldt-tools-panel .ldt-chinese-tools summary{cursor:pointer;font-weight:600;}
#ldt-tools-panel .ldt-chinese-tools p{overflow-wrap:anywhere;}

/* R85 user policy: UI motion is off. Loading text, disabled state and task timers remain. */
html,body,*,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important;}
