:root {
  /* Radix Sand, light */
  --s1: #fdfdfc;
  --s2: #f9f9f8;
  --s3: #f1f0ef;
  --s4: #e9e8e6;
  --s5: #e2e1de;
  --s6: #dad9d6;
  --s7: #cfceca;
  --s8: #bcbbb5;
  --s9: #8d8d86;
  --s10: #82827c;
  --s11: #63635e;
  --s12: #21201c;
  --iris9: #5b5bd6;
  --iris11: #5753c6;
  --red11: #ce2c31;
  --line: rgba(33, 32, 28, 0.09);
  --pill: #f0efee;
  --pill-fill: #dcdbd8;
  --ease: 250ms cubic-bezier(0.2, 0, 0, 1);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--s1);
  color: var(--s12);
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

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

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 46px;
  padding: 0 12px 0 14px;
  border-bottom: 0.5px solid var(--line);
  flex: none;
}
.bar-l { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.bar-l h1 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.bar-r { display: flex; gap: 6px; }
.dim { color: var(--s11); font-size: 12px; white-space: nowrap; }

main { flex: 1; display: flex; min-height: 0; }

/* ---------------------------------------------------------------- 画布 */

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #ecebe8;
}
#view { display: block; width: 100%; height: 100%; }

.drop[hidden] { display: none; }
.drop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(250, 249, 249, 0.82);
  cursor: pointer;
}
.drop-hit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--s11);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color var(--ease);
}
.drop-ico {
  width: 44px;
  height: 44px;
  color: var(--s8);
  transition: color var(--ease);
}
.drop-hit:hover { color: var(--s12); }
.drop-hit:hover .drop-ico { color: var(--s10); }
.drop-sample {
  position: absolute;
  bottom: 18px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--s9);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color var(--ease);
}
.drop-sample[hidden] { display: none; }
.drop-sample:hover { color: var(--s11); }

.block[hidden] { display: none; }
.block {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(420px, calc(100% - 40px));
  padding: 18px 20px 16px;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  background: rgba(253, 253, 252, 0.97);
  box-shadow: 0 8px 30px rgba(33, 32, 28, 0.12);
}
.block p { margin: 0; font-size: 13px; }
.block .dim { font-size: 12px; line-height: 1.55; white-space: normal; }
.block-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.hint-bar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 10px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: rgba(253, 253, 252, 0.92);
  color: var(--s11);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hint-bar[hidden] { display: none; }
.hint-bar button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--s12);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------------------------------------------------------- 参数栏 */

.side {
  width: 300px;
  flex: none;
  border-left: 0.5px solid var(--line);
  background: var(--s2);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--s6) transparent;
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb {
  background: var(--s6);
  border: 2px solid var(--s2);
  border-radius: 8px;
}
.side::-webkit-scrollbar-thumb:hover { background: var(--s8); }
.side::-webkit-scrollbar-track { background: transparent; }

.grp { padding: 8px 14px 4px; border-bottom: 0.5px solid var(--line); }
.grp:last-child { border-bottom: 0; }

.grp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  margin-bottom: 6px;
  padding: 0 16px;
}
.grp-head h2 { margin: 0; font-size: 12px; font-weight: 600; color: var(--s12); letter-spacing: 0.02em; }
.grp-head .dim { color: var(--s10); }

/* 模型选择：平放 / 竖立 */

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  height: 32px;
  margin-bottom: 4px;
  padding: 2px;
  border-radius: 10px;
  background: var(--pill);
  box-shadow: inset 0 0 0 0.5px rgba(33, 32, 28, 0.05);
}
.seg-btn {
  border: 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--s11);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}
.seg-btn:hover { color: var(--s12); }
.seg-btn.on {
  background: var(--s1);
  color: var(--s12);
  box-shadow: 0 0.5px 1.5px rgba(33, 32, 28, 0.12);
}
.seg-btn:focus-visible { outline: 2px solid var(--iris11); outline-offset: 1px; }

/* 一条参数 = 一个胶囊 */

.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 10px;
  height: 32px;
  margin-bottom: 4px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--pill);
  box-shadow: inset 0 0 0 0.5px rgba(33, 32, 28, 0.05);
  overflow: hidden;
  cursor: ew-resize;
  transition: background var(--ease);
}
.row:last-child { margin-bottom: 6px; }
.row[hidden] { display: none; }
.row:hover { background: #ecebe9; }

/* 进度底：宽度跟着值走 */
.row .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--pct, 0%);
  background: var(--pill-fill);
  pointer-events: none;
}

.row .lbl {
  position: relative;
  font-size: 13px;
  color: var(--s12);
  white-space: nowrap;
  pointer-events: none;
}
.row .val {
  position: relative;
  min-width: 34px;
  padding: 1px 4px;
  margin-right: -4px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--s12);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  cursor: text;
  z-index: 3;
  transition: background var(--ease);
}
.row .val:hover { background: rgba(33, 32, 28, 0.07); }
.row .val input {
  width: 54px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
  outline: 0;
}

/* 滑杆铺满整条胶囊，透明，拖哪儿都行 */
.row input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 2;
}

.row:focus-within {
  box-shadow: inset 0 0 0 2px var(--iris11);
}

/* 颜色行 */
.row.color .swatch {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #101014;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.16);
}
.row.color input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

/* 开关行：文字在左，开关在右 */
.row.check { grid-template-columns: 1fr auto; }
.row.check .lbl { grid-column: 1; grid-row: 1; }
.row.check .switch { grid-column: 2; grid-row: 1; }
.row.check input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.row.check .switch {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--s6);
  transition: background var(--ease);
  pointer-events: none;
}
.row.check .switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.2);
  transition: transform var(--ease);
}
.row.check input:checked ~ .switch { background: var(--s12); }
.row.check input:checked ~ .switch::after { transform: translateX(14px); }

/* 采样行：拖行调目标帧数，条填满＝累积完成，重算重新开始 */
.row.stop {
  grid-template-columns: 1fr auto auto;
  cursor: ew-resize;
}
.row.stop .val { color: var(--s11); }

/* ---------------------------------------------------------------- 按钮 */

.btn, .btn-mini {
  height: 28px;
  padding: 0 11px;
  border: 0.5px solid var(--s6);
  border-radius: 8px;
  background: var(--s1);
  color: var(--s12);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.btn:hover, .btn-mini:hover { background: var(--s4); border-color: var(--s8); }
.btn:active, .btn-mini:active { background: var(--s5); }
.btn:focus-visible, .btn-mini:focus-visible {
  outline: 2px solid var(--iris11);
  outline-offset: 1px;
}
.btn-primary {
  background: var(--s12);
  border-color: var(--s12);
  color: #fff;
}
.btn-primary:hover { background: #3a3934; border-color: #3a3934; }
.btn-primary:active { background: #4a4944; }

.btn-mini {
  position: relative;
  z-index: 3;
  height: 24px;
  padding: 0 9px;
  margin-right: 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--s11);
}
.btn-mini:hover { background: rgba(33, 32, 28, 0.06); border-color: transparent; color: var(--s12); }

/* ---------------------------------------------------------------- 状态 */

.status {
  margin: 0;
  height: 28px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 0.5px solid var(--line);
  color: var(--s11);
  background: var(--s1);
  font-size: 12px;
  flex: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .side { width: 262px; }
  .grp { padding: 12px 10px 6px; }
  .row { height: 38px; padding: 0 12px; }
  .row .lbl, .row .val { font-size: 12px; }
  .bar { padding: 0 8px 0 10px; }
  .btn { padding: 0 8px; }
}

/* 窄到装不下左右分栏时（PS 面板里就是这种情况）：预览在上，参数在下 */
@media (max-width: 760px) {
  .bar { height: auto; min-height: 44px; padding: 8px 10px; }
  .bar-l { min-width: 0; }
  .bar-l h1 { white-space: nowrap; }
  .bar-l .dim { display: none; }
  .bar-r { flex-wrap: wrap; justify-content: flex-end; }
  main { flex-direction: column; }
  .stage { flex: 0 0 40vh; min-height: 180px; }
  .side {
    width: auto;
    flex: 1 1 auto;
    min-height: 0;
    border-left: 0;
    border-top: 0.5px solid var(--line);
    padding-top: 2px;
  }
  .block[hidden] { display: none; }
.block {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(420px, calc(100% - 40px));
  padding: 18px 20px 16px;
  border: 0.5px solid var(--line);
  border-radius: 14px;
  background: rgba(253, 253, 252, 0.97);
  box-shadow: 0 8px 30px rgba(33, 32, 28, 0.12);
}
.block p { margin: 0; font-size: 13px; }
.block .dim { font-size: 12px; line-height: 1.55; white-space: normal; }
.block-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.hint-bar { display: none; }
}
