/* QUÍMICA V17.0 · Preferences, accessible themes, instrument panels and reference hub */
.settings-open-button { flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; gap:.48rem; min-height:2.65rem; padding:.58rem .8rem; border:1px solid #cbd8e8; border-radius:.82rem; color:#183b70; background:#fff; font-size:.74rem; font-weight:780; box-shadow:0 4px 12px rgba(22,47,88,.055); }
.settings-open-button:hover { color:#0e7b7e; border-color:#9bd5d0; background:#f2fbfa; }
.settings-open-button svg,.library-search svg { width:1.1rem; height:1.1rem; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.header-tools { gap:.55rem; }
.hero-title-main { color:#f6f9ff!important; text-shadow:none!important; }
.settings-dialog { width:min(100% - 2rem, 34rem); max-width:34rem; max-height:min(90vh, 52rem); padding:0; overflow:hidden; border:1px solid rgba(158,180,211,.45); border-radius:1.35rem; color:var(--color-ink); background:var(--color-surface); box-shadow:0 30px 100px rgba(5,19,43,.36); }
.settings-dialog::backdrop { background:rgba(5,15,31,.58); backdrop-filter:blur(5px); }
.settings-dialog-shell { display:flex; max-height:min(90vh,52rem); flex-direction:column; }
.settings-dialog-header { display:flex; align-items:center; justify-content:space-between; padding:1.25rem 1.4rem; border-bottom:1px solid var(--color-line); background:linear-gradient(120deg,var(--color-surface-soft),var(--color-surface)); }
.settings-heading-lockup { display:flex; align-items:center; gap:.8rem; }
.settings-heading-icon { display:grid; width:2.55rem; height:2.55rem; place-items:center; border:1px solid #c9d8f0; border-radius:.85rem; color:#234b91; background:#eaf1ff; font-size:1.35rem; }
.settings-kicker { display:block; margin-bottom:.18rem; color:#6480a5; font:800 .54rem/1.3 var(--font-mono); letter-spacing:.1em; }
.settings-dialog-header h2 { margin:0; color:var(--color-ink); font-size:1.35rem; letter-spacing:-.035em; }
.settings-icon-button { display:grid; width:2.3rem; height:2.3rem; place-items:center; border:1px solid var(--color-line); border-radius:.7rem; color:var(--color-muted); background:var(--color-surface); font-size:1.4rem; cursor:pointer; }
.settings-dialog-body { display:grid; gap:1.1rem; padding:1.2rem 1.4rem; overflow:auto; }
.settings-group { padding:1rem; border:1px solid var(--color-line); border-radius:1rem; background:var(--color-surface-soft); }
.settings-group-heading { display:flex; align-items:center; gap:.7rem; margin-bottom:.9rem; }
.settings-group-symbol { display:grid; width:2rem; height:2rem; flex:0 0 2rem; place-items:center; border-radius:.65rem; color:#155b84; background:#e2f4f5; font-weight:850; }
.settings-group-heading h3 { margin:0; color:var(--color-ink); font-size:.88rem; }
.settings-group-heading p { margin:.12rem 0 0; color:var(--color-muted); font-size:.68rem; line-height:1.45; }
.settings-field { display:grid; gap:.4rem; margin-top:.7rem; color:var(--color-ink-soft); font-size:.7rem; font-weight:750; }
.settings-field select { width:100%; min-height:2.7rem; padding:.55rem .75rem; border:1px solid var(--color-line-strong); border-radius:.7rem; color:var(--color-ink); background:var(--color-surface); font:600 .76rem var(--font-sans); }
.settings-switch-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; cursor:pointer; }
.settings-switch-row strong,.settings-switch-row small { display:block; }
.settings-switch-row strong { color:var(--color-ink); font-size:.75rem; }
.settings-switch-row small { margin-top:.18rem; color:var(--color-muted); font-size:.65rem; }
.settings-switch-row input { position:absolute; width:1px; height:1px; opacity:0; }
.settings-switch { position:relative; width:2.7rem; height:1.5rem; flex:0 0 2.7rem; border-radius:99px; background:#aab7c8; transition:background .18s ease; }
.settings-switch::after { position:absolute; top:.2rem; left:.2rem; width:1.1rem; height:1.1rem; border-radius:50%; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.2); content:""; transition:transform .18s ease; }
.settings-switch-row input:checked + .settings-switch { background:#167f80; }
.settings-switch-row input:checked + .settings-switch::after { transform:translateX(1.2rem); }
.settings-switch-row input:focus-visible + .settings-switch { outline:3px solid #d69b40; outline-offset:3px; }
.settings-local-note { display:flex; gap:.55rem; margin:0; color:var(--color-muted); font-size:.65rem; line-height:1.5; }
.settings-local-note > span:first-child { color:#13a37f; }
.settings-dialog-footer { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:1rem 1.4rem; border-top:1px solid var(--color-line); background:var(--color-surface-soft); }
.settings-reset-button { min-height:2.7rem; padding:.5rem .75rem; border:0; color:var(--color-muted); background:transparent; font-size:.68rem; font-weight:750; cursor:pointer; }
.settings-done-button { min-width:7rem; min-height:2.8rem; justify-content:center; }

/* Experimental lab instrument */
.titration-lab-card { margin:1.1rem 0 2.1rem; overflow:hidden; border:1px solid #cbd9eb; border-radius:1.45rem; background:linear-gradient(145deg,#fff 0%,#f7faff 100%); box-shadow:0 20px 52px rgba(17,42,81,.09); }
.titration-card-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1.2rem; padding:1.5rem 1.6rem 1.1rem; border-bottom:1px solid #e4eaf3; background:linear-gradient(115deg,#eff5ff 0%,#f8fbff 58%,#e9f8f5 100%); }
.lab-instrument-kicker { color:#456ba2; font:800 .57rem/1.4 var(--font-mono); letter-spacing:.12em; }
.titration-card-heading h3 { margin:.3rem 0 .35rem; color:#10294a; font-size:clamp(1.4rem,2.2vw,1.9rem); letter-spacing:-.045em; }
.titration-card-heading p { max-width:50rem; margin:0; color:#62758f; font-size:.76rem; line-height:1.65; }
.titration-live-status { display:flex; flex:0 0 auto; align-items:center; gap:.45rem; padding:.42rem .65rem; border:1px solid #bde4d9; border-radius:99px; color:#21735f; background:#effbf6; font:750 .59rem var(--font-mono); }
.live-status-dot { width:.42rem; height:.42rem; border-radius:50%; background:#29b68a; box-shadow:0 0 0 4px rgba(41,182,138,.12); }
.titration-controls-grid { display:grid; grid-template-columns:minmax(255px,.78fr) minmax(0,1.55fr); gap:1.05rem; padding:1.05rem; }
.titration-control-panel { padding:1.1rem; border:1px solid #e0e8f2; border-radius:1rem; background:#f9fbff; }
.instrument-panel-label { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.8rem; color:#57718f; font:800 .56rem var(--font-mono); letter-spacing:.1em; }
.instrument-panel-label b { color:#1f4e87; font-size:.72rem; letter-spacing:0; }
.titration-field { display:grid; gap:.35rem; margin:.75rem 0; color:#506782; font-size:.67rem; font-weight:720; }
.field-with-unit { display:flex; align-items:center; min-height:2.55rem; border:1px solid #cfdaea; border-radius:.65rem; background:white; }
.field-with-unit input { width:100%; min-width:0; padding:.55rem .7rem; border:0; outline:0; color:#132c4c; background:transparent; font:750 .82rem var(--font-mono); }
.field-with-unit b { padding-inline:.7rem; color:#71829a; font:650 .62rem var(--font-mono); white-space:nowrap; }
.instrument-panel-divider { height:1px; margin:1rem 0; background:#e1e9f3; }
.titration-volume-control { margin-top:1.1rem; padding:.9rem; border:1px solid #d9e4f2; border-radius:.8rem; background:#fff; }
.titration-volume-heading { display:flex; align-items:center; justify-content:space-between; gap:.5rem; color:#536d89; font-size:.68rem; font-weight:750; }
.titration-volume-heading output { color:#155b87; font:800 .83rem var(--font-mono); }
#titration-base-volume { width:100%; margin:.95rem 0 .25rem; accent-color:#0d9488; cursor:pointer; }
.range-scale { display:flex; justify-content:space-between; color:#90a0b3; font:600 .56rem var(--font-mono); }
.titration-step-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.35rem; margin-top:.75rem; }
.instrument-step-button { min-height:2.35rem; padding:.35rem .25rem; border:1px solid #d4e0ef; border-radius:.62rem; color:#31577f; background:#edf3fb; font:750 .57rem var(--font-mono); cursor:pointer; }
.instrument-step-button:hover { border-color:#8db8d7; background:#e5f3f8; }
.titration-bottom-actions { display:flex; gap:.45rem; margin-top:.8rem; }
.instrument-equivalence-button,.instrument-reset-button,.instrument-export-button { min-height:2.45rem; padding:.5rem .72rem; border-radius:.65rem; font-size:.65rem; font-weight:780; cursor:pointer; }
.instrument-equivalence-button { flex:1; border:1px solid #a8dcd4; color:#0c716d; background:#e8f8f5; }
.instrument-reset-button { border:1px solid #d9e0ea; color:#66758a; background:#fff; }
.titration-analysis-panel { min-width:0; padding:1rem 1.1rem; border:1px solid #e0e8f2; border-radius:1rem; background:#fff; }
.titration-readout-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.readout-caption,.equivalence-readout > span { display:block; color:#7b8da5; font:800 .56rem var(--font-mono); letter-spacing:.1em; }
.ph-value { display:block; margin:.12rem 0; color:#112f57; font:800 clamp(2rem,4vw,3rem)/1.05 var(--font-mono); letter-spacing:-.08em; }
.ph-interpretation { display:inline-flex; padding:.27rem .52rem; border:1px solid #c9e7e1; border-radius:99px; color:#1a796c; background:#effaf7; font-size:.61rem; font-weight:750; }
.equivalence-readout { display:grid; justify-items:end; gap:.27rem; text-align:right; }
.equivalence-readout strong { color:#1b4c83; font:800 1.1rem var(--font-mono); }
.equivalence-readout small { color:#8493a7; font-size:.58rem; }
.titration-chart-wrap { position:relative; display:grid; grid-template-columns:1.6rem minmax(0,1fr); align-items:stretch; margin:1.2rem 0 .45rem; }
.chart-axis-y { display:flex; flex-direction:column; justify-content:space-between; padding:0 0 1.1rem; color:#8292a8; font:600 .56rem var(--font-mono); }
#titration-curve { width:100%; height:auto; min-height:12rem; overflow:visible; }
.chart-grid-lines path { fill:none; stroke:#e8edf4; stroke-width:1; stroke-dasharray:3 5; }
.titration-curve-area { fill:url(#titration-area-gradient); }
.titration-curve-line { fill:none; stroke:#0d9488; stroke-width:3.4; stroke-linecap:round; stroke-linejoin:round; }
.titration-equivalence-line { fill:none; stroke:#e29a35; stroke-width:1.5; stroke-dasharray:5 5; }
.titration-curve-marker { fill:#fff; stroke:#0d9488; stroke-width:3; filter:drop-shadow(0 2px 4px rgba(13,148,136,.25)); }
.chart-axis-x { grid-column:2; display:flex; justify-content:space-between; padding:0 .05rem; color:#8292a8; font:600 .55rem var(--font-mono); }
.titration-result-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.45rem; margin-top:.95rem; }
.titration-result-grid > div { display:grid; gap:.25rem; padding:.65rem .7rem; border:1px solid #e5ebf3; border-radius:.7rem; background:#f8faff; }
.titration-result-grid span { color:#8190a4; font-size:.56rem; }
.titration-result-grid strong { color:#1b3b62; font:750 .68rem var(--font-mono); }
.titration-model-note { display:flex; gap:.55rem; margin-top:.8rem; padding:.7rem .8rem; border:1px solid #dce8f3; border-radius:.7rem; color:#4f6b88; background:#f5f9fd; }
.titration-model-note > span { color:#1c83a0; font-size:.9rem; }
.titration-model-note p { margin:0; font-size:.58rem; line-height:1.55; }
.titration-card-footer { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.85rem 1.25rem; border-top:1px solid #e5ebf3; color:#78899f; background:#f9fbfe; font-size:.6rem; }
.instrument-export-button { border:1px solid #c9d8ec; color:#28558b; background:#fff; }

/* Reference library hub */
.library-toolbar { display:flex; align-items:center; justify-content:space-between; gap:.8rem; margin:1.2rem 0 .8rem; }
.library-search { display:flex; width:min(100%,38rem); min-height:3.1rem; align-items:center; gap:.65rem; padding:.35rem .75rem; border:1px solid #d6e1ef; border-radius:.85rem; color:#6480a3; background:#fff; box-shadow:0 5px 16px rgba(20,44,83,.035); }
.library-search svg { flex:0 0 1.05rem; }
.library-search input { width:100%; min-width:0; border:0; outline:0; color:#183654; background:transparent; font:500 .75rem var(--font-sans); }
.library-search-shortcut { display:grid; width:1.45rem; height:1.45rem; flex:0 0 1.45rem; place-items:center; border:1px solid #e0e7f1; border-radius:.4rem; color:#91a0b4; background:#f7f9fc; font:700 .65rem var(--font-mono); }
.library-export-button { min-height:2.85rem; padding:.5rem .85rem; border:1px solid #cbd9eb; border-radius:.78rem; color:#234d82; background:#fff; font-size:.66rem; font-weight:780; cursor:pointer; }
.library-category-strip { display:flex; flex-wrap:wrap; gap:.45rem; margin-bottom:.8rem; }
.library-category { padding:.42rem .7rem; border:1px solid #dbe5f1; cursor:pointer; font:inherit; font-size:.61rem; font-weight:750; border-radius:99px; color:#687d97; background:#fff; font-size:.61rem; font-weight:750; }
.library-category.is-active { border-color:#b7d5ec; color:#155b89; background:#eaf4fb; }
.library-results-line { margin:.35rem 0 .8rem; color:#7d8ea3; font-size:.65rem; }
.library-reference-grid { grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; }
.library-reference-card { min-height:14rem; }
.library-card-top { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.9rem; }
.library-card-icon { display:grid; width:2.1rem; height:2.1rem; place-items:center; border:1px solid #cbdcf1; border-radius:.7rem; color:#27599b; background:#ebf2ff; font:800 .64rem var(--font-mono); }
.library-card-tag { color:#6481a7; font:800 .52rem var(--font-mono); letter-spacing:.09em; }
.library-formula { margin:.8rem 0; color:#17477b; font:700 1.4rem var(--font-mono); }
.library-constant-value { margin:.7rem 0; color:#164f80; font:800 .88rem var(--font-mono); line-height:1.5; }
.library-reference-card details { position:relative; z-index:1; margin-top:.8rem; padding-top:.65rem; border-top:1px solid #e7edf5; }
.library-reference-card summary { color:#22658b; font-size:.64rem; font-weight:780; cursor:pointer; }
.library-reference-card details p { margin:.55rem 0 0; color:#60748d; font-size:.66rem; line-height:1.65; }
.library-source-link { position:relative; z-index:1; display:inline-flex; margin-top:.45rem; color:#1b7180; font-size:.67rem; font-weight:800; text-decoration:none; }
.library-no-results { margin:1.2rem 0; padding:1.4rem; border:1px dashed #cbd9e9; border-radius:.9rem; color:#6d7f97; text-align:center; }
.library-disclaimer { margin-top:1rem; color:#8190a3; font-size:.62rem; line-height:1.65; }

/* Dark appearance. Scoped selectors intentionally include the older V13/V14 workbench. */
html[data-theme="dark"] { color-scheme:dark; --color-page:#091321; --color-surface:#101e30; --color-surface-soft:#14243a; --color-surface-raised:#172941; --color-ink:#e8f0fa; --color-ink-soft:#c2d0e1; --color-muted:#93a5bb; --color-line:#283a52; --color-line-strong:#3b506c; --color-brand:#8bb8ff; --color-brand-strong:#a9caff; --color-brand-soft:#1b3456; --color-accent:#56d6ca; --color-accent-soft:#173c40; --shadow-card:0 18px 48px rgba(0,0,0,.25); }
html[data-theme="dark"] body { color:var(--color-ink); background:radial-gradient(ellipse at 8% 7%,rgba(37,99,235,.13),transparent 30rem),radial-gradient(ellipse at 94% 24%,rgba(13,148,136,.09),transparent 28rem),linear-gradient(180deg,#0b1727 0%,#091321 100%); }
html[data-theme="dark"] body::before { opacity:.12; background-image:radial-gradient(rgba(148,183,225,.3) .65px,transparent .65px); }
html[data-theme="dark"] .site-header { border-color:rgba(75,99,130,.45); background:rgba(9,20,35,.94); box-shadow:0 8px 28px rgba(0,0,0,.22); }
html[data-theme="dark"] .brand-mark { border-color:#344a66; background:linear-gradient(145deg,#1b2c43,#101c2d); }
html[data-theme="dark"] .brand-copy strong { color:#e8f1ff; }
html[data-theme="dark"] .brand-copy span,html[data-theme="dark"] .header-note { color:#9eb3cc; }
html[data-theme="dark"] .main-nav a { color:#a9bad0; }
html[data-theme="dark"] .main-nav a:hover { color:#a8d7ff; border-color:#2b4868; background:#172c47; }
html[data-theme="dark"] .main-nav a[aria-selected="true"] { color:#fff; border-color:#426db0; background:linear-gradient(135deg,#1f4988,#235e8c); }
html[data-theme="dark"] .settings-open-button,html[data-theme="dark"] .settings-icon-button,html[data-theme="dark"] .settings-reset-button { color:var(--color-ink); border-color:var(--color-line-strong); background:var(--color-surface); }
html[data-theme="dark"] .section-heading h2,html[data-theme="dark"] .feature-copy h2,html[data-theme="dark"] .discipline-card h3,html[data-theme="dark"] .feature-item strong,html[data-theme="dark"] .phet-card h3,html[data-theme="dark"] .lab-card h3,html[data-theme="dark"] .library-card h3 { color:#e6effb; }
html[data-theme="dark"] .section-heading p,html[data-theme="dark"] .discipline-card p,html[data-theme="dark"] .feature-copy p,html[data-theme="dark"] .feature-item span:last-child,html[data-theme="dark"] .phet-card p,html[data-theme="dark"] .lab-card p,html[data-theme="dark"] .library-card p { color:#a5b6cb; }
html[data-theme="dark"] .feature-section,html[data-theme="dark"] .nexus-section { border-color:#263951; background:linear-gradient(135deg,#101f32 0%,#0e1b2c 55%,#10282d 100%); }
html[data-theme="dark"] .discipline-card,html[data-theme="dark"] .feature-item,html[data-theme="dark"] .phet-card,html[data-theme="dark"] .lab-card,html[data-theme="dark"] .library-card,html[data-theme="dark"] .lab3d-benefit-card { border-color:#2a405b; background:linear-gradient(145deg,#14243a,#101d2f); box-shadow:0 9px 26px rgba(0,0,0,.16); }
html[data-theme="dark"] .card-index,html[data-theme="dark"] .section-kicker,html[data-theme="dark"] .periodic-kicker { color:#8dbcf6; }
html[data-theme="dark"] .card-arrow,html[data-theme="dark"] .library-source-link { color:#69d6cb; }
html[data-theme="dark"] .periodic-workbench { border-color:#30465f; background:#101e30; }
html[data-theme="dark"] .periodic-workbench-head { border-color:#30465f; background:linear-gradient(115deg,#172d4b,#12253b 62%,#123439); }
html[data-theme="dark"] .periodic-workbench-head h3,html[data-theme="dark"] .periodic-workbench-head h4 { color:#e5effb; }
html[data-theme="dark"] .periodic-workbench-head p { color:#a8bbd1; }
html[data-theme="dark"] .periodic-head-stats span,html[data-theme="dark"] .periodic-app-nav,html[data-theme="dark"] .periodic-view,html[data-theme="dark"] .v11-series-wrap { border-color:#2b405a; color:#c5d2e2; background:#13243a; }
html[data-theme="dark"] .periodic-app-tab { color:#afc1d7; }
html[data-theme="dark"] .periodic-app-tab.is-active { color:#c4dcff; background:#1c3d67; box-shadow:inset 0 0 0 1px #345b8a; }
html[data-theme="dark"] .periodic-view h3,html[data-theme="dark"] .periodic-view h4,html[data-theme="dark"] .periodic-view label { color:#dbe8f8; }
html[data-theme="dark"] .periodic-view p,html[data-theme="dark"] .periodic-view small { color:#a9bad0; }
html[data-theme="dark"] .periodic-view input,html[data-theme="dark"] .periodic-view select,html[data-theme="dark"] .periodic-view textarea { color:#e7effa; border-color:#38516f; background:#0f1c2d; }
html[data-theme="dark"] .lab-subheading { border-color:#2a405b; }
html[data-theme="dark"] .footer-inner { border-color:#2c4057; }
html[data-theme="dark"] .site-footer { color:#95a8bf; }
html[data-theme="dark"] .closing { border-color:#2a506d; }
html[data-theme="dark"] .titration-lab-card { border-color:#314b69; background:linear-gradient(145deg,#11233a,#0e1c2f); box-shadow:0 18px 48px rgba(0,0,0,.28); }
html[data-theme="dark"] .titration-card-heading { border-color:#2b415b; background:linear-gradient(115deg,#172f50,#13263f 58%,#12393c); }
html[data-theme="dark"] .titration-card-heading h3 { color:#e4efff; }
html[data-theme="dark"] .titration-card-heading p { color:#a6bad2; }
html[data-theme="dark"] .lab-instrument-kicker { color:#9bc7ff; }
html[data-theme="dark"] .titration-control-panel,html[data-theme="dark"] .titration-analysis-panel { border-color:#2d4562; background:#12243a; }
html[data-theme="dark"] .instrument-panel-label,html[data-theme="dark"] .titration-field,html[data-theme="dark"] .titration-volume-heading { color:#adbed2; }
html[data-theme="dark"] .instrument-panel-label b { color:#9cc7ff; }
html[data-theme="dark"] .field-with-unit,html[data-theme="dark"] .titration-volume-control,html[data-theme="dark"] .instrument-reset-button,html[data-theme="dark"] .instrument-export-button { border-color:#3a5473; background:#0d1b2d; }
html[data-theme="dark"] .field-with-unit input,html[data-theme="dark"] .library-search input { color:#e7f1ff; }
html[data-theme="dark"] .field-with-unit b,html[data-theme="dark"] .range-scale { color:#91a6bf; }
html[data-theme="dark"] .instrument-step-button { border-color:#38516f; color:#c5dcf4; background:#203753; }
html[data-theme="dark"] .instrument-equivalence-button { border-color:#276c6a; color:#9be5d9; background:#143c3b; }
html[data-theme="dark"] .ph-value,html[data-theme="dark"] .equivalence-readout strong,html[data-theme="dark"] .titration-result-grid strong { color:#dceaff; }
html[data-theme="dark"] .ph-interpretation { border-color:#286c65; color:#93e3d6; background:#153b39; }
html[data-theme="dark"] .readout-caption,html[data-theme="dark"] .equivalence-readout>span,html[data-theme="dark"] .equivalence-readout small,html[data-theme="dark"] .chart-axis-y,html[data-theme="dark"] .chart-axis-x { color:#91a8c1; }
html[data-theme="dark"] .chart-grid-lines path { stroke:#2b4059; }
html[data-theme="dark"] .titration-result-grid>div,html[data-theme="dark"] .titration-model-note,html[data-theme="dark"] .titration-card-footer { border-color:#2c435d; color:#a9bdd4; background:#102037; }
html[data-theme="dark"] .titration-model-note p { color:#a9bdd4; }
html[data-theme="dark"] .titration-card-footer { border-color:#2b4159; }
html[data-theme="dark"] .library-search,html[data-theme="dark"] .library-export-button,html[data-theme="dark"] .library-category { border-color:#344d6a; color:#b6cce4; background:#13243a; }
html[data-theme="dark"] .library-search-shortcut { border-color:#344d6a; color:#8ea6c1; background:#0e1c2d; }
html[data-theme="dark"] .library-category.is-active { border-color:#37668f; color:#b5e1f2; background:#183a52; }
html[data-theme="dark"] .library-results-line,html[data-theme="dark"] .library-disclaimer { color:#91a6bd; }
html[data-theme="dark"] .library-card-icon { border-color:#3b5a80; color:#a8caff; background:#1a365a; }
html[data-theme="dark"] .library-card-tag { color:#93b8e7; }
html[data-theme="dark"] .library-formula,html[data-theme="dark"] .library-constant-value { color:#9bdad6; }
html[data-theme="dark"] .library-reference-card details { border-color:#344b66; }
html[data-theme="dark"] .library-reference-card summary { color:#86d8dc; }
html[data-theme="dark"] .library-reference-card details p { color:#a7b9cf; }
html[data-theme="dark"] .library-no-results { border-color:#405571; color:#a6b7cd; }
html[data-theme="dark"] .settings-dialog { color:#e6effb; border-color:#314762; background:#101f32; }
html[data-theme="dark"] .settings-dialog-header,html[data-theme="dark"] .settings-dialog-footer { border-color:#2b4058; background:#14253a; }
html[data-theme="dark"] .settings-heading-icon { border-color:#385b89; color:#a9caff; background:#1b3557; }
html[data-theme="dark"] .settings-kicker { color:#8daed7; }
html[data-theme="dark"] .settings-dialog-header h2,html[data-theme="dark"] .settings-group-heading h3,html[data-theme="dark"] .settings-switch-row strong { color:#e2edfa; }
html[data-theme="dark"] .settings-group { border-color:#2c435e; background:#12243a; }
html[data-theme="dark"] .settings-group-heading p,html[data-theme="dark"] .settings-switch-row small,html[data-theme="dark"] .settings-local-note { color:#9caec4; }
html[data-theme="dark"] .settings-group-symbol { color:#a4e4e3; background:#174046; }
html[data-theme="dark"] .settings-field { color:#b8c9dc; }
html[data-theme="dark"] .settings-field select { border-color:#3b5470; color:#e4eefb; background:#0d1b2c; }
html[data-theme="dark"] .settings-icon-button { border-color:#38516c; color:#c0d2e7; background:#172940; }
html[data-theme="dark"] .settings-switch { background:#53657a; }
html[data-theme="dark"] .settings-reset-button { color:#a6bad1; }

html[data-text-size="large"] { font-size:108%; }
html[data-motion="reduced"] *,html[data-motion="reduced"] *::before,html[data-motion="reduced"] *::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
@media(max-width:1050px) { .settings-open-button { order:0; } }
@media(max-width:760px) {
  .settings-open-button { min-height:2.45rem; padding:.45rem .6rem; }
  .settings-open-button span { display:none; }
  .titration-card-heading { flex-direction:column; padding:1.2rem; }
  .titration-live-status { align-self:flex-start; }
  .titration-controls-grid { grid-template-columns:1fr; padding:.7rem; }
  .titration-card-footer { align-items:flex-start; flex-direction:column; }
  .library-toolbar { align-items:stretch; flex-direction:column; }
  .library-search { width:100%; }
  .library-reference-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .library-export-button { width:100%; }
}
@media(max-width:520px) {
  .settings-dialog { width:calc(100% - 1rem); border-radius:1rem; }
  .settings-dialog-header,.settings-dialog-body,.settings-dialog-footer { padding-inline:1rem; }
  .titration-result-grid { grid-template-columns:1fr 1fr; }
  .titration-result-grid > div:last-child { grid-column:1/-1; }
  .titration-readout-row { align-items:flex-start; }
  .equivalence-readout { max-width:48%; }
  .equivalence-readout strong { font-size:.85rem; }
  .library-reference-grid { grid-template-columns:1fr; }
}

/* V17.0 refinement: readable equations and transparent range validation. */
.library-formula { display:inline-flex; align-items:center; min-height:2.1rem; padding:.35rem .55rem; border:1px solid #d8e5f3; border-radius:.55rem; background:#f2f7fd; letter-spacing:.01em; }
.titration-validation { margin:.7rem 0 0; padding:.65rem .75rem; border:1px solid #f0c987; border-radius:.65rem; color:#80510d; background:#fff8e9; font-size:.66rem; line-height:1.55; }
.titration-field input[aria-invalid="true"] { border-color:#c75b55; box-shadow:0 0 0 2px rgba(199,91,85,.1); }
html[data-theme="dark"] .library-formula { border-color:var(--color-line-strong); background:#172b40; }
html[data-theme="dark"] .titration-validation { border-color:#765a31; color:#f2d49d; background:#302719; }

.library-reference-citation { display:inline-flex; margin-top:.48rem; color:#1c7180; font-size:.62rem; font-weight:780; text-decoration:none; text-underline-offset:3px; }
.library-reference-citation:hover { text-decoration:underline; }
html[data-theme="dark"] .library-reference-citation { color:#7edbd1; }


/* QUÍMICA V17.1 · public sharing and enhanced accessibility preferences. */
.share-page-button { flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; gap:.46rem; min-height:2.65rem; padding:.56rem .78rem; border:1px solid #cbd8e8; border-radius:.82rem; color:#183b70; background:#fff; font-size:.73rem; font-weight:780; box-shadow:0 4px 12px rgba(22,47,88,.045); }
.share-page-button svg { width:1.05rem; height:1.05rem; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.share-page-button:hover { color:#0e7b7e; border-color:#9bd5d0; background:#f2fbfa; }
.share-page-button:disabled { opacity:.6; cursor:wait; }
.share-status { position:fixed; z-index:250; right:1.1rem; bottom:1.1rem; max-width:min(28rem,calc(100vw - 2rem)); padding:.82rem 1rem; border:1px solid #9bd5d0; border-radius:.9rem; color:#103d43; background:#effcf9; box-shadow:0 15px 42px rgba(15,44,58,.18); font-size:.78rem; font-weight:700; line-height:1.5; }
.share-status[hidden] { display:none; }
html[data-theme="dark"] .share-page-button { color:#d8e9fb; border-color:#3b5470; background:#14253a; }
html[data-theme="dark"] .share-page-button:hover { color:#a9f4e8; border-color:#347a79; background:#173b43; }
html[data-theme="dark"] .share-status { color:#dffcf6; border-color:#347a79; background:#123a3a; }
.settings-switch-row input:focus-visible + .settings-switch { outline:3px solid var(--color-focus); outline-offset:3px; }
.settings-switch-row { min-height:3.3rem; }

/* High contrast keeps the chosen light/dark mode but strengthens essential UI contrast. */
html[data-contrast="high"] { --color-ink:#080d16; --color-ink-soft:#172333; --color-muted:#334155; --color-line:#66758a; --color-line-strong:#3d4c60; --color-brand-strong:#003f8f; }
html[data-contrast="high"] body { color:#080d16!important; }
html[data-contrast="high"] .main-nav a,html[data-contrast="high"] .header-note,html[data-contrast="high"] .brand-copy span { color:#26364b!important; }
html[data-contrast="high"] .main-nav a[aria-selected="true"] { color:#fff!important; background:#003f8f!important; border-color:#002e6b!important; }
html[data-contrast="high"] .section-heading p,html[data-contrast="high"] .feature-copy p,html[data-contrast="high"] .discipline-card p,html[data-contrast="high"] .feature-item span:last-child,html[data-contrast="high"] .phet-card p,html[data-contrast="high"] .lab-card p,html[data-contrast="high"] .library-card p { color:#26364b!important; }
html[data-contrast="high"] .discipline-card,html[data-contrast="high"] .feature-item,html[data-contrast="high"] .phet-card,html[data-contrast="high"] .lab-card,html[data-contrast="high"] .library-card { border-color:#68788e!important; }
html[data-contrast="high"] button,html[data-contrast="high"] a,html[data-contrast="high"] input,html[data-contrast="high"] select,html[data-contrast="high"] textarea,html[data-contrast="high"] summary { text-decoration-thickness:2px; }
html[data-contrast="high"] :focus-visible { outline:3px solid #a34d00!important; outline-offset:3px!important; }
html[data-theme="dark"][data-contrast="high"] { --color-page:#000; --color-surface:#050505; --color-surface-soft:#101010; --color-surface-raised:#171717; --color-ink:#fff; --color-ink-soft:#f1f5f9; --color-muted:#e2e8f0; --color-line:#9aa4b2; --color-line-strong:#cbd5e1; --color-brand:#9cc7ff; --color-brand-strong:#bfdbfe; }
html[data-theme="dark"][data-contrast="high"] body { color:#fff!important; background:#000!important; }
html[data-theme="dark"][data-contrast="high"] .main-nav a,html[data-theme="dark"][data-contrast="high"] .header-note,html[data-theme="dark"][data-contrast="high"] .brand-copy span,html[data-theme="dark"][data-contrast="high"] .section-heading p,html[data-theme="dark"][data-contrast="high"] .feature-copy p,html[data-theme="dark"][data-contrast="high"] .discipline-card p,html[data-theme="dark"][data-contrast="high"] .feature-item span:last-child,html[data-theme="dark"][data-contrast="high"] .phet-card p,html[data-theme="dark"][data-contrast="high"] .lab-card p,html[data-theme="dark"][data-contrast="high"] .library-card p { color:#f1f5f9!important; }
html[data-theme="dark"][data-contrast="high"] .discipline-card,html[data-theme="dark"][data-contrast="high"] .feature-item,html[data-theme="dark"][data-contrast="high"] .phet-card,html[data-theme="dark"][data-contrast="high"] .lab-card,html[data-theme="dark"][data-contrast="high"] .library-card { border-color:#9aa4b2!important; }
@media(max-width:760px) { .share-page-button { min-height:2.45rem; padding:.45rem .6rem; } .share-page-button span { display:none; } }
