@font-face { font-family: Mont; src: url('/fonts/Mont-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF; }
@font-face { font-family: Mont; src: url('/fonts/Mont-Book.otf') format('opentype'); font-weight: 500; font-display: swap; unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF; }
@font-face { font-family: Mont; src: url('/fonts/Mont-SemiBold.otf') format('opentype'); font-weight: 600; font-display: swap; unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF; }

:root {
  color-scheme: light;
  --bg: #f8f8f8;
  --panel: #fcfcfc;
  --ink: #171717;
  --muted: #767676;
  --line: #e9e9e9;
  --accent: #fa5d19;
  --accent-hover: #df480a;
  --accent-soft: #fff0e9;
  --warning: #ac6900;
  --error: #b9382b;
  font-family: Mont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: 0;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; letter-spacing: 0; min-width: 0; }
button, input, select, label { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-header { height: 56px; display: flex; align-items: center; gap: 26px; padding: 0 22px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { display: block; width: 31px; height: 25px; object-fit: contain; }
.brand h1 { font-size: 18px; font-weight: 600; margin: 0; line-height: 1.3; }
.header-context { display: flex; align-items: center; gap: 14px; color: #5c5c5c; font-size: 12px; }
.header-slash { color: #d4d4d4; font-weight: 400; font-size: 20px; }
.local-badge { font-size: 10px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.save-status { margin-left: auto; font-size: 11px; color: var(--muted); min-width: 0; text-align: right; overflow-wrap: anywhere; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr) 280px; height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 440px; }
.panel { min-width: 0; overflow-y: auto; scrollbar-width: thin; background: var(--panel); }
.panel-left { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.panel-right { border-left: 1px solid var(--line); }
.control-section { display: grid; gap: 13px; padding: 21px 18px; border-bottom: 1px solid var(--line); }
.control-section:last-child { border-bottom: 0; }
.control-section h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.section-icon { width: 15px; height: 15px; opacity: 0.55; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 13px 10px; }
label { display: grid; gap: 7px; min-width: 0; }
label > span { color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 400; }
input, select { width: 100%; height: 36px; min-width: 0; border: 1px solid #e4e4e4; border-radius: 6px; background: #fff; color: var(--ink); padding: 7px 10px; outline: none; font-size: 13px; font-weight: 500; transition: border-color 120ms, box-shadow 120ms; }
input:hover, select:hover { border-color: #cbcbcb; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(250 93 25 / 9%); }
input:disabled, select:disabled { opacity: 0.55; }
input[type='range'] { height: 20px; padding: 0; border: 0; box-shadow: none; background: transparent; accent-color: var(--accent); cursor: pointer; }
.toggle-label { display: flex; align-items: center; gap: 8px; }
.toggle-label input { width: 14px; height: 14px; accent-color: var(--accent); padding: 0; box-shadow: none; }
.toggle-label span { color: #575757; }

button { min-height: 34px; border: 1px solid #e4e4e4; border-radius: 6px; background: #fff; color: #333; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 120ms, border-color 120ms; }
button:hover { background: #f3f3f3; border-color: #d1d1d1; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.primary { background: var(--accent); color: #fff; border-color: #ed5514; box-shadow: 0 1px 2px rgb(186 63 7 / 15%); }
.primary:hover { background: var(--accent-hover); color: #fff; border-color: var(--accent-hover); }
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-actions .primary { grid-column: 1 / -1; min-height: 38px; }
.export-actions .primary::before { content: ''; display: inline-block; vertical-align: -3px; width: 15px; height: 15px; background: currentColor; mask: url('/assets/download.svg') center / contain no-repeat; margin-right: 7px; }
.fineprint { margin: 0; font-size: 10px; line-height: 1.65; color: var(--muted); overflow-wrap: anywhere; }

.dropbox { position: relative; min-height: 142px; padding: 15px 10px; place-items: center; gap: 9px; text-align: center; border: 1px dashed #d8d8d8; border-radius: 6px; background: #fff; cursor: pointer; }
.dropbox:hover, .dropbox.dragover { border-color: var(--accent); background: #fff8f4; }
.dropbox:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropbox input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #f7ded1; background: var(--accent-soft); border-radius: 6px; }
.drop-icon img { width: 18px; height: 18px; opacity: 0.65; }
.dropbox strong { font-size: 11px; font-weight: 500; }
.dropbox small { color: var(--muted); font-size: 10px; }
.source-thumb { width: 44px; height: 52px; border-radius: 3px; object-fit: cover; border: 1px solid var(--line); }
.has-image .dropbox { min-height: 89px; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; padding: 12px; text-align: left; gap: 5px 12px; justify-items: start; }
.has-image .source-thumb { grid-row: 1 / 3; }
.has-image .drop-icon { display: none; }
.has-image .dropbox strong { align-self: end; }
.has-image .dropbox small { align-self: start; overflow-wrap: anywhere; }
.info-section { margin-top: auto; border-top: 1px solid var(--line); }
.info-section dl { display: grid; gap: 13px; margin: 0; }
.info-section dl > div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; line-height: 1.5; }
.info-section dt { color: var(--muted); }
.info-section dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.workspace { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar-title { display: grid; gap: 4px; min-width: 0; flex: 1 1 0; }
.topbar-title strong { font-size: 12px; font-weight: 600; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title span { font-size: 10px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar { display: flex; flex-shrink: 0; gap: 3px; align-items: center; }
.toolbar button { width: 30px; height: 30px; min-height: 30px; padding: 6px; display: grid; place-items: center; border-color: transparent; background: transparent; border-radius: 5px; }
.toolbar button:hover { background: #f1f1f1; border-color: #e6e6e6; }
.toolbar img { width: 16px; height: 16px; opacity: 0.65; }
.toolbar-divider { width: 1px; height: 16px; margin: 0 5px; background: var(--line); }
.canvas-wrap { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 36px; overflow: hidden; background-color: #f7f7f7; background-image: linear-gradient(#ededed 1px, transparent 1px), linear-gradient(90deg, #ededed 1px, transparent 1px); background-size: 48px 48px; background-position: center; }
#stage { display: block; max-width: 100%; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / 5%), 0 0 0 1px #e1e1e1; cursor: grab; touch-action: none; }
#stage:active { cursor: grabbing; }
.empty-state { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 12px; pointer-events: none; padding: 20px; text-align: center; }
.empty-mark { width: 44px; height: 32px; object-fit: contain; margin-bottom: 5px; }
.empty-state strong { font-size: 16px; font-weight: 500; }
.empty-state span { font-size: 10px; color: #999; }
.statusbar { min-height: 34px; padding: 8px 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; background: #fff; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.statusbar span:last-child { margin-left: auto; }
.open-exports { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--accent); }
.open-exports[hidden] { display: none; }
.open-exports .folder-icon { width: 15px; height: 15px; flex-shrink: 0; background: currentColor; -webkit-mask: url('/assets/folder-open.svg') center / contain no-repeat; mask: url('/assets/folder-open.svg') center / contain no-repeat; }
.export-location { min-width: 0; font-size: 11px; color: var(--muted); }
.export-location summary { cursor: pointer; padding: 4px 0; }
.export-location p { margin: 7px 0 0; overflow-wrap: anywhere; line-height: 1.6; user-select: text; }
.warning-section { gap: 11px; }
.warning-section ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.warning-section li { position: relative; padding-left: 13px; font-size: 10px; line-height: 1.6; color: #686868; }
.warning-section li::before { content: ''; position: absolute; left: 0; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: #aaa; }
.warning-section li.warn { color: var(--warning); }
.warning-section li.error { color: var(--error); }
.warning-section li.warn::before { background: var(--warning); }
.warning-section li.error::before { background: var(--error); }
body.exporting { cursor: wait; }
body.exporting button, body.exporting input, body.exporting select { pointer-events: none; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr) 250px; }
  .control-section { padding: 18px 14px; }
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar-title { min-width: 110px; }
  .canvas-wrap { padding: 24px; }
}
@media (max-width: 840px) {
  .app-shell { height: auto; grid-template-columns: 1fr 1fr; }
  .workspace { grid-column: 1 / -1; grid-row: 1; height: 560px; border-bottom: 1px solid var(--line); }
  .panel-left { grid-column: 1; grid-row: 2; border-right: 0; }
  .panel-right { grid-column: 2; grid-row: 2; }
  .info-section { margin-top: 0; }
}
@media (max-width: 520px) {
  .app-header { padding: 0 14px; gap: 12px; height: 54px; }
  .brand h1 { font-size: 17px; }
  .brand-mark { width: 27px; height: 23px; }
  .header-context { display: none; }
  .save-status { max-width: 130px; font-size: 10px; }
  .app-shell { display: flex; flex-direction: column; }
  .workspace { flex: 0 0 480px; order: -1; }
  .topbar { align-items: center; }
  .topbar-title { min-width: 75px; }
  .toolbar { gap: 1px; }
  .toolbar button { width: 27px; padding: 5px; }
  .toolbar-divider { margin: 0 2px; }
  .panel-right, .panel-left { overflow: visible; border: 0; }
  .control-section { padding: 20px; }
  .canvas-wrap { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
