@property --finish {
  syntax: '<color>';
  inherits: true;
  initial-value: #b8b8b8;
}

:root {
  --bg: #e9eaed;
  --stage-core: #f6f7f8;
  --panel: #ffffff;
  --well: #f0f1f3;
  --ink: #16181c;
  --muted: #5f6570;
  --faint: #9aa0aa;
  --line: #e3e5e9;
  --focus: #2e6bff;
  --match: #1f8a4c;
  --shadow: 0 1px 2px rgb(16 18 22 / .08), 0 0 0 1px rgb(16 18 22 / .04);

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Schibsted Grotesk", var(--font-ui);
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bar-h: 56px;
  --panel-w: 348px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --stage-core: #1b1d21;
    --panel: #16171a;
    --well: #222428;
    --ink: #eef0f3;
    --muted: #a3a8b1;
    --faint: #6c717b;
    --line: #2a2d32;
    --focus: #6d9bff;
    --match: #4cc17f;
    --shadow: 0 0 0 1px rgb(255 255 255 / .06);
    color-scheme: dark;
  }
  .mark { box-shadow: 0 0 0 1px rgb(255 255 255 / .22); }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: --finish .7s ease;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand h1 {
  margin: 0;
  font: 700 18px/1 var(--font-display);
  letter-spacing: .01em;
  white-space: nowrap;
}
.mark {
  align-self: center;
  width: 13px;
  height: 22px;
  border-radius: 4px;
  border: 3px solid var(--finish);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12), 0 0 0 1px rgb(0 0 0 / .08);
}
.tagline { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.notice {
  padding: 10px 20px;
  background: #fff4d6;
  color: #5a4300;
  border-bottom: 1px solid #f0dca0;
  font-size: 13px;
}
.notice code { font-family: var(--font-mono); font-size: 12px; background: rgb(0 0 0 / .06); padding: 1px 5px; border-radius: 4px; }

/* ---------- 布局 ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  height: calc(100vh - var(--bar-h));
  height: calc(100dvh - var(--bar-h));
}
body:has(.notice:not([hidden])) .app { height: calc(100dvh - var(--bar-h) - 42px); }

/* ---------- 舞台（预览） ---------- */
.stage {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
  background:
    radial-gradient(ellipse 48% 58% at 50% 46%,
      color-mix(in oklab, var(--finish) 38%, var(--stage-core)) 0%,
      color-mix(in oklab, var(--finish) 10%, var(--stage-core)) 42%,
      var(--bg) 100%);
}
.viewport {
  position: relative;
  min-height: 0;
  padding: 36px 32px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame { position: relative; flex: none; }
.frame canvas { display: block; width: 100%; height: 100%; }

.dropzone {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgb(255 255 255 / .92);
  text-align: center;
  border-radius: var(--dz-r, 24px);
}
.dropzone::before {
  content: "";
  position: absolute;
  inset: var(--dz-inset, 14px);
  border: 1.5px dashed rgb(255 255 255 / .28);
  border-radius: calc(var(--dz-r, 24px) - var(--dz-inset, 14px));
  transition: border-color .2s, background-color .2s;
}
.dropzone:hover::before,
.stage.dragging .dropzone::before { border-color: rgb(255 255 255 / .7); background: rgb(255 255 255 / .05); }
.dropzone:focus-visible { outline-offset: -6px; }
.dz-title { font: 600 clamp(15px, 2.2vw, 22px)/1.2 var(--font-ui); }
.dz-sub { font-size: 12px; color: rgb(255 255 255 / .55); padding: 0 12px; }

.spinner {
  position: absolute;
  left: 50%; top: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2.5px solid rgb(127 127 127 / .25);
  border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.info {
  margin: 0;
  padding: 0 24px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 1.5em;
}
.info .num { color: var(--ink); }
.info .ok { color: var(--match); }

.strip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 20px 14px;
  border-top: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
  background: color-mix(in oklab, var(--panel) 55%, transparent);
  backdrop-filter: blur(12px);
  min-width: 0;
}
.strip-list { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px; min-width: 0; scrollbar-width: thin; }
.thumb { position: relative; flex: none; }
.thumb-btn {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--well);
  overflow: hidden;
  box-shadow: var(--shadow);
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.thumb-btn img { display: block; height: 64px; width: auto; max-width: 140px; object-fit: cover; }
.thumb.is-current .thumb-btn { outline-color: var(--ink); }
.thumb-btn:focus-visible { outline-color: var(--focus); }
.thumb-x {
  position: absolute;
  top: -7px; right: -7px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--panel);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.thumb:hover .thumb-x, .thumb:focus-within .thumb-x { opacity: 1; }
.thumb-add {
  flex: none;
  width: 44px; height: 64px;
  border-radius: 8px;
  border: 1.5px dashed var(--faint);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}
.thumb-add:hover { border-color: var(--ink); color: var(--ink); }

.veil {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--ink);
  border-radius: 16px;
  background: color-mix(in oklab, var(--panel) 40%, transparent);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.veil span { background: var(--ink); color: var(--panel); padding: 8px 16px; border-radius: 999px; }
.stage.dragging.has-shots .veil { opacity: 1; }

/* ---------- 设置面板 ---------- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.panel-scroll { flex: 1; overflow-y: auto; padding: 4px 20px 12px; }
.group { padding: 18px 0; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.group-head h2 { margin: 0; }
.value { font-size: 13px; color: var(--ink); text-align: right; }
.value small { color: var(--faint); font-family: var(--font-display); font-size: 12px; margin-left: 6px; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--faint); }

input[type=radio], .switch input { position: absolute; opacity: 0; pointer-events: none; }

/* 系列 */
.families { display: grid; grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); gap: 4px; margin-bottom: 10px; }
.chip span {
  position: relative;
  display: grid;
  place-items: center;
  height: 30px;
  padding: 0 2px;
  border-radius: 8px;
  background: var(--well);
  font: 600 13px/1 var(--font-display);
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.chip:hover span { color: var(--ink); }
.chip input:checked + span { background: var(--ink); color: var(--panel); }
.chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip.has-match span::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--match);
}

/* 机型列表 */
.models { display: grid; gap: 2px; }
.model {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background-color .12s;
}
.model:hover { background: var(--well); }
.model:has(input:checked) { background: var(--well); box-shadow: inset 0 0 0 1.5px var(--ink); }
.model:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-name { font: 500 15px/1.25 var(--font-display); }
.model-name small { font-family: var(--font-ui); font-size: 12px; color: var(--muted); margin-left: 6px; }
.model-res { font: 12px/1 var(--font-mono); color: var(--faint); }
.model-meta { grid-column: 1 / -1; display: flex; gap: 8px; font-size: 11.5px; color: var(--faint); }
.model-meta .match { color: var(--match); font-weight: 500; }

/* 颜色 */
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch span {
  display: block;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .14), inset 0 -6px 10px rgb(0 0 0 / .08), inset 0 6px 8px rgb(255 255 255 / .25);
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color .15s, transform .15s;
}
.swatch:hover span { transform: scale(1.06); }
.swatch input:checked + span { outline-color: var(--ink); }
.swatch input:focus-visible + span { outline-color: var(--focus); }

/* 分段控件 */
.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--well);
}
.seg label { flex: 1; position: relative; }
.seg span {
  display: grid;
  place-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--panel); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg.compact span { height: 28px; padding: 0 12px; }

.row { display: flex; align-items: center; gap: 12px; min-height: 36px; margin-top: 10px; }
.group > .row:first-of-type { margin-top: 0; }
.group h2 + .row { margin-top: 0; }
.row .seg { flex: 1; }
.row-label { flex: none; width: 56px; font-size: 13px; color: var(--ink); }
.row input[type=range] { flex: 1; accent-color: var(--ink); }
.num { font: 12px var(--font-mono); color: var(--muted); min-width: 34px; text-align: right; }

/* 背景色 */
.bg-options { display: flex; align-items: center; gap: 10px; }
.bg-opt { position: relative; }
.bg-chip {
  display: block;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(127 127 127 / .35);
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.bg-chip.is-clear {
  background: repeating-conic-gradient(#d4d6da 0 25%, #fff 0 50%) 0 0 / 10px 10px;
}
.bg-opt input:checked + .bg-chip { outline-color: var(--ink); }
.bg-opt input:focus-visible + .bg-chip { outline-color: var(--focus); }
#bgCustom { width: 0; height: 0; padding: 0; border: 0; opacity: 0; position: absolute; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; position: relative; }
.track {
  flex: none;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--faint) 55%, transparent);
  position: relative;
  transition: background-color .2s;
}
.track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .25);
  transition: transform .2s;
}
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .switch input:checked + .track::after { background: var(--panel); }
}

/* 操作区 */
.actions {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  background: var(--panel);
}
.out-size { margin: 0; font: 12px var(--font-mono); color: var(--faint); }
.action-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 500;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { border-color: var(--faint); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.btn.primary:hover:not(:disabled) { background: color-mix(in oklab, var(--ink) 86%, var(--panel)); }
.btn.wide { width: 100%; }
.bar .btn { height: 34px; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--panel);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 介绍与常见问题 ---------- */
.about { background: var(--panel); border-top: 1px solid var(--line); }
.about-inner { max-width: 1080px; margin: 0 auto; padding: 72px 32px 40px; }
.about h2 { margin: 0 0 12px; font: 700 28px/1.3 var(--font-display); letter-spacing: -.005em; }
.lead { max-width: 660px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.steps {
  list-style: none;
  margin: 40px 0 64px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.steps li { padding: 20px 20px 22px; border-radius: 14px; background: var(--well); }
.step-n {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--panel);
  font: 500 12px/1 var(--font-mono);
}
.steps h3 { margin: 12px 0 6px; font-size: 15px; font-weight: 600; }
.steps p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }

.about-cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 64px; align-items: start; }
.about-label { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  font: 400 18px/1 var(--font-mono);
  color: var(--faint);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--muted); }
.faq details p { margin: -4px 0 16px; max-width: 560px; color: var(--muted); font-size: 13.5px; line-height: 1.8; }

.model-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.model-list strong { display: block; font: 500 14px/1.4 var(--font-display); }
.model-list span { font-size: 12.5px; color: var(--muted); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--faint);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  .tagline { display: none; }
  .bar { padding: 0 16px; }
  .app { display: block; height: auto; }
  body:has(.notice:not([hidden])) .app { height: auto; }
  .stage { height: 68svh; min-height: 420px; }
  .viewport { padding: 24px 16px 10px; }
  .strip { padding: 8px 16px 12px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { overflow: visible; padding: 0 16px; }
  .actions { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .about-inner { padding: 48px 16px 32px; }
  .about h2 { font-size: 22px; }
  .steps { grid-template-columns: 1fr; margin: 28px 0 44px; }
  .about-cols { grid-template-columns: 1fr; gap: 40px; }
  .foot { margin-top: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  body { transition: none; }
}
