/* Theme applies to interface surfaces, never to media or generated files. */
:root{--surface:#fff;--canvas:#f7f9fc;--ink:#18243b;--soft:#f2f5fa;--field:#f9fbfe;--border:#cbd7e6;--link:#2459e8;--error:#ab2435;--success:#237253;color-scheme:light}
:root[data-theme=dark]{--surface:#192335;--canvas:#101724;--ink:#edf2fc;--soft:#243047;--field:#131d2e;--border:#53647e;--line:#3b4a63;--muted:#b0bdd1;--blue:#9db7ff;--link:#9db7ff;--error:#ffada8;--success:#9ae1bb;color:#edf2fc;background:#101724;color-scheme:dark}
.theme-control{display:inline-flex;align-items:center;gap:6px;font-size:13px;white-space:nowrap;color:var(--muted);margin-left:auto}
.theme-control select{font:inherit;color:var(--ink);background:var(--surface);border:1px solid var(--border);border-radius:7px;padding:7px;min-height:40px;max-width:110px}
[data-theme=dark] header,[data-theme=dark] .panel,[data-theme=dark] .tool-card,[data-theme=dark] .search,[data-theme=dark] .filter,[data-theme=dark] .button,[data-theme=dark] .skip-link{background:var(--surface);color:var(--ink);border-color:var(--border)}
[data-theme=dark] nav,[data-theme=dark] .footer-brand,[data-theme=dark] .quick-search button,[data-theme=dark] .card-category,[data-theme=dark] .card-open{color:var(--muted)}
[data-theme=dark] .search input,[data-theme=dark] .panel textarea,[data-theme=dark] .panel input:not([type=checkbox]):not([type=radio]):not([type=range]),[data-theme=dark] .panel select{color:var(--ink);background:var(--field);border-color:var(--border)}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:var(--muted);opacity:1}
[data-theme=dark] .button.primary,[data-theme=dark] .filter[aria-pressed=true],[data-theme=dark] .brand-mark{background:#2459e8;color:#fff;border-color:#658dff}
[data-theme=dark] .button.subtle,[data-theme=dark] kbd,[data-theme=dark] .loading-field,[data-theme=dark] .loading-action,[data-theme=dark] .calc-formula,[data-theme=dark] .img-tool .img-resultstats div,[data-theme=dark] .img-tool .img-preview .empty,[data-theme=dark] .pdf-tool .pdf-result{background:var(--soft);color:var(--ink);border-color:var(--border)}
[data-theme=dark] .tool-icon{background:#273d6b;color:#bfd0ff}[data-theme=dark] .tool-icon.image{background:#183f37;color:#9be6cb}[data-theme=dark] .tool-icon.pdf{background:#4c302e;color:#ffc3b5}[data-theme=dark] .tool-icon.calculate{background:#393057;color:#d2c2ff}
[data-theme=dark] .calc-result,[data-theme=dark] .img-tool .img-selectionnote{color:var(--link)}
[data-theme=dark] .calc-label,[data-theme=dark] .calc-result-text summary{color:var(--muted)}
[data-theme=dark] .calc-error,[data-theme=dark] .text-workspace .text-status[data-error=true],[data-theme=dark] .pdf-tool .pdf-status[data-tone=error]{color:var(--error)}
[data-theme=dark] .calc-field input[aria-invalid=true],[data-theme=dark] .img-tool .img-status[data-error=true]{background:#442b31;color:var(--error);border-color:var(--error)}
[data-theme=dark] .img-tool .img-status{background:#253c60;color:#c5d8ff}[data-theme=dark] .pdf-tool .pdf-status[data-tone=success]{color:var(--success)}
[data-theme=dark] input::file-selector-button{background:var(--soft);color:var(--link)}
[data-theme=dark] :focus-visible{outline-color:#b3c9ff}
button:disabled{cursor:not-allowed}

@media print{:root,:root[data-theme=dark]{--surface:#fff;--canvas:#fff;--ink:#18243b;--soft:#f2f5fa;--field:#fff;--muted:#66758c;--blue:#2459e8;--link:#2459e8;--line:#e3e9f2;--border:#cbd7e6;color:#18243b!important;background:#fff!important;color-scheme:light}.theme-control{display:none!important}body,header,main,footer,.panel,.tool-card,.site-card,.card-body,.calc-formula,.pdf-result{background:#fff!important;color:#18243b!important;box-shadow:none!important}input,textarea,select{background:#fff!important;color:#18243b!important}}

[data-theme=dark] .site-card,[data-theme=dark] .browser-bar,[data-theme=dark] .view-switch button[aria-pressed=true],[data-theme=dark] .skip{background:var(--surface);color:var(--ink);border-color:var(--border)}
[data-theme=dark] header,[data-theme=dark] footer,[data-theme=dark] .intro,[data-theme=dark] .about,[data-theme=dark] .card-visual,[data-theme=dark] .tags span{border-color:var(--border)}
[data-theme=dark] .card-visual,[data-theme=dark] .view-switch,[data-theme=dark] .status,[data-theme=dark] .pending{background:var(--soft);color:var(--muted)}
[data-theme=dark] .nav-link,[data-theme=dark] .card-meta,[data-theme=dark] .description,[data-theme=dark] .tags span,[data-theme=dark] .site-address,[data-theme=dark] .release-note,[data-theme=dark] .collection-label,[data-theme=dark] footer>span,[data-theme=dark] footer small{color:var(--muted)}
[data-theme=dark] .visit:not(.pending),[data-theme=dark] .logo-mark{background:#223ee8;color:#fff}
[data-theme=dark] .error{color:var(--error)}


footer .theme-control{display:flex;align-items:center;flex-wrap:wrap;gap:4px;width:100%;margin:0;justify-content:flex-end;font-size:12px}
footer .theme-control span{margin-right:5px}
footer .theme-control button{font:inherit;border:1px solid transparent;background:transparent;color:var(--muted);border-radius:5px;padding:6px 9px;min-height:36px;cursor:pointer}
footer .theme-control button[aria-pressed=true]{color:var(--ink);background:var(--soft);border-color:var(--border);font-weight:700}
footer .theme-control button:focus-visible{outline:3px solid var(--link);outline-offset:2px}
@media(max-width:600px){footer .theme-control{justify-content:flex-start;flex-basis:100%;order:10;padding-top:8px}footer .theme-control button{min-height:44px}footer small{margin-left:0}}
@media print{footer .theme-control{display:none!important}}
