:root {
  --bg-root: #090a0f;
  --bg-panel: #11131a;
  --bg-elevated: #171a24;
  --bg-hover: #1e2230;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f5fa;
  --text-muted: #98a2b3;
  --lime: #c4f135;
  --lime-text: #0b0e06;
  --violet: #7c5cff;
  --cyan: #22d3ee;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 14px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-root);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 5px;
}

/* TOP BAR */
.topbar {
  height: 56px;
  padding: 0 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--lime), #6ee7b7);
  color: var(--lime-text);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  letter-spacing: -0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.active-crumb {
  font-weight: 500;
  color: var(--text);
}

.stack-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 5px 10px;
  border-radius: 999px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.status-pill:hover {
  background: var(--bg-hover);
  border-color: var(--lime);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
}

.status-pill.connected .status-dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

/* SHELL */
.studio-shell {
  height: calc(100vh - 56px);
  display: flex;
}

/* LEFT NAV RAIL */
.nav-rail {
  width: 76px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 12px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.nav-item.active {
  color: var(--lime);
  background: rgba(196, 241, 53, 0.1);
  border-color: rgba(196, 241, 53, 0.35);
}

/* WORKSPACE & SCREENS */
.workspace {
  flex: 1;
  padding: 14px;
  overflow: hidden;
}

.screen {
  display: none;
  height: 100%;
}

.screen.active {
  display: block;
}

.split-2col {
  height: 100%;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
}

.workbench-3col {
  height: 100%;
  display: grid;
  grid-template-columns: 330px 1fr 310px;
  gap: 14px;
}

/* PANELS */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-header.wrap {
  flex-wrap: wrap;
}

.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 2px;
}

h2 {
  font-size: 17px;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  font-weight: 600;
}

.muted-small {
  font-size: 12px;
  color: var(--text-muted);
}

.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.chip.accent {
  color: var(--lime);
  border-color: rgba(196, 241, 53, 0.35);
  background: rgba(196, 241, 53, 0.08);
}

/* FORM CONTROLS */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.val-badge {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.input-select,
.input-text,
.input-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.input-select:focus,
.input-text:focus,
.input-textarea:focus {
  border-color: var(--violet);
}

.input-textarea {
  resize: vertical;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--violet);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.input-with-btn {
  display: flex;
  gap: 6px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.segmented.compact {
  grid-auto-columns: auto;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.seg-btn.active {
  background: var(--bg-hover);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* BUTTONS */
.btn-primary {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s, opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary.lime {
  background: var(--lime);
  color: var(--lime-text);
}

.btn-primary.violet {
  background: linear-gradient(135deg, #7c5cff, #a855f7);
  color: #ffffff;
}

.btn-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.launch-colab-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  border-color: rgba(124, 92, 255, 0.45);
  color: #ddd6fe;
}

.launch-colab-btn:hover {
  border-color: var(--violet);
}

.pill-btn {
  border: 1px solid rgba(196, 241, 53, 0.35);
  background: rgba(196, 241, 53, 0.1);
  color: var(--lime);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.full {
  width: 100%;
}

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

.btn-row.wrap {
  flex-wrap: wrap;
}

.btn-row.end {
  justify-content: flex-end;
}

.stack-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}

.toggle-row strong {
  display: block;
  font-size: 12px;
}

.toggle-row span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--lime);
}

/* DROPZONES */
.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.compact {
  padding: 11px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--lime);
  background: rgba(196, 241, 53, 0.05);
}

.drop-copy strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.drop-copy span {
  font-size: 11px;
  color: var(--text-muted);
}

.drop-thumb {
  max-height: 110px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: contain;
}

/* IMAGE PREVIEW & STRIP */
.preview-panel {
  overflow: hidden;
}

.status-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.canvas-stage {
  flex: 1;
  min-height: 260px;
  background: radial-gradient(circle at center, #181c28 0%, #0b0d13 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.canvas-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.stage-placeholder {
  text-align: center;
  max-width: 400px;
  padding: 20px;
  color: var(--text-muted);
}

.strip-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.thumb-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.thumb-card {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.thumb-card.active {
  border-color: var(--lime);
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3D VIEWPORT PANEL */
.viewport-panel {
  padding: 0;
  position: relative;
  overflow: hidden;
  background: #0c0e14;
}

.viewport-canvas-wrap {
  width: 100%;
  height: 100%;
}

.viewport-hud-top {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.hud-hint {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(9, 10, 15, 0.72);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.vp-toolbar {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vp-tool {
  background: rgba(17, 19, 26, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.vp-tool:hover {
  color: var(--text);
}

.vp-tool.active {
  color: var(--lime);
  border-color: rgba(196, 241, 53, 0.45);
}

.vp-swatches {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 19, 26, 0.85);
  border: 1px solid var(--border);
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.swatch.active {
  border-color: var(--lime);
  transform: scale(1.15);
}

/* INSPECTOR STATS */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.stat-card span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.stat-card strong {
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}

.stat-card strong.ok {
  color: var(--ok);
}

.divider {
  height: 1px;
  background: var(--border);
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  cursor: pointer;
}

.asset-row:hover {
  border-color: var(--lime);
}

/* BLENDER SCENE COMPOSER */
.bl-assets-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bl-asset-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bl-asset-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.code-box {
  flex: 1;
  background: #0b0d13;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #a5f3fc;
  overflow: auto;
  white-space: pre-wrap;
}

.qa-pair {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
}

.qa-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
}

.qa-card span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.qa-mock {
  flex: 1;
  border-radius: 6px;
  background: linear-gradient(145deg, #1b2030, #10131c);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* VLOG SHOT CARDS & PHONE PREVIEW */
.shots-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shot-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

.shot-card.active {
  border-color: var(--lime);
}

.shot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phone-frame {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 360px;
}

.phone-screen {
  width: 215px;
  height: 382px;
  border-radius: 26px;
  border: 4px solid #262b3b;
  background: linear-gradient(170deg, #1d2238 0%, #0d1018 70%, #241935 100%);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.phone-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lime);
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 8px;
  border-radius: 999px;
  align-self: flex-start;
}

.phone-era-title {
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.phone-caption {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  text-align: center;
  font-weight: 600;
}

.sfx-pill {
  font-size: 11px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 7px 10px;
  border-radius: 8px;
}

/* ASSETS GALLERY */
.assets-full {
  height: 100%;
}

.search-box {
  width: 210px;
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.gallery-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-thumb {
  height: 145px;
  background: linear-gradient(135deg, #1b2030, #12151f);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-type {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(9, 10, 15, 0.78);
  color: var(--lime);
}

.gallery-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MODAL & TOASTS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal-card {
  width: min(480px, 92vw);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-status {
  font-size: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--lime);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  html, body {
    overflow: auto;
  }
  .studio-shell {
    height: auto;
    min-height: calc(100vh - 56px);
  }
  .split-2col,
  .workbench-3col {
    grid-template-columns: 1fr;
    height: auto;
  }
  .viewport-panel {
    min-height: 440px;
  }
}
