/* ==========================================================================
   Particle Studio — inspector controls, dock panels
   ========================================================================== */

/* ---------- shared form atoms ---------- */

.mini-select,
.field-select {
  height: 24px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-size: 11px;
  padding: 0 5px;
  outline: none;
  cursor: pointer;
}
.mini-select:hover,
.field-select:hover { border-color: #39445a; color: var(--text); }
.mini-select:focus,
.field-select:focus { border-color: var(--accent); }

input[type="number"],
input[type="text"] {
  height: 24px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 6px;
  outline: none;
  min-width: 0;
}
input[type="number"]:hover,
input[type="text"]:hover { border-color: #39445a; }
input[type="number"]:focus,
input[type="text"]:focus { border-color: var(--accent); background: #0c0f16; }
input[type=number]::-webkit-inner-spin-button { opacity: 0; }
input[type=number]:hover::-webkit-inner-spin-button { opacity: 0.4; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), #2a3242 var(--fill, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: #f0e4d0;
  border: 1px solid #9a7a45;
  transition: transform 0.1s;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #2a3242; }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%;
  background: #f0e4d0; border: 1px solid #9a7a45;
}

.switch {
  width: 26px;
  height: 14px;
  border-radius: 10px;
  background: #2a3242;
  border: 1px solid #333c4e;
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background 0.14s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7c879c;
  transition: transform 0.14s, background 0.14s;
}
.switch.is-on { background: rgba(232, 163, 61, 0.28); border-color: rgba(232, 163, 61, 0.45); }
.switch.is-on::after { transform: translateX(12px); background: var(--accent); }

/* ---------- inspector ---------- */

.inspector {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 24px;
  min-height: 0;
}

.insp-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.insp-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.insp-title-row svg { width: 14px; height: 14px; color: var(--accent); flex: none; }
.insp-name {
  flex: 1;
  height: 24px !important;
  background: transparent !important;
  border-color: transparent !important;
  font-family: var(--font-ui) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  padding: 0 4px !important;
}
.insp-name:hover { border-color: var(--line) !important; background: var(--bg-0) !important; }
.insp-sub {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
  letter-spacing: 0.03em;
}
.insp-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .6; }

.insp-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.insp-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 26px;
}
.insp-field > span { font-size: 11px; color: var(--text-2); }
.insp-field input[type="number"] { width: 72px; text-align: right; }

/* ---------- module stack ---------- */

.stage-group { padding: 4px 8px 0; }
.group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 4px;
}
.group-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.group-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 0 4px;
}
.group-spacer { flex: 1; }
.group-add {
  height: 19px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px dashed #333c4e;
  background: transparent;
  color: var(--text-3);
  font-size: 10px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}
.stage-group:hover .group-add { opacity: 1; }
.group-add:hover { color: var(--accent); border-color: rgba(232, 163, 61, 0.5); }
.group-add svg { width: 10px; height: 10px; }

.module-card {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--bg-2);
  margin-bottom: 5px;
  overflow: hidden;
  transition: border-color 0.12s;
}
.module-card:hover { border-color: #2d3648; }
.module-card.is-off { opacity: 0.55; }
.module-card.is-off .mod-name { text-decoration: line-through; text-decoration-color: var(--text-3); }

.module-head {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 6px 0 3px;
  cursor: pointer;
}
.mod-twisty {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s;
}
.mod-twisty svg { width: 10px; height: 10px; }
.module-card.is-open .mod-twisty { transform: rotate(90deg); }
.mod-name {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mod-type {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 84px;
}
.mod-power {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #3a4457;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex: none;
  margin: 0 3px;
}
.mod-power.is-on { background: var(--accent); border-color: var(--accent); }
.mod-del {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.12s;
}
.module-card:hover .mod-del { opacity: 1; }
.mod-del:hover { color: var(--err); background: rgba(229, 101, 122, 0.1); }
.mod-del svg { width: 11px; height: 11px; }

.module-body {
  display: none;
  padding: 2px 8px 8px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 10, 15, 0.35);
}
.module-card.is-open .module-body { display: block; }

.param-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 2px 0;
}
.param-label {
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.param-control { display: flex; align-items: center; gap: 5px; min-width: 0; }
.param-control .num {
  width: 46px;
  text-align: right;
  flex: none;
}
.param-control .range { flex: 1; min-width: 40px; }

.vec-row { display: flex; gap: 4px; width: 100%; }
.vec-row .num { width: 100%; text-align: center; }
.vec-row .vtag {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-3);
  align-self: center;
  width: 8px;
  flex: none;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.color-swatch {
  width: 24px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #384155;
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
  flex: none;
}
.color-swatch input[type="color"] {
  position: absolute;
  inset: -4px;
  width: 140%;
  height: 140%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.color-hex {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.03em;
}

.curve-btn {
  height: 22px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-0);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}
.curve-btn:hover { border-color: rgba(232, 163, 61, 0.45); }
.curve-btn svg { width: 100%; height: 18px; overflow: visible; }
.curve-btn .cb-tag {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-3);
  flex: none;
}

/* inline gradient editor */
.grad-field {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-0);
  border-radius: 4px;
  padding: 4px 4px 3px;
}
.grad-bar {
  height: 12px;
  border-radius: 3px;
  border: 1px solid #2b3242;
}
.grad-stops {
  display: flex;
  justify-content: space-between;
  padding: 3px 0 0;
}
.grad-stop {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  flex: none;
}
.grad-stop input[type="color"] {
  position: absolute;
  inset: -4px;
  width: 200%;
  height: 200%;
  opacity: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.range-pair { display: flex; gap: 4px; width: 100%; }
.range-pair .num { width: 100%; text-align: center; }
.range-pair .rp-sep { color: var(--text-3); font-size: 9px; align-self: center; }

/* ---------- dock ---------- */

.dock {
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dock-tabs {
  height: 33px;
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  height: 100%;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.tab-badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--bg-3);
  color: var(--text-3);
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.tab-badge.has-issue { background: rgba(232, 163, 61, 0.18); color: var(--accent); }
.dock-spacer { flex: 1; }
.dock-meta {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
  margin-right: 8px;
}
.dock-collapse { align-self: center; }
.dock-collapse svg { transition: transform 0.16s; }
.app.dock-collapsed .dock-collapse svg { transform: rotate(180deg); }
.app.dock-collapsed .dock-body { display: none; }
.app.dock-collapsed .dock-tabs { border-bottom: 0; }

.dock-body {
  flex: 1;
  position: relative;
  min-height: 0;
}
.tab-pane {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}
.tab-pane.is-active { display: block; }

/* ---------- timeline ---------- */

.timeline-wrap {
  position: absolute;
  inset: 0;
  padding: 6px 10px 4px;
  display: flex;
  flex-direction: column;
}
#timeline-canvas { flex: 1; width: 100%; min-height: 0; cursor: ew-resize; }
.timeline-legend {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 20px;
  font-size: 9.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.lg { width: 10px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.lg-play { background: var(--accent); }
.lg-loop { background: rgba(108, 156, 245, 0.6); }
.tl-hint { margin-left: auto; font-family: var(--font-ui); opacity: 0.8; }

/* ---------- curve ---------- */

.curve-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 10px 4px;
}
.curve-toolbar {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.curve-target {
  font-size: 11px;
  color: var(--text-2);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.curve-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
#curve-canvas { flex: 1; width: 100%; min-height: 0; cursor: crosshair; }
.curve-foot {
  flex: none;
  height: 17px;
  font-size: 9.5px;
  color: var(--text-3);
  opacity: 0.8;
}

/* ---------- diagnostics ---------- */

.diag-list {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 6px 10px 14px;
}
.diag-item {
  display: grid;
  grid-template-columns: 14px 58px 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line-soft);
}
.diag-item:hover { background: var(--bg-2); }
.diag-sev { width: 7px; height: 7px; border-radius: 50%; justify-self: center; }
.diag-sev.error { background: var(--err); }
.diag-sev.warning { background: var(--warn); }
.diag-sev.info { background: var(--info); }
.diag-code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diag-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-loc {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
}
.diag-loc:hover { color: var(--accent); border-color: rgba(232, 163, 61, 0.4); }
.diag-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  color: var(--text-3);
  font-size: 11.5px;
}
.diag-empty .de-mark {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid #33405a; display: grid; place-items: center;
  color: var(--ok); font-size: 11px;
}

/* ---------- perf ---------- */

.perf-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) 1.6fr;
  gap: 1px;
  background: var(--line-soft);
  overflow: hidden;
}
.perf-cell {
  background: var(--bg-1);
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}
.perf-k {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}
.perf-v {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
}
.perf-v small { font-size: 9.5px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.perf-spark { position: relative; }
.perf-spark canvas { position: absolute; inset: 8px 10px; width: calc(100% - 20px); height: calc(100% - 16px); }
.perf-foot {
  position: absolute;
  right: 12px;
  bottom: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
}

/* ---------- empty inspector ---------- */

.insp-empty {
  padding: 40px 24px;
  text-align: left;
  color: var(--text-3);
}
.insp-empty h3 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.insp-empty p { margin: 0; font-size: 11.5px; line-height: 1.6; }

@media (max-width: 1040px) {
  .param-row { grid-template-columns: 74px minmax(0, 1fr); }
  .perf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .perf-spark { display: none; }
}
