:root {
  color-scheme: dark;
  --page: #10151d;
  --panel: #19222e;
  --panel-light: #202c3a;
  --line: #354253;
  --text: #f3f6fb;
  --muted: #b6c3d2;
  --accent: #75adff;
  --accent-text: #081728;
  --error: #ffb6aa;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--page); color: var(--text); line-height: 1.5; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
a { color: inherit; }
:focus-visible, .upload-zone:focus-within, .replace-control:focus-within { outline: 3px solid #a4cbff; outline-offset: 4px; }
.shell { width: min(100% - 32px, 960px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-size: 1.4rem; font-weight: 800; letter-spacing: -.05em; text-decoration: none; }
.brand span { color: var(--accent); }
.header-note { color: var(--muted); font-size: .82rem; text-align: right; }
.hero { padding-top: clamp(32px, 6vw, 68px); text-align: center; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-size: .76rem; font-weight: 750; letter-spacing: .14em; margin: 0 0 8px; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1 { max-width: 760px; margin: 0 auto; font-size: clamp(2.15rem, 5vw, 3.8rem); line-height: 1.12; letter-spacing: -.05em; }
.hero-copy { color: var(--muted); margin: 18px auto 28px; font-size: clamp(1rem, 2.2vw, 1.15rem); }
.upload-zone { position: relative; display: grid; place-items: center; min-height: 245px; background: var(--panel); border: 2px dashed #6187b5; border-radius: 22px; transition: background .18s, border-color .18s; }
.upload-zone:hover, .upload-zone.drag-over { background: #223146; border-color: #a4cbff; }
.upload-content { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; pointer-events: none; }
.upload-content strong { font-size: 1.35rem; }
.upload-desktop, .upload-hint { color: var(--muted); }
.upload-hint { font-size: .85rem; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: #304b6e; color: #b9d7ff; }
.upload-icon svg { width: 28px; height: 28px; }
.file-overlay { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.privacy-note { max-width: 690px; margin: 16px auto 0; color: var(--muted); font-size: .85rem; }
.status-panel, .workbench, .information { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.status-panel { margin-top: 22px; padding: 17px 20px; }
.status-heading { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.status-heading p { margin: 0; font-weight: 650; }
.status-indicator { flex: none; width: 10px; height: 10px; background: var(--accent); border-radius: 50%; }
.status-panel.is-done .status-indicator { background: #75d9ad; }
.status-panel.is-error .status-indicator { background: var(--error); }
.model-progress { padding: 12px 0 2px 22px; }
.progress-label { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .85rem; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }
progress:indeterminate { animation: progress-pulse 1.5s ease-in-out infinite; }
.error-text { color: var(--error); margin: 10px 0; font-weight: 600; }
.workbench { margin-top: 24px; padding: clamp(16px, 3vw, 28px); scroll-margin-top: 18px; }
.workbench-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.workbench-heading h2 { margin: 0; font-size: 1.65rem; }
.image-details { color: var(--muted); margin: 0 0 3px; font-size: .85rem; text-align: right; }
.workbench-side { display: flex; flex-direction: column; align-items: end; gap: 7px; }
.size-notice { color: #d6e7ff; background: #243a55; border-radius: 10px; padding: 9px 12px; margin: 17px 0 0; font-size: .88rem; }
.original-section { margin-top: 22px; }
.section-label { margin: 0 0 10px; font-weight: 700; }
.preview-frame, .compare-frame { position: relative; width: 100%; margin-inline: auto; overflow: hidden; border-radius: 12px; background-color: #e7e9ed; background-image: linear-gradient(45deg, #cbd1d9 25%, transparent 25%), linear-gradient(-45deg, #cbd1d9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #cbd1d9 75%), linear-gradient(-45deg, transparent 75%, #cbd1d9 75%); background-position: 0 0, 0 14px, 14px -14px, -14px 0; background-size: 28px 28px; }
.preview-frame canvas, .compare-frame canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.preview-caption { color: var(--muted); font-size: .83rem; margin: 10px 0 0; }
.result-section { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 21px; scroll-margin-top: 20px; }
.result-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 16px; margin-bottom: 14px; }
.result-heading h3 { margin: 0; font-size: 1.4rem; }
.result-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.compare-frame { cursor: ew-resize; touch-action: none; user-select: none; }
.compare-frame .before-canvas { clip-path: inset(0 50% 0 0); }
.compare-slider { position: absolute; z-index: 1; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-50%); touch-action: none; }
.slider-grip { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 48px; height: 48px; transform: translate(-50%, -50%); border: 2px solid white; border-radius: 50%; color: white; background: #1a273b; box-shadow: 0 3px 12px #0007; }
.slider-grip svg { width: 27px; height: 27px; }
.compare-slider:focus-visible { outline: 0; }
.compare-slider:focus-visible .slider-grip { outline: 3px solid #a4cbff; outline-offset: 4px; }
.compare-legend { display: flex; justify-content: space-between; margin-top: 9px; color: var(--muted); font-size: .83rem; }
.backgrounds { border: 0; margin: 22px 0 0; padding: 0; min-width: 0; }
.backgrounds legend { font-weight: 700; padding: 0 0 10px; }
.background-options { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.background-option { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.background-option:has(input:checked) { border-color: var(--accent); background: #253d59; }
.background-option:has(input:focus-visible) { outline: 3px solid #a4cbff; outline-offset: 3px; }
.background-option input { accent-color: var(--accent); margin: 0; }
#customColor { width: 48px; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-light); cursor: pointer; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.button, .replace-control { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 10px; padding: 10px 19px; font-weight: 700; border: 1px solid transparent; text-align: center; }
.button-primary { background: var(--accent); color: var(--accent-text); }
.button-primary:hover:not(:disabled) { background: #9ac5ff; }
.button-secondary, .replace-control { background: var(--panel-light); color: var(--text); border-color: #586b82; }
.button-quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.replace-control { position: relative; cursor: pointer; }
.information { margin-top: 28px; padding: 22px 26px; }
.information h2 { font-size: 1.3rem; margin: 0 0 13px; }
.information ol { margin: 0; padding-left: 23px; color: var(--muted); }
.information li + li { margin-top: 7px; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 650; min-height: 36px; }
.faq details p { margin: 6px 0 0; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); margin-top: 45px; padding: 20px 0; color: var(--muted); font-size: .83rem; }
.save-dialog { width: min(92vw, 680px); max-height: 92vh; overflow: auto; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.save-dialog::backdrop { background: #050a10c9; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-heading h2 { margin: 0; font-size: 1.25rem; }
.dialog-close { min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: var(--panel-light); color: var(--text); font-size: 1.7rem; }
.save-dialog p { color: var(--muted); }
.save-preview { display: grid; place-items: center; min-height: 100px; background: #e7e9ed; border-radius: 8px; }
.save-preview img { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; }
.save-dialog .button { margin-top: 14px; width: 100%; }
@keyframes progress-pulse { 50% { opacity: .45; } }
@media (max-width: 600px) {
  .shell { width: min(100% - 28px, 960px); }
  .header-note { display: none; }
  .upload-zone { min-height: 230px; }
  .upload-desktop { display: none; }
  .workbench-heading { display: block; }
  .workbench-side { align-items: stretch; margin-top: 12px; }
  .image-details { text-align: left; margin-top: 8px; }
  .result-actions { display: grid; grid-template-columns: 1fr; }
  .result-actions > * { width: 100%; }
  .information { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
