: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;
  --iris11: #5753c6;
  --line: rgba(33, 32, 28, 0.09);
  --pill: #f0efee;
  --pill-fill: #dcdbd8;
  --ease: 250ms cubic-bezier(0.2, 0, 0, 1);
}

* { 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: #10262a;
}
#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.9);
  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:hover { color: var(--s11); }

.zoom-note {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(253, 253, 252, 0.9);
  border: 0.5px solid var(--line);
  color: var(--s11);
  font-size: 12px;
}
.zoom-note[hidden] { display: none; }

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

.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; 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; }

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

.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;
  z-index: 3;
}

.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 .swatch {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #101014;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}
.row input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

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

.btn {
  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 { background: var(--s4); border-color: var(--s8); }
.btn:active { background: var(--s5); }
.btn: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; }

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

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

@media (max-width: 760px) {
  .bar { height: auto; min-height: 44px; padding: 8px 10px; }
  .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;
  }
}
