:root {
  --bg-darkest: #07080d;
  --bg-primary: #0d0f18;
  --bg-secondary: #131726;
  --bg-surface: #1a2035;
  --bg-surface-hover: #222a45;
  --bg-glass: rgba(19, 23, 38, 0.75);
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(236, 72, 153, 0.4));
  --gradient-card: linear-gradient(180deg, rgba(26, 32, 53, 0.8) 0%, rgba(19, 23, 38, 0.95) 100%);
  
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-glow: rgba(139, 92, 246, 0.3);
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-darkest);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(139, 92, 246, 0.07) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Header (OpenArt style) */
.header-nav {
  height: 70px;
  background: rgba(13, 15, 24, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient-brand);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(26, 32, 53, 0.4);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link-btn:hover {
  color: var(--text-main);
}

.nav-link-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.telemetry-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(26, 32, 53, 0.5);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Primary Hero Banner & Button */
.btn-primary-glow {
  background: var(--gradient-brand);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: all 0.25s ease;
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(139, 92, 246, 0.55);
}

.btn-primary-glow:active {
  transform: translateY(0);
}

.btn-secondary-glass {
  background: rgba(34, 42, 69, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary-glass:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
}

/* Main Container */
.app-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px;
  flex: 1;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.3s ease forwards;
}

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

/* Hero Section (OpenArt Reference Style) */
.hero-banner {
  background: linear-gradient(135deg, rgba(30, 36, 60, 0.6) 0%, rgba(19, 23, 38, 0.8) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 44px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.25;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 650px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.preset-pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-pill-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Studio Editor Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
}

@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-heading {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group-custom {
  margin-bottom: 20px;
}

.form-label-custom {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-custom, .textarea-custom, .select-custom {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 12px 16px;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.input-custom:focus, .textarea-custom:focus, .select-custom:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.textarea-script {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
}

/* Big Action Button (Generate Video) */
.btn-generate-hero {
  width: 100%;
  background: var(--gradient-brand);
  color: white;
  border: none;
  padding: 18px 32px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.45);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 10px;
}

.btn-generate-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.6);
}

/* Projects Gallery Cards (OpenArt style) */
.projects-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-purple);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(139, 92, 246, 0.2);
}

.project-thumb-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-thumb-img {
  transform: scale(1.04);
}

.thumb-play-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.project-card:hover .thumb-play-overlay {
  opacity: 1;
}

.play-circle-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: var(--shadow-glow);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.thumb-play-overlay:hover .play-circle-icon {
  transform: scale(1.05);
}

.project-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.badge-status-pill {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-rendering { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.project-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* POST-PRODUCTION VIDEO EDITOR (SECTION 4) */
.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.editor-cinema-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .editor-cinema-row {
    grid-template-columns: 1fr;
  }
}

.video-cinema-box {
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9;
  position: relative;
}

.cinema-video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.scene-inspector-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inspector-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Timeline Filmstrip (Section 4) */
.timeline-filmstrip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow: hidden;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.filmstrip-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 4px 16px 4px;
  scroll-behavior: smooth;
}

.filmstrip-clip {
  flex: 0 0 200px;
  background: var(--bg-primary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.filmstrip-clip:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.filmstrip-clip.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.08);
}

.clip-thumb {
  width: 100%;
  height: 95px;
  object-fit: cover;
  background: #000;
  display: block;
}

.clip-info {
  padding: 8px 10px;
  font-size: 0.75rem;
}

.clip-info strong {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.clip-duration-tag {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Progress Stage Stepper */
.progress-stepper-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 24px 0;
}

@media (max-width: 768px) {
  .progress-stepper-container {
    grid-template-columns: 1fr;
  }
}

.stepper-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: all 0.3s ease;
}

.stepper-item.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.stepper-item.done {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-emerald);
}

.stepper-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
  display: block;
}

.stepper-title {
  font-size: 0.8rem;
  font-weight: 700;
}

/* Big Progress Bar */
.progress-outer-bar {
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  height: 12px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin: 16px 0;
}

.progress-inner-bar {
  background: var(--gradient-brand);
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
