/* lispshaders — dark, calm chrome so the shader supplies the color. */

:root {
  --bg: #0d1117;
  --panel: #141a23;
  --panel-edge: #232b38;
  --text: #d7dde6;
  --text-dim: #8b96a5;
  --clj-green: #63b132;
  --clj-blue: #5881d8;
  --error: #ff7a7a;
  --error-bg: #2a1518;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;
}

* { box-sizing: border-box; }

html, body, #app {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---- toolbar ---- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-edge);
}

.logo {
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-right: 8px;
  user-select: none;
}
.logo-lambda { color: var(--clj-green); }
.logo-name { color: var(--clj-blue); }

.example-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  padding: 5px 8px;
}

.control {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 13px;
  padding: 5px 10px;
  cursor: pointer;
}
.control:hover { border-color: var(--clj-blue); }

.stats {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- workspace ---- */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 46%) 1fr;
  min-height: 0;
}

.editor-pane {
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--panel-edge);
}
.editor-pane .cm-editor { height: 100%; font-size: 14px; }
.editor-pane .cm-scroller { font-family: var(--mono); line-height: 1.55; }

.right-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 58%;
  min-height: 220px;
  background: #000;
}

.shader-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- output tabs ---- */

.output {
  flex: 1 1 42%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--panel-edge);
  background: var(--panel);
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--panel-edge);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--clj-green);
  border-bottom-color: var(--clj-green);
}

.reference {
  overflow-y: auto;
  padding: 10px 16px 20px;
}
.reference h3 {
  color: var(--clj-blue);
  font-size: 13px;
  text-transform: lowercase;
  margin: 16px 0 6px;
}
.reference .entry {
  display: grid;
  grid-template-columns: minmax(220px, 42%) 1fr;
  gap: 10px;
  padding: 3px 0;
}
.reference .entry code { color: var(--clj-green); font-size: 12.5px; }
.reference .entry p { margin: 0; color: var(--text-dim); font-size: 12.5px; }

.code-panel {
  position: relative;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.code-panel pre {
  margin: 0;
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}
.code-panel .copy {
  position: sticky;
  top: 8px;
  float: right;
  margin-right: 12px;
}

/* ---- drones tab ---- */

.drones {
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
}

.drone-card {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drone-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.drone-name { color: var(--clj-green); font-weight: 700; }
.drone-meta { color: var(--text-dim); font-size: 11.5px; }

/* live level meter */
.level-track {
  height: 6px;
  border-radius: 3px;
  background: #0a0e14;
  overflow: hidden;
}
.level-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--clj-green);
  transition: width 60ms linear;
}

.drone-actions { display: flex; gap: 8px; }
.control.engaged {
  color: #0a0e14;
  background: var(--clj-green);
  border-color: var(--clj-green);
}

.drones-empty {
  overflow-y: auto;
  padding: 16px 20px;
  color: var(--text-dim);
  max-width: 60ch;
}
.drones-empty pre {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--clj-green);
  font-size: 12.5px;
  overflow-x: auto;
}
.drones-empty code { color: var(--clj-blue); }

.control.drone { border-color: var(--clj-green); }

/* ---- params tab (defparam knobs) ---- */

.params {
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
}

.param-card {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.param-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.param-name { color: var(--clj-blue); font-weight: 700; }
.param-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
}

.param-slider {
  width: 100%;
  accent-color: var(--clj-blue);
  cursor: pointer;
}

.param-range {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.params-empty {
  overflow-y: auto;
  padding: 16px 20px;
  color: var(--text-dim);
  max-width: 60ch;
}
.params-empty pre {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--clj-green);
  font-size: 12.5px;
  overflow-x: auto;
}
.params-empty code { color: var(--clj-blue); }

/* ---- recording ---- */

.control.recording {
  color: #ff5f56;
  border-color: #ff5f56;
  animation: rec-pulse 1.4s ease-in-out infinite;
}
@keyframes rec-pulse {
  50% { opacity: 0.55; }
}

/* ---- samples & images tabs ---- */

.media-panel {
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.media-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.control.upload { display: inline-block; }

.media-hint { color: var(--text-dim); font-size: 12.5px; max-width: 60ch; }
.media-hint code { color: var(--clj-green); }

.media-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
}

.media-card {
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.media-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: #0a0e14;
}

.media-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.media-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.media-name { color: var(--clj-green); font-weight: 700; }
.media-meta { color: var(--text-dim); font-size: 11.5px; }

.media-snippet {
  color: var(--clj-blue);
  font-size: 12px;
  user-select: all; /* one click selects the whole snippet for copying */
}

.media-remove { margin-left: auto; padding: 3px 8px; }

/* ---- status bar ---- */

.status {
  padding: 6px 14px;
  font-size: 12.5px;
  border-top: 1px solid var(--panel-edge);
  max-height: 30vh;
  overflow-y: auto;
}
.status.ok { color: var(--clj-green); background: var(--panel); }
.status.error { color: var(--error); background: var(--error-bg); }
.status pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--mono);
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .editor-pane { border-right: none; border-bottom: 1px solid var(--panel-edge); }
}
