:root {
  --paper: #f5f5f1;
  --surface: #fff;
  --ink: #19231f;
  --secondary: #4d5c54;
  --muted: #627066;
  --line: #d0d7cf;
  --green: #195742;
  --soft: #e9eee8;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --stage-height: clamp(296px, 58svh, 612px);
  --head-height: 60px;
  color-scheme: light;
  font: 16px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei","PingFang SC",sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
[hidden],.symbols,.touch-help { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
button,input,select { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; }
button:disabled { cursor: default; color: #879189; }
a { color: inherit; }
button,a,.segments span,.switch { transition: background-color 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out; }
:focus-visible { outline: 3px solid #46896a; outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; }
h1,h2,p { margin: 0; }
.shell { width: min(1560px, calc(100% - clamp(32px, 6vw, 96px))); margin-inline: auto; }
.mast { background: var(--surface); border-bottom: 1px solid var(--line); }
.mast-inner { min-height: 76px; display: flex; align-items: center; gap: 20px; }
.brand,.file-strip,.privacy,.choose,.save,.brand-mark,.grid-control,.zoom,.view-options,.pane-head,.tools,.pane-info,.segments,.box,.receipt>div { display: flex; align-items: center; }
.brand { flex: none; gap: 10px; }
.brand-mark { width: 36px; height: 36px; justify-content: center; background: var(--green); border-radius: 8px; color: #e0f3d6; }
.brand-mark .icon { width: 24px; height: 24px; }
h1 { font-size: 1.4rem; font-weight: 600; }
.product-name { color: var(--secondary); font-size: .9rem; padding-left: 16px; margin-left: 6px; border-left:1px solid var(--line); }
.file-strip { margin-left: auto; gap: 8px; min-width: 0; }
.file-icon { display: grid; place-items: center; color: var(--muted); }
.file-info { min-width: 0; display: grid; gap: 2px; }
.file-info strong { font-weight: 500; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(28vw, 320px); }
#source-meta { color: var(--muted); font: .76rem/1.25 var(--mono); }
.privacy { font-size: .82rem; flex: none; color: var(--secondary); gap: 6px; }
.choose,.save { gap: 8px; justify-content: center; border-radius: 6px; font-weight: 550; white-space: nowrap; }
.choose { min-height: 44px; padding: 0 16px; flex: none; border: 1px solid #b7c4bb; background: var(--surface); font-size: .9rem; }
.choose:hover { background: var(--soft); }
.studio { padding: clamp(20px, 4vh, 44px) 0 24px; }
.workbench { display:grid; grid-template-columns:minmax(0,1fr) clamp(260px,21vw,324px); gap:16px; align-items:stretch; }
.visual-pair,.settings { background:var(--surface); border:1px solid var(--line); border-radius:10px; min-width:0; }
.visual-pair { display:grid; grid-template-columns:minmax(0,1.13fr) minmax(0,1fr); grid-template-rows: auto auto minmax(36px,1fr); align-content:start; overflow:hidden; }
.pane,.tools,.pane-info { min-width:0; }
.pane-head { height:var(--head-height); padding:0 20px; gap:8px; justify-content:space-between; border-bottom:1px solid var(--line); }
h2 { font-size:clamp(1rem,1.35vw,1.32rem); font-weight:600; letter-spacing:.01em; white-space:nowrap; }
.grid-control { gap:6px; font-size:.81rem; color:var(--secondary); cursor:pointer; min-height:44px; position:relative; }
.grid-control input,.segments input { position:absolute; width:1px; height:1px; opacity:0; }
.switch { display:inline-flex; align-items:center; width:26px; height:16px; padding:2px; border-radius:12px; background:#78847b; }
.switch:after { content:""; width:12px; height:12px; background:white; border-radius:50%; }
.grid-control input:checked + .switch { background:var(--green); }
.grid-control input:checked + .switch:after { transform:translateX(10px); }
.grid-control input:focus-visible + .switch,.segments input:focus-visible + span { outline:2px solid #46896a; outline-offset:2px; }
.view-scale,.stamp,.proof-spec,.zoom output,.receipt strong { font-family:var(--mono); font-variant-numeric:tabular-nums; }
.view-scale { color:var(--secondary); font-size:.82rem; }
.stage,.proof-surface { height:var(--stage-height); min-width:0; position:relative; }
.stage { --frame-gutter:24px; background:#29322f; display:grid; place-items:center; isolation:isolate; overflow:hidden; }
.backdrop { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.backdrop img { position:absolute; max-width:none; opacity:.28; filter:saturate(.74); user-select:none; }
.ruler { position:absolute; z-index:1; opacity:.45; pointer-events:none; }
.top-ruler { inset:0 0 auto; height:5px; background:repeating-linear-gradient(90deg,#d9dfd8 0 1px,transparent 1px 12px); }
.side-ruler { inset:0 auto 0 0; width:5px; background:repeating-linear-gradient(0deg,#d9dfd8 0 1px,transparent 1px 12px); }
.frame,.proof-surface { background-color:#fafbf8; background-image:conic-gradient(#eceeea 25%,transparent 0 50%,#eceeea 0 75%,transparent 0); background-size:16px 16px; }
.frame { position:relative; width:140px; height:196px; box-shadow:0 0 0 1px #ffffffb3; }
#editor-canvas { display:block; width:100%; height:100%; touch-action:none; cursor:grab; }
#editor-canvas:active { cursor:grabbing; }
.guides,.corner { position:absolute; pointer-events:none; }
.guides { inset:0; background:linear-gradient(90deg,transparent calc(33.333% - .5px),#fff9 33.333%,transparent calc(33.333% + .5px),transparent calc(66.666% - .5px),#fff9 66.666%,transparent calc(66.666% + .5px)),linear-gradient(0deg,transparent calc(33.333% - .5px),#fff9 33.333%,transparent calc(33.333% + .5px),transparent calc(66.666% - .5px),#fff9 66.666%,transparent calc(66.666% + .5px)); }
.corner { width:12px; height:12px; border:0 solid white; }
.tl { top:-2px; left:-2px; border-width:3px 0 0 3px; }.tr { top:-2px; right:-2px; border-width:3px 3px 0 0; }.bl { bottom:-2px; left:-2px; border-width:0 0 3px 3px; }.br { bottom:-2px; right:-2px; border-width:0 3px 3px 0; }
.stamp { position:absolute; right:8px; bottom:8px; background:#17221ed9; color:#fff; padding:3px 6px; border-radius:3px; font-size:.75rem; pointer-events:none; }
.proof,.proof-tools,.proof-info { border-left:1px solid var(--line); }
.proof-surface { isolation:isolate; display:grid; grid-template: minmax(0,1fr) / minmax(0,1fr); place-items:safe center; overflow:auto; }
#result-image,#preview-message { grid-area:1 / 1; }
#result-image { display:block; max-width:none; max-height:none; outline:1px solid #26302924; }
#preview-message { color:var(--secondary); background:#ffffffeb; padding:6px 8px; font-size:.84rem; text-align:center; }
.tools { padding:8px 16px; gap:12px; min-height:60px; border-top:1px solid var(--line); }
.tools-label,.pane-info { color:var(--secondary); font-size:.81rem; }
.zoom { flex:1; justify-content:flex-start; gap:4px; min-width:0; }
.icon-button { width:36px; height:36px; display:grid; place-items:center; border-radius:5px; flex:none; }
.icon-button:enabled:hover,.view-options button:hover,.segments label:hover span { background:var(--soft); }
.step { font:1.15rem/1 var(--mono); }
.step:disabled { color:#8d988e; }
.zoom input { width:clamp(52px,5.5vw,104px); min-width:0; height:24px; margin:0; accent-color:var(--green); cursor:pointer; }
.zoom output { font-size:.82rem; color:var(--secondary); margin-left:4px; }
.reset { color:var(--secondary); margin-left:auto; }
.reset:enabled:hover { background:var(--soft); }
.view-options,.segments { border:1px solid var(--line); border-radius:6px; background:#f2f4f0; }
.view-options button,.segments span { font-size:.84rem; line-height:1.2; color:var(--secondary); border-radius:5px; display:grid; place-items:center; white-space:nowrap; }
.view-options button { min-width:54px; min-height:32px; padding:0 10px; }
.view-options button[aria-pressed=true],.segments input:checked + span { background:white; color:var(--green); box-shadow:inset 0 0 0 1px #abbeb1; font-weight:600; }
.pane-info { border-top:1px solid #e4e8e2; background:#fafbf8; padding:8px 16px; gap:4px 10px; flex-wrap:wrap; align-content:center; overflow-wrap:anywhere; }
#zoom-hint,#result-detail { color:var(--muted); font-size:.75rem; }
.proof-spec { font-size:.81rem; }
.settings { display:flex; flex-direction:column; position:relative; }
.settings-icon { color:var(--secondary); display:flex; }
#settings-form { display:flex; flex:1; flex-direction:column; padding:20px; gap:24px; min-width:0; }
.dimension-heading { display:flex; gap:8px; justify-content:space-between; align-items:center; margin-bottom:12px; }
.field-heading,.field>span:first-child { font-size:.88rem; font-weight:550; }
.segments label { position:relative; cursor:pointer; }
.segments span { min-width:46px; height:32px; padding-inline:8px; }
.dimension-fields,.encoding-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.field { min-width:0; display:grid; gap:6px; align-content:start; }
.field small { color:var(--muted); font-size:.75rem; font-weight:400; }
.box { border:1px solid #bac5bc; border-radius:6px; height:44px; background:var(--surface); position:relative; }
.box:focus-within { outline:2px solid #498b69; outline-offset:1px; }
.box input,.box select { appearance:none; width:100%; min-width:0; background:transparent; border:0; outline:none; padding:8px 10px; font-size:1rem; line-height:1.25; font-variant-numeric:tabular-nums; }
.box input { appearance:textfield; }
.box input::-webkit-inner-spin-button { appearance:none; }
.box>span { color:var(--muted); font: .78rem/1 var(--mono); padding-right:8px; }
.box select { padding-right:28px; height:100%; cursor:pointer; }
.box.select .icon { position:absolute; right:8px; width:16px; pointer-events:none; }
.dpi,.help { grid-column:1/-1; }
.encoding-fields { border-top:1px solid var(--line); padding-top:20px; }
.help { font-size:.76rem; line-height:1.4; color:var(--muted); }
.save-group { margin-top:auto; }
.receipt { display:grid; gap:6px; padding-top:12px; border-top:1px solid var(--line); }
.receipt>div { gap:8px; justify-content:space-between; flex-wrap:wrap; }
.receipt span { font-size:.78rem; color:var(--secondary); }
.receipt strong { font-size:.84rem; font-weight:500; text-align:right; overflow-wrap:anywhere; }
.save { width:100%; min-height:44px; margin-top:16px; text-decoration:none; font-size:.95rem; background:var(--green); color:white; }
.save:hover { background:#124a36; }
.save[aria-disabled=true] { background:#e8ece7; color:#637067; cursor:default; }
.retry { text-decoration:underline; font-size:.82rem; min-height:40px; }
.notice { color:#923d26; font-size:.84rem; line-height:1.4; margin:4px 0; }
.settings:has(.save[aria-disabled=true]) #save-status { color:#785133; }
@media (pointer:coarse) {
  .desktop-help { display:none; }.touch-help { display:inline !important; }
  .icon-button,.view-options button,.segments span { min-width:44px; min-height:44px; }
}
@media(min-width:1041px) and (max-height:760px) {
  :root { --head-height:48px; --stage-height:clamp(244px,55svh,418px); }
  .mast-inner { min-height:60px; }.studio { padding-top:20px; }
  #settings-form { gap:16px; padding:16px; }.encoding-fields { padding-top:14px; }
}
@media(max-width:1040px) {
  :root { --head-height:48px; --stage-height:clamp(168px,calc(100svh - 420px),460px); }
  .shell { width:calc(100% - 32px); }
  .mast-inner { min-height:60px; gap:12px; }.brand-mark { width:32px; height:32px; }
  .studio { padding:16px 0; }
  .workbench { grid-template-columns:minmax(0,1fr); gap:12px; }
  .visual-pair { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .pane-head { padding-inline:16px; }.tools { min-height:48px; padding:4px 12px; }
  .pane-info { padding:4px 12px; }
  .settings .pane-head { height:40px; border:0; padding:8px 16px 0; }
  .settings-icon { display:none; }
  #settings-form { display:grid; grid-template-columns: minmax(0,1.16fr) minmax(0,.88fr) minmax(150px,.72fr); gap:16px; padding:8px 16px 12px; align-items:start; }
  .dimension-heading { position:absolute; right:16px; top:2px; margin:0; }.field-heading { display:none; }
  .dimension-fields:has(#dpi-row:not([hidden])) { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .dpi { grid-column:auto; }
  .encoding-fields { padding:0; border:0; }
  .dimension-fields,.encoding-fields { gap:4px 8px; }
  .field { gap:4px; }
  .receipt { padding:0; border:0; gap:0; }
  .save-group { margin:0; }.save { margin-top:4px; }
}
@media(max-width:680px) {
  :root { --head-height:44px; --stage-height:clamp(132px,calc(100svh - 484px),320px); }
  .shell { width:calc(100% - 16px); }
  .mast-inner { min-height:52px; gap:8px; }.brand { gap:6px; }.brand h1 { font-size:1.12rem; }
  .product-name,.privacy { display:none; }
  .file-icon { display:none; }.file-info strong { max-width:30vw; font-size:.76rem; }#source-meta { font-size:.7rem; }
  .choose { padding:0 9px; font-size:.82rem; min-height:44px; gap:4px; }
  .studio { padding:8px 0 max(8px,env(safe-area-inset-bottom)); }
  .workbench { gap:8px; }.visual-pair,.settings { border-radius:8px; }
  .visual-pair { grid-template-columns:repeat(12,minmax(0,1fr)); grid-template-rows:auto auto auto; }
  .editor { grid-column:1/7; }.proof { grid-column:7/13; }
  .pane-head { padding:0 8px; gap:3px; }h2 { font-size:.96rem; }
  .grid-control { font-size:.74rem; gap:4px; }.switch { width:22px; height:14px; }.switch:after { width:10px; height:10px; }.grid-control input:checked + .switch:after { transform:translateX(8px); }
  .stage { --frame-gutter:12px; }
  .stamp { padding:2px 4px; font-size:.66rem; bottom:4px; right:4px; }
  .top-ruler { height:3px; }.side-ruler { width:3px; }.corner { width:9px; height:9px; }
  .crop-tools { grid-column:1/9; }.proof-tools { grid-column:9/13; justify-content:flex-end; border-left:0; }
  .tools { padding:0 4px; min-height:46px; gap:0; }.tools-label { display:none; }
  .zoom { gap:0; }.zoom input { flex:1; max-width:76px; min-width:25px; height:36px; }
  .zoom output { font-size:.75rem; margin:0; }
  .step { min-width:44px; min-height:44px; }.view-options button { min-width:44px; min-height:44px; padding:0 6px; font-size:.8rem; }
  .crop-info { display:none; }.proof-info { grid-column:1/-1; min-height:26px; border-left:0; padding:3px 8px; justify-content:space-between; }
  .proof-spec,#result-detail { font-size:.72rem; }
  .settings .pane-head { height:44px; padding:0 12px; border-bottom:1px solid #e4e8e2; }
  .dimension-heading { top:0; right:8px; }.segments { border:0; }.segments span { min-height:44px; min-width:48px; }
  #settings-form { grid-template-columns:minmax(0,1fr); gap:8px; padding:8px 12px 12px; }
  .dimension-fields,.encoding-fields { gap:4px 8px; }
  .field { gap:2px; }.field>span:first-child { font-size:.8rem; }
  .box { height:44px; }.box input,.box select { padding:6px 8px; }.box.select select { padding-right:24px; }
  .help { font-size:.71rem; }
  .save-group { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:4px 8px; padding-top:8px; border-top:1px solid var(--line); }
  .receipt>div { justify-content:flex-start; gap:6px; }.receipt { grid-column:1; }
  .receipt span { font-size:.72rem; }.receipt strong { font-size:.75rem; text-align:left; }
  .save { grid-column:2; grid-row:1; min-width:94px; padding:0 10px; margin:0; font-size:.86rem; }
  .save-group .notice,.retry { grid-column:1/-1; }
}
@media(max-width:375px) { .grid-control { gap:3px; }.file-info strong { max-width:26vw; } }
@media(max-width:680px) and (max-height:620px) {
  :root { --stage-height:clamp(86px,calc(100svh - 451px),156px); }
  .help { display:none; }
  #settings-form { gap:4px; padding-bottom:8px; }
  .brand-mark { width:28px; height:28px; }
}
@media(min-width:600px) and (max-width:1040px) and (max-height:500px) {
  :root { --stage-height:clamp(100px,calc(100svh - 186px),248px); --head-height:38px; }
  .shell { width:calc(100% - 12px); }
  .mast-inner { min-height:44px; }
  .studio { padding-block:4px; }
  .workbench { grid-template-columns:minmax(0,1fr) clamp(212px,34vw,280px); gap:6px; }
  .visual-pair { grid-template-columns:repeat(12,minmax(0,1fr)); grid-template-rows:auto auto 1fr; }
  .editor { grid-column:1/7; }.proof { grid-column:7/13; }
  .crop-tools { grid-column:1/9; }.proof-tools { grid-column:9/13; justify-content:flex-end; border-left:0; }
  .tools { min-height:44px; padding:0 4px; gap:0; }.tools-label { display:none; }
  .zoom { gap:0; }.zoom input { width:48px; flex:1; max-width:75px; }
  .crop-info { display:none; }.proof-info { grid-column:1/-1; border-left:0; padding:4px 8px; align-content:start; }
  .stage { --frame-gutter:10px; }.pane-head { padding:0 8px; }
  .settings .pane-head { height:44px; padding:0 8px; }
  .dimension-heading { top:0; right:4px; }.segments span { min-width:44px; }
  #settings-form { display:grid; grid-template-columns:1fr; padding:4px 8px 8px; gap:4px; }
  .field { gap:1px; }.field>span:first-child { font-size:.77rem; }
  .box { height:40px; }.box input,.box select { padding:4px 6px; }.box>span { padding-right:4px; }
  .help { display:none; }.save-group { display:block; margin:0; padding-top:4px; }
  .receipt { gap:0; }.receipt>div { flex-wrap:nowrap; gap:4px; }.receipt strong { font-size:.72rem; }
  .save { margin-top:4px; min-height:44px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important; } }


.native-short { display:none; }
@media(max-width:680px), (max-width:1040px) and (max-height:500px) {
  .native-short { display:inline; }.native-long { display:none; }
  .stamp { display:none; }
  .crop-tools .reset { min-width:44px; min-height:44px; }
}
@media(max-width:680px) and (max-height:620px) { .stage { --frame-gutter:8px; } }