:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --panel: #fffefa;
  --ink: #24231f;
  --muted: #67635b;
  --line: #e1ddd3;
  --field: #f6f4ee;
  --stage: #242725;
  --stage-line: #41453f;
  --stage-ink: #f7f4ed;
  --stage-muted: #cbc8bf;
  --accent: #a83d26;
  --accent-hover: #8e301f;
  --accent-soft: #f9e7dc;
  --focus: #a6402b;
  --status: #39684d;
  --logo: #f07c58;
  --white: #fff;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  accent-color: var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > main { flex: 1; min-width: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .5; }
:is(button, a, input, select, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p, figure { margin: 0; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.wrap { width: min(1512px, calc(100% - 72px)); margin-inline: auto; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.brand, .tabs a, .tile, .hero-actions a { text-decoration: none; }
.brand, .tile { color: inherit; }
.brand { justify-self: start; padding: 0; border: 0; background: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 19px; font-weight: 720; letter-spacing: -.055em; }
.brand-mark { display: block; width: 36px; height: 36px; flex: none; }
.brand:hover { color: var(--accent); }
.tabs { display: flex; align-items: center; gap: 3px; }
.tabs a { padding: 8px 11px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; font-size: 13px; font-weight: 620; display: flex; align-items: center; gap: 6px; }
.tabs a .icon { width: 15px; height: 15px; }
.tabs a:hover { background: var(--field); color: var(--ink); }
.tabs a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.language-link { justify-self: end; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px; font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.language-link:hover { color: var(--accent); border-color: var(--accent); }
.site-footer { background: var(--stage); color: var(--stage-ink); }
.footer-inner { min-height: 94px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 28px; padding-block: 22px; }
.site-footer a { color: inherit; text-underline-offset: 4px; }
.site-footer a:hover { color: var(--logo); }
.site-footer a:focus-visible { outline-color: var(--logo); }
.footer-brand { font-size: 18px; font-weight: 690; letter-spacing: -.04em; text-decoration: none; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 13px; }
.site-footer nav a { color: var(--stage-muted); text-decoration: none; }
.footer-license { font-size: 13px; }

.button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--panel); font-size: 13px; font-weight: 650; }
.button:not(:disabled):hover { background: var(--field); border-color: var(--muted); }
.button .icon { width: 16px; height: 16px; }
.button.primary { color: var(--white); background: var(--accent); border-color: var(--accent); }
.button.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.home { max-width: 1320px; padding-block: clamp(27px, 5vw, 74px) 34px; }
.hero { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); align-items: center; gap: clamp(24px, 5vw, 88px); }
.hero-content { padding-block: 19px; }
.hero h1 { font-size: clamp(34px, 4.35vw, 65px); font-weight: 760; letter-spacing: -.065em; line-height: 1.1; text-wrap: balance; }
.hero p { margin-top: 24px; font-size: clamp(13px, 1.25vw, 17px); color: var(--muted); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.hero-actions .button { min-height: 43px; padding-inline: 16px; }
.hero-content .install-static-help { display: none; }
.hero-content .install-static-help:target { display: block; }
.hero-visual { min-width: 0; position: relative; background: var(--stage); border: 1px solid var(--stage-line); border-radius: 13px; padding: clamp(12px, 2vw, 23px); overflow: hidden; }
.print { position: relative; margin: 0; }
.print img { display: block; width: 100%; height: auto; border-radius: 5px; }
.print figcaption { display: flex; gap: 10px; justify-content: space-between; color: var(--stage-muted); padding-top: 13px; font: 11px/1.3 var(--mono); }
.hero-sticker { position: absolute; right: 5%; bottom: 11%; width: 29%; transform: rotate(12deg); filter: drop-shadow(0 6px 11px #15191799); }
.hero-sticker .art { width: 100%; height: auto; display: block; filter: drop-shadow(2px 0 var(--white)) drop-shadow(-2px 0 var(--white)) drop-shadow(0 2px var(--white)) drop-shadow(0 -2px var(--white)); }
.tool-section, .home-workflows { margin-top: clamp(38px, 6vw, 84px); }
.tool-section h2, .home-workflows h2 { font-size: clamp(22px, 2.6vw, 34px); letter-spacing: -.035em; margin-bottom: 16px; }
.tool-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { grid-column: span 2; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: clamp(17px, 2vw, 24px); min-width: 0; }
.tile:nth-last-child(-n + 2) { grid-column: span 3; }
.tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile:focus-visible { outline-offset: -3px; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tile-icon { display: grid; place-items: center; width: 36px; height: 36px; background: var(--accent-soft); border-radius: 9px; color: var(--accent); }
.tile-top > .icon { color: var(--muted); width: 15px; }
.tile h3 { font-size: 18px; }
.tile-copy { color: var(--muted); font-size: 14px; line-height: 1.65; margin-top: 6px; }
.home-workflows > p { margin-top: -7px; margin-bottom: 18px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.workflow-grid, .guide-topics { display: grid; gap: clamp(23px, 4.8vw, 64px); }
.workflow-card, .guide-topics > section { padding-block-start: clamp(20px, 3.6vw, 42px); border-block-start: 1px solid var(--line); }
.workflow-card h3 { font-size: clamp(19px, 2.25vw, 29px); line-height: 1.3; }
.workflow-card p { font-size: 14px; line-height: 1.65; color: var(--muted); }
.workflow-path { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 12px 0; padding: 0; }
.workflow-path li { display: inline-flex; align-items: center; gap: 6px; }
.workflow-path li + li::before { content: '→'; color: var(--muted); }
.workflow-path a { padding: 5px 9px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 630; text-decoration: none; }
.workflow-path a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footnote { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 14px; }

.tool-guide {
  max-width: 1180px;
  margin: clamp(32px, 5vw, 64px) auto 0;
  padding-block-end: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.home .tool-guide { max-width: none; }
.guide-heading { padding: clamp(17px, 3.3vw, 42px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.guide-heading-example { padding: 0; border: 0; background: transparent; }
.illustrated-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: clamp(16px, 5vw, 66px); }
.illustrated-row:nth-child(even) > .guide-visual { order: 1; }
.illustrated-row > div { min-width: 0; }
.tool-guide h2 { font-size: clamp(23px, 3vw, 39px); line-height: 1.25; letter-spacing: -.045em; text-wrap: balance; }
.tool-guide header p { max-width: 60em; margin-top: 12px; color: var(--muted); }
.guide-visual { min-width: 0; padding: clamp(8px, 1.3vw, 15px); border-radius: 14px; background: var(--stage); color: var(--stage-ink); }
.guide-comparison { display: grid; grid-template-columns: repeat(var(--frames, 2), minmax(0, 1fr)); gap: 6px; }
.guide-comparison[data-columns="1"] { --frames: 1; }
.guide-comparison[data-columns="3"] { --frames: 3; }
.guide-sample { min-width: 0; }
.guide-sample-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 6px; background: #191c19; }
.guide-comparison[data-columns="1"] .guide-sample-photo { aspect-ratio: 2 / 1; }
.guide-sample-photo[data-backdrop="paper"] { background: #f7f5ef; }
.guide-sample-photo[data-backdrop="sage"] { background: #c7d3bc; }
.guide-sample-photo[data-backdrop="night"] { background: #252a28; }
.guide-sample-photo[data-backdrop="checker"] { background: repeating-conic-gradient(#505650 0 25%, #606760 0 50%) 0 0 / 14px 14px; }
.guide-sample-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.guide-sample-photo[data-compact="true"] img { inset: 13%; width: 74%; height: 74%; }
.guide-sample-label { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 7px; padding: 5px 2px; font-size: 12px; }
.guide-sample-label span { color: var(--stage-muted); }
.guide-visual figcaption { border-top: 1px solid var(--stage-line); color: var(--stage-muted); padding-top: 6px; font-size: 11px; }
.guide-content { display: grid; gap: clamp(24px, 3.8vw, 44px); margin-top: clamp(24px, 3.8vw, 44px); }
.guide-content h3 { font-size: clamp(17px, 1.8vw, 22px); line-height: 1.38; margin-bottom: 10px; }
.guide-steps ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: guide-step; }
.guide-steps li { counter-increment: guide-step; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: clamp(14px, 2vw, 22px); }
.guide-steps li::before { content: counter(guide-step); display: inline-grid; place-items: center; width: 26px; height: 26px; margin-inline-end: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.guide-steps strong { font-size: 15px; }
.guide-steps p { margin-top: 8px; }
.guide-topics h3 { font-size: clamp(19px, 2.35vw, 29px); }
.guide-topics p, .guide-steps p { color: var(--muted); }
.guide-topics p + p { margin-top: 9px; }
.guide-faq-panel { display: grid; grid-template-columns: minmax(140px, .27fr) minmax(0, 1fr); gap: 14px 25px; padding: clamp(16px, 2.8vw, 30px); border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.guide-faq-panel h3 { margin: 9px 0 0; }
.guide-faq details + details { border-block-start: 1px solid var(--line); }
.guide-faq summary { position: relative; list-style: none; padding: 10px 28px 10px 0; font-weight: 650; cursor: pointer; }
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::after { content: '+'; position: absolute; inset: 9px 3px auto auto; color: var(--accent); }
.guide-faq details[open] summary::after { content: '−'; }
.guide-faq details p { max-width: 68em; padding-block: 0 11px; color: var(--muted); }
@media (max-width: 680px) {
  .illustrated-row, .guide-steps ol, .guide-faq-panel { grid-template-columns: minmax(0, 1fr); }
  .illustrated-row:nth-child(even) > .guide-visual { order: 0; }
  .guide-faq-panel h3 { margin-top: 0; }
}

.desk { padding-block: 28px 28px; }
.desk-header { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 18px; }
.desk-header h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.13; letter-spacing: -.05em; margin-bottom: 5px; }
.desk-header p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.desk-header .button { min-height: 34px; white-space: nowrap; }
.mobile-workspace-nav { display: none; }
.studio { --desk-height: clamp(420px, calc(100vh - 205px), 730px); display: grid; grid-template-columns: minmax(165px, .68fr) minmax(0, 3fr) minmax(265px, 1fr); gap: 12px; align-items: start; }
.panel { min-width: 0; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.panel-heading { min-height: 54px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 14px; font-weight: 690; }
.panel-heading h2 span { color: var(--muted); font: 11px var(--mono); }
.panel-heading .button { min-height: 32px; padding: 4px 7px; font-size: 11px; white-space: nowrap; }
.queue { grid-column: 1; grid-row: 1; }
.queue-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 7px; }
.queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px; }
.file { min-width: 0; padding: 6px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px; text-align: left; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.file:hover { background: var(--field); }
.file[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 21%, var(--accent-soft)); }
.thumb { width: 32px; height: 32px; border-radius: 4px; background: var(--field); overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-description { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.file-description strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.file-description small { display: flex; flex-wrap: wrap; gap: 2px 6px; color: var(--muted); font-size: 10px; }
.file-description small span { white-space: nowrap; }
.file-description small[data-status="done"] { color: var(--status); }
.file-description small[data-status="running"] { color: var(--accent); }
.queue-row .remove { color: var(--muted); border: 0; border-radius: 5px; background: transparent; width: 24px; height: 28px; }
.queue-row .remove:hover { background: var(--field); }
.empty-copy { padding: 9px 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.preview { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-height: var(--desk-height); background: var(--stage); border-color: var(--stage-line); color: var(--stage-ink); }
.preview .panel-heading { border-color: var(--stage-line); padding-inline: 14px; }
.preview .toggle { border-color: var(--stage-line); background: color-mix(in srgb, var(--white) 6%, var(--stage)); }
.preview .toggle button { color: var(--stage-muted); }
.preview .toggle button[aria-pressed="true"] { color: var(--ink); border-color: var(--paper); background: var(--paper); }
.preview :is(button, .pan-area):focus-visible { outline-color: var(--logo); }
.toggle { display: inline-flex; max-width: 100%; padding: 2px; gap: 2px; background: var(--field); border: 1px solid var(--line); border-radius: 7px; }
.toggle button { white-space: nowrap; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; background: transparent; color: var(--muted); }
.toggle button[aria-pressed="true"] { background: var(--panel); border-color: var(--line); color: var(--accent); font-weight: 690; }
.preview-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.canvas {
  flex: 1;
  display: flex;
  min-height: 0;
  background: radial-gradient(var(--stage-line) .8px, transparent .8px) 0 0 / 16px 16px, var(--stage);
}
.canvas[data-background="透明"] { background: conic-gradient(#dedbcf 25%, #f4f0e5 0 50%, #dedbcf 0 75%, #f4f0e5 0) 0 0 / 22px 22px; }
.empty-preview { text-align: center; color: var(--stage-muted); font-size: 14px; }
.empty-preview-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; color: var(--ink); }
.pan-area { overflow: auto; width: 100%; max-height: calc(var(--desk-height) - 144px); }
.pan-area:focus-visible { outline: 2px solid var(--logo); outline-offset: -2px; }
.pan-board { width: max(100%, var(--zoom, 100%)); min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 22px; margin-inline: auto; }
.image-box { width: min(var(--preview-scale, 100%), var(--image-width, 660px), calc(var(--fit-scale, 1000) * (var(--desk-height) - 184px))); aspect-ratio: var(--ratio, 1.49); border-radius: 5px; background: var(--stage); position: relative; box-shadow: 0 10px 26px #10141258; overflow: hidden; isolation: isolate; }
.image-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.image-box:is([data-view="result"], [data-view="draft"], [data-view="cutout"]) .before { visibility: hidden; }
.image-box[data-alpha="true"]:not([data-view="original"]) { background: repeating-conic-gradient(#dadbd5 0 25%, #fbfbf7 0 50%) 0 0 / 16px 16px; }
.image-box figcaption { display: flex; justify-content: space-between; position: absolute; top: 9px; left: 9px; right: 9px; pointer-events: none; }
.image-box figcaption span { padding: 4px 7px; border-radius: 4px; background: #222522ed; color: var(--white); font-size: 11px; }
.image-box[data-view="original"] .result-label, .image-box[data-view="result"] .original-label { visibility: hidden; }
.divider { position: absolute; inset-block: 0; left: var(--split); width: 2px; background: var(--white); pointer-events: none; }
.divider span { display: grid; place-content: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; background: var(--white); border-radius: 50%; color: var(--ink); box-shadow: 0 2px 14px #1a291e50; }
.split-control { width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; opacity: 0; cursor: ew-resize; }
.split-control::-webkit-slider-thumb { width: 30px; }
.image-box:focus-within { outline: 2px solid var(--logo); outline-offset: 4px; }
.image-box:not([data-view="compare"]) :is(.divider, .split-control) { display: none; }
.canvas-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 9px; padding: 11px 14px; border-top: 1px solid var(--stage-line); font: 11px/1.4 var(--mono); color: var(--stage-muted); overflow-wrap: anywhere; }
.canvas-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--stage-line); }
.zoom-controls { display: flex; align-items: center; gap: 4px; }
.zoom-controls .button { min-height: 28px; padding: 3px 7px; background: transparent; border-color: var(--stage-line); font-size: 12px; white-space: nowrap; }
.zoom-controls .button:not(:disabled):hover { background: var(--stage-line); border-color: var(--stage-muted); }
.zoom-controls output { min-width: 37px; text-align: center; color: var(--stage-muted); font: 11px var(--mono); }
.preview-status { color: var(--stage-muted); font-size: 11px; line-height: 1.4; }

.settings { grid-column: 3; grid-row: 1; max-height: var(--desk-height); display: flex; flex-direction: column; }
.settings .panel-heading, .settings-footer, .progress-panel { flex: none; }
.settings-scroll { min-block-size: 0; overflow: auto; scrollbar-gutter: stable; scrollbar-color: var(--muted) transparent; scroll-padding-block: 8px; }
.settings-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.settings-body { padding: 12px; display: grid; align-content: start; gap: 12px; border: 0; margin: 0; min-inline-size: 0; }
.setting { display: grid; gap: 6px; min-width: 0; }
.setting label { font-size: 12px; font-weight: 640; }
.setting-title { font-size: 12px; font-weight: 750; }
.setting-line { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.setting output, .setting small, .settings-note { color: var(--muted); font-size: 11px; line-height: 1.55; }
.setting output { font-family: var(--mono); }
.setting :is(select, input[type="text"], input[type="number"]) { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); padding: 7px; font-size: 13px; }
.setting input[type="range"] { width: 100%; margin: 0; }
.setting input[type="color"] { width: 37px; height: 27px; padding: 1px 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.setting #convert-background { width: 44px; height: 44px; }
.scale-heading { position: relative; }
.scale-help {
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.scale-help:is(:hover, [aria-expanded="true"]) { color: var(--accent); border-color: var(--accent); }
.scale-tooltip {
  position: absolute;
  z-index: 3;
  inset-inline-end: 0;
  inset-block-start: 100%;
  inline-size: min(246px, 100%);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 5px 14px #24231f26;
  font: 12px/1.55 var(--sans);
}
.settings-footer { border-top: 1px solid var(--line); padding: 11px 12px; display: grid; gap: 6px; }
.processing-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.processing-actions .button { min-height: 38px; }
.processing-hint { position: relative; display: flex; }
.processing-hint .button { width: 38px; color: var(--status); padding: 0; }
.processing-hint .icon { width: 18px; height: 18px; }
.processing-tooltip { position: absolute; z-index: 2; inset: auto 0 100% auto; width: max-content; max-width: 180px; padding: 7px 10px; border-radius: 6px; background: var(--stage); color: var(--stage-ink); font-size: 12px; line-height: 1.5; }
@media (pointer: coarse) {
  .processing-actions .button { min-height: 44px; }
  .processing-hint .button { width: 44px; }
}
.settings-body .toggle { width: fit-content; }
.settings-note { background: var(--field); padding: 7px 8px; border-radius: 6px; }
.edit-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.edit-actions .button { padding: 5px 6px; min-height: 32px; font-size: 11px; }
.editor-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.editor-tabs .button { min-height: 30px; padding: 4px; font-size: 11px; }
.editor-tabs .button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.settings-body details { border: 1px solid var(--line); border-radius: 6px; padding: 9px; }
.settings-body summary { cursor: pointer; font-size: 12px; font-weight: 690; }
.detail-fields { display: grid; gap: 11px; margin-top: 10px; }
.size-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.check { display: flex; align-items: center; gap: 6px; }
.check input { margin: 0 2px 0 0; }
.progress-panel { border-top: 1px solid var(--line); padding: 9px 12px; }
.progress-panel progress { display: block; width: 100%; height: 8px; margin: 7px 0; }
.progress-label, .progress-eta { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 11px; }
.progress-label strong { color: var(--ink); }
.progress-file { margin-top: 4px; color: var(--muted); font: 10px var(--mono); overflow-wrap: anywhere; }

dialog { width: min(420px, calc(100% - 28px)); max-height: calc(100% - 28px); border: 1px solid var(--line); border-radius: 11px; padding: 19px; background: var(--panel); color: var(--ink); box-shadow: 0 20px 70px #25272063; }
dialog::backdrop { background: #252720a0; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-title h2 { font-size: 18px; }
.dialog-title .button { min-height: 32px; padding: 3px 8px; }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 10px 0; }
.install-dialog .button { min-height: 44px; }
@media (max-width: 1100px) {
  .wrap { width: calc(100% - 40px); }
  .studio { grid-template-columns: minmax(148px, .68fr) minmax(0, 2.55fr) minmax(244px, 1fr); gap: 9px; }
  .queue .panel-heading { padding-inline: 8px; }
}
@media (max-width: 900px) {
  .topbar-inner { min-height: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding-block: 10px 7px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; overflow-x: auto; }
  .studio { --desk-height: 580px; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .preview { grid-column: 1 / -1; grid-row: 1; }
  .queue { grid-column: 1; grid-row: 2; }
  .settings { grid-column: 2; grid-row: 2; max-height: none; }
  .settings-scroll { overflow: visible; scrollbar-gutter: auto; }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 28px); }
  .tabs { gap: 0; }
  .tabs a { padding: 7px clamp(5px, 2vw, 10px); gap: 3px; font-size: 12px; }
  .tabs a .icon { width: 13px; height: 13px; }
  :lang(en) .tabs a { padding-inline: 6px; }
  :lang(en) .tabs a .icon { display: none; }
  .hero { grid-template-columns: 1fr; gap: 17px; }
  .hero-content { padding: 0; }
  .hero h1 { font-size: clamp(32px, 8.5vw, 48px); }
  .hero p { margin-top: 15px; }
  .hero-actions { margin-top: 15px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile, .tile:nth-last-child(-n + 2) { grid-column: span 1; }
  .tile:last-child { grid-column: 1 / -1; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .desk { padding-top: 17px; }
  .desk-header { align-items: start; margin-bottom: 12px; }
  .desk-header p { font-size: 13px; }
  .desk-header .button { min-height: 44px; padding-inline: 8px; font-size: 12px; }
  .mobile-workspace-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-block-end: 10px; }
  .mobile-workspace-nav a { display: grid; place-items: center; min-height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none; }
  .mobile-workspace-nav a:is(:hover, :focus-visible) { border-color: var(--accent); color: var(--accent); }
  .studio { --desk-height: clamp(365px, 105vw, 520px); grid-template-columns: minmax(0, 1fr); }
  .studio .panel-heading h2 { scroll-margin-top: 12px; }
  .preview[data-empty="true"] { --desk-height: 294px; }
  .preview .toggle { flex-wrap: wrap; }
  .preview .toggle button, .settings-footer .button, .empty-preview-actions .button { min-height: 44px; }
  .zoom-controls .button { min-width: 44px; min-height: 44px; }
  .split-control { touch-action: pan-y; }
  .settings { grid-column: 1; grid-row: 3; }
  .queue-list { grid-template-columns: repeat(auto-fit, minmax(min(174px, 100%), 1fr)); max-height: 16rem; overflow: auto; }
  .queue-row .remove, .queue .panel-heading .button { min-height: 44px; min-width: 44px; }
  .setting :is(select, input[type="text"], input[type="number"]) { min-height: 44px; }
  .pan-board { padding: 12px; }
  .preview .panel-heading, .canvas-tools, .canvas-meta { padding-inline: 9px; }
}
@media (max-width: 460px) {
  .language-link { min-height: 44px; display: inline-flex; align-items: center; }
  .tabs { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; overflow: visible; }
  .tabs a { grid-column: span 3; justify-content: center; min-height: 44px; }
  .tabs a:nth-child(n+5) { grid-column: span 4; }
  .desk-header { display: grid; gap: 7px; }
  .desk-header .button { justify-self: end; }
  .canvas-tools { flex-wrap: wrap; }
  .preview-status { flex: 1 1 10rem; overflow-wrap: anywhere; }
  .zoom-controls { margin-inline-start: auto; }
}
@media (max-width: 360px) {
  .tabs a .icon { display: none; }
  .preview-status { font-size: 10px; }
}
@media (max-width: 680px) and (pointer: coarse) {
  #settings-body :is(select, input[type="number"], input[type="text"]) { font-size: 16px; }
}


.desk.dragging .canvas { box-shadow: inset 0 0 0 2px var(--logo); }
.file-description small[data-status="error"] { color: var(--accent); }
.workspace-mode-settings:empty { display: none; }
.workspace-preprocessor-settings { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mode-preview, .result-frame { position: absolute; inset: 0; }
.mode-preview:empty { pointer-events: none; }
.image-box[data-view="compare"] .before { clip-path: inset(0 calc(100% - var(--split, 52%)) 0 0); }
.image-box[data-view="compare"] .result-frame { clip-path: inset(0 0 0 var(--split, 52%)); }
.settings-body:disabled { opacity: .65; }
.settings-body:disabled .workspace-mode-settings { pointer-events: none; }
.settings-body:disabled input:disabled { cursor: default; }

/* Theme the reused Squoosh encoder controls using the workspace palette. */
.squoosh-options {
  --off-black: var(--panel);
  --black: var(--field);
  --white: var(--ink);
  --dark-gray: var(--field);
  --light-gray: var(--line);
  --medium-light-gray: var(--muted);
  --less-light-gray: var(--line);
  --blue: var(--accent);
  --deep-blue: var(--accent);
  --dim-blue: var(--muted);
  --accent-color: var(--accent);
  --header-text-color: var(--ink);
  --horizontal-padding: 0px;
  min-width: 0;
  font-size: 12px;
}
.squoosh-options label { min-width: 0; }
.squoosh-options [class*="_option-reveal_"] { line-height: 1.4; }
.squoosh-options :is(input, select) { max-width: 100%; }
.squoosh-options input[type="checkbox"] { width: 15px; height: 15px; }
.squoosh-options svg { stroke-width: 0; fill: currentColor; }
.squoosh-options [class*="_select"] { border-radius: 6px; }

/* Upstream range and select views use hard-coded light text on dark backgrounds. */
.squoosh-options {
  --main-theme-color: var(--accent);
}
.squoosh-options label > span:first-child,
.squoosh-options select {
  color: var(--ink);
}
.squoosh-options [class*="_arrow_"] {
  fill: var(--ink);
}
.squoosh-options range-input:focus-within [class*="_thumb_"] {
  outline-color: var(--focus);
}

@supports (appearance: base-select) and selector(select::picker(select)) {
  #settings-body select:not([multiple], [size]),
  #settings-body select:not([multiple], [size])::picker(select) {
    appearance: base-select;
  }
  #settings-body select:not([multiple], [size]) {
    align-items: center;
    gap: 8px;
  }
  #settings-body select:not([multiple], [size])::picker-icon {
    color: var(--muted);
  }
  #settings-body select:not([multiple], [size]):open::picker-icon {
    rotate: 180deg;
    color: var(--accent);
  }
  #settings-body .squoosh-options [class^="_select_"] > select:not([multiple], [size]) {
    padding-inline-end: 8px;
  }
  #settings-body .squoosh-options [class^="_select_"] > select:not([multiple], [size]) + [class^="_arrow_"] {
    display: none;
  }
  #settings-body select:not([multiple], [size])::picker(select) {
    min-inline-size: anchor-size(width);
    max-inline-size: calc(100% - 16px);
    max-block-size: min(360px, 55dvh);
    overflow: auto;
    margin-block: 5px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 8px 24px #24231f26;
    font: 13px/1.4 var(--sans);
  }
  #settings-body select:not([multiple], [size]) option {
    min-block-size: 34px;
    padding: 6px 9px;
    border-radius: 6px;
    gap: 8px;
  }
  #settings-body select:not([multiple], [size]) option:checked {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 650;
  }
  #settings-body select:not([multiple], [size]) option:not(:checked, :disabled):hover {
    background: var(--field);
  }
  #settings-body select:not([multiple], [size]) option:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
  }
  #settings-body select:not([multiple], [size]) option:disabled {
    color: var(--muted);
    opacity: .65;
  }
  #settings-body select:not([multiple], [size]) option::checkmark {
    order: 1;
    margin-inline-start: auto;
  }
  @media (pointer: coarse) {
    #settings-body select:not([multiple], [size]) option {
      min-block-size: 44px;
    }
  }
}
