/* HDL Design Bench — deliberately NOT Code IDE */

body.studio-hdl {
  --bg-deep: #06110f;
  --bg-base: #0a1815;
  --bg-raised: #10241f;
  --bg-hover: #16332c;
  --bg-active: #1e4037;
  --border: #1a3a32;
  --border-soft: rgba(94, 234, 212, 0.14);
  --text: #e8faf5;
  --text-dim: #8fbeb4;
  --text-mute: #5a8076;
  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.16);
  --accent-hot: #fbbf24;
  --ai: #7dd3fc;
  --radius: 3px;
  --titlebar-h: 46px;
  --activity-w: 54px;
  --sidebar-w: 240px;
  --ai-w: 300px;
  --bottom-h: 150px;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
}

body.studio-hdl .app {
  grid-template-rows: var(--titlebar-h) 42px 1fr var(--statusbar-h);
  background:
    linear-gradient(90deg, rgba(94, 234, 212, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(94, 234, 212, 0.03) 1px, transparent 1px),
    radial-gradient(800px 360px at 0% 0%, rgba(94, 234, 212, 0.14), transparent 55%),
    radial-gradient(600px 300px at 100% 10%, rgba(125, 211, 252, 0.08), transparent 50%),
    linear-gradient(180deg, #0c1c18 0%, var(--bg-deep) 50%, #030908 100%);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
}

/* ── Title / flow ───────────────────────────────────────── */
body.studio-hdl .titlebar {
  border-bottom: 1px solid rgba(94, 234, 212, 0.28);
  background: linear-gradient(180deg, #14352d, #0c1f1a);
  gap: 12px;
  padding: 0 10px 0 12px;
}

body.studio-hdl .hdl-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.06);
  white-space: nowrap;
}

body.studio-hdl .hdl-flow__arrow {
  color: var(--text-mute);
  letter-spacing: 0;
}

body.studio-hdl .brand-tag {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.5);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 3px 7px;
}

body.studio-hdl .menu-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 2px;
  padding: 7px 10px;
}

body.studio-hdl .menu-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Spawn rail (unique to HDL) ─────────────────────────── */
body.studio-hdl .hdl-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px dashed rgba(94, 234, 212, 0.22);
  background: rgba(6, 20, 17, 0.92);
  overflow-x: auto;
  scrollbar-width: thin;
}

body.studio-hdl .hdl-rail__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  flex-shrink: 0;
}

body.studio-hdl .hdl-chip {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.08);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

body.studio-hdl .hdl-chip:hover {
  background: rgba(94, 234, 212, 0.18);
  border-color: var(--accent);
  transform: translateY(-1px);
}

body.studio-hdl .hdl-chip--ghost {
  border-style: dashed;
  color: var(--text-dim);
}

body.studio-hdl .hdl-rail__sep {
  width: 1px;
  height: 18px;
  background: rgba(94, 234, 212, 0.25);
  flex-shrink: 0;
  margin: 0 4px;
}

body.studio-hdl .hdl-rail__hint {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}

/* ── Activity = pin strip ───────────────────────────────── */
body.studio-hdl .activity {
  border-right: 1px solid rgba(94, 234, 212, 0.2);
  background:
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 10px,
      rgba(94, 234, 212, 0.04) 10px,
      rgba(94, 234, 212, 0.04) 11px
    ),
    #081612;
}

body.studio-hdl .activity::before {
  content: "BENCH";
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--accent);
  padding: 12px 0 8px;
}

body.studio-hdl .activity__btn {
  border-radius: 2px;
  margin: 4px;
  width: calc(100% - 8px);
}

body.studio-hdl .activity__btn.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ── Modules browser ────────────────────────────────────── */
body.studio-hdl .sidebar {
  border-right: 1px solid rgba(94, 234, 212, 0.16);
  background: rgba(5, 16, 13, 0.88);
}

body.studio-hdl .sidebar__header {
  align-items: flex-start;
  border-bottom: 1px dashed rgba(94, 234, 212, 0.2);
  gap: 8px;
}

body.studio-hdl .sidebar__title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

body.studio-hdl .hdl-side-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
}

body.studio-hdl .tree-item.is-active {
  background: rgba(94, 234, 212, 0.12);
  border-radius: 2px;
}

/* ── Dual pane: RTL | Desk (always) ─────────────────────── */
body.studio-hdl .main {
  background: transparent;
  min-width: 0;
}

body.studio-hdl .hdl-pane-labels {
  display: none;
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1.15fr);
  gap: 0;
  padding: 0 10px;
  height: 22px;
  align-items: center;
  border-bottom: 1px solid rgba(94, 234, 212, 0.12);
  background: rgba(4, 14, 12, 0.9);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}

body.studio-hdl .main:has(.editor-row.has-preview) .hdl-pane-labels {
  display: grid;
}

body.studio-hdl .hdl-pane-labels span:last-child {
  color: var(--accent);
  padding-left: 12px;
  border-left: 1px solid rgba(94, 234, 212, 0.16);
}

body.studio-hdl .tabs {
  background: #071612;
  border-bottom: 1px solid rgba(94, 234, 212, 0.14);
  min-height: 32px;
}

body.studio-hdl .tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
}

body.studio-hdl .editor-row.has-preview {
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1.15fr) !important;
}

body.studio-hdl .preview {
  display: flex;
  flex-direction: column;
  order: 2;
  border-left: 1px solid rgba(94, 234, 212, 0.28);
  background:
    radial-gradient(rgba(94, 234, 212, 0.05) 1px, transparent 1px),
    #051411;
  background-size: 14px 14px, auto;
  min-width: 0;
}

body.studio-hdl .editor-shell {
  order: 1;
  background:
    linear-gradient(90deg, rgba(94, 234, 212, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(94, 234, 212, 0.025) 1px, transparent 1px),
    #0a1814;
  background-size: 22px 22px;
  border-right: 1px solid rgba(94, 234, 212, 0.08);
}

body.studio-hdl .editor-empty__brand {
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
}

body.studio-hdl .editor-empty__hint {
  max-width: 380px;
  line-height: 1.55;
}

body.studio-hdl .hdl-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

body.studio-hdl .preview__bar {
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.14), transparent 70%);
  border-bottom: 1px solid rgba(94, 234, 212, 0.2);
}

body.studio-hdl .preview__title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

body.studio-hdl .preview__title::before {
  content: "▣ ";
}

body.studio-hdl .preview-py {
  display: none !important;
}

/* Idle desk artwork */
body.studio-hdl .hdl-desk-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  text-align: center;
  color: var(--text-dim);
}

body.studio-hdl .hdl-desk-idle[hidden] {
  display: none !important;
}

body.studio-hdl .hdl-desk-idle__chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}

body.studio-hdl .hdl-desk-idle h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
}

body.studio-hdl .hdl-desk-idle p {
  max-width: 340px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-mute);
}

body.studio-hdl .hdl-desk-idle__mock {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

body.studio-hdl .hdl-pin {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-hot);
  padding: 4px 8px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 2px;
}

body.studio-hdl .hdl-block {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  padding: 18px 28px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(94, 234, 212, 0.06);
  box-shadow: 0 0 24px rgba(94, 234, 212, 0.12);
}

/* Elaboration log */
body.studio-hdl .bottom {
  border-top: 1px solid rgba(94, 234, 212, 0.18);
  background: #050f0d;
}

body.studio-hdl .bottom__tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Co-pilot */
body.studio-hdl .ai-panel {
  border-left: 1px solid rgba(94, 234, 212, 0.2);
  background:
    linear-gradient(180deg, rgba(94, 234, 212, 0.07), transparent 140px),
    #071814;
}

body.studio-hdl .ai-panel__header {
  border-bottom: 1px dashed rgba(94, 234, 212, 0.22);
}

body.studio-hdl .ai-panel__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

body.studio-hdl .ai-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

body.studio-hdl .ai-send {
  background: var(--accent);
  color: #04201a;
  border-radius: 2px;
}

body.studio-hdl .ai-msg--bot {
  border-left: 2px solid rgba(94, 234, 212, 0.4);
  border-radius: 0 6px 6px 0;
}

body.studio-hdl .hdl-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
}

body.studio-hdl .hdl-prompts button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px dashed rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.05);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

body.studio-hdl .hdl-prompts button:hover {
  border-style: solid;
  border-color: rgba(94, 234, 212, 0.55);
  color: var(--text);
  background: rgba(94, 234, 212, 0.1);
}

/* Status */
body.studio-hdl .statusbar {
  background: #040e0c;
  border-top: 1px solid rgba(94, 234, 212, 0.22);
  font-family: var(--font-mono);
  font-size: 11px;
}

body.studio-hdl .status-item--accent {
  color: var(--accent);
  letter-spacing: 0.06em;
}

body.studio-hdl .status-item--live .pulse {
  background: var(--accent);
}

body.studio-hdl .ctx-run {
  display: none;
}

/* Mobile / narrow */
@media (max-width: 1100px) {
  body.studio-hdl .hdl-flow {
    display: none;
  }

  body.studio-hdl .hdl-rail__hint {
    display: none;
  }
}

@media (max-width: 900px) {
  body.studio-hdl .app {
    grid-template-rows: var(--titlebar-h) 40px 1fr var(--statusbar-h);
  }

  body.studio-hdl .hdl-pane-labels {
    display: none;
  }

  body.studio-hdl .editor-row.has-preview {
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(0, 42%) minmax(0, 58%);
  }
}

@media (max-width: 640px) {
  body.studio-hdl .hdl-rail {
    gap: 6px;
    padding: 0 8px;
  }

  body.studio-hdl .hdl-rail__label {
    display: none;
  }
}
