:root{color-scheme:light;--page:#f7f8fa;--panel:#fff;--ink:#202327;--muted:#636a74;--soft:#eceef1;--line:#dfe2e6;--accent:#ed592e;--tint:#fff5ef;--dot:#efd6ca;--quiet:#f5f6f8;--action:#e7e9ed;--shadow:0 2px 5px #1c253205}
:root.dark{color-scheme:dark;--page:#191b20;--panel:#23262c;--ink:#f6f5f3;--muted:#b0b5be;--soft:#383b42;--line:#41444d;--accent:#ff8a63;--tint:#352922;--dot:#594035;--quiet:#2c3037;--action:#353940;--shadow:none}
*{box-sizing:border-box}body{margin:0;background:var(--page);color:var(--ink);font:16px/1.5 Inter,"Malgun Gothic","Apple SD Gothic Neo",sans-serif;letter-spacing:-.035em;word-break:keep-all}button,input,select{font:inherit}button{color:inherit;cursor:pointer}button:disabled{cursor:default}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid var(--accent);outline-offset:3px}button{border:0;background:none}i[data-icon]{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}svg{width:1.15em;height:1.15em;display:block}
header{height:52px;background:var(--panel);border-bottom:1px solid var(--line)}.topbar,main{width:calc(100% - clamp(24px,4vw,64px));margin:auto}.topbar,.header-actions,.brand,.guide,.icon-btn,.panel-heading,h2,.clear,.choose,.summary,#run,.privacy,.dialog-head{display:flex;align-items:center}.topbar{height:100%;justify-content:space-between}.brand{gap:11px;font:800 25px/1 Arial,sans-serif;letter-spacing:-1.6px}.brandmark{position:relative;width:32px;height:32px;display:block;border-radius:9px;background:#f36136}.brandmark i{width:14px;height:12px;position:absolute;border:2.2px solid white;transform:skewY(-18deg);border-radius:2px;left:7px;top:12px}.brandmark i+i{left:12px;top:7px;background:#f36136}.header-actions{gap:16px}.guide,.icon-btn{gap:7px;font-size:14px;font-weight:600;color:var(--muted);padding:6px}.divider{height:17px;width:1px;background:var(--line)}.icon-btn{justify-content:center;width:32px;height:32px}.guide:hover,.icon-btn:hover,.clear:hover:enabled{color:var(--accent)}
main { padding: 6px 0 16px; }
.brand, .modes a, #language { text-decoration: none; color: inherit; }
#language, #cancel, .result-row { font-size: 14px; }
#cancel { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 10px; }
#results { order: 4; }
.tool-footer { color:var(--muted); font-size:13px; }
#tool-description { margin:10px 0 0; }
.tool-footer .privacy a { margin-left:auto; color:inherit; }
html:lang(ja) body, html:lang(zh-CN) body { word-break:normal; overflow-wrap:anywhere; }
#language { position:relative; }
#language summary {
  display:flex; align-items:center; gap:6px; min-height:32px; padding:0 10px;
  background:var(--quiet); color:var(--ink); border-radius:999px; cursor:pointer;
  list-style:none; white-space:nowrap; font-size:13px; font-weight:600;
}
#language summary::-webkit-details-marker { display:none; }
#language summary:hover, #language[open] summary { background:var(--soft); }
#language summary i { color:var(--muted); }
#language summary [data-icon=chevron] { font-size:10px; }
#language[open] summary [data-icon=chevron] { transform:rotate(180deg); }
#language :is(summary,a):focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#language nav {
  position:absolute; right:0; top:calc(100% + 6px); z-index:6; display:grid; gap:2px; min-width:148px;
  padding:5px; border:1px solid var(--line); border-radius:10px; background:var(--panel); box-shadow:0 6px 18px #171c241a;
}
#language a { display:flex; align-items:center; justify-content:space-between; padding:7px 10px; text-decoration:none; color:var(--ink); border-radius:6px; }
#language a:hover { background:var(--quiet); }
#language a[aria-current] { background:var(--tint); font-weight:600; }
#language a[aria-current]::after {
  content:""; width:5px; height:9px; margin-right:2px;
  border:solid var(--accent); border-width:0 2px 2px 0; transform:rotate(45deg);
}
#progress { padding: 0 15px 9px; color: var(--muted); font-size: 13px; }
#work-progress { position:fixed; z-index:4; right:16px; bottom:max(16px,env(safe-area-inset-bottom)); width:min(360px,calc(100% - 32px)); padding:12px 15px; border-radius:10px; border:1px solid var(--line); background:var(--panel); color:var(--ink); box-shadow:0 4px 24px #10192328; font-size:14px; pointer-events:none; }
#work-progress div { display:flex; align-items:center; gap:10px; }
#progress-label { flex:1; }
#work-progress button { pointer-events:auto; }
#progress-detail { display:block; margin-top:5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--muted); }
#progress-detail:empty { display:none; }
#progress-size, #queue-size { color:var(--muted); font-weight:400; font-size:12px; }
.queue-panel h2 { flex-wrap:wrap; }
.queue-panel .clear { flex-shrink:0; }
#size-summary:not([hidden]) { display:flex; flex-wrap:wrap; gap:8px 24px; }
#size-summary { margin:0 15px 8px; padding:9px 12px; background:var(--quiet); border-radius:7px; }
#size-summary dt { color:var(--muted); font-size:12px; }
#size-summary dd { margin:0; font-size:14px; font-weight:600; font-variant-numeric:tabular-nums; }
@media (max-width: 820px) { body:has(#work-progress:not([hidden])) #notice { bottom:136px; } }
#progress-amount { font-variant-numeric: tabular-nums; }
#progress-bar { display: block; width: 100%; height: 8px; margin-top: 6px; accent-color: var(--accent); }
.result-row { padding: 9px 15px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.result-row a { color: var(--accent); font-weight: 700; }
.result-row small { color: var(--muted); }
#download-zip { border-radius: 6px; padding: 5px 10px; color: var(--accent); background: var(--tint); font-size: 13px; font-weight: 700; }
.result-names { display: grid; gap: 2px; flex: 1; min-width: 0; }
.result-names strong { font-size: 14px; }
.result-row a { flex-shrink: 0; }
@media(max-width:500px){.identity h1{display:none}}
h1, h2, h3, p { margin: 0; }
.identity { display: flex; align-items: center; gap: 14px; }
.identity h1 {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.modes {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 6px;
  margin: 5px 0 12px;
}
.modes a {
  display: flex;
  align-items: center;
  gap: clamp(5px, .7vw, 12px);
  padding: 7px clamp(6px, 1vw, 15px);
  min-height: 55px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}
.modes strong, .modes small { display: block; line-height: 1.4; }
.modes small { font-size: 12px; color: var(--muted); }
.modes i { width: 28px; height: 28px; border-radius: 7px; color: var(--muted); background: var(--quiet); }
.modes a:hover { border-color: var(--muted); }
.modes a[aria-current="page"] { background: var(--tint); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.modes a[aria-current="page"] i { background: #cc4822; color: #fff; }
@media (max-width: 700px) {
  .modes { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) clamp(266px,27vw,360px);gap:12px;align-items:start}.left{min-width:0;display:grid;gap:12px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:11px;box-shadow:var(--shadow)}.panel-heading{justify-content:space-between;gap:8px;padding:12px 16px}.panel-heading h2,.dialog-head h2{gap:8px;line-height:1.35;font-size:16px;letter-spacing:-.055em}.panel-heading h2>i{color:var(--muted);font-size:17px}.queue-panel .panel-heading,.settings .panel-heading{border-bottom:1px solid var(--line)}.count{font:600 12px/20px Inter,Arial,sans-serif;min-width:22px;padding:0 5px;background:var(--quiet);color:var(--muted);border-radius:6px;text-align:center}.clear{font-size:13px;color:var(--muted);gap:5px}.clear:disabled{opacity:.55}.empty{min-height:52px;display:flex;align-items:center;justify-content:center;gap:11px;color:var(--muted);font-size:14px}.empty i{font-size:21px;color:#939aa4}.row{display:flex;align-items:center;gap:12px;padding:12px 20px}.row+.row{border-top:1px solid var(--line)}.thumb{width:44px;height:40px;border-radius:6px;background:var(--quiet);display:grid;place-items:center;overflow:hidden;color:var(--muted)}.thumb img{width:100%;height:100%;object-fit:cover}.detail{flex:1;min-width:0}.detail strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.detail small{color:var(--muted);font-size:12px}
.settings-body{padding:14px 16px;display:grid;gap:14px}.field{display:grid;gap:9px}.field label,.field-title{font-size:14px;font-weight:700}.label-line{display:flex;align-items:center;justify-content:space-between}.value{font:700 13px/1.5 Arial,sans-serif;background:var(--tint);border-radius:5px;color:var(--accent);padding:2px 7px}.select-wrap{position:relative}.select-wrap i{position:absolute;right:12px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--muted);font-size:13px}select{appearance:none;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:7px;width:100%;height:40px;padding:0 30px 0 12px;font-size:14px}.range{appearance:none;width:100%;height:5px;border-radius:10px;margin:8px 0 2px;background:linear-gradient(to right,var(--accent) var(--fill),var(--soft) var(--fill));cursor:pointer}.range::-webkit-slider-thumb{appearance:none;background:var(--panel);border:3px solid var(--accent);width:16px;height:16px;border-radius:50%;box-shadow:0 1px 3px #2222}.range::-moz-range-thumb{background:var(--panel);border:3px solid var(--accent);border-radius:50%;width:11px;height:11px}.ticks{display:flex;justify-content:space-between;color:var(--muted);font-size:12px}.run-area{border-top:1px solid var(--line);padding:12px 16px}.summary{justify-content:space-between;font-size:13px;margin-bottom:8px;color:var(--muted)}.summary strong{color:var(--ink)}#run{width:100%;justify-content:center;gap:8px;background:var(--accent);color:white;border-radius:8px;height:43px;font-size:15px;font-weight:700}#run:disabled{background:var(--action);color:var(--muted)}.privacy{margin-top:10px;gap:6px;color:var(--muted);font-size:12px}.privacy i{font-size:13px}
dialog{width:min(430px,calc(100% - 32px));background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:16px;padding:24px;box-shadow:0 15px 60px #0002}dialog::backdrop{background:#15171b66}.dialog-head{justify-content:space-between;margin-bottom:14px}#dialog-body{color:var(--muted);font-size:15px}#dialog-body p+p{margin-top:10px}#notice{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:var(--ink);color:var(--panel);border-radius:9px;font-size:14px;max-width:90%;width:max-content;z-index:3}#notice:not(:empty){padding:10px 18px}
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .left { gap: 10px; }


  .panel-heading { padding: 10px 13px; }
  .brand { font-size: 22px; gap: 7px; }
  .header-actions, .identity { gap: 6px; }
  .identity h1 { padding-left: 8px; font-size: 12px; }
  .empty { min-height: 44px; }
}
@media (max-width: 400px) {
  .guide span, .header-actions .divider { display: none; }
  .guide { width: 32px; justify-content: center; }
}
html { scrollbar-gutter: stable; }
.topbar, main { max-width: 1280px; }
.right { display: grid; gap: 12px; min-width: 0; }
.meta, .caption span, .field-hint { font-size: 12px; color: var(--muted); }
.preview-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  aspect-ratio: 1.85;
  min-height: 300px;
  max-height: clamp(300px, 62svh, 560px);
  overflow: hidden;
}
.stage {
  display: grid; place-items: center; position: relative; min-width: 0; min-height: 0;
  margin: 8px; border: 1px solid transparent; border-radius: 7px;
  background-color: var(--quiet); background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 9px 9px; overflow: hidden; cursor: pointer;
}
.stage.over { outline: 3px dashed var(--accent); outline-offset: -4px; }
.stage.over::after { content: ''; position: absolute; inset: 0; background: #ed592e22; pointer-events: none; }
.stage.awaiting-file {
  border-color: var(--line); border-style: dashed; background: var(--quiet);
}
.stage.awaiting-file:hover, .stage.awaiting-file.over { background: var(--tint); border-color: var(--accent); }
#upload-prompt {
  display: grid; place-content: center; justify-items: center; gap: 4px;
  width: 100%; height: 100%; border-radius: inherit;
}
#upload-prompt i { color: var(--accent); font-size: 22px; margin-bottom: 4px; }
#upload-prompt strong { font-size: 16px; }
#upload-prompt span { font-size: 13px; color: var(--muted); }
#upload-prompt:focus-visible { outline-offset: -3px; }
#upload-prompt[hidden], .caption[hidden] { display: none; }
.stage:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.caption > div { display: flex; align-items: center; min-width: 0; gap: 7px; }
.caption .meta { font-size: 11px; padding: 1px 5px; border-radius: 4px; color: var(--muted); background: var(--quiet); }
.caption .meta:empty { display: none; }
#media.cover img { object-fit: cover; }
.resize-fields { display: grid; gap: 14px; min-width: 0; border: 0; padding: 0; margin: 0; }
.resize-fields:disabled { color: var(--muted); }
.resize-fields:disabled .amount span, .resize-fields select:disabled, .crop-fields .amount span:has(input:disabled) { background: var(--quiet); }
.crop-fields .amount:has(input:disabled) { color: var(--muted); }
.upload-limits { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; margin: 9px 0; }
.upload-limits dd { margin: 0; text-align: right; }
#notice, #progress { white-space: pre-line; overflow-wrap: anywhere; }
.resize-fields:disabled .segments, .resize-fields:disabled .presets { opacity: .6; }
.segments { display: flex; background: var(--quiet); border: 1px solid var(--line); padding: 3px; border-radius: 8px; }
.segments button { flex: auto; padding: 6px 2px; font-size: 13px; border-radius: 5px; color: var(--muted); }
.segments button[aria-pressed=true] { background: var(--panel); color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px #15182022; }
.dimension-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.amount { display: grid; gap: 6px; font-size: 14px; }
.amount span { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 0 9px; }
.amount span:focus-within { outline: 2px solid var(--accent); }
.amount input { width: 100%; min-width: 0; padding: 8px 0; outline: none; border: 0; background: transparent; color: var(--ink); }
.amount small { color: var(--muted); }
.lock-ratio { font-size: 13px; display: flex; align-items: center; gap: 5px; }
.lock-ratio input { accent-color: var(--accent); }
.presets { display: flex; gap: 4px; }
.presets button { flex: 1; border: 1px solid var(--line); border-radius: 5px; padding: 4px 0; font-size: 12px; }
.presets button:hover:enabled { color: var(--accent); background: var(--tint); }
#frame { position: relative; overflow: hidden; box-shadow: 0 1px 5px #14171b26; }
#frame[hidden], #crop-box[hidden], #fallback[hidden] { display: none; }
#media, #media img { display: block; width: 100%; height: 100%; }
#media img { user-select: none; }
#fallback { padding: 12px; font-size: 14px; color: var(--muted); text-align: center; }
.caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 15px; }
.caption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.caption span { flex: none; font-variant-numeric: tabular-nums; }
#crop-box {
  position: absolute; cursor: move; touch-action: none; outline: 2px solid #fff; outline-offset: -2px;
  box-shadow: 0 0 0 2000px #10111688;
  background-image: linear-gradient(to right, transparent calc(100% - 1px), #ffffff80 1px),
    linear-gradient(to bottom, transparent calc(100% - 1px), #ffffff80 1px);
  background-size: calc(100% / 3) 100%, 100% calc(100% / 3);
}
#crop-box:focus-visible { outline-color: #ffb570; }
#frame.cropping { cursor: crosshair; touch-action: none; user-select: none; }
.crop-fields { display: grid; gap: 10px; }
#crop-box [data-handle] { position: absolute; display: grid; place-items: center; }
#crop-box [data-handle]::after {
  content: ''; width: 8px; height: 8px; border-radius: 2px;
  background: white; box-shadow: 0 0 0 1px #2525258c;
}
#crop-box [data-handle=n], #crop-box [data-handle=s] { left: 0; width: 100%; height: 16px; cursor: ns-resize; }
#crop-box [data-handle=w], #crop-box [data-handle=e] { top: 0; height: 100%; width: 16px; cursor: ew-resize; }
#crop-box [data-handle=n] { top: -8px; }
#crop-box [data-handle=s] { bottom: -8px; }
#crop-box [data-handle=w] { left: -8px; }
#crop-box [data-handle=e] { right: -8px; }
#crop-box [data-handle=nw], #crop-box [data-handle=ne],
#crop-box [data-handle=sw], #crop-box [data-handle=se] { width: 22px; height: 22px; }
#crop-box [data-handle=nw] { left: -11px; top: -11px; cursor: nwse-resize; }
#crop-box [data-handle=ne] { right: -11px; top: -11px; cursor: nesw-resize; }
#crop-box [data-handle=sw] { left: -11px; bottom: -11px; cursor: nesw-resize; }
#crop-box [data-handle=se] { right: -11px; bottom: -11px; cursor: nwse-resize; }
.numeric { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.numeric input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); padding: 8px 10px; }
.row { padding: 5px 12px; gap: 5px; }
#dialog { width:min(810px,calc(100% - 24px)); padding:0; max-height:90dvh; }
#dialog[open] { display:flex; flex-direction:column; }
#dialog .dialog-head { flex:none; margin:0; padding:12px 20px 4px; }
#dialog-title { font-size:19px; }
.guide-tools { flex:none; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; padding:6px 20px 0; }
.guide-tools label { position:relative; min-width:0; }
.guide-tools input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.guide-tools span { display:grid; place-items:center; min-height:44px; border-radius:7px; background:var(--quiet); color:var(--muted); font-size:14px; font-weight:600; }
.guide-tools label:hover span { background:var(--soft); color:var(--ink); }
.guide-tools input:checked + span { background:var(--ink); color:var(--panel); }
.guide-tools input:focus-visible + span { text-decoration:underline 2px; text-underline-offset:4px; }
@media (forced-colors:active) {
  .guide-tools input:checked + span { forced-color-adjust:none; background:Highlight; color:HighlightText; }
}
#dialog-body { overflow:auto; overscroll-behavior:contain; padding:18px 20px 20px; min-height:0; }
#guide-heading { margin:0; color:var(--ink); font-size:20px; }
#guide-intro { margin:4px 0 12px; }
#guide-steps { margin:0; padding:0; list-style:none; counter-reset:guide-step; }
#guide-steps li { position:relative; display:grid; grid-template-columns:minmax(0,0.8fr) minmax(0,1.2fr); align-items:start; gap:18px; padding:16px 0; border-top:1px solid var(--line); counter-increment:guide-step; }
#guide-steps h4 { display:flex; gap:8px; align-items:baseline; margin:0; color:var(--ink); font-size:16px; }
#guide-steps h4::before { content:counter(guide-step); flex:none; width:22px; text-align:center; border-radius:50%; background:var(--tint); color:var(--ink); font:600 13px/22px system-ui,sans-serif; }
#guide-steps p { margin:8px 0 0; line-height:1.55; overflow-wrap:anywhere; }
.guide-shots { display:grid; gap:6px; }
.guide-shots img { display:block; width:100%; height:auto; border:1px solid var(--line); border-radius:7px; }
@media (max-width:650px) {
  .guide-tools { gap:4px; padding-inline:12px; }
  .guide-tools span { font-size:13px; }
  #dialog-body { padding:14px; }
  #guide-steps li { grid-template-columns:1fr; gap:10px; }
}
.file-pick { display: flex; align-items: center; gap: 10px; padding: 4px; min-width: 0; flex: 1; text-align: left; }
.row:has(.file-pick[aria-pressed=true]) { background: var(--tint); }
.row .thumb { flex: none; width: 58px; height: 44px; }
.types { font-size: 12px; color: var(--muted); }
.types summary { cursor: pointer; }
.types p { margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .workspace { display: flex; flex-direction: column; align-items: stretch; }
  .left, .right { display: contents; }
  .preview-panel { order: 1; }
  .settings { order: 2; }
  .queue-panel { order: 3; }
  .caption { flex-wrap: wrap; }
}
