/* HoloLab UI — dark lab, no external fonts or assets. */

:root {
  --bg: #05070c;
  --bg-2: #0a0e16;
  --panel: #0d121c;
  --panel-2: #141b28;
  --line: #243044;
  --text: #e8f4ff;
  --muted: #7f8da3;
  --cyan: #5ce1ff;
  --cyan-2: #9af6ff;
  --cyan-dim: #1a6d80;
  --cyan-bg: rgba(92, 225, 255, 0.12);
  --blue: #4d7cff;
  --amber: #ffc14d;
  --pink: #ff6b8a;
  --green: #6ee7a8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Liberation Sans", sans-serif;
  font-size: 15px;
}

body {
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px 8px;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.tag {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan-2);
}

.pill-dim {
  color: var(--muted);
}

.pill-live {
  border-color: var(--cyan-dim);
  background: var(--cyan-bg);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 18px 10px;
  flex: 0 0 auto;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--cyan-dim);
  background: #182233;
}

.btn:focus-visible,
.select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.btn-on {
  border-color: var(--cyan-dim);
  background: var(--cyan-bg);
  color: var(--cyan-2);
}

.btn-ghost {
  background: transparent;
}

.btn-run {
  background: var(--cyan-bg);
  border-color: var(--cyan-dim);
  color: var(--cyan-2);
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.seg .btn {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
}

.seg .btn:last-child {
  border-right: 0;
}

.grow {
  flex: 1 1 auto;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  padding: 0 14px 14px;
  gap: 12px;
}

#view {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: #04060a;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#view-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hw-info,
.cam-hint {
  position: absolute;
  left: 14px;
  right: 14px;
  pointer-events: none;
}

.hw-info {
  bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(5, 7, 12, 0.72);
  border: 1px solid rgba(92, 225, 255, 0.18);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  max-width: 520px;
}

.hw-info strong {
  color: var(--cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.cam-hint {
  top: 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side {
  flex: 0 0 360px;
  width: 360px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.side h2 {
  margin: 0;
  padding: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.panel[hidden] {
  display: none !important;
}

.panel-pad {
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}

.editor-wrap {
  flex: 1 1 auto;
  min-height: 140px;
  display: flex;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #080c14;
}

.gutter {
  margin: 0;
  padding: 10px 8px 10px 10px;
  width: 2.2em;
  text-align: right;
  color: #455166;
  font-family: Consolas, "Cascadia Mono", "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  user-select: none;
  overflow: hidden;
}

#editor {
  flex: 1 1 auto;
  width: 100%;
  resize: none;
  border: 0;
  margin: 0;
  padding: 10px 12px 10px 6px;
  background: transparent;
  color: #d6f7ff;
  font-family: Consolas, "Cascadia Mono", "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.error-panel {
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--green);
  min-height: 2.4em;
  flex: 0 0 auto;
}

.error-panel.bad {
  color: var(--pink);
  background: rgba(255, 107, 138, 0.08);
}

.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.readout b {
  color: var(--cyan-2);
  font-weight: 600;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: -1px;
  box-shadow: 0 0 8px currentColor;
}

.chat {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 95%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.bubble-user {
  align-self: flex-end;
  background: #182233;
  border: 1px solid var(--line);
}

.bubble-ai {
  align-self: flex-start;
  background: var(--cyan-bg);
  border: 1px solid rgba(92, 225, 255, 0.25);
}

.bubble-sys {
  align-self: stretch;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
  background: none;
  border: 0;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}

#chat-input {
  width: 100%;
  resize: none;
  min-height: 58px;
  max-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080c14;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: flex-end;
  z-index: 20;
}

.drawer[hidden] {
  display: none !important;
}

.drawer-panel {
  width: min(480px, 100%);
  height: 100%;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.drawer-body {
  overflow: auto;
  padding: 16px 18px 32px;
  font-size: 14px;
  line-height: 1.55;
  color: #d5e4f2;
}

.drawer-body h3 {
  margin: 1.4em 0 0.4em;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}

.drawer-body p,
.drawer-body li {
  color: #c9d7e6;
}

.drawer-body code,
code {
  font-family: Consolas, "Cascadia Mono", "Liberation Mono", monospace;
  font-size: 0.92em;
  background: #141b28;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--cyan-2);
}

.drawer-body pre {
  background: #080c14;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  font-family: Consolas, "Cascadia Mono", "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #d6f7ff;
}

#webgl-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--pink);
  background: var(--bg);
  z-index: 5;
}

#webgl-error[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100%;
  }

  .stage {
    flex-direction: column;
    height: auto;
  }

  #view {
    min-height: 52vh;
    height: 52vh;
  }

  .side {
    flex: 1 1 auto;
    width: auto;
    min-height: 40vh;
  }
}

/* Glow slider (added for Daftlad) */
.glow-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-left: 8px; }
.glow-field input { width: 110px; accent-color: var(--cyan); }
