/**
 * Whiteboard Explainers — Storyboard-AI Design System
 * Dark theme: #0B0C0E background, #4285F4 accent
 */

/* ── Base ── */
:root {
  --bg: #0B0C0E;
  --bg-soft: #09090b;
  --card: #131516;
  --primary: #4285F4;
  --primary-hover: #5a96ff;
  --text: #ffffff;
  --text-muted: rgba(255,255,255,0.50);
  --text-dim: rgba(255,255,255,0.40);
  --text-faint: rgba(255,255,255,0.25);
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --success: #34d399;
  --success-bg: rgba(52,211,153,0.10);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.10);
  --error: #ef4444;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button, select, [role="button"] { cursor: pointer; }

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

img { max-width: 100%; height: auto; display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Animations ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.05); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes gray-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes blur-in {
  0% { opacity: 0; transform: scale(1.08); filter: blur(12px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes slide-up {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.animate-spin { animation: spin 0.9s linear infinite; }
.animate-pulse-glow { animation: pulse-glow 4s ease-in-out infinite; }
.animate-blur-in { animation: blur-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slide-up { animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ── Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tracking-tight { letter-spacing: -0.02em; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(66,133,244,0.25);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

/* ── Inputs ── */
.input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  border-color: rgba(66,133,244,0.4);
  box-shadow: 0 0 0 3px rgba(66,133,244,0.1);
}

.input-icon {
  position: relative;
}
.input-icon input {
  padding-left: 40px;
}
.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.card-hover:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.02);
}

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-done {
  background: var(--success-bg);
  border-color: rgba(52,211,153,0.20);
  color: var(--success);
}
.badge-running {
  background: rgba(66,133,244,0.10);
  border-color: rgba(66,133,244,0.20);
  color: var(--primary);
}
.badge-waiting {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
  color: var(--text-dim);
}
.badge-failed {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.20);
  color: var(--error);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-done .badge-dot { background: var(--success); }
.badge-running .badge-dot { background: var(--primary); animation: pulse-glow 2s ease-in-out infinite; }
.badge-waiting .badge-dot { background: var(--text-dim); }
.badge-failed .badge-dot { background: var(--error); }

/* ── Segmented Control ── */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.segmented button {
  flex: 1;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-dim);
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button.active {
  background: #fff;
  color: #000;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.segmented button:hover:not(.active) {
  color: var(--text);
}

/* ── Progress Bar ── */
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(66,133,244,0.3);
}

/* ── Loading Spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(141,162,202,0.20);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ── Scrollbar ── */
.custom-scrollbar::-webkit-scrollbar { width: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Login View ── */
.login-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.login-view[hidden] { display: none; }

.login-view::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 40%;
  height: 40%;
  background: rgba(66,133,244,0.08);
  filter: blur(120px);
  border-radius: 50%;
  pointer-events: none;
}

.login-view::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 40%;
  height: 40%;
  background: rgba(66,133,244,0.04);
  filter: blur(120px);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 10;
  width: min(100%, 400px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}

.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-card .brand-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(66,133,244,0.25);
}

.login-card .brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-card .brand p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.google-login-btn {
  width: 100%;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
}

.google-login-btn:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.09);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--text-dim);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

.login-card .field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-left: 4px;
}

.login-card .login-error {
  min-height: 18px;
  margin: 0;
  color: var(--error);
  font-size: 12px;
  font-weight: 500;
}

.email-verification-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(66,133,244,0.35);
  border-radius: 14px;
  background: rgba(66,133,244,0.08);
}

.email-verification-panel strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.email-verification-panel p {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.link-account-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(66,133,244,0.35);
  border-radius: 14px;
  background: rgba(66,133,244,0.08);
}

.link-account-panel[hidden] { display: none; }

.link-account-panel strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.link-account-panel p {
  margin: 0 0 12px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.link-account-panel .google-login-btn {
  margin-bottom: 10px;
}

.ghost-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}

.remember-label input {
  display: none;
}

.check-box {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.remember-label:hover .check-box {
  border-color: var(--border-hover);
}

.remember-label input:checked + .check-box {
  background: var(--primary);
  border-color: var(--primary);
}

.remember-label input:checked + .check-box::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  margin-bottom: 1px;
}

.forgot-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--primary);
}

.login-card .input {
  padding: 12px 14px;
  font-size: 14px;
}

.login-card .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 14px;
  margin-top: 4px;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  font-weight: 700;
}

/* ── Landing Page Navbar (Lovable Style) ── */
.landing-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 12, 14, 0.4);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-blend-mode: overlay;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.landing-navbar:hover {
  background: rgba(11, 12, 14, 0.55);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.landing-navbar-left {
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-logo {
  height: 22px;
  width: auto;
  display: block;
}

.landing-home-row {
  display: none;
  padding: 14px 24px 0;
}

.landing-home-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  min-height: 52px;
  padding: 10px 14px 10px 12px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(20, 20, 22, 0.92);
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.landing-home-link:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(24, 24, 26, 0.96);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
}

.landing-home-link[hidden] {
  display: none;
}

.landing-home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
}

.landing-home-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.landing-home-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.landing-home-subtitle {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.landing-navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Profile Dropdown Styling */
.profile-container {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.profile-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border-hover);
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: #18191b;
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 1000;
  min-width: 180px;
  display: none;
}

.profile-dropdown.show {
  display: block;
  animation: fadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.profile-user-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.profile-user-info .user-email {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-user-info .user-status {
  font-size: 11px;
  color: var(--primary);
  margin-top: 2px;
  font-weight: 500;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.profile-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.profile-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.profile-dropdown-item svg {
  color: var(--text-dim);
}

.profile-dropdown-item:hover svg {
  color: var(--text);
}

/* Toggling navbar displays depending on prompt-mode / has-project classes on body */
body.prompt-mode .landing-navbar {
  display: flex;
  height: 52px;
  min-height: 52px;
}
body.prompt-mode .topbar {
  display: none !important;
}

body.has-project:not(.prompt-mode) .landing-navbar {
  display: none !important;
}
body.has-project:not(.prompt-mode) .topbar {
  display: flex;
}

body.prompt-mode.studio-home-link-visible .landing-home-row {
  display: block;
}

body:not(.studio-home-link-visible) .landing-home-row {
  display: none;
}

/* ── App Header ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,12,14,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

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

.divider-v {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.project-path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.project-path:hover {
  background: rgba(255,255,255,0.03);
}

.project-path .path-personal {
  color: var(--text-dim);
}

.project-path .path-sep {
  color: var(--text-faint);
}

.project-path .path-project {
  color: var(--text);
  font-weight: 600;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.credits-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.credits-badge svg {
  color: var(--text-dim);
}

.btn-upgrade {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: #fff;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-upgrade:hover {
  background: rgba(255,255,255,0.9);
}

.btn-resume {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(88, 132, 255, 0.5);
  background: rgba(88, 132, 255, 0.16);
  color: #dbe6ff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-resume:hover:not(:disabled) {
  background: rgba(88, 132, 255, 0.26);
  border-color: rgba(88, 132, 255, 0.75);
}

.btn-resume:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-resume[hidden] {
  display: none;
}

.btn-save {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save.is-dirty {
  border-color: rgba(88, 132, 255, 0.65);
  background: rgba(88, 132, 255, 0.18);
  color: #dbe6ff;
}

.btn-save:hover:not(:disabled) {
  background: rgba(255,255,255,0.09);
  color: var(--text);
}

.btn-save:disabled {
  opacity: 0.65;
  cursor: default;
}

.btn-save.is-saving {
  opacity: 0.85;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: #fff;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-export:hover {
  background: rgba(255,255,255,0.9);
}

.notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--error);
  border-radius: 50%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.top-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  border: none;
}

/* ── Home Panel Redesign: Premium Dashboard ── */
.home-panel {
  max-width: 1280px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  overflow: visible;
}

.home-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--whiteboard-home-panel-bg, url('bg-whiteboard.png'));
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0.40;
  pointer-events: none;
  z-index: 0;
}

.home-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(11, 12, 14, 0.3) 0%,
    rgba(11, 12, 14, 0.1) 30%,
    rgba(11, 12, 14, 0.5) 70%,
    rgba(11, 12, 14, 1.0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.dashboard-center-container {
  position: relative;
  z-index: 1;
}

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

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

.animate-fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-up {
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Dashboard Centered Layout */
.dashboard-center-container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  position: relative;
  z-index: 2;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  overflow: visible;
}

/* Dashboard Header & Welcome copy (Centered) */
.dashboard-header {
  margin-bottom: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.title-line-1 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 12px;
  text-align: center;
  width: 100%;
}

.title-line-2 {
  display: block;
  color: var(--text);
}

.title-static {
  display: inline;
  color: var(--text);
}

.title-static-accent {
  display: inline;
  color: var(--primary);
}

.hero-subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 480px;
  font-weight: 400;
}

/* Creation Card Console (Borderless & Flat) */
.console-card {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
  width: 100%;
}

.console-header {
  display: none;
}

.prompt-box-ai-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.prompt-box-ai-badge svg {
  color: var(--primary);
}

/* Redesigned Unified Prompt Box - Vercel-like Minimal */
.prompt-box-redesign {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}



.prompt-input-wrapper {
  position: relative;
  z-index: 1;
}

.prompt-input-wrapper textarea {
  width: 100%;
  min-height: 60px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
  font-weight: 400;
}

.prompt-input-wrapper textarea::placeholder {
  color: var(--text-faint);
  font-weight: 400;
}

.prompt-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  gap: 12px;
  position: relative;
  z-index: 1;
}

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

.action-trigger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.action-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.attached-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(360px, 100%);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(76, 134, 236, 0.12);
  border: 1px solid rgba(76, 134, 236, 0.28);
  color: var(--text);
}

.attached-file-chip[hidden] {
  display: none;
}

.attached-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(76, 134, 236, 0.18);
  color: #8eb7ff;
}

.attached-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attached-file-label {
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-dim);
}

.attached-file-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-box-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.character-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.generate-submit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: none;
  color: #0a0a0a;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.generate-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.2) 0%, rgba(167, 139, 250, 0.15) 100%);
  opacity: 0;
  transition: opacity 0.2s;
}

.generate-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

.generate-submit-btn:hover::before {
  opacity: 1;
}

.generate-submit-btn:active {
  transform: translateY(0px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.generate-submit-btn span,
.generate-submit-btn svg {
  position: relative;
  z-index: 1;
}

.generate-credit {
  font-size: 12px;
  font-weight: 700;
  color: #0a0a0a;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

/* Redesigned Settings Grid - Minimal */
.settings-grid-redesign {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  overflow: visible;
  isolation: isolate;
}

.setting-item {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
}

.setting-item:has(.custom-dropdown-trigger.active) {
  z-index: 120;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.setting-label svg {
  color: var(--text-faint);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-muted);
  pointer-events: none;
}

.select-wrapper select {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 32px 9px 12px;
  cursor: pointer;
  appearance: none;
  outline: none;
  transition: all 0.2s;
}

.select-wrapper select:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.select-wrapper select:focus {
  border-color: rgba(66, 133, 244, 0.4);
  background: rgba(0, 0, 0, 0.2);
}

.select-wrapper select option {
  background: #18191b;
  color: var(--text);
  padding: 12px;
}

/* Voice Picker Trigger */
.voice-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  min-height: 38px;
}

.voice-picker-trigger:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.voice-picker-trigger span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.voice-picker-trigger svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Redesigned Ideas Section */
.idea-section-redesign {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.idea-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.idea-section-header h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  flex-shrink: 0;
}

.idea-section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  max-width: 120px;
}

.prompt-tags-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  text-align: left;
  line-height: 1.4;
  min-height: 100px;
  aspect-ratio: auto;
}

.topic-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(66, 133, 244, 0.3);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.topic-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topic-card-text .line-1 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

.topic-card-text .line-2 {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.4;
}

.topic-card:hover .topic-card-text .line-1,
.topic-card:hover .topic-card-text .line-2 {
  color: var(--text);
}

.topic-icon {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.topic-card:hover .topic-icon {
  transform: scale(1.1);
  color: var(--primary);
}

/* Project Library (Below Prompt Console) - Flat & Borderless */
.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  width: 100%;
  margin-top: 32px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 14px;
}

.sidebar-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.library-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 10px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

/* Redesigned Project Grid: Bigger vertical cards */
.recent-grid-redesign {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding-right: 4px;
}

/* Custom scrollbar for recent grid */
.recent-grid-redesign::-webkit-scrollbar {
  width: 6px;
}
.recent-grid-redesign::-webkit-scrollbar-track {
  background: transparent;
}
.recent-grid-redesign::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}
.recent-grid-redesign::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Premium Project Card */
.premium-project-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.premium-project-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.premium-project-card .project-thumb {
  width: 100%;
  height: 255px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.premium-project-card .project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.project-card .project-thumb,
.premium-project-card .project-thumb {
  position: relative;
}

.project-thumb-status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.project-thumb-status.completed {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.30);
  color: #a7f3d0;
}

.project-thumb-status.running,
.project-thumb-status.draft,
.project-thumb-status.script_ready,
.project-thumb-status.incomplete {
  background: rgba(66, 133, 244, 0.16);
  border-color: rgba(66, 133, 244, 0.28);
  color: #dbeafe;
}

.project-thumb-status.failed {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.premium-project-card .project-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  letter-spacing: -0.05em;
}

.premium-project-card .project-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.premium-project-card .project-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Property cards grid of details */
.project-properties {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
}

.prop-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.prop-item-wide {
  grid-column: span 1;
}

.prop-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.prop-value {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skeletons */
.skeleton-project-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.01);
  overflow: hidden;
}

.skeleton-thumb {
  width: 100%;
  aspect-ratio: var(--project-aspect-ratio, 16 / 9);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

.skeleton-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.skeleton-line {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.skeleton-line.title {
  width: 70%;
  height: 14px;
}

.skeleton-properties {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
}

.skeleton-line.prop {
  width: 100%;
  height: 20px;
}

.skeleton-thumb::after,
.skeleton-line::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.03) 20%,
    rgba(255, 255, 255, 0.05) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer-swipe 1.5s infinite;
}

@keyframes shimmer-swipe {
  100% {
    transform: translateX(100%);
  }
}

.privacy-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  margin: auto 0 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  letter-spacing: 0.02em;
}

/* ── Studio Shell ── */
.studio-shell {
  display: none;
  flex-direction: column;
  height: calc(100vh - 52px);
  overflow: hidden;
}

body.has-project .studio-shell {
  display: flex;
}

body.has-project:not(.prompt-mode) .home-panel {
  display: none;
}

body.prompt-mode .studio-shell {
  display: none;
}

/* ── Studio Top ── */
.studio-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

/* ── Generation Header ── */
.gen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.gen-header .title-group {
  flex: 1;
  min-width: 0;
}

.gen-header .title-group h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.gen-header .title-group p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-dim);
}

.gen-header .percent-group {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.gen-header .percent-group strong {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.gen-header .percent-group span {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Stepper ── */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

.stepper .step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.stepper .step .circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.3s;
  flex-shrink: 0;
}

.stepper .step .circle.done {
  background: var(--primary);
  color: #fff;
}

.stepper .step .circle.running {
  background: rgba(66,133,244,0.15);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66,133,244,0.2);
}

.stepper .step .circle.waiting {
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
}

.stepper .step .circle.failed {
  background: rgba(239,68,68,0.15);
  color: var(--error);
}

.stepper .step .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.3s;
  white-space: nowrap;
}

.stepper .step.active .label {
  color: var(--text);
}

.stepper .sep {
  width: 12px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Studio Workspace ── */
.studio-workspace {
  display: grid;
  grid-template-columns: 180px 1fr 420px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Slides Panel ── */
.slides-panel {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slides-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.slides-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slides-head span {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
}

.slides-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slide-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.slide-card.active {
  border-color: var(--primary);
}

.slide-thumb {
  position: relative;
  aspect-ratio: var(--slide-aspect-ratio, 16 / 10);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
}

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

.slide-thumb.skeleton {
  background: rgba(255,255,255,0.03);
  cursor: default;
  pointer-events: none;
  overflow: hidden;
}

.slide-thumb.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 45%, rgba(255,255,255,0.04) 55%, transparent 100%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.6s infinite ease-in-out;
}

.scene-shimmer,
.loading-shimmer {
  background: linear-gradient(100deg, #d3d5d7 18%, #eef0f1 38%, #c5c8ca 58%, #d3d5d7 78%);
  background-size: 250% 100%;
  animation: gray-shimmer 1.35s linear infinite;
}

.scene-shimmer {
  width: 100%;
  height: 100%;
}

.slide-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

.slide-thumb:hover .slide-edit-btn,
.slide-edit-btn:focus-visible {
  opacity: 1;
}

.slide-edit-btn:hover {
  background: rgba(0, 0, 0, 0.55);
  border-color: var(--border-hover);
}

.slide-thumb .slide-status-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}

.slide-thumb .slide-status-badge.ready {
  background: rgba(34,197,94,0.9);
}

.slide-thumb .slide-status-badge.pending {
  background: rgba(107,114,128,0.85);
}

/* ── Workspace Center ── */
.workspace-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ── Video Player ── */
.video-player {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.video-stage {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-stage .stage-shell {
  position: relative;
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: var(--stage-aspect-ratio, 3 / 2);
  border-radius: 10px;
  border: none;
  flex: 0 0 auto;
}

.video-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 2px 0;
  flex-shrink: 0;
}

.video-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-time {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  min-width: 60px;
}

.video-audio {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.stage-shell {
  min-height: 0;
  background: var(--bg-soft);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.stage-shell canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fbfbf8;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.stage-shell canvas.is-dragging-element {
  cursor: grabbing;
}

.canvas-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 22, 23, 0.86);
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.canvas-loading-overlay[hidden] {
  display: none;
}

.canvas-loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  width: 220px;
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.canvas-loader-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}

.canvas-loader-dots {
  display: inline-block;
  width: 20px;
  text-align: left;
}

.canvas-loader-dots::after {
  content: "";
  animation: loader-dots 1.4s steps(4, end) infinite;
}

@keyframes loader-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: "..."; }
}

.canvas-loader-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.canvas-loader-fill {
  width: 0%;
  height: 100%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.canvas-loader-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 16px;
}

.canvas-loader-percent {
  font-size: 28px;
  font-weight: 750;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.canvas-loader-detail {
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.48);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .canvas-loader-fill {
    transition: none;
  }
}

.stage-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.transport .btn {
  padding: 6px 12px;
  font-size: 11px;
}

.transport output {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

#audioReadout {
  font-size: 10px;
  color: var(--text-faint);
}

/* ── Bottom Timeline (Storyboard-AI Style) ── */
.bottom-timeline {
  flex-shrink: 0;
  height: 320px;
  background: #0c0c0e;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.timeline-toolbar {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: #0c0c0e;
  z-index: 30;
}

.timeline-toolbar .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: rgba(255,255,255,0.45);
}

.timeline-toolbar .icon-btn:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.timeline-toolbar .zoom-control input[type="range"] {
  width: 64px;
}

.timeline-scene-tabs {
  flex-shrink: 0;
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: #0f0f11;
  overflow-x: auto;
  scrollbar-width: thin;
}

.timeline-scene-tab {
  position: relative;
  min-width: 126px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font: inherit;
  cursor: pointer;
  margin-bottom: -1px;
  transition: background 0.15s, color 0.15s;
}

.timeline-scene-tab::before,
.timeline-scene-tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 1px solid transparent;
  border-bottom: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.timeline-scene-tab::before {
  left: -10px;
  border-right: none;
  border-radius: 0 10px 0 0;
  box-shadow: 3px -3px 0 0 transparent;
}

.timeline-scene-tab::after {
  right: -10px;
  border-left: none;
  border-radius: 10px 0 0 0;
  box-shadow: -3px -3px 0 0 transparent;
}

.timeline-scene-tab:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.8);
}

.timeline-scene-tab.active {
  background: #1a1a1d;
  border-color: rgba(255,255,255,0.08);
  color: #fff;
  z-index: 2;
}

.timeline-scene-tab.active::before,
.timeline-scene-tab.active::after {
  opacity: 1;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 -1px 0 0 #1a1a1d;
}

.timeline-scene-tab span {
  min-width: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-scene-tab small {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.55;
  font-size: 9px;
  font-weight: 700;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}

.btn-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.10);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.btn-play:hover {
  background: rgba(255,255,255,0.20);
}

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

.zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
}

.zoom-control input[type="range"] {
  width: 80px;
  height: 4px;
}

.zoom-control input[type="range"]::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  background: #fff;
  border: none;
  box-shadow: none;
}

.zoom-control input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: #fff;
  border: none;
  box-shadow: none;
}

.timeline-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0c0c0e;
}

.timeline-scroll {
  flex: 1;
  overflow: auto;
  padding-left: 16px;
  position: relative;
}

.timeline-wrapper {
  position: relative;
  min-width: 100%;
  user-select: none;
}

/* Ruler */
.timeline-ruler {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: #0c0c0e;
  cursor: ew-resize;
  overflow: hidden;
}

.ruler-tick {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.ruler-tick .tick-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.58);
  transform: translateX(10px) translateY(-2px);
}

.ruler-tick .tick-line {
  width: 1px;
  margin-top: 2px;
}

.ruler-tick.major .tick-line {
  height: 13px;
  background: rgba(255,255,255,0.42);
}

.ruler-tick.medium .tick-line {
  height: 9px;
  background: rgba(255,255,255,0.22);
}

.ruler-tick.minor .tick-line {
  height: 6px;
  background: rgba(255,255,255,0.14);
}

/* Tracks */
.timeline-tracks {
  position: relative;
  padding-top: 4px;
  min-height: 120px;
}

.timeline-track-row {
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  overflow: hidden;
}

.timeline-track-row.element {
  background: rgba(255,255,255,0.012);
}

.timeline-track-row::before {
  content: attr(data-track-name);
  position: sticky;
  left: 6px;
  top: 4px;
  z-index: 30;
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(8,8,10,0.82);
  color: rgba(255,255,255,0.42);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  pointer-events: none;
  max-width: 168px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-bg {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.01);
}

/* Skeleton / ghost tracks shown while loading or when timeline is empty */
.timeline-track-row.skeleton {
  background: rgba(255,255,255,0.018);
  border-bottom: 1px solid rgba(255,255,255,0.035);
  overflow: hidden;
}

.timeline-track-row.skeleton::before {
  content: attr(data-track-name);
  color: rgba(255,255,255,0.22);
  background: rgba(8,8,10,0.72);
}

.timeline-track-row.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.055) 45%,
    rgba(255,255,255,0.055) 55%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.6s infinite ease-in-out;
  pointer-events: none;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Scene Placeholders */
.scene-placeholder {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.scene-placeholder:hover {
  border-color: rgba(66,133,244,0.40);
  background: rgba(66,133,244,0.05);
}

.scene-placeholder .placeholder-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.20);
  transition: color 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.scene-placeholder:hover .placeholder-label {
  color: var(--primary);
}

.scene-placeholder .placeholder-hint {
  font-size: 7.5px;
  color: rgba(255,255,255,0.06);
  font-family: var(--font-mono);
  margin-top: 2px;
  animation: pulse 2s ease-in-out infinite;
}

.scene-placeholder:hover .placeholder-hint {
  color: rgba(66,133,244,0.60);
}

/* Transition Badges */
.transition-badge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 20px;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 25;
  cursor: pointer;
  transition: all 0.2s ease;
}

.transition-badge:hover {
  background: rgba(255,255,255,0.90);
  transform: translateY(-50%) scale(1.05);
}

.transition-badge:active {
  transform: translateY(-50%) scale(0.95);
}

.transition-badge svg {
  width: 8px;
  height: 8px;
  color: rgba(255,255,255,0.50);
}

/* Clip Blocks */
.clip-block {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.clip-block:hover {
  border-color: rgba(255,255,255,0.30);
}

.clip-block.selected {
  box-shadow: 0 0 0 2px #fff;
  z-index: 40;
}

.clip-block.element.selected {
  border-color: #6c8cff;
  box-shadow: 0 0 0 2px rgba(108,140,255,0.95), 0 10px 28px rgba(79,124,255,0.22);
}

/* Clip Colors by Track */
.clip-block.video {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.15);
}

.clip-block.video:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.30);
}

.clip-block.audio {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.70);
  border-color: rgba(255,255,255,0.15);
}

.clip-block.audio:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.25);
}

.clip-block.image {
  background: rgba(16,185,129,0.12);
  color: rgba(16,185,129,0.90);
  border-color: rgba(16,185,129,0.25);
}

.clip-block.image:hover {
  background: rgba(16,185,129,0.18);
  border-color: rgba(16,185,129,0.40);
}

.clip-block.element {
  background: rgba(245,158,11,0.14);
  color: rgba(251,191,36,0.95);
  border-color: rgba(245,158,11,0.35);
  cursor: grab;
}

.clip-block.element.is-hidden {
  opacity: 0.48;
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.28);
}

.clip-block.element.is-locked {
  cursor: default;
  border-style: dashed;
}

.clip-block.element:hover,
.clip-block.element.dragging {
  background: rgba(245,158,11,0.22);
  border-color: rgba(251,191,36,0.75);
  z-index: 35;
}

.clip-block.element.dragging {
  cursor: grabbing;
  transition: none;
}

.clip-block.element.is-resizing,
.clip-block.audio.is-resizing {
  cursor: ew-resize;
}

.clip-trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  z-index: 12;
  cursor: ew-resize;
}

.clip-trim-handle.left {
  left: -2px;
}

.clip-trim-handle.right {
  right: -2px;
}

.clip-trim-handle::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.clip-block.element:hover .clip-trim-handle::before,
.clip-block.element.selected .clip-trim-handle::before,
.clip-block.element.is-resizing .clip-trim-handle::before,
.clip-block.audio:hover .clip-trim-handle::before,
.clip-block.audio.selected .clip-trim-handle::before,
.clip-block.audio.is-resizing .clip-trim-handle::before {
  background: rgba(255,255,255,0.75);
}

/* Clip Label */
.clip-label {
  height: 20px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  z-index: 10;
}

.clip-label.video {
  background: rgba(255,255,255,0.06);
}

.clip-label.audio {
  background: rgba(255,255,255,0.06);
}

.clip-label.image {
  background: rgba(16,185,129,0.15);
  border-bottom-color: rgba(16,185,129,0.20);
}

.clip-label.element {
  background: rgba(245,158,11,0.18);
  border-bottom-color: rgba(245,158,11,0.25);
}

.clip-label span {
  font-size: 9px;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.clip-label em {
  flex-shrink: 0;
  margin-left: auto;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.55);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.clip-label.video span {
  color: rgba(255,255,255,0.70);
}

.clip-label.audio span {
  color: rgba(255,255,255,0.70);
}

.clip-label.image span {
  color: rgba(16,185,129,0.80);
}

.clip-label.element span {
  color: rgba(253,230,138,0.95);
}

/* Clip Content */
.clip-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.10);
}

/* Filmstrip */
.filmstrip {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.filmstrip img,
.filmstrip video {
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.05);
}

/* Waveform */
.waveform {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5px;
  padding: 0 12px;
  pointer-events: none;
  user-select: none;
}

.waveform-bar {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  flex-shrink: 0;
  width: 2px;
}

.element-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: #ffffff;
  pointer-events: none;
}

.element-preview img,
.element-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.element-toolbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  margin: 0 0 8px;
  width: 100%;
  max-width: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.element-toolbar[hidden] {
  display: none;
}

.element-toolbar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.element-toolbar-title {
  display: none;
}

.element-toolbar-field {
  display: flex;
  align-items: center;
  margin: 0;
}

.element-toolbar-field select {
  height: 32px;
  min-width: 150px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.9);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  cursor: pointer;
  outline: none;
}

.element-toolbar-field select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.element-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.element-toolbar-actions::-webkit-scrollbar {
  display: none;
}

.element-toolbar-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.element-toolbar-actions button svg {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}

.element-toolbar-actions button:hover:not(:disabled) {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.element-toolbar-actions button.active {
  background: rgba(74,222,128,0.16);
  border-color: rgba(74,222,128,0.4);
  color: #86efac;
}

.element-toolbar-actions button.active svg {
  color: #86efac;
}

.element-toolbar-actions button:disabled,
.element-toolbar-actions button.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.element-toolbar-actions button.danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.1);
  color: #f87171;
}

.element-toolbar-actions button[data-action="ai-edit"] {
  background: #ffffff;
  color: #0b0c0e;
  border-color: #ffffff;
}

.element-toolbar-actions button[data-action="ai-edit"] svg {
  color: #0b0c0e;
}

.element-toolbar-actions button[data-action="ai-edit"]:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  color: #0b0c0e;
  border-color: rgba(255, 255, 255, 0.9);
}

.element-toolbar-actions button[data-action="ai-edit"].active {
  background: #4285f4;
  border-color: #4285f4;
  color: #ffffff;
}

.element-toolbar-actions button[data-action="ai-edit"].active svg {
  color: #ffffff;
}

/* Playhead */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  z-index: 30;
  pointer-events: none;
  transform: translateX(-1px);
}

.playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -6px;
  width: 14px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Track Info */
.track-info {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  z-index: 15;
}

.track-info .track-name {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.track-info .track-type {
  font-size: 8px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ── Right Panel ── */
.right-panel {
  width: 420px;
  min-width: 420px;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.right-panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.right-panel-tab {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.right-panel-tab[hidden],
.right-panel-tab-btn[hidden] {
  display: none !important;
}

.right-panel-tab.active {
  display: flex;
}

.tab-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tab-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Right Panel Nav Strip ── */
.right-panel-nav {
  width: 64px;
  min-width: 64px;
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  flex-shrink: 0;
}

.right-panel-tab-btn {
  width: 100%;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  border-right: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.right-panel-tab-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.right-panel-tab-btn.active {
  color: var(--text);
  border-right-color: var(--primary);
  background: rgba(255, 255, 255, 0.02);
}

.right-panel-tab-btn.active svg {
  color: var(--primary);
}

.right-panel-tab-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.right-panel-tab-btn:hover svg {
  color: var(--text);
}

.right-panel-tab-btn span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Storyboard-AI style generator panels (Audio / Video) ── */
.sb-panel {
  padding: 0;
  background: #09090b;
  overflow-y: auto;
}

.sb-panel::-webkit-scrollbar {
  width: 5px;
}

.sb-panel::-webkit-scrollbar-track {
  background: transparent;
}

.sb-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
}

.sb-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sb-section:last-child {
  border-bottom: none;
}

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

.sb-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.sb-head p {
  margin: 3px 0 0;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}

.sb-credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.sb-tutorial {
  position: relative;
  overflow: hidden;
  margin: 12px 16px 0;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
}

.sb-tutorial::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(66,133,244,0.18);
  filter: blur(30px);
}

.sb-tutorial::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(168,85,247,0.10);
  filter: blur(25px);
}

.sb-tutorial-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-tutorial-thumb {
  position: relative;
  width: 56px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1a1a1c;
  border: 1px solid rgba(255,255,255,0.08);
}

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

.sb-tutorial-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
}

.sb-tutorial-play svg {
  width: 12px;
  height: 12px;
  color: #fff;
  fill: #fff;
  margin-left: 1px;
}

.sb-tutorial-text h5 {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.sb-tutorial-text p {
  margin: 0;
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}

.sb-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sb-help-row span {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

.sb-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.sb-card {
  background: #121214;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 12px;
}

.sb-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sb-card-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.sb-card-sub {
  margin: 3px 0 0;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}

.sb-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 9px;
  border: none;
  background: #4285f4;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sb-btn-primary:hover {
  background: #3b78de;
}

#propertiesPanel .sb-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.properties-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 16px;
  text-align: center;
  color: rgba(255,255,255,0.45);
}

.properties-empty-state svg {
  color: rgba(255,255,255,0.35);
}

.properties-empty-state h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}

.properties-empty-state p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,0.35);
}

.ai-edit-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-edit-history-empty {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

.ai-edit-history-entry {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-edit-history-entry img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,0.95);
}

.ai-edit-history-prompt {
  margin: 0;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.sb-tool-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s;
}

.sb-tool-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(249,115,22,0.5), rgba(37,99,235,0.5), rgba(168,85,247,0.5));
  opacity: 0.7;
}

.sb-tool-btn:hover {
  background: rgba(255,255,255,0.04);
}

.sb-tool-btn svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.7);
}

.sb-upload-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.08);
  background: #141416;
}

.sb-upload-zone p {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.sb-upload-zone small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  line-height: 1.4;
}

.sb-upload-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.5);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.sb-upload-btn svg {
  width: 14px;
  height: 14px;
}

.sb-textarea-wrap {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px;
  min-height: 140px;
}

.sb-textarea-wrap textarea {
  width: 100%;
  height: 90px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.sb-textarea-wrap textarea::placeholder {
  color: rgba(255,255,255,0.2);
}

.sb-toggle {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.sb-toggle button {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.4);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.sb-toggle button.active {
  background: #fff;
  color: #111113;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.sb-row-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sb-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: #18181b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sb-row-btn:hover {
  background: rgba(255,255,255,0.04);
}

.sb-row-btn svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.55);
}

.sb-slider {
  margin-top: 10px;
}

.sb-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sb-slider-head span {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.sb-slider-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: #282828;
  overflow: hidden;
}

.sb-slider-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: #bfbfbf;
  border-radius: 999px;
  width: 50%;
}

.sb-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.sb-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}

.sb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sb-tag {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.sb-tag:hover {
  background: rgba(255,255,255,0.08);
}

.sb-tag.active {
  background: #fff;
  color: #111113;
  border-color: #fff;
}

.sb-history-card {
  background: #131416;
  border: 2px solid #303031;
  border-radius: 12px;
  overflow: hidden;
}

.sb-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #303031;
  font-size: 10px;
  color: #5f676e;
}

.sb-history-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.sb-history-player button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #232426;
  background: #1a1b1e;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sb-history-player button svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  margin-left: 1px;
}

.sb-history-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sb-history-track p {
  margin: 0;
  font-size: 10px;
  color: #e0e0e0;
}

.sb-history-progress {
  position: relative;
  height: 3px;
  background: #4c4f53;
  border-radius: 999px;
}

.sb-history-progress span {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 33%;
  background: #fff;
  border-radius: 999px;
}

.sb-history-progress::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 33%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.sb-history-times {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #e0e0e0;
}

.sb-history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid #303031;
}

.sb-history-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}

.sb-history-actions button.danger {
  color: rgba(229,97,97,0.85);
}

.sb-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: #09090b;
}

.sb-generate-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #111113;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.sb-generate-btn:hover {
  background: #fff;
}

.sb-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.sb-section-title svg {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.55);
}

.sb-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sb-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.sb-pill:hover {
  background: rgba(255,255,255,0.07);
}

.sb-pill.active {
  background: #fff;
  color: #111113;
  border-color: #fff;
}

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

.sb-style-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.sb-style-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #1a1a1c;
  transition: border-color 0.15s;
}

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

.sb-style-thumb.selected {
  border-color: #4285f4;
}

.sb-style-thumb .check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #4285f4;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sb-style-thumb .check svg {
  width: 10px;
  height: 10px;
}

.sb-style-item span {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
}

.sb-more-thumb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  padding: 3px;
}

.sb-more-thumb div {
  border-radius: 5px;
  overflow: hidden;
  background: #1a1a1c;
}

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

.sb-upload-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb-upload-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.sb-upload-box:hover {
  background: rgba(255,255,255,0.04);
}

.sb-upload-box svg {
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.3);
}

.sb-upload-arrow {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-upload-arrow svg {
  width: 12px;
  height: 12px;
}

/* ── Image Generator Panel ── */
.ig-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: #09090b;
  flex-shrink: 0;
}

.ig-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

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

.ig-credits {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.ig-credits svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.ig-close {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #1a1b1e;
  color: rgba(255,255,255,0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ig-close svg {
  width: 14px;
  height: 14px;
}

.ig-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.ig-tab {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-tab.active {
  background: #fff;
  color: #111113;
}

.ig-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.ig-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ig-help-row span {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.ig-guide-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ig-guide-link svg {
  width: 14px;
  height: 14px;
}

.ig-upload-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.015);
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ig-upload-box:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.18);
}

.ig-upload-box svg {
  width: 28px;
  height: 28px;
  color: rgba(255,255,255,0.35);
}

.ig-upload-box strong {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.ig-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.ig-lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  margin-bottom: 10px;
}

.ig-lang-pill b {
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

.ig-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.75);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.ig-textarea::placeholder {
  color: rgba(255,255,255,0.25);
  font-style: italic;
}

.ig-gen-prompt-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ig-gen-prompt-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.ig-label-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.ig-label-info .ig-section-title {
  margin: 0;
}

.ig-label-info svg {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.35);
}

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

.ig-aspect-btn {
  padding: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.ig-aspect-btn.active {
  background: #4285f4;
  border-color: #4285f4;
  color: #fff;
}

@keyframes igPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

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

.ig-skeleton-loader {
  animation: igPulse 1.5s infinite ease-in-out;
}

.ig-spin {
  animation: igSpin 1s linear infinite;
  transform-origin: center;
}

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

.ig-style-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.ig-style-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #1a1a1c;
  transition: border-color 0.15s;
}

.ig-style-thumb.selected {
  border-color: #4285f4;
}

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

.ig-style-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #4285f4;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ig-style-check svg {
  width: 11px;
  height: 11px;
}

.ig-style-item span {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
}

.ig-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: #09090b;
}

.ig-footer-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ig-footer-btn.primary {
  background: #4285f4;
  border-color: #4285f4;
  color: #fff;
}

.ig-footer-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ── Asset Panel ── */
.asset-panel,
.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.asset-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}

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

.asset-card .asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-card .asset-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

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

.asset-card .asset-body img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.asset-card .asset-body audio {
  width: 100%;
  border-radius: 6px;
}

/* Custom audio player (replaces native <audio controls>) */
.custom-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #e8e8eb;
  border-radius: 999px;
  color: #111113;
}

.custom-audio-player audio {
  display: none;
}

.cap-play-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #111113;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

.cap-play-btn:hover {
  background: #2a2a2d;
  transform: scale(1.05);
}

.cap-play-btn svg[hidden],
.cap-volume-btn svg[hidden] {
  display: none;
}

.cap-play-btn .play-icon {
  margin-left: 1px;
}

.cap-time {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #111113;
  min-width: 64px;
  text-align: left;
}

.cap-progress-wrap {
  flex: 1;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.cap-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(0,0,0,0.12);
  border-radius: 999px;
  position: relative;
}

.cap-progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 6px;
  height: 6px;
  background: #111113;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.1s linear;
}

.cap-volume-btn,
.cap-more-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #111113;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, background 0.15s;
}

.cap-volume-btn:hover,
.cap-more-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.07);
}

/* Voiceover card action buttons */
.voice-actions {
  gap: 8px;
}

.voice-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.voice-action-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  color: #fff;
}

.asset-card .asset-body p {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.asset-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.asset-actions .btn {
  padding: 6px 10px;
  font-size: 10px;
}

/* ── Scene Cards Grid ── */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.scene-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s;
  cursor: pointer;
}

.scene-card:hover, .scene-card.active {
  border-color: rgba(66,133,244,0.3);
}

.scene-card.is-updating,
.scene-prompt-card.is-updating {
  border-color: rgba(66,133,244,0.72);
  box-shadow: 0 0 0 1px rgba(66,133,244,0.18);
}

.scene-card .scene-thumb {
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.scene-card .scene-thumb .loading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  padding: 8px;
}

.scene-card h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.scene-card p {
  margin: 0;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
}

.scene-card .scene-status {
  font-size: 10px;
  color: var(--text-faint);
}

.scene-prompts-section,
.scene-prompt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scene-prompt-card {
  gap: 10px;
}

.scene-prompt-card.active {
  border-color: rgba(66,133,244,0.3);
}

.scene-prompt-card.is-updating .scene-thumb {
  opacity: 0.84;
}

.scene-prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scene-prompt-card-head h3 {
  margin: 0 0 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.scene-prompt-card-head span {
  font-size: 10px;
  color: var(--text-faint);
}

.scene-edit-btn {
  flex-shrink: 0;
}

.scene-edit-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scene-edit-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.72);
}

.scene-narration-display {
  min-height: 64px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.64);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.scene-prompt-input {
  width: 100%;
  min-height: 112px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.78);
  font: inherit;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.scene-prompt-input:focus {
  border-color: rgba(66,133,244,0.45);
  box-shadow: 0 0 0 2px rgba(66,133,244,0.12);
}

.scene-prompt-card .scene-thumb {
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.scene-prompt-card .scene-thumb .loading-block {
  width: calc(100% - 16px);
  margin: 8px;
}

/* ── Part Cards ── */
.part-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.part-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.part-card .part-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.part-card .part-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.part-card .part-info strong {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.part-card .part-info small {
  font-size: 9px;
  color: var(--text-dim);
}

.part-card .part-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
}

.part-card .part-actions .btn {
  padding: 4px 8px;
  font-size: 9px;
}

/* ── Loading Block ── */
.loading-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 11px;
  background: rgba(255,255,255,0.01);
}

.loading-block .loading-shimmer {
  width: 42px;
  height: 30px;
  border-radius: 5px;
  flex: 0 0 auto;
}

/* ── Activity Panel ── */
.activity-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: #d8e5ff;
}

.log-list:empty { display: none; }

.log-list li::marker { color: #84a0ff; }

/* ── Range Input ── */
input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px rgba(66,133,244,0.4);
  cursor: pointer;
  border: 2px solid #fff;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px rgba(66,133,244,0.4);
  cursor: pointer;
  border: 2px solid #fff;
}

/* ── Responsive Studio ── */
@media (max-width: 1100px) {
  .studio-workspace {
    grid-template-columns: 1fr;
  }
  .slides-panel {
    display: none;
  }
  .right-panel {
    display: none;
  }
}

/* ── Voice Modal ── */
.voice-modal[hidden] { display: none !important; }

.voice-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.voice-modal .backdrop {
  position: absolute;
  inset: 0;
}

.voice-panel {
  position: relative;
  z-index: 10;
  width: min(100%, 720px);
  max-height: min(840px, calc(100vh - 48px));
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.voice-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.voice-panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.voice-panel-head .icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-panel-head .icon-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.voice-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 16px 24px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.voice-search:focus-within {
  border-color: rgba(255,255,255,0.15);
}

.voice-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.voice-search input::placeholder { color: var(--text-faint); }

.voice-search svg {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.voice-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 24px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.voice-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  flex: 1;
  min-width: 0;
}

.voice-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.voice-select-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  pointer-events: none;
  z-index: 1;
}

.voice-filters select {
  width: 100%;
  padding: 8px 28px 8px 32px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}

.voice-filters select:hover {
  border-color: rgba(255,255,255,0.15);
}

.voice-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-list::-webkit-scrollbar {
  width: 5px;
}

.voice-list::-webkit-scrollbar-track {
  background: transparent;
}

.voice-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
}

.voice-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.voice-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

.voice-card.selected {
  border-color: var(--primary);
  background: rgba(66,133,244,0.06);
}

.voice-play-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.voice-play-button:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
  transform: scale(1.05);
}

.voice-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.voice-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-card-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.voice-card-title span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding: 2px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 99px;
}

.voice-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.voice-tags span {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.voice-select-button {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}

.voice-select-button:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}

.voice-card.selected .voice-select-button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.voice-card.selected .voice-select-button:hover {
  background: var(--primary-hover);
}

.load-more-voices {
  margin: 0 24px 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.load-more-voices:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
}

.voice-modal-status {
  margin: 0 24px 16px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  flex-shrink: 0;
  line-height: 1.5;
}

/* ── Style Picker Trigger ── */
.style-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  min-height: 38px;
}

.style-picker-trigger:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.style-picker-trigger span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.style-picker-trigger svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Custom Dropdown ── */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  min-height: 38px;
}

.custom-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.custom-dropdown-trigger.active {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.custom-dropdown:has(.custom-dropdown-trigger.active) {
  z-index: 80;
}

.custom-dropdown-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.custom-dropdown-trigger svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.custom-dropdown-trigger.active svg {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 500;
  box-sizing: border-box;
  background: #18191b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-height: 200px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.home-panel .settings-grid-redesign .custom-dropdown {
  z-index: 30;
}

.home-panel .settings-grid-redesign .custom-dropdown-menu {
  top: calc(100% + 8px);
  bottom: auto;
  max-height: 220px;
  min-width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.custom-dropdown-menu.show {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.custom-dropdown-menu::-webkit-scrollbar {
  width: 4px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.custom-dropdown-option {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.custom-dropdown-option.selected {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

/* ── Style Modal ── */
.style-modal[hidden] { display: none !important; }

.style-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease;
}

.style-backdrop {
  position: absolute;
  inset: 0;
}

.style-panel {
  position: relative;
  z-index: 10;
  width: min(100%, 960px);
  max-height: min(85vh, 700px);
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Style Panel Header */
.style-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(255,255,255,0.01);
}

.style-panel-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.style-panel-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.style-panel-title span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.style-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.style-close-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}

/* Style Panel Body */
.style-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.style-panel-body::-webkit-scrollbar {
  width: 5px;
}

.style-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.style-panel-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
}

/* Style Tags */
.style-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-shrink: 0;
}

.style-tags::-webkit-scrollbar {
  display: none;
}

.style-tag {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.style-tag:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--text);
}

.style-tag.active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

/* Style List Grid */
.style-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Style Card */
.style-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  padding: 0;
  position: relative;
}

.style-card:hover {
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.style-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(66,133,244,0.15);
}

.style-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin: 8px 8px 0 8px;
  width: calc(100% - 16px);
}

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

.style-card-thumb .style-thumb-placeholder {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.08);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Selected Checkmark */
.style-checkmark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(66,133,244,0.3);
}

.style-checkmark svg {
  width: 12px;
  height: 12px;
  color: #fff;
}

/* Style Card Info */
.style-card-info {
  padding: 10px 12px;
}

.style-card-info span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.style-card:hover .style-card-info span {
  color: var(--text);
}

.style-card.selected .style-card-info span {
  color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .idea-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .recent-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .style-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .home-panel {
    padding: 20px 12px;
  }
  .hero-copy h1 {
    font-size: 28px;
  }
  .option-row {
    justify-content: stretch;
  }
  .option-pill {
    flex: 1;
    min-width: 0;
  }
  .idea-row {
    grid-template-columns: 1fr;
  }
  .recent-grid {
    grid-template-columns: 1fr;
  }
  .gen-header {
    flex-wrap: wrap;
  }
  .stepper {
    gap: 6px;
  }
  .stepper .sep {
    width: 8px;
  }
  .voice-filters {
    flex-direction: column;
    gap: 10px;
  }
  .voice-card {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }
  .style-list {
    grid-template-columns: 1fr;
  }
  .style-panel {
    max-height: 90vh;
  }
  .voice-select-button {
    grid-column: 2;
    justify-self: start;
  }
  .timeline-row {
    grid-template-columns: 1fr 60px 60px;
  }
}

/* ── Premium Generation Stopped Modal ── */
dialog.stopped-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 420px;
  width: calc(100vw - 40px);
  outline: none;
  box-shadow: none;
  overflow: visible;
  /* Centering */
  margin: auto;
}

dialog.stopped-modal::backdrop {
  background: rgba(10, 10, 15, 0.85); /* Darker backdrop */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stopped-modal-card {
  background: rgba(20, 20, 25, 0.7); /* Glassmorphic background */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modal-fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modal-fade-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stopped-modal-icon-container {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  color: #ef4444; /* Bright red */
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

.stopped-modal-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.2) 0%, transparent 70%);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.stopped-modal-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: #ffffff;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.stopped-modal-desc {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 32px 0;
}

.stopped-modal-error {
  width: 100%;
  background: rgba(20, 20, 25, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 32px;
  text-align: left;
  font-size: 13px;
  max-height: 140px;
  overflow-y: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stopped-modal-error .error-label {
  font-weight: 600;
  color: #ef4444;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.stopped-modal-error .error-message {
  color: rgba(255, 255, 255, 0.8);
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.5;
}

.stopped-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.stopped-modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stopped-modal-btn.primary {
  background: linear-gradient(135deg, #4285f4, #2b6cb0);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stopped-modal-btn.primary::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #5c9af5, #3b82f6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stopped-modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(66, 133, 244, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stopped-modal-btn.primary:hover::before {
  opacity: 1;
}

.stopped-modal-btn.primary span,
.stopped-modal-btn.primary svg {
  position: relative;
  z-index: 1;
}

/* Removed secondary button styles since we deleted the Dismiss button */
