:root {
  --bg: #0b0d11;
  --bg-2: #0f1218;
  --panel: #151920;
  --panel-2: #1a1f28;
  --panel-3: #202632;
  --line: #272e3a;
  --line-soft: #1f2530;
  --text: #ece8e0;
  --text-2: #b9b4aa;
  --muted: #7e8795;
  --muted-2: #5f6875;
  --accent: #e2a94e;
  --accent-2: #f2c675;
  --accent-deep: #c1852c;
  --accent-ink: #201505;
  --ok: #6fc08c;
  --warn: #e0a84e;
  --danger: #e27768;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 78% -10%, rgba(226, 169, 78, .075), transparent 65%),
    radial-gradient(700px 420px at 8% 108%, rgba(98, 120, 160, .07), transparent 60%),
    var(--bg);
}

[hidden] { display: none !important; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(226, 169, 78, .65);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* 顶栏 */
/* ------------------------------------------------------------------ */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 13, 17, .72);
  backdrop-filter: blur(14px);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #2a1b06;
  background: linear-gradient(150deg, #f3ca80, #d99a3c 58%, #b97a24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 18px rgba(226, 169, 78, .18);
  display: grid;
  place-items: center;
  padding: 6px;
}

.brand-mark svg { width: 100%; height: 100%; }

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .02em;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .015em;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(21, 25, 32, .8);
  color: var(--text-2);
  font-size: 11.5px;
  letter-spacing: .01em;
  white-space: nowrap;
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(126, 135, 149, .12);
}

.status-pill.ready .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(111, 192, 140, .14); animation: breathe 2.8s ease-in-out infinite; }
.status-pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(224, 168, 78, .14); }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(21, 25, 32, .6);
  color: var(--text-2);
  font-size: 12.5px;
  transition: border-color .16s, color .16s, background .16s;
  white-space: nowrap;
}

.ghost-btn:hover { border-color: #3b4453; color: var(--text); background: #1b2029; }
.ghost-btn svg { width: 15px; height: 15px; }
.ghost-btn:disabled { opacity: .4; cursor: default; }

/* ------------------------------------------------------------------ */
/* 主体布局 */
/* ------------------------------------------------------------------ */

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 20px 18px;
}

.sidebar {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #2c3441 transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c3441; border-radius: 999px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.card {
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(24, 28, 36, .92), rgba(20, 24, 31, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.card-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--text-2);
  text-transform: uppercase;
}

.mini {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .02em;
}

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .01em;
  transition: color .15s;
}

.text-btn:hover { color: var(--accent-2); }

.hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* 上传 */
/* ------------------------------------------------------------------ */

.upload-card { padding: 12px; }

.dropzone {
  position: relative;
  border: 1.5px dashed #333c4a;
  border-radius: 12px;
  background:
    radial-gradient(220px 120px at 50% 0%, rgba(226, 169, 78, .05), transparent 70%),
    rgba(10, 12, 16, .45);
  transition: border-color .18s, background .18s;
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragging {
  border-color: rgba(226, 169, 78, .72);
  background:
    radial-gradient(240px 140px at 50% 0%, rgba(226, 169, 78, .1), transparent 70%),
    rgba(12, 14, 19, .6);
}

.dz-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px 14px 20px;
  text-align: center;
}

.dz-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid #343d4c;
  background: linear-gradient(180deg, #212936, #181e28);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 5px;
}

.dz-icon svg { width: 20px; height: 20px; }

.dz-empty strong { font-size: 13px; font-weight: 550; }
.dz-empty span { font-size: 10.5px; color: var(--muted); letter-spacing: .015em; }

.dz-filled {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  min-height: 76px;
}

.dz-filled img {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid #333b48;
  flex: 0 0 auto;
}

.dz-meta { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.dz-meta strong {
  font-size: 12.5px;
  font-weight: 550;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.dz-meta span { font-size: 10.5px; color: var(--muted); font-family: "SF Mono", ui-monospace, Menlo, monospace; }

.dz-change {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(226, 169, 78, .3);
  background: rgba(226, 169, 78, .06);
  border-radius: 7px;
  padding: 4px 9px;
}

.upload-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 4px 0;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
}

.privacy-note svg { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ */
/* 模式 / 尺寸 / 滑杆 */
/* ------------------------------------------------------------------ */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: #0e1117;
  border: 1px solid var(--line-soft);
}

.segmented button {
  position: relative;
  border: 0;
  border-radius: 8px;
  padding: 8px 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: background .16s, color .16s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segmented button small {
  font-size: 9px;
  color: var(--accent);
  border: 1px solid rgba(226, 169, 78, .35);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 14px;
}

.segmented button.active {
  background: linear-gradient(180deg, #2a3240, #232a36);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 10px rgba(0, 0, 0, .2);
}

.segmented button.active small { color: var(--accent-2); }
.segmented button:disabled { opacity: .45; cursor: default; }

.field-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 0 6px;
}

.field-line label { font-size: 12px; color: var(--text-2); }

.num-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #0e1117;
  border: 1px solid var(--line);
}

.num-wrap:focus-within { border-color: rgba(226, 169, 78, .55); }

.num-wrap input {
  width: 68px;
  border: 0;
  background: transparent;
  text-align: right;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  padding: 2px 0;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.num-wrap input::-webkit-outer-spin-button,
.num-wrap input::-webkit-inner-spin-button { appearance: none; margin: 0; }

.num-wrap em { font-style: normal; font-size: 10.5px; color: var(--muted); }

.select-line { margin-top: 8px; }

select {
  max-width: 220px;
  appearance: none;
  border: 1px solid var(--line);
  background: #0e1117 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%237e8795' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 11px;
  padding: 7px 28px 7px 10px;
  cursor: pointer;
}

select:focus { border-color: rgba(226, 169, 78, .5); }

.readout {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #0e1117;
  border: 1px solid var(--line-soft);
}

.readout-main {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: var(--accent-2);
  letter-spacing: .01em;
}

.readout-sub { font-size: 10.5px; color: var(--muted); }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

.slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--fill, 0%), #2b323e var(--fill, 0%) 100%);
}

.slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #2b323e;
}

.slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #f6efe4;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  transition: transform .12s;
}

.slider:hover::-webkit-slider-thumb { transform: scale(1.12); }

.slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f6efe4;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}

.slider:disabled { opacity: .35; cursor: default; }

#widthRange { margin: 2px 0 8px; }

.slider-row { padding: 4px 0 5px; }
.slider-row + .slider-row { border-top: 1px solid rgba(39, 46, 58, .5); }

.slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.slider-label span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-2);
}

.slider-label i {
  font-style: normal;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--muted-2);
  color: var(--muted);
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  cursor: help;
}

.slider-label output {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--accent-2);
  min-width: 30px;
  text-align: right;
}

.slider-row.disabled { opacity: .38; pointer-events: none; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.presets button {
  border: 1px solid var(--line);
  background: #10141a;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11px;
  transition: all .15s;
}

.presets button:hover { color: var(--text-2); border-color: #3a4352; }

.presets button.active {
  color: var(--accent-2);
  border-color: rgba(226, 169, 78, .55);
  background: rgba(226, 169, 78, .09);
}

/* ------------------------------------------------------------------ */
/* 高级 */
/* ------------------------------------------------------------------ */

.advanced { padding: 0; overflow: hidden; }

.advanced summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.advanced summary::-webkit-details-marker { display: none; }
.advanced summary span { font-size: 12.5px; color: var(--text-2); font-weight: 600; letter-spacing: .04em; }
.advanced summary small { font-size: 10.5px; color: var(--muted); font-weight: 400; flex: 1 1 auto; }
.advanced summary svg { width: 14px; height: 14px; color: var(--muted); transition: transform .18s; }
.advanced[open] summary svg { transform: rotate(180deg); }

.advanced-body { padding: 0 16px 15px; border-top: 1px solid var(--line-soft); padding-top: 13px; }

.adv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.adv-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}

.adv-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1117;
  padding: 6px 9px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.adv-grid input:focus { border-color: rgba(226, 169, 78, .5); }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid #3a4352;
  background: #0e1117;
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}

.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #221605;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

/* ------------------------------------------------------------------ */
/* 预览舞台 */
/* ------------------------------------------------------------------ */

.stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #12161d, #0e1116);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stage-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 16, 21, .45);
}

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: #0a0d12;
  border: 1px solid var(--line-soft);
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 13px;
  font-size: 12px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.tabs button:hover { color: var(--text-2); }

.tabs button.active {
  background: #242b37;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset;
}

.light-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}

.light-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.light-controls input {
  width: 90px;
  height: 14px;
  appearance: none;
  background: transparent;
}

.light-controls input::-webkit-slider-runnable-track { height: 3px; border-radius: 999px; background: #2b323e; }
.light-controls input::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 0;
}
.light-controls input::-moz-range-track { height: 3px; background: #2b323e; border-radius: 999px; }
.light-controls input::-moz-range-thumb { width: 11px; height: 11px; background: var(--accent-2); border: 0; border-radius: 50%; }

.stage-state {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted-2);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  white-space: nowrap;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 14px;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, #191f28 0%, #0b0e13 68%, #080a0e 100%);
  border: 1px solid rgba(39, 46, 58, .55);
}

.canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 50% 50%, #000 40%, transparent 78%);
}

#previewCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.empty-art {
  width: 88px;
  height: 88px;
  color: #677183;
  margin-bottom: 12px;
  opacity: .9;
}

.empty-art svg { width: 100%; height: 100%; }

.empty-state h3 {
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 550;
  letter-spacing: .01em;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}

.empty-actions { display: flex; gap: 9px; }

.busy-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(8, 10, 14, .68);
  backdrop-filter: blur(3px);
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: .03em;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(226, 169, 78, .18);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.busy-line {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0;
  transition: opacity .2s;
}

.canvas-wrap.is-busy .busy-line {
  opacity: 1;
  animation: scan 1.1s ease-in-out infinite;
}

@keyframes scan {
  0% { width: 0; transform: translateX(0); }
  50% { width: 55%; transform: translateX(35%); }
  100% { width: 0; transform: translateX(100%); }
}

.stage-foot {
  flex: 0 0 auto;
  padding: 0 18px 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.metrics div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.metrics span {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metrics strong {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warnings {
  list-style: none;
  margin: 0 0 10px;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(224, 168, 78, .055);
  border: 1px solid rgba(224, 168, 78, .17);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.warnings li {
  position: relative;
  padding-left: 12px;
  font-size: 10.5px;
  line-height: 1.55;
  color: #d8b77e;
}

.warnings li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warn);
}

.actionbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(12, 15, 20, .55);
}

.save-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.save-label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.save-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: linear-gradient(180deg, #f2c675, #dfa343 60%, #d39636);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .02em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 6px 16px rgba(203, 148, 55, .16);
  transition: filter .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}

.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .34; cursor: default; box-shadow: none; filter: none; }
.primary-btn.alt {
  background: linear-gradient(180deg, #323b4a, #262e3a);
  color: #e6e1d7;
  border-color: #3d4656;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}

.primary-btn.loading { opacity: .6; pointer-events: none; }

/* ------------------------------------------------------------------ */
/* 弹窗 / 提示 */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 7, 10, .72);
  backdrop-filter: blur(6px);
  animation: fadeIn .16s ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(680px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #181c24, #12161d);
  border: 1px solid #2d3542;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: popIn .2s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: thin;
  scrollbar-color: #3a4352 transparent;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  background: linear-gradient(180deg, #181c24 70%, rgba(24, 28, 36, .85));
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .02em; }

.icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a1f28;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  transition: color .15s, border-color .15s;
}

.icon-btn:hover { color: var(--text); border-color: #3d4656; }

.modal-body { padding: 16px 22px 24px; }

.modal-body h3 {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--accent);
  text-transform: uppercase;
}

.modal-body h3:first-child { margin-top: 2px; }

.steps {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps li { font-size: 12.5px; color: var(--text-2); line-height: 1.65; }
.steps li strong { color: var(--text); margin-right: 7px; }
.steps li span { color: var(--muted); }

.tips {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips li {
  position: relative;
  padding-left: 13px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .65em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4b5668;
}

.tips strong, .tips b { color: var(--text-2); font-weight: 600; }

.modal-p { font-size: 12px; line-height: 1.75; color: var(--muted); margin: 0; }
.modal-p b { color: var(--text-2); }

.modal-note {
  margin-top: 18px;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0e1117;
  font-size: 11.5px;
  color: var(--muted);
}

code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: .92em;
  color: var(--accent-2);
  background: rgba(226, 169, 78, .07);
  border-radius: 4px;
  padding: 1px 5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  max-width: min(520px, calc(100vw - 40px));
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #3a4352;
  background: rgba(26, 31, 40, .96);
  color: var(--text);
  font-size: 12px;
  letter-spacing: .01em;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  transition: opacity .22s, transform .22s;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(226, 119, 104, .5); color: #f0b3a9; background: rgba(45, 24, 23, .97); }

/* ------------------------------------------------------------------ */
/* 响应式 */
/* ------------------------------------------------------------------ */

@media (max-width: 1080px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px;
  }
  .sidebar { overflow: visible; padding-right: 0; }
  .stage { min-height: 76vh; }
  .canvas-wrap { min-height: 46vh; }
}

@media (max-width: 640px) {
  .topbar { padding: 12px 14px; }
  .brand-text p { display: none; }
  .brand-text h1 { font-size: 15px; }
  .status-pill { display: none; }
  .workspace { padding: 10px; gap: 10px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .actionbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .actions { justify-content: stretch; }
  .actions .primary-btn { flex: 1 1 0; }
  .save-info { display: none; }
  .stage-head { flex-wrap: wrap; gap: 8px; }
  .light-controls { order: 3; width: 100%; }
  .stage-state { display: none; }
}

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