/* Site chrome and preview surfaces only. Never filter generated image pixels. */
:root{--theme-surface:#fff;--theme-raised:#fff;--theme-control:#fff;--theme-soft:#edf0f7;--theme-accent-soft:#eaf1ff;--theme-checker-a:#e1e5ed;--theme-checker-b:#fff}
html[data-theme="light"]{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark;--ink:#f1f4fa;--muted:#abb4c5;--line:#353d4f;--bg:#0b0e14;--blue:#83acff;--theme-surface:#141923;--theme-raised:#1b2230;--theme-control:#101620;--theme-soft:#10151f;--theme-accent-soft:#23304b;--theme-checker-a:#263043;--theme-checker-b:#1a2230}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;min-width:44px;padding:0 12px;border:1px solid var(--line);border-radius:9px;background:var(--theme-surface);color:var(--ink);white-space:nowrap;font-size:12px;font-weight:600}
.theme-toggle:hover{border-color:var(--blue)}
.theme-toggle [data-theme-icon]{font-size:19px;line-height:1}
.visitor-stats{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:11px;line-height:1.5;color:var(--muted);font-variant-numeric:tabular-nums}
.visitor-stats b,.visitor-stats output{color:var(--ink);font-weight:700}
.visitor-stats [data-count],#visitorToday,#visitorTotal{font-variant-numeric:tabular-nums}
.brand-logo{position:relative;display:block;flex:0 0 auto;width:120px;aspect-ratio:var(--logo-crop-ratio,1737/1508);overflow:hidden}
.brand-logo img{position:absolute;display:block;left:var(--logo-image-left,-73.229706%);top:var(--logo-image-top,-36.870027%);width:var(--logo-image-width,245.480714%);height:auto;max-width:none;user-select:none}
.header{height:116px;min-height:116px}
.header .brand{flex-shrink:0}
footer .brand-logo{width:96px}
.visitor-counter{display:grid;grid-template-columns:repeat(2,max-content);gap:6px 20px;padding:12px 16px;border:1px solid var(--line);border-radius:10px;background:var(--theme-surface);color:var(--muted);font-size:12px;line-height:1.6}
.visitor-counter b,.visitor-counter output{color:var(--ink);font-variant-numeric:tabular-nums}
.visitor-counter .visitor-label{color:var(--muted)}
.visitor-counter [role=status],#visitorStatus{grid-column:1/-1;font-size:10px;line-height:1.5;color:var(--muted)}
.visitor-counter-title{grid-column:1/-1;color:var(--ink);font-weight:600}.visitor-counter strong{color:var(--ink);font-variant-numeric:tabular-nums}
/* The supplied white mark has a transparent background, so it sits cleanly on both theme surfaces. */
html[data-theme="dark"] .brand-logo img{filter:none;mix-blend-mode:normal}
html[data-theme="light"] .brand-logo img{filter:invert(1);mix-blend-mode:normal}
html[data-theme="dark"] body{background:var(--bg);color:var(--ink)}
html[data-theme="dark"] :is(.header,footer,.moremenu,.toolcard,.options,.filetile,.secondary,.resultrow,.html-editor,dialog,.comparison-panel,.upscale-inspector){background:var(--theme-surface);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .moremenu{box-shadow:0 14px 40px #0007}
html[data-theme="dark"] :is(.moremenu a:hover,.tabs .active,.rotation-buttons .active){background:var(--theme-accent-soft);color:var(--blue);border-color:#5575af}
html[data-theme="dark"] .home:before{background:linear-gradient(132deg,transparent 7%,#121c31 7%,#0b0e14 32%,transparent 32%),radial-gradient(ellipse at 108% 30%,#14213b 0 23%,transparent 23%),radial-gradient(ellipse at -8% 95%,#121d31 0 25%,transparent 25%)}
html[data-theme="dark"] .hero p{color:var(--muted)}
html[data-theme="dark"] .categories button{background:var(--theme-surface);border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .categories button.active{background:#d8e5ff;border-color:#d8e5ff;color:#172239}
html[data-theme="dark"] .toolcard:hover{border-color:#7494d4;box-shadow:0 8px 24px #0005}
html[data-theme="dark"] .badge{background:#223853;color:#a9d9ff}
html[data-theme="dark"] .workflow div{background:var(--theme-surface);border-color:var(--line)}
html[data-theme="dark"] .workflow .step{background:var(--theme-accent-soft);color:var(--blue)}
html[data-theme="dark"] :is(.canvas-area,.html-fullsize-scroll){background:var(--theme-soft)}
html[data-theme="dark"] :is(.uploadstage.dragover,.upload-symbol){background:var(--theme-accent-soft)}
html[data-theme="dark"] :is(.field input:not([type=checkbox]):not([type=range]),.field select,.field textarea,.html-editor textarea,.html-editor input){background:var(--theme-control);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .field{color:#c3cbda}
html[data-theme="dark"] ::placeholder{color:#8e9caf;opacity:1}
html[data-theme="dark"] .hint{color:#a9b4c7!important}
html[data-theme="dark"] .option-note{background:var(--theme-accent-soft);color:#c4d3ed}
html[data-theme="dark"] .primary{background:#3467ce;color:#fff}
html[data-theme="dark"] .primary:hover{background:#3d70d5}
html[data-theme="dark"] .filetile .remove{background:var(--theme-raised);color:var(--ink);box-shadow:0 1px 5px #0008}
html[data-theme="dark"] :is(.preview-label,.comparison-after .comparison-tag){color:var(--blue)}
html[data-theme="dark"] .preview-label button{background:var(--theme-surface);color:var(--ink)}
html[data-theme="dark"] .preview-label button.active{background:var(--theme-accent-soft);color:var(--blue)}
html[data-theme="dark"] :is(.filetile img,.preview-wrap img,.comparison-image-frame,.placement-stage){background-image:conic-gradient(var(--theme-checker-a) 25%,var(--theme-checker-b) 0 50%,var(--theme-checker-a) 0 75%,var(--theme-checker-b) 0)}
html[data-theme="dark"] .comparison-pending{background:#141923ed;border-color:var(--line)}
html[data-theme="dark"] .comparison-before .comparison-tag:before{background:#283245;color:#c1cce0}
html[data-theme="dark"] .comparison-after .comparison-tag:before{background:var(--theme-accent-soft);color:var(--blue)}
html[data-theme="dark"] .placement-workspace{background:#141923d9;border-color:var(--line)}
html[data-theme="dark"] .inline-results{border-color:var(--line)}
html[data-theme="dark"] .resultrow img{background:var(--theme-soft)}
html[data-theme="dark"] :is(.resultrow .saving,.success-circle){color:#a0d48c}
html[data-theme="dark"] .success-circle{background:#203822}
html[data-theme="dark"] .warning{color:#e9c783!important}
html[data-theme="dark"] .errorbar{background:#321b22;border-color:#80424d;color:#ffbcc4}
html[data-theme="dark"] .progress{background:#283245}
html[data-theme="dark"] dialog{box-shadow:0 20px 80px #0009}
html[data-theme="dark"] dialog::backdrop{background:#0009}
html[data-theme="dark"] .history-row{border-color:var(--line)}
html[data-theme="dark"] .upscale-detail-grid canvas{background:var(--theme-soft)}

/* Imported QR/conversion modules use local tokens and retain QR canvas colors. */
html[data-theme="dark"] .lab-tool{--lab-border:var(--line);--lab-muted:var(--muted);--lab-accent:var(--blue);color:var(--ink)}
html[data-theme="dark"] .lab-tool :is(button,.lab-panel,.lab-batch-card){background:var(--theme-surface);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .lab-tool :is(input:not([type=file]):not([type=range]),select,textarea){background:var(--theme-control);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .lab-tool button.primary{background:#3467ce;border-color:#3467ce;color:#fff}
html[data-theme="dark"] .lab-tabs button[aria-selected=true]{background:var(--theme-accent-soft);color:var(--blue);border-color:#5575af}
html[data-theme="dark"] :is(.lab-drop,.lab-qr-canvas,.lab-preview-body pre){background:var(--theme-soft);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .lab-queue-row.is-selected{background:var(--theme-accent-soft)}
html[data-theme="dark"] .lab-preview-body{background:repeating-conic-gradient(var(--theme-checker-a) 0% 25%,var(--theme-checker-b) 0% 50%) 50%/16px 16px}

/* Restoration workbench controls change theme; its pixel/mask canvases do not. */
html[data-theme="dark"] .restoration-tool{color:var(--ink)}
html[data-theme="dark"] :is(.restore-notice,.restore-empty){background:var(--theme-soft);color:var(--muted);border-color:var(--line)}
html[data-theme="dark"] :is(.restore-controls,.restore-comparison,.restore-options){background:var(--theme-surface);border-color:var(--line)}
html[data-theme="dark"] .restoration-tool :is(button,input[type=number],select){background:var(--theme-control);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .restoration-tool button:hover:not(:disabled){background:var(--theme-accent-soft);border-color:#7494d4}
html[data-theme="dark"] .restore-controls button[aria-pressed=true]{background:var(--theme-accent-soft);border-color:#7494d4;color:var(--blue)}
html[data-theme="dark"] :is(.restore-toolbar span,.restore-comparison figcaption span,.restore-local,.restore-limits,.restore-progress span){color:var(--muted)}
html[data-theme="dark"] .restore-options output{color:var(--blue)}
html[data-theme="dark"] .restore-options>.restore-primary{background:#3467ce;color:#fff;border-color:#3467ce}
html[data-theme="dark"] .restore-options>[data-r=cancel]{color:#ffbcc4;border-color:#80424d}
html[data-theme="dark"] .restoration-tool .error{color:#ffbcc4}
html[data-theme="dark"] :is(.restore-comparison figure+figure,.restore-region){border-color:var(--line)}
html[data-theme="dark"] .restore-scroll{background-color:var(--theme-checker-b);background-image:linear-gradient(45deg,var(--theme-checker-a) 25%,transparent 25%),linear-gradient(-45deg,var(--theme-checker-a) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--theme-checker-a) 75%),linear-gradient(-45deg,transparent 75%,var(--theme-checker-a) 75%);border-color:var(--line)}

/* The lazy-loaded original upscale style keeps its violet semantic palette. */
html[data-theme="dark"] .original-upscale-workbench .field{color:var(--semantic-muted)}
html[data-theme="dark"] .original-upscale-workbench .field :is(input:not([type=checkbox]):not([type=range]),select,textarea){background:var(--semantic-control);color:var(--semantic-ink);border-color:var(--semantic-line-strong)}
html[data-theme="dark"] .original-upscale-workbench .hero p{color:var(--semantic-muted)}
html[data-theme="dark"] .original-upscale-workbench .button.primary{color:#101423;background:var(--semantic-accent);border-color:var(--semantic-accent)}
html[data-theme="dark"] .original-upscale-workbench .button.primary:hover:not(:disabled){background:var(--semantic-accent-strong);border-color:var(--semantic-accent-strong)}

@media(max-width:1280px){.header-right{gap:10px}.visitor-stats{gap:7px}}
@media(max-width:900px){.header .visitor-stats{display:none}.theme-toggle{padding:0 10px}}
@media(max-width:720px){.header{height:96px;min-height:96px;padding:0 12px;gap:10px}.header .brand-logo{width:96px}.theme-toggle{padding:0 8px;font-size:11px}.theme-toggle [data-theme-icon]{font-size:17px}.header-right{gap:5px}.header .language{display:none}footer .visitor-stats{flex-basis:100%}.visitor-counter{padding:10px 14px;gap:5px 14px}}
@media(max-width:380px){.theme-toggle #themeLabel{display:none}.theme-toggle{padding:0 9px}.header{gap:6px}.header .brand-logo{width:88px}}
@media(prefers-reduced-motion:reduce){.theme-toggle{transition:none}}
