/* ==========================================================================
   NEURAL STUDIO — Comprehensive Design System & Desktop Architecture
   Built by Opcelerate Neural Inc. · Sherwood Park, Alberta
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #07070a;
  --bg-translucent: rgba(7, 7, 10, 0.85);
  --s1: #0e0e13;
  --s2: #14141c;
  --s3: #1c1c28;
  --s4: #262636;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-bright: rgba(255, 255, 255, 0.28);
  --line-light: rgba(255, 255, 255, 0.22);
  
  --text: #f4f4f7;
  --text-muted: #9fa1ad;
  --text-dim: #6b6c7a;
  
  --copper: #e07a5f;
  --copper-hover: #eb8c73;
  --copper-bright: #f4a28a;
  --copper-ink: #1c0e09;
  --copper-glow: rgba(224, 122, 95, 0.28);

  --lime: #d1fe17;
  --lime-glow: rgba(209, 254, 23, 0.35);

  --mint: #38ef7d;
  --danger: #ff5c5c;
  --danger-bg: rgba(255, 92, 92, 0.12);

  /* AutoCAD Technical Palette */
  --cad-cyan: #00e5ff;
  --cad-cyan-dim: rgba(0, 229, 255, 0.15);
  --cad-cyan-line: rgba(0, 229, 255, 0.08);
  --cad-amber: #ffb300;

  --font-h: "Bebas Neue", Impact, -apple-system, sans-serif;
  --font-b: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", Menlo, Consolas, monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

img, video {
  max-width: 100%;
  display: block;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
}

button {
  cursor: pointer;
  user-select: none;
  transition: all 0.18s var(--ease);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--s3);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--s4);
}

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 100;
  transform: translateY(-180%);
  background: var(--s3);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: none;
}

/* Generic Buttons */
.ghost, .copper, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.ghost:hover {
  background: var(--s2);
  border-color: var(--line-strong);
}

.copper {
  background: var(--copper);
  color: var(--copper-ink);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--copper-glow);
}

.copper:hover {
  background: var(--copper-hover);
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.copper.lg, .ghost.lg {
  min-height: 48px;
  padding: 0 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.copper.sm, .ghost.sm, .danger-btn.sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.danger-btn {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(255, 92, 92, 0.25);
}

.danger-btn:hover {
  background: rgba(255, 92, 92, 0.25);
  border-color: var(--danger);
}

/* ==========================================================================
   HEADER & TOPBAR
   ========================================================================== */

.ns-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
  padding: 0 24px;
  background: var(--bg-translucent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.15s ease;
}

.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.brand:hover img {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(224, 122, 95, 0.4);
}

.brand span {
  font-family: var(--font-h);
  font-size: 22px;
  letter-spacing: 0.04em;
  line-height: 1;
}

.brand small {
  display: block;
  font-family: var(--font-b);
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--copper);
  margin-top: 2px;
}

/* Quick Model Switcher in Topbar */
.model-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--s2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.18s var(--ease);
}

.model-picker-btn:hover {
  background: var(--s3);
  border-color: var(--copper);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(224, 122, 95, 0.15);
}

.provider-tag {
  font-size: 10px;
  letter-spacing: 0.05em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--copper);
  background: rgba(224, 122, 95, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(224, 122, 95, 0.2);
}

.model-picker-btn b {
  font-weight: 600;
  color: var(--text);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-picker-btn .chevron {
  color: var(--text-dim);
  font-size: 11px;
}

/* Nav View Switcher Pills */
.ns-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.view-pills {
  display: flex;
  align-items: center;
  background: rgba(12, 12, 18, 0.85);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.view-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.18s var(--ease);
}

.view-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.view-pill.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 100%), var(--s3);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.badge-count {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--s4);
  color: var(--text-dim);
  margin-left: 4px;
}

.view-pill.active .badge-count {
  background: var(--copper);
  color: var(--copper-ink);
  box-shadow: 0 0 6px var(--copper-glow);
}

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

.lamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s ease;
}

.lamp i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #555;
  transition: all 0.2s ease;
}

.lamp[data-on="true"] i {
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime-glow);
  animation: lampPulse 3s infinite ease-in-out;
}

@keyframes lampPulse {
  0%, 100% { box-shadow: 0 0 6px var(--lime-glow); }
  50%      { box-shadow: 0 0 14px var(--lime-glow), 0 0 22px rgba(209, 254, 23, 0.3); }
}

.lamp[data-on="true"] {
  border-color: rgba(209, 254, 23, 0.25);
  color: var(--text);
}

/* ==========================================================================
   COVER / OVERVIEW VIEW
   ========================================================================== */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Switching Views */
body[data-view="cover"] #view-cover,
body[data-view="cover"] #cover-reel,
body[data-view="cover"] #cover-how {
  display: block;
}
body[data-view="cover"] #desk,
body[data-view="cover"] #view-gallery {
  display: none !important;
}

body[data-view="desk"] #desk {
  display: grid !important;
}
body[data-view="desk"] #view-cover,
body[data-view="desk"] #cover-reel,
body[data-view="desk"] #cover-how,
body[data-view="desk"] #view-gallery,
body[data-view="desk"] .ns-footer {
  display: none !important;
}

body[data-view="gallery"] #view-gallery {
  display: flex !important;
}
body[data-view="gallery"] #view-cover,
body[data-view="gallery"] #cover-reel,
body[data-view="gallery"] #cover-how,
body[data-view="gallery"] #desk {
  display: none !important;
}

/* Cover Hero */
.cover {
  position: relative;
  min-height: calc(100svh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 48px;
  padding: 64px 6% 80px;
  align-items: center;
  overflow: hidden;
}

.cover::before {
  content: "";
  position: absolute;
  inset: -15% 40% auto -10%;
  height: 65%;
  background: radial-gradient(circle, rgba(224, 122, 95, 0.08), transparent 60%);
  pointer-events: none;
  animation: coverGlow 8s ease-in-out infinite alternate;
}

@keyframes coverGlow {
  0% { opacity: 0.6; transform: translate(0, 0) scale(1); }
  100% { opacity: 1; transform: translate(3%, -2%) scale(1.08); }
}

.status-pill-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--s1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--copper);
  margin-bottom: 20px;
  animation: fadeInUp 0.6s var(--ease) both;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 6px var(--lime-glow);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.cover h1 {
  font-family: var(--font-h);
  font-size: clamp(52px, 7vw, 108px);
  line-height: 0.92;
  letter-spacing: 0.01em;
  margin-bottom: 24px;
  font-weight: 400;
  animation: fadeInUp 0.6s 0.1s var(--ease) both;
}

.cover h1 em {
  font-style: normal;
  color: var(--copper);
}

.lede {
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 36rem;
  margin-bottom: 36px;
  animation: fadeInUp 0.6s 0.2s var(--ease) both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 48px;
  animation: fadeInUp 0.6s 0.3s var(--ease) both;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.facts article {
  padding: 20px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(20, 20, 28, 0.7);
  backdrop-filter: blur(10px);
  transition: all 0.22s var(--ease);
}

.fact-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.facts h2 {
  font-family: var(--font-h);
  font-size: 20px;
  letter-spacing: 0.03em;
  font-weight: 400;
  margin-bottom: 6px;
  color: var(--text);
}

.facts p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.facts article:hover {
  border-color: var(--copper);
  background: rgba(20, 20, 28, 0.9);
  box-shadow: 0 8px 32px rgba(224, 122, 95, 0.08);
  transform: translateY(-3px);
}

.hero-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 520px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.75);
  background: #000;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.hero-stage:hover {
  border-color: rgba(224, 122, 95, 0.25);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.75), 0 0 60px rgba(224, 122, 95, 0.08);
}

.hero-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 7, 10, 0.1) 0%, rgba(7, 7, 10, 0.75) 100%);
  pointer-events: none;
}

.hero-badge {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.6));
  z-index: 2;
}

.hero-caption {
  position: absolute;
  left: 24px;
  bottom: 20px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  z-index: 2;
}

/* Reel & How Sections */
.reel, .how {
  padding: 40px 6% 80px;
  border-top: 1px solid var(--line);
}

.reel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.reel h2, .how h2 {
  font-family: var(--font-h);
  font-size: clamp(34px, 4vw, 56px);
  letter-spacing: 0.02em;
  font-weight: 400;
  margin-bottom: 8px;
}

.takes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.take {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.take img, .take video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

.take:hover img {
  transform: scale(1.04);
}

.take span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--font-h);
  font-size: 17px;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.steps article {
  padding: 28px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--s1);
  transition: all 0.22s var(--ease);
}

.steps article:hover {
  border-color: var(--line-strong);
  background: var(--s2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--copper);
  font-weight: 600;
  margin-bottom: 10px;
}

.steps h3 {
  font-family: var(--font-h);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.steps p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ==========================================================================
   2. THE DESK WORKSPACE
   ========================================================================== */

.desk {
  display: none;
  grid-template-columns: 250px minmax(0, 1fr) 270px;
  grid-template-rows: minmax(0, 1fr) auto;
  height: calc(100dvh - 64px);
  overflow: hidden;
  background: var(--bg);
}

/* LEFT SIDEBAR: JOBS & MODELS */
.jobs-sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(10, 10, 15, 0.95);
  height: 100%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.sidebar-header h2 {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

.browse-all-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--copper);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(224, 122, 95, 0.1);
  border: 1px solid rgba(224, 122, 95, 0.2);
  transition: all 0.18s var(--ease);
}

.browse-all-btn:hover {
  background: rgba(224, 122, 95, 0.2);
  border-color: var(--copper);
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.25);
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.job:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.job:hover .job-icon {
  transform: scale(1.2);
}

.job[aria-pressed="true"] {
  background: linear-gradient(90deg, rgba(224, 122, 95, 0.14) 0%, rgba(20, 20, 28, 0.85) 100%);
  border-color: rgba(224, 122, 95, 0.4);
  box-shadow: inset 3px 0 0 var(--copper), 0 0 16px rgba(224, 122, 95, 0.14);
}

.job-icon {
  font-size: 16px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.job-meta b {
  display: block;
  font-family: var(--font-h);
  font-size: 17px;
  letter-spacing: 0.03em;
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
}

.job-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
  margin-top: 2px;
}

.model-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--s3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.18s ease;
}

.job[aria-pressed="true"] .model-tag {
  background: rgba(224, 122, 95, 0.15);
  color: var(--copper-bright);
  border-color: rgba(224, 122, 95, 0.3);
}

/* Recipes Deck in Sidebar */
.recipes-deck {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.deck-header h3 {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

.deck-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--lime);
  background: rgba(209, 254, 23, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.recipe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipe-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--s2);
  border: 1px solid var(--line);
  color: var(--text-muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.18s var(--ease);
}

.recipe-chip:hover {
  background: var(--s3);
  color: var(--text);
  border-color: var(--copper);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.recipe-chip:active {
  transform: scale(0.92);
  background: rgba(224, 122, 95, 0.18);
  border-color: var(--copper);
}

/* CENTER CANVAS (THE STAGE) */
.stage-container {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  background: #040406;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
  z-index: 10;
}

.stage-ratio-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ratio-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--s3);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.model-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--copper);
  background: rgba(224, 122, 95, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--s2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.18s var(--ease);
}

.stage-tool-btn:hover {
  background: var(--s3);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.stage-tool-btn:active {
  transform: scale(0.95);
}

.stage-tool-btn.active,
.stage-tool-btn[data-active="true"] {
  background: var(--copper);
  color: var(--copper-ink);
  border-color: transparent;
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.35);
}

#toggle-measure-btn.active {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.12);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.3);
}

#toggle-trajectory-btn.active {
  color: #ff007f;
  border-color: rgba(255, 0, 127, 0.5);
  background: rgba(255, 0, 127, 0.12);
  box-shadow: 0 0 12px rgba(255, 0, 127, 0.3);
}

#toggle-cad-layers-btn.active {
  color: #38ef7d;
  border-color: rgba(56, 239, 125, 0.5);
  background: rgba(56, 239, 125, 0.12);
  box-shadow: 0 0 12px rgba(56, 239, 125, 0.3);
}

#stage-loop-btn.active,
#stage-loop-btn[data-active="true"] {
  color: var(--copper-bright);
  border-color: var(--copper);
  background: rgba(224, 122, 95, 0.15);
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.25);
}

.stage-viewport {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.frame {
  width: min(100%, 460px);
  aspect-ratio: var(--ratio, 9 / 16);
  max-height: calc(100% - 10px);
  background: #07070a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 0 0 2px rgba(255, 255, 255, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.85),
    0 0 100px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: aspect-ratio 0.25s var(--ease), box-shadow 0.4s ease, border-color 0.4s ease;
}

.frame:has(.cad-hud-overlay.active) {
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.3),
    0 0 0 2px rgba(0, 0, 0, 0.8),
    0 24px 64px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.25);
}

.frame.canvas-dragover {
  outline: 2px dashed #00e5ff !important;
  outline-offset: -6px;
  box-shadow:
    0 0 0 2px rgba(0, 229, 255, 0.6),
    0 0 35px rgba(0, 229, 255, 0.4) !important;
  border-color: #00e5ff !important;
}

.frame img, .frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ==============================================================================
   AUTOCAD TECHNICAL DRAFTING HUD & VIEWPORT ANIMATIONS
   ============================================================================== */

#toggle-cad-btn.active {
  color: var(--cad-cyan);
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.cad-hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cad-hud-overlay.active {
  opacity: 1;
}

/* 1. Precision Millimeter Orthogonal Grid */
.cad-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--cad-cyan-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--cad-cyan-line) 1px, transparent 1px),
    linear-gradient(to right, rgba(0, 229, 255, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 229, 255, 0.14) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  opacity: 0.85;
}

/* 2. Laser Scanline Animation */
.cad-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 229, 255, 0.2) 20%, var(--cad-cyan) 50%, rgba(0, 229, 255, 0.2) 80%, transparent 100%);
  box-shadow: 0 0 10px var(--cad-cyan), 0 0 20px rgba(0, 229, 255, 0.4);
  animation: cadLaserSweep 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes cadLaserSweep {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* 3. Corner Drafting Reticles */
.cad-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.cad-tl {
  top: 12px;
  left: 12px;
  border-top: 2px solid var(--cad-cyan);
  border-left: 2px solid var(--cad-cyan);
}

.cad-tr {
  top: 12px;
  right: 12px;
  border-top: 2px solid var(--cad-cyan);
  border-right: 2px solid var(--cad-cyan);
}

.cad-bl {
  bottom: 28px;
  left: 12px;
  border-bottom: 2px solid var(--cad-cyan);
  border-left: 2px solid var(--cad-cyan);
}

.cad-br {
  bottom: 28px;
  right: 12px;
  border-bottom: 2px solid var(--cad-cyan);
  border-right: 2px solid var(--cad-cyan);
}

/* 4. Dimension Leaders & Millimeter Tags */
.cad-dim {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--cad-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
  letter-spacing: 0.04em;
  background: rgba(5, 10, 16, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.cad-dim-x {
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
}

.cad-dim-y {
  left: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center center;
}

.cad-dim-arrow {
  font-size: 8px;
  color: var(--cad-cyan);
  opacity: 0.8;
}

/* 5. Center Reticle & Crosshair */
.cad-crosshair-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.cad-crosshair-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px dashed rgba(0, 229, 255, 0.35);
  animation: cadReticlePulse 3s ease-in-out infinite alternate;
}

@keyframes cadReticlePulse {
  0% { transform: scale(0.95); opacity: 0.6; }
  100% { transform: scale(1.05); opacity: 1; }
}

.cad-crosshair-h {
  position: absolute;
  top: 50%;
  left: -14px;
  right: -14px;
  height: 1px;
  background: rgba(0, 229, 255, 0.3);
}

.cad-crosshair-v {
  position: absolute;
  left: 50%;
  top: -14px;
  bottom: -14px;
  width: 1px;
  background: rgba(0, 229, 255, 0.3);
}

/* 6. Dynamic Cursor Reticle Tracker */
.cad-cursor-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease;
  opacity: 0.9;
}

.cad-cursor-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--cad-cyan);
  position: relative;
}

.cad-cursor-box::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: var(--cad-cyan);
  transform: translate(-50%, -50%);
}

.cad-cursor-coords {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--cad-cyan);
  background: rgba(5, 10, 16, 0.85);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  white-space: nowrap;
}

/* 7. Technical Header & Footer Status */
.cad-stamp-top {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(0, 229, 255, 0.8);
  background: rgba(5, 10, 16, 0.75);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  white-space: nowrap;
}

.cad-badge-dwg {
  color: var(--cad-cyan);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cad-stamp-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: rgba(5, 10, 16, 0.92);
  border-top: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(0, 229, 255, 0.75);
  letter-spacing: 0.03em;
}

.cad-status-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cad-live-coords {
  color: var(--cad-cyan);
  font-weight: 600;
}

/* 8. CAD Cinematography Chips */
.chip-cad {
  background: rgba(0, 229, 255, 0.08);
  color: var(--cad-cyan);
  border-color: rgba(0, 229, 255, 0.25);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chip-cad:hover {
  background: var(--cad-cyan);
  color: #03080d;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.45);
  transform: translateY(-2px);
}

/* --- PHASE 3: AUTOCAD LAYERS DOCK --- */
.cad-layers-dock {
  position: absolute;
  top: 42px;
  left: 14px;
  width: 200px;
  background: rgba(5, 10, 18, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 229, 255, 0.15);
  z-index: 25;
  pointer-events: auto;
  overflow: hidden;
  animation: cadDockSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cadDockSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cad-layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 229, 255, 0.08);
  border-bottom: 1px solid rgba(0, 229, 255, 0.2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--cad-cyan);
  letter-spacing: 0.06em;
}

.cad-dock-close {
  background: none;
  border: none;
  color: rgba(0, 229, 255, 0.6);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.cad-dock-close:hover {
  color: var(--cad-cyan);
}

.cad-layers-list {
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}

.cad-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.cad-layer-item:hover {
  background: rgba(0, 229, 255, 0.06);
  color: var(--text);
}

.cad-layer-item input[type="checkbox"] {
  accent-color: var(--cad-cyan);
  cursor: pointer;
}

.cad-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.cad-layer-name {
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* --- 3D CAMERA FRUSTUM & SENSOR OVERLAY --- */
.cad-frustum-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

.cad-frustum-svg {
  position: absolute;
  inset: 10%;
  width: 80%;
  height: 80%;
}

.frustum-cone {
  fill: rgba(255, 179, 71, 0.04);
  stroke: rgba(255, 179, 71, 0.4);
  stroke-width: 0.75;
  stroke-dasharray: 2 2;
}

.frustum-edge {
  stroke: rgba(255, 179, 71, 0.6);
  stroke-width: 1;
}

.frustum-axis {
  stroke: rgba(255, 179, 71, 0.35);
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
}

.frustum-nodal {
  fill: #ffb347;
  stroke: #fff;
  stroke-width: 0.5;
}

.frustum-sensor {
  fill: rgba(255, 179, 71, 0.2);
  stroke: #ffb347;
  stroke-width: 1;
}

.cad-frustum-info {
  position: absolute;
  top: 36px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #ffb347;
  background: rgba(5, 10, 16, 0.75);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 179, 71, 0.3);
  text-shadow: 0 0 6px rgba(255, 179, 71, 0.4);
}

.cad-focal-val {
  font-weight: 700;
}

/* --- ANIMATED MOTION TRAJECTORY LAYER --- */
.cad-trajectory-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

.cad-trajectory-svg {
  position: absolute;
  inset: 15%;
  width: 70%;
  height: 70%;
}

.cad-orbit-ring {
  fill: none;
  stroke: #ff007f;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  animation: cadMotionDash 12s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 0, 127, 0.6));
}

@keyframes cadMotionDash {
  to { stroke-dashoffset: -100; }
}

.cad-spline-path {
  fill: none;
  stroke: rgba(0, 229, 255, 0.4);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.cad-motion-node {
  fill: #ff007f;
  stroke: #fff;
  stroke-width: 1;
  filter: drop-shadow(0 0 8px #ff007f);
}

.cad-motion-arrow {
  fill: #ff007f;
}

.cad-trajectory-tag {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: #ff007f;
  background: rgba(5, 10, 16, 0.85);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 0, 127, 0.4);
  letter-spacing: 0.05em;
  text-shadow: 0 0 6px rgba(255, 0, 127, 0.5);
}

/* --- CALIPER MEASUREMENT LAYER --- */
.cad-measure-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.cad-measure-layer.measuring {
  pointer-events: auto;
  cursor: crosshair;
}

.cad-measure-svg {
  width: 100%;
  height: 100%;
}

.cad-measure-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid #ffd166;
  color: #ffd166;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.3);
  z-index: 30;
}

.cad-measure-banner button {
  background: #ffd166;
  color: #050a10;
  border: none;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

/* --- TOOLBAR BUTTON STATES (extended — primary rule at #toggle-cad-btn.active) --- */
.stage-tool-btn.active {
  color: var(--cad-cyan);
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

/* --- DIRECTOR TIMELINE & SCRUBBER DECK --- */
.stage-timeline-deck {
  margin-top: 10px;
  background: rgba(12, 14, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.timeline-transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.16s var(--ease);
}

.tl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.tl-btn:active {
  transform: scale(0.92);
}

.tl-play-btn {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--copper) 0%, var(--copper-bright) 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 10px rgba(224, 122, 95, 0.35);
}

.tl-play-btn:hover {
  background: linear-gradient(135deg, var(--copper-bright) 0%, #fbd5cb 100%);
  box-shadow: 0 0 16px rgba(224, 122, 95, 0.6);
  transform: scale(1.05);
  color: #1a0a05;
}

.tl-timecode {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cad-cyan);
  background: #040508;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  letter-spacing: 0.06em;
  margin-left: 4px;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

.tl-speed-select {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tl-speed-select:hover {
  border-color: var(--copper);
  background: rgba(255, 255, 255, 0.09);
}

.timeline-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.stage-audio-canvas {
  width: 100%;
  height: 22px;
  border-radius: 5px;
  background: rgba(4, 5, 8, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: block;
}

.timeline-scrubber-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  transition: height 0.15s ease;
}

.timeline-scrubber-track:hover {
  height: 10px;
}

.timeline-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--cad-cyan) 0%, var(--copper) 70%, var(--copper-bright) 100%);
  border-radius: 4px;
  transition: width 0.12s linear;
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.4);
}

.timeline-playhead {
  position: absolute;
  top: -4px;
  left: 0%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--copper);
  box-shadow: 0 0 10px var(--copper), 0 2px 4px rgba(0, 0, 0, 0.6);
  cursor: grab;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-playhead:hover {
  transform: scale(1.25);
  box-shadow: 0 0 16px var(--copper-bright), 0 2px 6px rgba(0, 0, 0, 0.8);
}

.timeline-partitions {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}

.tl-beat-pill {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-beat-pill:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

#timeline-beat-1.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.5);
  color: #5ce9ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}

#timeline-beat-2.active {
  background: rgba(224, 122, 95, 0.14);
  border-color: var(--copper);
  color: var(--copper-bright);
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.3);
}

#timeline-beat-3.active {
  background: rgba(255, 179, 0, 0.12);
  border-color: rgba(255, 179, 0, 0.5);
  color: #ffca7a;
  box-shadow: 0 0 10px rgba(255, 179, 0, 0.25);
}

/* Stage Placeholder */
.placeholder {
  text-align: center;
  padding: 36px 28px;
  color: var(--text-muted);
  background: radial-gradient(circle at 50% 38%, rgba(224, 122, 95, 0.09) 0%, rgba(7, 7, 10, 0) 70%);
  border-radius: var(--radius-md);
}

.placeholder-icon {
  font-size: 40px;
  margin-bottom: 12px;
  animation: iconBreath 3s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(224, 122, 95, 0.3));
}

@keyframes iconBreath {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50%      { transform: scale(1.08); opacity: 1; }
}

.placeholder strong {
  display: block;
  font-family: var(--font-h);
  font-size: 30px;
  letter-spacing: 0.04em;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.placeholder p {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
  max-width: 290px;
  margin-left: auto;
  margin-right: auto;
  color: var(--text-muted);
}

.shortcut-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(18, 18, 26, 0.9);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.shortcut-pill::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: mintBeacon 2s infinite ease-in-out;
}

@keyframes mintBeacon {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50%      { opacity: 1; transform: scale(1.2); box-shadow: 0 0 12px var(--mint); }
}

.shortcut-pill b {
  color: var(--text-muted);
}

/* Status Overlay during generation */
.status-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 10, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  animation: fadeIn 0.3s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.status-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  filter: drop-shadow(0 0 6px rgba(224, 122, 95, 0.4));
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-text {
  font-family: var(--font-h);
  font-size: 24px;
  letter-spacing: 0.05em;
  color: var(--text);
  text-transform: uppercase;
}

.status-timer {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--copper);
  background: rgba(224, 122, 95, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.cancel-run-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--danger);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--danger-bg);
  border: 1px solid rgba(255, 92, 92, 0.2);
  margin-top: 4px;
}

.cancel-run-btn:hover {
  background: rgba(255, 92, 92, 0.3);
}

/* Split Comparison View */
.compare-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  background: #000;
}

.compare-pane {
  position: relative;
  overflow: hidden;
  height: 100%;
  border-right: 1px solid var(--line-strong);
}

.compare-pane:last-child {
  border-right: 0;
}

.compare-pane img, .compare-pane video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* RIGHT SHELF: RECENT TAKES & TIMELINE */
.timeline-shelf {
  grid-column: 3;
  grid-row: 1 / -1;
  border-left: 1px solid var(--line);
  padding: 16px 12px;
  overflow-y: auto;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.shelf-header h2 {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

.open-gallery-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--copper);
}

.open-gallery-link:hover {
  text-decoration: underline;
}

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

.empty-shelf-note {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 24px 8px;
  line-height: 1.4;
}

.shelf-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.shelf-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.shelf-item[aria-current="true"] {
  background: linear-gradient(270deg, rgba(224, 122, 95, 0.12) 0%, rgba(20, 20, 28, 0.85) 100%);
  border-color: rgba(224, 122, 95, 0.4);
  box-shadow: inset -3px 0 0 var(--copper), 0 0 16px rgba(224, 122, 95, 0.12);
}

.shelf-thumb-wrapper {
  width: 56px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.shelf-thumb-wrapper img, .shelf-thumb-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.shelf-item:hover .shelf-thumb-wrapper img,
.shelf-item:hover .shelf-thumb-wrapper video {
  transform: scale(1.08);
}

.shelf-item-meta b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-item-meta p {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.shelf-status-pill {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--s3);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
}

.shelf-status-pill[data-status="completed"] {
  color: var(--lime);
  background: rgba(209, 254, 23, 0.1);
  border-color: rgba(209, 254, 23, 0.25);
}

/* ==========================================================================
   BOTTOM COMPOSER: MEDIA TRAY, CHIPS, PROMPT & CONTROLS
   ========================================================================== */

.composer {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--line);
  background: rgba(12, 12, 16, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

/* 1. Multi-Role Media Tray */
.media-tray {
  display: flex;
  align-items: center;
  gap: 10px;
}

.media-tray:not(:has(.drop-card:not([hidden]))) {
  display: none !important;
}

.tray-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.drops-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drop-card {
  width: 76px;
  height: 56px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(18, 18, 26, 0.7);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4px;
  font-size: 9px;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.drop-card:hover {
  border-color: var(--copper);
  background: rgba(224, 122, 95, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 10px rgba(224, 122, 95, 0.18);
}

.drop-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.drop-icon {
  font-size: 15px;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.drop-card:hover .drop-icon {
  transform: scale(1.15) translateY(-2px);
}

.drop-text {
  font-weight: 600;
  font-size: 9px;
  color: var(--text-muted);
}

.drop-filled {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.drop-filled img, .drop-filled video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.drop-card:hover .drop-filled img,
.drop-card:hover .drop-filled video {
  transform: scale(1.05);
}

.drop-card.has-file {
  border-style: solid;
  border-color: rgba(224, 122, 95, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.remove-file-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.remove-file-btn:hover {
  background: var(--danger);
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 0 8px rgba(255, 92, 92, 0.6);
}

/* 2. Director Chips Bar */
.director-chips-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.chips-group {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chips-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-right: 2px;
}

.chip {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.chip:active {
  transform: scale(0.92);
}

.chip-guard {
  border-color: rgba(56, 239, 125, 0.25);
  color: #73f7a6;
  background: rgba(56, 239, 125, 0.05);
}

.chip-guard:hover {
  background: rgba(56, 239, 125, 0.15);
  border-color: #38ef7d;
  box-shadow: 0 0 12px rgba(56, 239, 125, 0.3);
}

.chip-cad {
  border-color: rgba(0, 229, 255, 0.25);
  color: #5ce9ff;
  background: rgba(0, 229, 255, 0.05);
}

.chip-cad:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

/* 3. Prompt Section & Controls */
.prompt-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.prompt-input-wrapper {
  position: relative;
  background: #09090d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 8px 14px 6px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  width: 100%;
}

.prompt-input-wrapper:focus-within {
  border-color: var(--copper);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--copper), 0 0 24px rgba(224, 122, 95, 0.2);
}

.prompt-input-wrapper textarea {
  width: 100%;
  min-height: 48px;
  max-height: 140px;
  resize: none;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  caret-color: var(--copper);
  background: transparent;
  border: none;
  outline: none;
}

.prompt-input-wrapper textarea::placeholder {
  color: var(--text-dim);
}

.prompt-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.16s var(--ease);
}

.prompt-tool-btn:hover {
  color: var(--text);
  background: var(--s3);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

#prompt-skills-btn {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.22);
}

#prompt-skills-btn:hover {
  background: rgba(255, 209, 102, 0.18);
  border-color: #ffd166;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.3);
}

#prompt-doctor-btn {
  color: var(--copper-bright);
  background: rgba(224, 122, 95, 0.08);
  border-color: rgba(224, 122, 95, 0.22);
}

#prompt-doctor-btn:hover {
  background: rgba(224, 122, 95, 0.18);
  border-color: var(--copper);
  box-shadow: 0 0 10px rgba(224, 122, 95, 0.35);
}

#prompt-clear-btn {
  margin-left: auto;
}

#prompt-clear-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(255, 92, 92, 0.25);
}

/* Controls & Generate Button */
.composer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.settings-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16, 16, 24, 0.85);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.setting-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.setting-name {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.setting-item select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.setting-item select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.09);
}

.setting-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.setting-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 16px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.setting-toggle input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.setting-toggle input:checked {
  background: var(--copper);
  box-shadow: 0 0 8px rgba(224, 122, 95, 0.6);
}

.setting-toggle input:checked::before {
  transform: translateX(12px);
}

.generate-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 175px;
  height: 42px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-h);
  font-size: 18px;
  letter-spacing: 0.03em;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #e07a5f 0%, #eb8c73 45%, #f4a28a 100%);
  color: #1a0a06;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 18px rgba(224, 122, 95, 0.4);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
  white-space: nowrap;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 8px 24px rgba(224, 122, 95, 0.55);
}

.generate-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2), 0 2px 8px rgba(224, 122, 95, 0.35);
}

.generate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: grayscale(0.45);
}

.generate-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.12) 45%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 60%
  );
  background-size: 250% 100%;
  animation: btnShimmer 4s ease-in-out infinite;
  pointer-events: none;
  border-radius: inherit;
}

@keyframes btnShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.btn-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.22);
  color: #1c0e09;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.05em;
  margin-top: 0;
}

.error-banner {
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 92, 92, 0.25);
  margin-top: 4px;
}

/* ==========================================================================
   3. FULL PRO GALLERY VIEW
   ========================================================================== */

.gallery-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 4% 80px;
  background: var(--bg);
  min-height: calc(100svh - 64px);
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.gallery-scopes {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--s1);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}

.scope-tab {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.scope-tab:hover {
  color: var(--text);
}

.scope-tab.active {
  background: var(--s3);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.gallery-search input {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--s1);
  border: 1px solid var(--line);
  font-size: 12px;
  width: 260px;
  color: var(--text);
}

.gallery-search input:focus {
  border-color: var(--copper);
}

/* Selection Bar */
.selection-bar {
  position: sticky;
  top: 74px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin-bottom: 20px;
  background: var(--s2);
  border: 1px solid var(--copper);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.selection-info span {
  font-weight: 600;
  color: var(--copper);
  font-size: 13px;
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Masonry Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

.empty-gallery-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
}

.empty-gallery-state h3 {
  font-family: var(--font-h);
  font-size: 32px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-gallery-state p {
  max-width: 420px;
  margin: 0 auto 24px;
  font-size: 14px;
}

/* Gallery Item Card */
.gallery-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--s1);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}

.gallery-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.gallery-media-wrapper {
  position: relative;
  aspect-ratio: var(--card-ratio, 9 / 16);
  background: #000;
  overflow: hidden;
}

.gallery-media-wrapper img, .gallery-media-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-overlay-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

.card-model-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  backdrop-filter: blur(4px);
}

.card-checkbox {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  accent-color: var(--copper);
  cursor: pointer;
}

.card-fav-btn {
  pointer-events: auto;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.6);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.card-fav-btn.is-fav, .card-fav-btn:hover {
  color: #ffca28;
}

.gallery-card-info {
  padding: 12px 14px;
}

.card-prompt-snippet {
  font-size: 12px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 8px;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ==========================================================================
   MODALS & DIALOGS
   ========================================================================== */

.ns-dialog {
  width: min(640px, calc(100vw - 28px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--s1);
  color: var(--text);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75);
  animation: dialogSlideUp 0.28s var(--ease);
}

@keyframes dialogSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ns-dialog::backdrop {
  background: rgba(4, 4, 6, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: backdropFade 0.25s ease;
}

@keyframes backdropFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  font-family: var(--font-h);
  font-size: 28px;
  letter-spacing: 0.03em;
  font-weight: 400;
  margin-bottom: 4px;
}

.dialog-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.close-dialog-btn {
  font-size: 24px;
  line-height: 1;
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.close-dialog-btn:hover {
  color: var(--text);
  background: var(--s2);
}

/* Quick Model Switcher & Skills in Topbar */
.skills-picker-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  background: rgba(209, 254, 23, 0.08);
  border: 1px solid rgba(209, 254, 23, 0.28);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--lime);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.skills-picker-btn:hover {
  background: rgba(209, 254, 23, 0.18);
  border-color: var(--lime);
  box-shadow: 0 0 12px var(--lime-glow);
  transform: translateY(-1px);
}

.skill-spark-icon {
  font-size: 13px;
}

.btn-spark {
  color: var(--lime);
}

.btn-dice {
  font-size: 13px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.prompt-tool-btn:hover .btn-dice {
  transform: rotate(35deg) scale(1.2);
}

.btn-dice.rolling {
  animation: diceSpin 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes diceSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.35); }
  100% { transform: rotate(360deg) scale(1); }
}

.recipe-search-box {
  margin: 6px 0 10px;
}

.recipe-search-box input {
  width: 100%;
  padding: 6px 10px;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 11px;
  font-family: var(--font-mono);
  outline: none;
  transition: all 0.15s ease;
}

.recipe-search-box input:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 2px rgba(224, 122, 95, 0.15);
}

.skills-search-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.skills-search-wrapper input {
  width: 100%;
  padding-right: 90px;
}

.skills-count-badge {
  position: absolute;
  right: 12px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  pointer-events: none;
  background: var(--s2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.skills-empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.slot-token {
  color: var(--copper);
  background: rgba(224, 122, 95, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(224, 122, 95, 0.25);
  font-weight: 600;
}

/* 1. Model Catalog Drawer */
.model-dialog, .skills-dialog {
  width: min(880px, calc(100vw - 28px));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.skills-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 52vh;
}

.skill-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--s2);
  text-align: left;
  transition: all 0.2s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-card:hover {
  background: var(--s3);
  border-color: var(--copper);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(224, 122, 95, 0.12);
}

.skill-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.skill-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--lime);
  background: rgba(209, 254, 23, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.skill-model-hint {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.skill-card h4 {
  font-family: var(--font-h);
  font-size: 20px;
  letter-spacing: 0.03em;
  color: var(--text);
  line-height: 1.15;
}

.skill-card p {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.skill-template-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-dim);
  background: var(--s1);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
  max-height: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.skill-card .use-skill-btn {
  margin-top: auto;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(224, 122, 95, 0.12);
  color: var(--copper);
  border: 1px solid rgba(224, 122, 95, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
}

.skill-card .use-skill-btn:hover {
  background: var(--copper);
  color: var(--copper-ink);
  box-shadow: 0 2px 10px var(--copper-glow);
}

.skill-cat-pill {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--s2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.skill-cat-pill:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.skill-cat-pill.active {
  background: var(--lime);
  color: #141a02;
  border-color: transparent;
  box-shadow: 0 0 10px var(--lime-glow);
}

.catalog-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.catalog-filters input {
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--s2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}

.catalog-filters input:focus {
  border-color: var(--copper);
}

.catalog-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.cat-pill {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--s2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.cat-pill.active {
  background: var(--copper);
  color: var(--copper-ink);
  border-color: transparent;
}

.model-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 50vh;
}

.model-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--s2);
  text-align: left;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.model-card:hover {
  background: var(--s3);
  border-color: var(--copper);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.model-card.active {
  border-color: var(--copper);
  box-shadow: 0 0 0 1px var(--copper);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-provider {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--copper);
}

.card-kind-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--s1);
  color: var(--text-dim);
}

.model-card b {
  font-family: var(--font-h);
  font-size: 18px;
  letter-spacing: 0.03em;
  color: var(--text);
}

.model-card p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* 2. Pro Lightbox Viewer Modal */
.viewer-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-height: 90vh;
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 340px;
  height: 80vh;
}

.viewer-stage {
  background: #000;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.viewer-media-wrapper {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.viewer-media-wrapper video, .viewer-media-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.viewer-sidebar {
  background: var(--s1);
  border-left: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.viewer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.viewer-provider {
  font-size: 10px;
  font-weight: 700;
  color: var(--copper);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.viewer-model-title {
  font-family: var(--font-h);
  font-size: 24px;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

.viewer-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.viewer-prompt-card, .viewer-specs-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--s2);
  border: 1px solid var(--line);
}

.viewer-prompt-card h4, .viewer-specs-card h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.viewer-prompt-card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.copy-prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--copper);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(224, 122, 95, 0.1);
}

.copy-prompt-btn:hover {
  background: rgba(224, 122, 95, 0.2);
}

.specs-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.spec-row span {
  color: var(--text-dim);
}

.spec-row b {
  color: var(--text);
  font-family: var(--font-mono);
}

.spec-row small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.full-width {
  width: 100%;
}

.viewer-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* 3. API Key Dialog */
.key-dialog {
  width: min(520px, calc(100vw - 28px));
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.key-dialog input[type="password"], .key-dialog input[type="text"] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--s2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 8px;
}

.key-dialog input:focus {
  border-color: var(--copper);
}

.dialog-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.dialog-hint a {
  color: var(--copper);
  text-decoration: underline;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--s2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.25s var(--ease);
}

.toast.removing {
  animation: slideDown 0.2s var(--ease) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(12px); }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.ns-footer {
  padding: 24px 6% 32px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-right a:hover {
  color: var(--text);
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */

@media (max-width: 1024px) {
  .cover {
    grid-template-columns: 1fr;
    padding-top: 32px;
  }
  .hero-stage {
    min-height: 380px;
  }
  .desk {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .timeline-shelf {
    display: none;
  }
}

@media (max-width: 768px) {
  .ns-header {
    padding: 0 14px;
  }
  .model-picker-btn,
  .skills-picker-btn {
    display: none;
  }
  .view-pill {
    padding: 4px 10px;
  }
  .facts {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .steps {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .desk {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .jobs-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
  }
  .job-list {
    flex-direction: row;
  }
  .job {
    min-width: 150px;
  }
  .recipes-deck {
    display: none;
  }
  .stage-container {
    min-height: 480px;
  }
  .prompt-section {
    grid-template-columns: 1fr;
  }
  .composer-controls {
    flex-direction: column;
    width: 100%;
  }
  .settings-strip {
    width: 100%;
    overflow-x: auto;
  }
  .generate-btn {
    width: 100%;
    height: 52px;
  }
  .viewer-layout {
    grid-template-columns: 1fr;
    height: 90vh;
  }
  .viewer-sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .director-chips-bar {
    padding: 8px 14px;
    gap: 10px;
  }
}

/* Accessibility: Respect Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

