:root {
  color-scheme: light;
  --bg: #f7f9f8;
  --surface: #ffffff;
  --surface-muted: #f4f7f5;
  --ink: #18211d;
  --ink-strong: #111915;
  --muted: #58635d;
  --border: #cbd5cf;
  --border-light: #dde4e0;
  --green: #178447;
  --green-dark: #0e6535;
  --green-soft: #e9f6ee;
  --coral: #d95f58;
  --coral-dark: #b94640;
  --coral-soft: #fff0ef;
  --amber: #cb831b;
  --danger: #a83934;
  --danger-soft: #fff1f0;
  --shadow: 0 12px 32px rgba(31, 48, 39, 0.06);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(23, 132, 71, 0.23);
  outline-offset: 2px;
}
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .52; }
a { color: inherit; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.header-inner, .footer-inner {
  width: min(1480px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: inline-flex; align-items: center; color: var(--ink-strong); text-decoration: none; }
.brand-logo { display: block; width: 136px; height: auto; }
.header-meta { display: flex; align-items: center; gap: 18px; }
.local-badge { display: inline-flex; align-items: center; gap: 7px; color: #3e4b44; font-size: .8rem; font-weight: 750; }
.local-badge .icon { color: var(--green); }
.lang-switch { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-muted); border: 1px solid var(--border-light); border-radius: 8px; }
.lang-btn { min-width: 41px; min-height: 32px; padding: 5px 9px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: .78rem; font-weight: 800; }
.lang-btn.active { color: var(--ink-strong); background: var(--surface); box-shadow: 0 1px 4px rgba(24,33,29,.12); }

main { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 29px 0 54px; }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; margin-bottom: 20px; }
.intro h1 { margin: 0; max-width: 900px; color: var(--ink-strong); font-size: 2.25rem; line-height: 1.09; font-weight: 850; }
.intro p { max-width: 840px; margin: 9px 0 0; color: var(--muted); font-size: .96rem; }
.intro-status { min-width: 195px; padding: 11px 13px; display: flex; align-items: center; gap: 9px; border: 1px solid #c8e1d1; border-radius: var(--radius); color: #2c6541; background: var(--green-soft); font-size: .79rem; font-weight: 750; }
.status-dot { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--green); }
.status-dot::after { content: ""; position: absolute; inset: -4px; border: 1px solid rgba(23,132,71,.25); border-radius: inherit; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .9; } 70%,100% { transform: scale(1.5); opacity: 0; } }

.domain-notice { margin-bottom: 14px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid #e5b6b2; border-radius: var(--radius); color: var(--danger); background: var(--danger-soft); }
.domain-notice .icon { flex: none; margin-top: 1px; }
.domain-notice div { display: grid; gap: 2px; }
.domain-notice strong { font-size: .86rem; }
.domain-notice span { font-size: .78rem; }

.workspace {
  min-width: 0;
  min-height: 650px;
  display: grid;
  grid-template-columns: 286px minmax(420px, 1fr) 310px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: clip;
}
.panel { min-width: 0; padding: 20px; background: var(--surface); }
.controls-panel { border-right: 1px solid var(--border-light); }
.output-panel { border-left: 1px solid var(--border-light); }
.panel-heading { min-height: 38px; margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading h2 { margin: 0; color: var(--ink-strong); font-size: 1rem; line-height: 1.2; font-weight: 850; }
.panel-heading.compact { margin: 20px 0 17px; }
.step-index { min-width: 28px; min-height: 24px; padding: 3px 6px; display: inline-grid; place-items: center; border-radius: 5px; color: var(--green-dark); background: var(--green-soft); font-size: .69rem; font-weight: 900; }
.step-index.coral { color: var(--coral-dark); background: var(--coral-soft); }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; flex: none; border: 1px solid var(--border-light); border-radius: 7px; color: #4d5a53; background: var(--surface); }
.icon-btn:hover { border-color: #b6c3bc; color: var(--green-dark); background: var(--surface-muted); }
.ai-postprocess-control { margin: -2px 0 17px; padding: 10px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
.ai-postprocess-control > div { min-width: 0; display: grid; gap: 2px; }
.ai-postprocess-control strong { color: #3f4b45; font-size: .74rem; }
.ai-postprocess-control span { color: var(--muted); font-size: .65rem; line-height: 1.35; }

.preset-row { margin-bottom: 17px; padding: 3px; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 2px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface-muted); }
.preset { min-width: 0; min-height: 33px; padding: 5px 2px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: .69rem; font-weight: 800; overflow-wrap: anywhere; }
.preset.active { color: var(--green-dark); background: var(--surface); box-shadow: 0 1px 4px rgba(24,33,29,.11); }
.field-label { display: block; margin-bottom: 6px; color: #3f4b45; font-size: .76rem; font-weight: 800; }
.control-group { margin-bottom: 19px; }
select, input[type="url"], input[type="password"], input[type="text"], input[type="number"], textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink-strong);
  background: var(--surface);
  font-size: .79rem;
}
select, input[type="url"], input[type="password"], input[type="text"], input[type="number"] { padding: 8px 10px; }
textarea { padding: 9px 10px; line-height: 1.45; resize: vertical; }
select:hover, input:hover, textarea:hover { border-color: #aebbb4; }
.control-list { display: grid; gap: 15px; }
.range-field { min-width: 0; }
.range-head { margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.range-head label { color: #3f4b45; font-size: .76rem; font-weight: 750; }
.range-head output { min-width: 37px; color: var(--green-dark); text-align: right; font-size: .73rem; font-variant-numeric: tabular-nums; font-weight: 850; }
input[type="range"] { --range-fill: 50%; width: 100%; height: 18px; margin: 0; appearance: none; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--green) var(--range-fill), #dce3df var(--range-fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #dce3df; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--green); }
input[type="range"]::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; appearance: none; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px rgba(14,101,53,.28), 0 2px 5px rgba(24,33,29,.2); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px rgba(14,101,53,.28); }
.toggle-row { margin-top: 18px; padding: 13px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border-light); }
.toggle-row > div { display: grid; }
.toggle-row strong { color: #3f4b45; font-size: .76rem; }
.toggle-row span { color: var(--muted); font-size: .68rem; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: #cbd5cf; transition: .2s ease; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s ease; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
.advanced { margin-top: 14px; border-top: 1px solid var(--border-light); }
.advanced summary { padding: 13px 0 5px; color: var(--muted); font-size: .73rem; font-weight: 800; cursor: pointer; }
.advanced-body { padding-top: 9px; display: grid; gap: 14px; }

.canvas-column { min-width: 0; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; background: #edf1ef; }
.ai-command-bar {
  min-height: 78px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: minmax(170px,1fr) auto minmax(210px,1.15fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #c8e1d1;
  background: #f4fbf7;
}
.ai-command-title { min-width: 0; display: flex; align-items: center; gap: 9px; }
.ai-command-title > span:last-child { min-width: 0; display: grid; gap: 1px; }
.ai-command-title strong { color: var(--ink-strong); font-size: .81rem; line-height: 1.25; }
.ai-command-title small { color: var(--muted); font-size: .64rem; line-height: 1.35; }
.ai-command-mark { min-width: 31px; min-height: 27px; display: grid; place-items: center; border: 1px solid #acd2bb; border-radius: 5px; color: var(--green-dark); background: var(--surface); font-size: .66rem; font-weight: 950; }
.ai-auto-control { min-width: 112px; padding-left: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-left: 1px solid #cfe2d6; }
.ai-auto-control > span { display: grid; gap: 0; }
.ai-auto-control strong { color: #34443b; font-size: .69rem; }
.ai-auto-control small { color: var(--muted); font-size: .59rem; }
.ai-model-control { min-width: 0; display: grid; gap: 4px; color: #425048; font-size: .61rem; font-weight: 800; }
.ai-model-control select { min-height: 36px; padding-block: 6px; background: var(--surface); }
.ai-generate-btn { min-height: 38px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--green-dark); border-radius: 7px; color: #fff; background: var(--green-dark); font-size: .7rem; font-weight: 850; white-space: nowrap; }
.ai-generate-btn:hover { background: #084a26; }
.ai-progress { grid-column: 1 / -1; min-width: 0; padding-top: 2px; }
.ai-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #3d5145; font-size: .64rem; font-weight: 800; }
.ai-progress-head output { color: var(--green-dark); font-variant-numeric: tabular-nums; }
.ai-progress-track { height: 6px; margin-top: 5px; overflow: hidden; border-radius: 4px; background: #dce9e1; }
.ai-progress-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #54ad72); transition: width .2s ease; }
.canvas-toolbar { min-height: 54px; padding: 9px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border-light); background: var(--surface); }
.view-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface-muted); }
.view-tab { min-height: 31px; padding: 5px 11px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: .73rem; font-weight: 800; }
.view-tab.active { color: var(--ink-strong); background: var(--surface); box-shadow: 0 1px 4px rgba(24,33,29,.12); }
.canvas-actions { display: flex; align-items: center; gap: 4px; }
.canvas-actions .icon-btn { width: 32px; height: 32px; }
.zoom-value { min-width: 54px; height: 32px; padding: 0 7px; border: 0; color: var(--muted); background: transparent; font-size: .7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.canvas-stage {
  position: relative;
  min-width: 0;
  min-height: 510px;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  background-color: #e9eeeb;
  background-image: linear-gradient(#d9e0dc 1px, transparent 1px), linear-gradient(90deg, #d9e0dc 1px, transparent 1px);
  background-size: 24px 24px;
}
.canvas-stage.is-empty { min-height: 510px; cursor: pointer; }
.canvas-stage:not(.is-empty) { cursor: default; }
.canvas-stage.compare-enabled { touch-action: none; }
.canvas-stage.drag-active { outline: 3px solid rgba(23,132,71,.26); outline-offset: -3px; }
#previewCanvas { display: block; max-width: calc(100% - 38px); max-height: calc(100% - 38px); width: auto; height: auto; background: #fff; box-shadow: 0 16px 36px rgba(28,42,34,.18); transform-origin: center; transition: transform .18s ease; image-rendering: auto; }
.empty-upload { width: min(520px, calc(100% - 36px)); min-height: 300px; padding: 34px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border: 2px dashed #a9cbb7; border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.76); text-align: center; }
.empty-upload-icon { width: 48px; height: 48px; margin-bottom: 4px; display: grid; place-items: center; border-radius: 8px; color: var(--green-dark); background: var(--green-soft); }
.empty-upload-icon .icon { width: 25px; height: 25px; }
.empty-upload strong { color: var(--ink-strong); font-size: 1rem; }
.empty-upload > span:not(.empty-upload-icon) { max-width: 390px; color: var(--muted); font-size: .75rem; }
.empty-upload small { color: #6a766f; font-size: .64rem; }
.stage-upload-btn { margin-top: 6px; }
.processing { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink); background: rgba(244,247,245,.58); font-size: .76rem; font-weight: 800; backdrop-filter: blur(2px); }
.compare-divider { position: absolute; z-index: 6; width: 2px; min-height: 24px; transform: translateX(-1px); pointer-events: auto; touch-action: none; background: rgba(255,255,255,.96); box-shadow: 0 0 0 1px rgba(24,33,29,.25), 0 0 12px rgba(24,33,29,.2); cursor: ew-resize; }
.compare-handle { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; display: grid; place-items: center; transform: translate(-50%,-50%); border: 2px solid #fff; border-radius: 50%; color: #fff; background: var(--coral); box-shadow: 0 3px 12px rgba(24,33,29,.26); }
.compare-handle .icon { width: 18px; height: 18px; }
.spinner { width: 17px; height: 17px; border: 2px solid #c1cdc6; border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop-hint { position: absolute; inset: 18px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--green); border-radius: var(--radius); color: var(--green-dark); background: rgba(233,246,238,.93); }
.drop-hint .icon { width: 28px; height: 28px; }
.file-strip { min-height: 70px; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; border-top: 1px solid var(--border-light); background: var(--surface); }
.primary-btn, .download-btn { min-height: 42px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--green); border-radius: 7px; color: #fff; background: var(--green); font-size: .77rem; font-weight: 850; }
.primary-btn:hover, .download-btn:hover { border-color: var(--green-dark); background: var(--green-dark); }
.file-meta { min-width: 0; display: grid; gap: 1px; }
.file-meta strong, .file-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta strong { color: var(--ink-strong); font-size: .75rem; }
.file-meta span { color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.compare-btn { min-height: 32px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; color: #435047; background: var(--surface); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.compare-btn:hover, .compare-btn.active { color: var(--coral-dark); border-color: #dda7a3; background: var(--coral-soft); }
.network-hint { margin-top: 11px; padding: 10px 11px; display: grid; gap: 3px; border: 1px solid #e5b6b2; border-radius: 7px; color: var(--danger); background: var(--danger-soft); font-size: .67rem; line-height: 1.45; }
.network-hint strong { font-size: .7rem; }

.panel-tabs { margin: -20px -20px 0; padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border-light); }
.panel-tab { position: relative; min-height: 54px; border: 0; color: var(--muted); background: transparent; font-size: .76rem; font-weight: 850; }
.panel-tab.active { color: var(--ink-strong); }
.panel-tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--green); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: reveal .18s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.metric-grid label { display: grid; gap: 5px; color: #3f4b45; font-size: .69rem; font-weight: 750; }
.summary-rail { margin: 16px 0; border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
.summary-rail div { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border-light); }
.summary-rail div:last-child { border-bottom: 0; }
.summary-rail span { color: var(--muted); font-size: .7rem; }
.summary-rail strong { color: var(--ink-strong); text-align: right; font-size: .73rem; font-variant-numeric: tabular-nums; }
.field-stack { margin: 13px 0; display: block; }
.download-btn { width: 100%; margin-top: 15px; }
.micro-note { margin: 9px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.ai-privacy { margin-bottom: 14px; padding: 10px 11px; display: flex; align-items: flex-start; gap: 8px; border: 1px solid #c8e1d1; border-radius: 7px; color: #326247; background: var(--green-soft); font-size: .67rem; line-height: 1.45; }
.ai-privacy .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.local-ai-tool { margin: 0 0 17px; padding: 13px 0 16px; border-bottom: 1px solid var(--border-light); }
.local-ai-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.local-ai-heading > div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.local-ai-heading strong { color: var(--ink-strong); font-size: .76rem; }
.local-ai-mark { padding: 3px 5px; border: 1px solid #b8d9c3; border-radius: 4px; color: var(--green-dark); background: var(--green-soft); font-size: .58rem; font-weight: 900; letter-spacing: .04em; }
.local-ai-status { color: var(--green-dark); font-size: .64rem; font-weight: 800; white-space: nowrap; }
.local-ai-copy { margin: 8px 0 11px; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.ai-separation-note { margin: 0 0 11px; padding: 8px 10px; border-left: 3px solid var(--coral); color: #704944; background: var(--coral-soft); font-size: .65rem; line-height: 1.4; }
.local-ai-tool .field-stack { margin: 9px 0; }
.ai-detail-range { margin-top: 13px; }
.model-meta { margin: 12px 0 0; padding: 9px 10px; border-left: 3px solid var(--green); color: #415047; background: var(--surface-muted); font-size: .65rem; line-height: 1.45; }
.ai-network-settings { margin-top: 12px; }
.ai-divider { margin: 0 0 12px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .64rem; font-weight: 850; }
.ai-divider::before, .ai-divider::after { content: ""; height: 1px; flex: 1; background: var(--border-light); }
.remote-ai-settings { margin-top: 2px; border-top: 1px solid var(--border-light); }
.remote-ai-settings > summary { padding: 14px 0; color: #46534c; font-size: .7rem; font-weight: 850; cursor: pointer; }
.remote-ai-body { padding: 0 0 8px; }
.coral-btn { border-color: var(--coral); background: var(--coral); }
.coral-btn:hover { border-color: var(--coral-dark); background: var(--coral-dark); }

.trust-strip { margin-top: 14px; min-height: 78px; display: grid; grid-template-columns: repeat(3,1fr); align-items: stretch; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--surface); }
.trust-strip > div { min-width: 0; padding: 15px 20px; display: flex; align-items: center; gap: 11px; border-right: 1px solid var(--border-light); }
.trust-strip > div:last-child { border-right: 0; }
.trust-strip .icon { width: 20px; height: 20px; flex: none; color: var(--green); }
.trust-strip > div:nth-child(2) .icon { color: var(--coral); }
.trust-strip > div:nth-child(3) .icon { color: var(--amber); }
.trust-strip span { min-width: 0; display: grid; gap: 1px; }
.trust-strip strong { color: var(--ink-strong); font-size: .76rem; }
.trust-strip small { color: var(--muted); font-size: .67rem; }

.site-footer { border-top: 1px solid var(--border-light); background: var(--surface); }
.footer-inner { min-height: 70px; color: var(--muted); font-size: .74rem; }
.footer-inner a { color: var(--ink-strong); font-weight: 800; text-decoration: none; }
.footer-inner a:hover { color: var(--green-dark); text-decoration: underline; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); width: min(420px, calc(100% - 32px)); padding: 11px 14px; border: 1px solid #b9c8c0; border-radius: 7px; color: #fff; background: #26332c; box-shadow: 0 12px 28px rgba(12,21,16,.24); text-align: center; font-size: .75rem; font-weight: 750; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); border-color: var(--danger); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 276px minmax(390px,1fr); }
  .output-panel { grid-column: 1 / -1; border-top: 1px solid var(--border-light); border-left: 0; }
  .output-panel .tab-panel.active { grid-template-columns: minmax(0,1fr); }
  #exportPanel.active { display: grid; grid-template-columns: 180px minmax(240px,1fr) 230px; align-items: end; gap: 16px; }
  #exportPanel .panel-heading { grid-column: 1 / -1; margin-bottom: 0; }
  #exportPanel .summary-rail { margin: 0; }
  #exportPanel .field-stack { margin: 0; }
  #exportPanel .download-btn { margin-top: 8px; }
  #exportPanel .micro-note { grid-column: 3; }
  #aiPanel.active { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); gap: 0 18px; }
  #aiPanel .panel-heading { grid-column: 1 / -1; }
  #aiPanel .local-ai-tool { margin-bottom: 0; border-bottom: 0; }
  #aiPanel .remote-ai-settings { margin-top: 0; padding-left: 18px; border-top: 0; border-left: 1px solid var(--border-light); }
}

@media (max-width: 980px) {
  .ai-command-bar { grid-template-columns: minmax(0,1fr) auto; }
  .ai-model-control, .ai-generate-btn { grid-column: 1 / -1; }
  .ai-generate-btn { width: 100%; }
}

@media (max-width: 820px) {
  .header-inner, .footer-inner, main { width: min(100% - 28px, 720px); }
  main { padding-top: 23px; }
  .intro { grid-template-columns: 1fr; align-items: start; gap: 13px; }
  .intro h1 { font-size: 1.85rem; }
  .intro-status { min-width: 0; width: fit-content; }
  .workspace { grid-template-columns: 1fr; }
  .canvas-column { order: 1; }
  .controls-panel { order: 2; border-right: 0; border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
  .output-panel { order: 3; }
  .control-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px 20px; }
  .canvas-stage { min-height: 480px; }
  .output-panel { grid-column: auto; }
  #exportPanel.active, #aiPanel.active { display: block; }
  #aiPanel .local-ai-tool { margin-bottom: 17px; border-bottom: 1px solid var(--border-light); }
  #aiPanel .remote-ai-settings { padding-left: 0; border-left: 0; border-top: 1px solid var(--border-light); }
  .trust-strip { grid-template-columns: 1fr; }
  .trust-strip > div { border-right: 0; border-bottom: 1px solid var(--border-light); }
  .trust-strip > div:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .header-inner, .footer-inner, main { width: calc(100% - 20px); }
  .header-inner { min-height: 58px; }
  .brand-logo { width: 116px; }
  .local-badge { display: none; }
  .header-meta { gap: 8px; }
  main { padding: 20px 0 38px; }
  .intro { margin-bottom: 16px; }
  .intro h1 { font-size: 1.55rem; line-height: 1.15; }
  .intro p { font-size: .84rem; }
  .workspace { min-height: 0; }
  .panel { padding: 16px; }
  .panel-tabs { margin: -16px -16px 0; padding: 0 16px; }
  .preset-row { grid-template-columns: repeat(5,minmax(44px,1fr)); overflow-x: auto; }
  .control-list { grid-template-columns: 1fr; gap: 14px; }
  .canvas-toolbar { align-items: stretch; flex-direction: column; }
  .ai-command-bar { grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
  .ai-command-title { min-width: 0; }
  .ai-auto-control { min-width: 0; }
  .ai-model-control, .ai-generate-btn { grid-column: 1 / -1; }
  .ai-generate-btn { width: 100%; }
  .view-tabs { display: grid; grid-template-columns: repeat(3,1fr); }
  .view-tab { padding-inline: 5px; }
  .canvas-actions { align-self: flex-end; }
  .canvas-stage { min-height: 330px; }
  .canvas-stage.is-empty { min-height: 380px; }
  .empty-upload { min-height: 260px; padding: 24px 16px; }
  #previewCanvas { max-width: calc(100% - 22px); max-height: calc(100% - 22px); }
  .file-strip { grid-template-columns: auto minmax(0,1fr); }
  .primary-btn { width: 43px; padding: 0; }
  .primary-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .canvas-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { min-height: 78px; padding: 13px 0; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
