/* Main stylesheet – Interfaces 2026 */

/* ── Reset & base ─────────────────────────────────────────────────────── */
body {
  font-family: sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  color: #222;
  background: #fafafa;
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 1.5rem;
}

header h1 {
  margin: 0;
  font-size: 1.4rem;
}

/* ── Navigation ───────────────────────────────────────────────────────── */
#main-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.4rem 1rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.nav-btn:hover {
  background: #f0f0f0;
}

.nav-btn.active {
  background: #222;
  color: #fff;
  border-color: #222;
}

/* ── Section switching ────────────────────────────────────────────────── */
/* All app sections are hidden by default; the active one is shown. */
.app-section {
  display: none;
}

.app-section.active {
  display: block;
}

/* ── Typography helpers ───────────────────────────────────────────────── */
.note {
  color: #666;
  font-style: italic;
  font-size: 0.9rem;
}

.api-links {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 1.5rem;
}

/* ── Landing page ─────────────────────────────────────────────────────── */
.landing-intro {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 720px;
}

.landing-features {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}

.landing-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  line-height: 1.55;
  font-size: 0.95rem;
}

.landing-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.landing-cta {
  font-size: 0.95rem;
  color: #444;
}

.nav-btn-inline {
  display: inline;
  padding: 0.2rem 0.6rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  vertical-align: baseline;
}

.nav-btn-inline:hover {
  background: #f0f0f0;
}

/* ── Database section ─────────────────────────────────────────────────── */
.db-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.db-header h2 {
  margin: 0;
}

.db-refresh-btn {
  padding: 0.3rem 0.8rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.db-refresh-btn:hover {
  background: #f0f0f0;
}

.db-intro {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #444;
  margin-bottom: 1rem;
  max-width: 720px;
}

.db-entity-desc {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  max-width: 680px;
}

.db-record-info {
  flex: 1;
  font-size: 0.9rem;
  color: #222;
}

.db-action-btn {
  padding: 0.2rem 0.55rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.db-action-btn:hover {
  background: #f0f0f0;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

input[type="text"],
select {
  padding: 0.35rem 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.95rem;
}

button[type="submit"] {
  padding: 0.35rem 0.8rem;
  border: 1px solid #555;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: #eee;
}

/* ── Lists ────────────────────────────────────────────────────────────── */
ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

li {
  padding: 0.3rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Upload progress ──────────────────────────────────────────────── */
input[type="file"] {
  font-size: 0.9rem;
  padding: 0.2rem 0;
}

#rawdata-upload-progress {
  display: none;
  width: 100%;
  height: 0.5rem;
  margin-bottom: 0.4rem;
  accent-color: #222;
}

#rawdata-upload-status {
  display: none;
  margin: 0 0 0.4rem;
}

/* ── Playground placeholders ──────────────────────────────────────────── */
.placeholder-panel {
  border: 1px dashed #bbb;
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
  color: #888;
}

.placeholder-panel h3 {
  margin-top: 0;
  color: #555;
}

/* ── Playground layout ────────────────────────────────────────────────── */

/*
 * The playground section overrides the narrow body max-width so all three
 * panels fit side-by-side on a standard desktop screen.
 */
#section-playground {
  /* Break out of the 900 px body column when active. */
  margin-left:  calc(-1 * max(0px, (100vw - 900px) / 2));
  margin-right: calc(-1 * max(0px, (100vw - 900px) / 2));
  padding: 0 1rem;
}

/* Top bar: heading + mode toggle in one row */
#playground-topbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

#playground-topbar h2 {
  margin: 0;
}

/* Mode toggle bar – now lives inside the datasource panel */
#playground-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pg-mode-label {
  font-size: 0.9rem;
  color: #555;
}

.pg-mode-btn {
  padding: 0.3rem 0.9rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.pg-mode-btn:hover {
  background: #f0f0f0;
}

.pg-mode-btn.pg-mode-active {
  background: #222;
  color: #fff;
  border-color: #222;
}

/* Main grid: editor left, output top-right, data-source bottom-right */
#playground-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.75rem;
  min-height: 520px;
}

#playground-js-editor {
  grid-column: 1;
  grid-row: 1 / 3;   /* spans both rows */
  display: flex;
  flex-direction: column;
}

#playground-p5-output {
  grid-column: 2;
  grid-row: 1;
  height: 90%;
}

/* Generic panel shell */
.pg-panel {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.75rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pg-panel h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #333;
}

/* Ace editor container */
#ace-editor {
  flex: 1;
  min-height: 340px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
}

/* Editor run/stop buttons */
.pg-editor-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Script persistence controls below the editor */
.pg-code-persist-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.pg-code-persist-controls select {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}

/* Hint line below the saved-scripts controls. */
.pg-persist-hint {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
}

/* Generic playground action button */
.pg-action-btn {
  padding: 0.35rem 0.9rem;
  border: 1px solid #555;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.pg-action-btn:hover:not(:disabled) {
  background: #eee;
}

.pg-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* p5 output iframe */
#pg-p5-frame {
  flex: 1;
  width: 100%;
  min-height: 280px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #111;
}

/* Three.js output canvas – same dimensions as the p5 iframe */
#pg-three-canvas {
  flex: 1;
  width: 100%;
  min-height: 280px;
  border: 1px solid #334;
  border-radius: 3px;
  background: #0d0d1a;
  display: block;
}

/* ── Output toolbar ───────────────────────────────────────────────────── */
/* Two-row toolbar: engine selector + sketch row on top, capability buttons right. */
.pg-output-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

/* Engine selector row */
.pg-engine-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pg-engine-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* Built-in sketch template row (hidden for Three.js engine) */
.pg-sketch-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

/* Three.js engine options panel – shown below the canvas when Three.js is active */
.pg-three-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

.pg-three-opt-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: #4a90d9;
  user-select: none;
}

.pg-sketch-select {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* Capability buttons pushed to the right of the toolbar. */
.pg-output-caps {
  margin-left: auto;
  display: flex;
  gap: 0.3rem;
}

/* Compact output capability buttons. */
.pg-output-btn {
  padding: 0.3rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: 3px;
}

/* Status line below the toolbar (above the iframe). */
.pg-output-status {
  font-size: 0.8rem;
  color: #555;
  min-height: 1.1rem;
  margin-bottom: 0.25rem;
  font-style: italic;
}

/* Data source panels */
.pg-db-row,
.pg-live-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

#pg-choreo-select {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.9rem;
}

/* Loaded choreo info table */
.pg-data-preview {
  font-size: 0.85rem;
  color: #444;
  overflow-y: auto;
  max-height: 120px;
}

.pg-preview-table {
  border-collapse: collapse;
  width: 100%;
}

.pg-preview-table th,
.pg-preview-table td {
  text-align: left;
  padding: 0.15rem 0.4rem;
  border-bottom: 1px solid #eee;
  font-weight: normal;
}

.pg-preview-table th {
  color: #888;
  width: 5rem;
}

/* Webcam container – anchors the absolutely-positioned pose canvas */
#pg-webcam-container {
  position: relative;
  display: block;
  width: 100%;
}

/* Webcam preview video */
#pg-webcam-preview {
  width: 100%;
  object-fit: cover;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #111;
  margin-top: 0.4rem;
  display: block;
}

/* Pose estimation canvas – overlaid exactly on the video element */
#pg-pose-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pg-webcam-status {
  font-size: 0.85rem;
}

/* ── Pose settings expandable panel (shared by webcam and video modes) ─── */

.pg-pose-settings {
  margin: 0.5rem 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
}

.pg-pose-settings-summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  padding: 0.35rem 0.6rem;
  user-select: none;
  list-style: none; /* hide default triangle in some browsers */
}

.pg-pose-settings-summary::-webkit-details-marker {
  display: none;
}

.pg-pose-settings-summary::before {
  content: "▶ ";
  font-size: 0.7rem;
  transition: transform 0.15s;
  display: inline-block;
}

details[open] > .pg-pose-settings-summary::before {
  transform: rotate(90deg);
}

.pg-pose-settings-body {
  padding: 0.4rem 0.75rem 0.6rem;
  border-top: 1px solid #eee;
}

.pg-pose-settings-body .note {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: #777;
}

.pg-pose-settings-hint {
  color: #856404;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

/* ── Video file data source ───────────────────────────────────────────── */

.pg-video-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pg-video-progress {
  width: 100%;
  height: 6px;
  margin: 0.3rem 0 0.4rem;
  border-radius: 3px;
  accent-color: #4a90d9;
}

.pg-video-status {
  font-size: 0.85rem;
  margin: 0 0 0.4rem;
}

.pg-video-save-row {
  border-top: 1px solid #e8e8e8;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

/* Video preview inside the source panel */
#pg-video-preview-container {
  width: 100%;
  margin-top: 0.4rem;
}

#pg-video-preview {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #111;
  display: block;
}

/* ── Data sink section ────────────────────────────────────────────────── */

.pg-sink-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 0.6rem 0;
}

#pg-sink-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.pg-sink-btn {
  padding: 0.25rem 0.75rem;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.pg-sink-btn:hover {
  background: #f0f0f0;
}

.pg-sink-btn.pg-sink-active {
  background: #444;
  color: #fff;
  border-color: #444;
}

.pg-sink-panel {
  margin-top: 0.4rem;
}

.pg-sink-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

/* Responsive: stack columns on narrow viewports */
@media (max-width: 700px) {
  #playground-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  #playground-js-editor {
    grid-column: 1;
    grid-row: 1;
  }

  #playground-p5-output {
    grid-column: 1;
    grid-row: 2;
  }

  #playground-datasource-panel {
    grid-column: 1;
    grid-row: 3;
  }
}

/* ── Data source control panel ─────────────────────────────────────────── */

#playground-datasource-panel {
  grid-column: 2;
  grid-row: 2;
}

/* Mode-bar is now inside the datasource panel – override topbar styles */
#playground-datasource-panel #playground-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

/* Source header: h3 + running indicator */
#pg-source-header h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Running indicator dot */
.pg-source-indicator {
  font-size: 1rem;
  line-height: 1;
}

.pg-indicator-on {
  color: #22aa44;
}

.pg-indicator-off {
  color: #999;
}

/* FPS slider row */
.pg-fps-row {
  align-items: center;
}

.pg-control-label {
  font-size: 0.85rem;
  color: #555;
  white-space: nowrap;
  min-width: 3.5rem;
}

.pg-fps-display {
  font-size: 0.85rem;
  color: #333;
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  text-align: right;
}

/* FPS range input */
#pg-fps-slider {
  flex: 1;
  min-width: 0;
  accent-color: #333;
  cursor: pointer;
}

/* Frame needle (scrubber) row */
.pg-needle-row {
  align-items: center;
}

/* Wrapper that stacks the range input and the trim overlay */
.pg-needle-track {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

#pg-frame-needle {
  flex: 1;
  min-width: 0;
  accent-color: #444;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

#pg-frame-needle:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Trim region highlight – absolutely covers the track, pointer-events off */
.pg-needle-trim-overlay {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  border-radius: 3px;
  z-index: 0;
}

/* Vertical tick marks for In / Out positions */
.pg-marker-tick {
  position: absolute;
  top: 10%;
  width: 2px;
  height: 80%;
  pointer-events: none;
  z-index: 2;
  border-radius: 1px;
  display: none;
}

.pg-marker-in-tick {
  background: #2980d9;
}

.pg-marker-out-tick {
  background: #d97c29;
}

/* ── Trim marker row ──────────────────────────────────────────────────────── */
.pg-trim-row {
  font-size: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pg-trim-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}

.pg-trim-display {
  font-variant-numeric: tabular-nums;
  color: #555;
  min-width: 2.5rem;
  text-align: center;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-size: 0.8rem;
}

.pg-trim-sep {
  color: #aaa;
  font-size: 0.85rem;
}

/* ── Trim export section inside DB sink ──────────────────────────────────── */
.pg-sink-trim-export {
  margin-top: 0.4rem;
}

/* ── Frame Inspector ─────────────────────────────────────────────────────── */
.pg-frame-inspector {
  margin-top: 0.6rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 0.85rem;
}

.pg-inspector-summary {
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: #444;
  background: #f8f8f8;
  border-radius: 4px;
  list-style: none; /* remove default triangle for custom look */
}

.pg-inspector-summary::before {
  content: "▶ ";
  font-size: 0.7rem;
  color: #888;
}

details[open] > .pg-inspector-summary::before {
  content: "▼ ";
}

.pg-inspector-body {
  padding: 0.5rem 0.6rem;
}

.pg-inspector-actions {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

/* Scrollable frame data table */
.pg-frame-data-table {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 3px;
}

.pg-insp-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.78rem;
}

.pg-insp-table th,
.pg-insp-table td {
  padding: 0.12rem 0.3rem;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}

.pg-insp-table th {
  background: #f5f5f5;
  color: #666;
  font-weight: normal;
  position: sticky;
  top: 0;
}

.pg-insp-idx {
  color: #999;
  font-variant-numeric: tabular-nums;
  min-width: 1.5rem;
}

.pg-insp-input {
  width: 5.5rem;
  padding: 0.1rem 0.2rem;
  border: 1px solid #ddd;
  border-radius: 2px;
  font-size: 0.75rem;
  font-family: monospace;
  font-variant-numeric: tabular-nums;
}

.pg-insp-input:focus {
  outline: 2px solid #4a90d9;
  border-color: #4a90d9;
}

.pg-insp-vis {
  width: 3.5rem;
}

.pg-frame-counter {
  font-size: 0.8rem;
  color: #555;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 5rem;
  text-align: right;
}

/* Playback buttons row */
.pg-playback-row {
  gap: 0.4rem;
}

/* Shared source footer */
.pg-source-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #eee;
  font-size: 0.8rem;
  color: #666;
}

.pg-footer-item {
  white-space: nowrap;
}

.pg-footer-item strong {
  font-variant-numeric: tabular-nums;
  color: #333;
}

/* WebSocket log */
.pg-ws-log {
  max-height: 80px;
  overflow-y: auto;
  font-size: 0.78rem;
  font-family: monospace;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.3rem;
  margin-bottom: 0.4rem;
}

.pg-ws-log-entry {
  border-bottom: 1px solid #eee;
  padding: 0.1rem 0;
  word-break: break-all;
}

.pg-ws-row,
.pg-ws-emit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.pg-ws-url-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: monospace;
}

.pg-ws-status {
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.4rem;
}


/* ── Frame Inspector – joint name column ─────────────────────────────────── */
.pg-insp-name {
  color: #555;
  font-size: 0.74rem;
  white-space: nowrap;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Curve View ──────────────────────────────────────────────────────────── */
.pg-curve-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pg-curve-select {
  padding: 0.25rem 0.4rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.82rem;
}

/* Each sub-chart canvas wrapper (position / velocity / acceleration) – 160 px each */
.pg-curve-canvas-wrap {
  position: relative;
  height: 160px;
  border: 1px solid #eee;
  border-radius: 3px;
  background: #fff;
}

.pg-curve-canvas-wrap canvas {
  display: block;
}

/* Container for each individual sub-chart with its label */
.pg-curve-sub {
  margin-bottom: 0.6rem;
}

.pg-curve-sub-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.2rem;
}

.pg-curve-status {
  margin-top: 0.3rem;
}

/* ── Popout system ───────────────────────────────────────────────────────────
   Styles for the floating panel produced by PlaygroundPopout (popout.js).
   The floating panel uses position:fixed so it stays on screen when the user
   scrolls.  A drop-shadow lifts it visually above the page content.
   z-index starts at 1000 and is raised by _bringToFront() on click.
*/

/* Pop-out toggle button inside panel headers and <summary> elements */
.pg-popout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.85rem;
  line-height: 1;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #f8f8f8;
  color: #555;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s;
}

.pg-popout-btn:hover {
  background: #e8e8e8;
  color: #222;
}

/* Invisible placeholder occupying the original grid position */
.pg-popout-placeholder {
  border: 2px dashed #ddd;
  border-radius: 6px;
  min-height: 2.5rem;
  background: #fafafa;
  opacity: 0.6;
}

/* The floating panel itself */
.pg-popout-panel {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 120px;
  /* Width and height are set dynamically by popout.js from the widget's
     rendered size, then adjusted by the CSS resize handle. */
  overflow: hidden;
  resize: both;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.10);
}

/* Scrollable content area below the title bar */
.pg-popout-content {
  flex: 1;
  overflow: auto;
  min-height: 0; /* allow flex shrinking */
}

/* Drag handle / title bar of the floating panel */
.pg-popout-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  background: #2b2b2b;
  color: #f0f0f0;
  border-radius: 5px 5px 0 0;
  cursor: grab;
  user-select: none;
}

.pg-popout-bar:active {
  cursor: grabbing;
}

.pg-popout-bar-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Dock button inside the floating panel title bar */
.pg-popout-dock-btn {
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid #888;
  border-radius: 3px;
  background: transparent;
  color: #e0e0e0;
  cursor: pointer;
  white-space: nowrap;
}

.pg-popout-dock-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* When a widget is inside a floating panel, remove outer margin and rounded
   borders that duplicate the panel's own styling */
.pg-popout-content .pg-frame-inspector,
.pg-popout-content .pg-panel {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
