/* ── Oscilloscope — floating panel ───────────────────────────────────────── */
.osc-panel {
  display: none; flex-direction: column;
  position: absolute;
  bottom: 20px; left: 20px;
  width: 460px; height: 250px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  z-index: 100;
  overflow: hidden;
  resize: both;        /* native browser resize handle */
}
.osc-panel.open { display: flex; }

.osc-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  font-family: 'Roboto', sans-serif; font-size: 13px;
  cursor: grab; user-select: none;
}
.osc-title    { font-family: 'Roboto', sans-serif; font-weight: 700; font-size: 13px; color: var(--white); letter-spacing: 0.3px; white-space: nowrap; }
.osc-title::first-letter { color: var(--accent); }
.osc-sep      { color: var(--border); font-size: 13px; }
.osc-comp-lbl { color: var(--yellow); font-size: 13px; letter-spacing: 0.3px; white-space: nowrap; }
.osc-flex   { flex: 1; }
.osc-chk    { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text); font-size: 13px; white-space: nowrap; }
.osc-chk input { accent-color: var(--accent); cursor: pointer; }
.osc-probe-btn {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  color: var(--text-dim); cursor: pointer; font-size: 14px;
  width: 24px; height: 24px; line-height: 1; padding: 0; flex-shrink: 0;
  transition: all 0.15s;
}
.osc-probe-btn:hover        { border-color: var(--accent); color: var(--accent); }
.osc-probe-btn.probe-active { border-color: var(--yellow); color: var(--yellow); animation: probe-pulse 0.8s infinite; }

@keyframes probe-pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.osc-csv-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; font-size: 13px; padding: 3px 9px; letter-spacing: 0.3px;
  font-family: 'Roboto', sans-serif; transition: all 0.15s;
}
.osc-csv-btn:hover   { border-color: var(--accent); color: var(--accent); }
.osc-close-btn       { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 0 2px; transition: color 0.15s; }
.osc-close-btn:hover { color: var(--white); }

#osc-canvas, [id^="osc-cvs-"] { flex: 1; width: 100%; display: block; min-height: 0; }

/* ── Settings panel ──────────────────────────────────────────────────────── */

.osc-cfg {
  position: absolute; top: 36px; right: 8px; width: 252px; max-height: 380px;
  overflow-y: auto; background: var(--panel);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 8px 12px 12px; font-size: 13px; color: var(--text);
  font-family: 'Roboto', sans-serif; z-index: 30; display: none;
  box-shadow: var(--shadow-panel);
}
.osc-cfg.open { display: block; }

.osc-cfg-header {
  display: flex; justify-content: flex-end; margin-bottom: 2px;
}
.osc-cfg-close {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 15px; padding: 0 2px; line-height: 1;
  transition: color 0.15s;
}
.osc-cfg-close:hover { color: #fff; }

.osc-cfg-row { display: flex; align-items: center; gap: 7px; margin: 6px 0; min-height: 24px; }

.osc-cfg-sep {
  font-size: 13px; font-weight: 500; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.5px; border-top: 1px solid var(--border);
  margin: 10px 0 5px; padding-top: 7px;
}
.osc-cfg-sep:first-child { border-top: none; margin-top: 1px; }

.osc-cfg-lbl  { flex: 1; overflow: hidden; white-space: nowrap; }
.osc-cfg-unit { color: var(--text-dim); font-size: 13px; flex-shrink: 0; }
.osc-cfg-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.osc-cfg input[type=color] {
  width: 26px; height: 22px; padding: 0; cursor: pointer; flex-shrink: 0;
  border: 1px solid var(--border); background: none; border-radius: 5px;
}
.osc-cfg input[type=number],
.osc-cfg select {
  background: var(--surface); border: 1px solid var(--border);
  color: #fff; padding: 5px 8px; font-size: 13px; font-family: inherit; border-radius: var(--radius-sm);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.osc-cfg input[type=number]:focus,
.osc-cfg select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2); }
.osc-cfg input[type=number] { width: 60px; }
.osc-cfg select              { max-width: 100px; }
.osc-cfg select option       { background: var(--panel); color: #fff; }
.osc-cfg input[type=checkbox] { accent-color: var(--accent); flex-shrink: 0; width: 15px; height: 15px; }

.osc-cfg-btn {
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 14px; padding: 0 3px; line-height: 1; transition: color .15s;
}
.osc-cfg-btn:hover  { color: #fff; }
.osc-cfg-btn.active { color: var(--yellow); }
