* { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #F7F8FC;
    --surface: #FFFFFF;
    --surface-soft: #F0F2FA;
    --text: #12131A;
    --muted: #687083;
    --line: #E5E8F2;
    --accent: #7C5CFF;
    --accent-strong: #6546F0;
    --accent-soft: #EEEAFE;
    --success: #16A979;
    --warning: #F5A524;
    --shadow: 0 18px 45px rgba(34, 36, 54, 0.08);
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0F1015;
      --surface: #18191F;
      --surface-soft: #1E1F27;
      --text: #E8E9F0;
      --muted: #8B8FA8;
      --line: #2A2C38;
      --accent: #8B72FF;
      --accent-strong: #A68EFF;
      --accent-soft: #1E1830;
      --success: #0F9068;
      --warning: #D4911E;
      --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    }
  }
  body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
  }
  button, input {
    font: inherit;
  }
button.playing {
  background: var(--accent);
  color: var(--surface);
}
  button {
    border: 0;
    cursor: pointer;
  }
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  a:focus-visible {
    outline: 3px solid rgba(124, 92, 255, 0.42);
    outline-offset: 3px;
  }
  button:disabled,
  .btn:disabled {
    cursor: not-allowed;
    opacity: 0.62;
  }
  .app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 6px 14px;
    border-bottom: 1px solid var(--line);
  }
  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(124, 92, 255, 0.28);
  }
  .brand-title {
    font-weight: 800;
    letter-spacing: -0.03em;
  }
  .brand-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
  }
  .launch-badge {
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
  }
  .nav-group {
    display: grid;
    gap: 6px;
  }
  .nav-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 10px 6px;
  }
  .nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--muted);
    background: transparent;
    text-align: left;
    font-weight: 500;
  }
  .nav-item:hover {
    background: var(--surface-soft);
    color: var(--text);
  }
  .nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .nav-icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    opacity: 0.7;
  }
  .nav-item.active .nav-icon,
  .nav-item:hover .nav-icon {
    opacity: 1;
  }
  .sidebar-card {
    margin-top: auto;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
  }
  .sidebar-card h3 {
    font-size: 14px;
    margin-bottom: 6px;
  }
  .sidebar-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 12px;
  }
  .main {
    min-width: 0;
  }
  .topbar {
    height: 72px;
    background: var(--surface);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .page-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
  }
  .page-kicker {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
  }
  .top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  /* TODO: implement project/gallery search, then restore the search input */
  .topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .topbar-icon-btn:hover {
    background: var(--surface-soft);
    color: var(--text);
  }
  .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
  }
  .user-avatar:hover {
    opacity: 0.85;
  }
  .upgrade-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 13px;
    color: var(--accent-strong);
    margin-bottom: 12px;
    flex-wrap: wrap;
  }
  .upgrade-banner span {
    flex: 1;
  }
  .support-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .support-actions strong {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
  }
  .user-menu-storage {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
  }
  .storage-bar-wrap {
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    margin-bottom: 5px;
    overflow: hidden;
  }
  .storage-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
  }
  .content {
    padding: 30px 34px 46px;
  }
  .home-page-active .content {
    height: calc(100vh - 72px);
    overflow: hidden;
    padding: 22px 34px 24px;
    display: grid;
    align-content: start;
  }
  .hero-simple {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 56px 60px;
    box-shadow: var(--shadow);
  }
  .home-page-active .hero-simple {
    padding: clamp(28px, 4vh, 42px) 48px;
  }
  .hero-simple .hero-copy {
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .home-page-active .hero-simple .hero-copy {
    gap: 14px;
  }
  .hero-simple h1 {
    font-size: 44px;
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: 0;
  }
  .home-page-active .hero-simple h1 {
    max-width: 760px;
    font-size: clamp(32px, 4.2vh, 42px);
    line-height: 1.06;
  }
  .hero-simple .lead {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.65;
    max-width: 520px;
  }
  .home-page-active .hero-simple .lead {
    line-height: 1.5;
  }
  .eyebrow {
    width: fit-content;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
  }
  h1 {
    max-width: 700px;
    font-size: 52px;
    line-height: 1.02;
    letter-spacing: -0.06em;
  }
  .lead {
    max-width: 630px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
  }
  .button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .button-row.compact {
    gap: 8px;
  }
  .button-row.compact .btn {
    flex: 1;
  }
  .btn {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  }
  .btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 12px 26px rgba(124, 92, 255, 0.24);
  }
  .btn-primary:hover {
    background: var(--accent-strong);
  }
  .btn-secondary:hover {
    background: var(--line);
    color: var(--text);
  }
  .btn:active {
    transform: scale(0.97);
  }
  .btn-secondary {
    background: var(--surface-soft);
    color: var(--text);
  }
  .btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 13px;
  }
  .btn-ghost:hover {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--line);
  }
  .btn-sm {
    padding: 7px 11px;
    font-size: 13px;
  }
  .btn-render {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    font-size: 14px;
    letter-spacing: 0;
  }
  .toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--line);
    align-self: center;
  }
  .btn-danger {
    background: transparent;
    color: rgba(220, 38, 38, 1);
    border: 1px solid rgba(254, 202, 202, 1);
    font-weight: 600;
  }
  .btn-danger:hover {
    background: rgba(254, 242, 242, 1);
    border-color: rgba(252, 165, 165, 1);
  }
  .btn-danger:disabled {
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface-soft);
    opacity: 0.65;
  }
  .btn.saved {
    background: #16A34A;
    color: white;
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.22);
  }
  .btn.save-error {
    background: #DC2626;
    color: white;
  }
  .section {
    margin-top: 28px;
  }
  .section:first-of-type {
    margin-top: 20px;
  }
  .home-feature-section {
    margin-top: 14px;
  }
  .section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
  }
  .section-head h2 {
    font-size: 22px;
    letter-spacing: -0.04em;
  }
  .section-head p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 5px;
  }
  .grid {
    display: grid;
    gap: 16px;
  }
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
  .home-feature-grid {
    gap: 12px;
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
  }
  .stat-card strong {
    display: block;
    font-size: 28px;
    letter-spacing: -0.04em;
    margin-bottom: 5px;
  }
  .stat-card span, .card p, .placeholder p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
  }
  .card[data-feature-card] {
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  }
  .home-feature-grid .card[data-feature-card] {
    min-height: 0;
    padding: 14px;
  }
  .home-feature-grid .card[data-feature-card] h3 {
    font-size: 15px;
  }
  .home-feature-grid .card[data-feature-card] p {
    font-size: 12px;
    line-height: 1.42;
  }
  .card[data-feature-card]:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 12px 30px rgba(124, 92, 255, 0.12);
    transform: translateY(-2px);
  }
  .card[data-feature-card]:active {
    transform: translateY(0);
  }
  .feature-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    margin-bottom: 14px;
  }
  .home-feature-grid .feature-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 10px;
  }
  .card h3 {
    font-size: 16px;
    margin-bottom: 7px;
  }
  .pricing-header {
    max-width: 760px;
    margin-bottom: 22px;
  }
  .pricing-header h1 {
    font-size: 46px;
    margin-bottom: 12px;
  }
  .plan {
    position: relative;
    min-height: 440px;
    display: flex;
    flex-direction: column;
  }
  .plan.featured {
    border-color: var(--line);
    box-shadow: 0 22px 50px rgba(124, 92, 255, 0.16);
  }
  .badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--accent);
    color: white;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
  }
  .price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin: 18px 0 16px;
  }
  .price strong {
    font-size: 42px;
    letter-spacing: -0.06em;
  }
  .price span {
    color: var(--muted);
  }
  .features {
    display: grid;
    gap: 11px;
    margin: 18px 0 22px;
  }
  .features li {
    list-style: none;
    color: var(--muted);
    font-size: 14px;
    display: flex;
    gap: 8px;
  }
  .features li::before {
    content: "\2713";
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    margin-top: 2px;
  }
  .features li.locked {
    opacity: 0.45;
  }
  .features li.locked::before {
    content: "—";
    background: var(--surface-soft);
    color: var(--muted);
  }
  .plan .btn {
    margin-top: auto;
    width: 100%;
  }
  .placeholder {
    min-height: 420px;
    display: grid;
    place-items: center;
    text-align: center;
  }
  .placeholder-card {
    width: min(640px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 46px;
    box-shadow: var(--shadow);
  }
  .placeholder-card h1 {
    font-size: 38px;
    margin: 0 auto 12px;
  }
  .studio-shell {
    display: grid;
    gap: 14px;
  }
  .studio-toolbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
    gap: 14px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .studio-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  .studio-left h1 {
    font-size: 18px;
    letter-spacing: -0.04em;
    white-space: nowrap;
  }
  .project-name {
    width: min(360px, 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 9px 11px;
    color: var(--text);
    font-weight: 700;
  }
  .studio-center {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .studio-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
  .auto-save-status {
    align-self: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    min-width: 84px;
  }
  .auto-save-status[hidden] {
    display: none;
  }
  .mini-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }
  .studio-actions, .asset-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .control-group {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    display: grid;
    gap: 10px;
  }
  .control-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .segmented {
    display: flex;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
  }
  .segmented button {
    background: transparent;
    color: var(--muted);
    border-radius: 7px;
    padding: 7px 10px;
    font-weight: 500;
    min-width: 56px;
  }
  .segmented button.active {
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: 0 8px 18px rgba(124, 92, 255, 0.12);
  }
  .asset-tray {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    align-items: center;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .asset-label {
    padding: 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .asset-btn {
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent-strong);
    padding: 9px 12px;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
  }
  .asset-btn:hover {
    opacity: 0.82;
  }
  .asset-btn.onboarding-highlight[data-studio-add="audio"] {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18), 0 12px 28px rgba(124, 92, 255, 0.24);
  }
  .asset-btn.secondary {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
  }
  .asset-btn.secondary:hover {
    background: var(--line);
  }
  .preview-empty-onboarding {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: white;
    text-align: center;
  }
  .preview-empty-onboarding div {
    display: grid;
    gap: 10px;
  }
  .preview-empty-onboarding strong {
    font-size: 18px;
  }
  .preview-empty-onboarding ol {
    display: grid;
    gap: 5px;
    margin: 0;
    padding-left: 0;
    list-style-position: inside;
    text-align: center;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
  }
  .onboarding-highlight {
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14), 0 8px 20px rgba(124, 92, 255, 0.16);
    outline: 1px solid rgba(124, 92, 255, 0.36);
    animation: onboardingPulse 2.8s ease-in-out infinite;
  }
  .onboarding-helper {
    color: white;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(124, 92, 255, 0.18);
  }
  @keyframes onboardingPulse {
    0%, 100% {
      box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12), 0 8px 18px rgba(124, 92, 255, 0.12);
    }
    50% {
      box-shadow: 0 0 0 5px rgba(124, 92, 255, 0.18), 0 10px 22px rgba(124, 92, 255, 0.18);
    }
  }
  .editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 28vw, 420px);
    gap: 14px;
    align-items: start;
  }
  .preview-panel, .context-panel, .timeline-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .preview-panel {
    height: clamp(420px, 50vw, 520px);
    padding: 14px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .preview-stage {
    min-height: 0;
    border-radius: 14px;
    background:
      linear-gradient(135deg, rgba(124, 92, 255, 0.12), transparent 42%),
      var(--surface);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    text-align: center;
    padding: 18px;
    overflow: hidden;
  }
  .preview-stage .preview-frame {
    position: relative;
    width: min(100%, 900px);
    max-height: 100%;
    border-radius: 12px;
    background: #111827;
    overflow: hidden;
    display: grid;
    place-items: center;
  }
  .preview-stage .preview-frame[data-aspect-ratio="9:16"] {
    height: min(100%, 460px);
    width: auto;
  }
  .preview-stage .preview-frame[data-aspect-ratio="1:1"] {
    height: min(100%, 460px);
    width: auto;
  }
  .preview-stage [data-preview-canvas] {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
  }
  .preview-stage .preview-fit-background {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(22px);
    transform: scale(1.12);
    opacity: 0.82;
    pointer-events: none;
    z-index: 0;
  }
  .preview-stage .preview-image,
  .preview-stage .preview-video {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    transform-origin: center center;
    will-change: transform;
    z-index: 1;
  }
  .preview-stage .preview-transition-media {
    pointer-events: none;
    will-change: opacity, transform;
  }
  .preview-stage .preview-image[data-fill-draggable="true"],
  .preview-stage .preview-video[data-fill-draggable="true"] {
    cursor: grab;
  }
  .preview-stage .preview-image[data-fill-dragging="true"],
  .preview-stage .preview-video[data-fill-dragging="true"] {
    cursor: grabbing;
  }
  .crop-editor {
    display: grid;
    gap: 8px;
  }
  .crop-editor input[type="range"] {
    width: 100%;
  }
  .preview-stage h2 {
    display: none;
  }
  .preview-stage p {
    display: none;
  }
  .preview-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
  }
.preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}

.preview-controls input[type="range"] {
  flex: 1;
}
  .context-panel {
    width: clamp(360px, 28vw, 420px);
    height: clamp(420px, 50vw, 520px);
    padding: 14px;
    display: grid;
    align-content: start;
    gap: 10px;
    overflow: hidden;
  }
  .inspector-header {
    display: grid;
    gap: 3px;
  }
  .inspector-header h2 {
    font-size: 20px;
    letter-spacing: -0.04em;
  }
  .inspector-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 4px;
  }
  .inspector-tabs button {
    border-radius: 7px;
    padding: 8px 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
  }
  .inspector-tabs button.active {
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: 0 8px 18px rgba(124, 92, 255, 0.12);
  }
  [data-inspector-tab-panel] {
    display: grid;
    align-content: start;
    gap: 10px;
  }
  [data-inspector-tab-panel][hidden] {
    display: none;
  }
  .export-panel {
    display: grid;
    gap: 10px;
  }
  [data-inspector-normal],
  [data-inspector-lyrics-sync] {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 10px;
  }
  [data-inspector-lyrics-sync][hidden],
  [data-inspector-normal][hidden] {
    display: none;
  }
  .context-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px;
    background: var(--surface);
  }
  .context-panel .mini-control {
    align-items: stretch;
    flex-direction: column;
  }
  .context-panel .segmented button {
    min-width: 0;
    flex: 1;
  }
  .shorts-custom-control input[type="range"] {
    width: 100%;
  }
  .shorts-custom-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  .trim-control {
    display: grid;
    gap: 7px;
    width: 100%;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .trim-control input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
  }
  .trim-control-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  .caption-editor {
    display: grid;
    gap: 12px;
  }
  .caption-editor textarea,
  .caption-editor select,
  .caption-editor input[type="range"] {
    width: 100%;
  }
  .caption-editor textarea {
    min-height: 96px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    color: var(--text);
    background: var(--surface);
    line-height: 1.45;
  }
  .caption-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .caption-preset-grid button {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    padding: 9px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
  }
  .caption-preset-grid button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    box-shadow: 0 8px 18px rgba(124, 92, 255, 0.12);
  }
  .caption-control-grid,
  .caption-range-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .caption-control-grid .control-line,
  .caption-range-grid .control-line {
    margin-top: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 8px;
    min-height: 42px;
  }
  .caption-range-grid {
    grid-template-columns: 1fr;
  }
  .caption-range-grid input[type="range"] {
    accent-color: var(--accent);
  }
  .caption-position-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .caption-position-row button {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 7px 8px;
    font-weight: 700;
  }
  .caption-position-row button.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--line);
  }
  .transition-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
    max-height: 260px;
    overflow: auto;
    padding-right: 2px;
  }
  .transition-preset-grid button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    padding: 8px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
  }
  .transition-preset-grid button::before,
  .transition-preset-grid button::after {
    content: none;
  }
  .transition-preset-grid button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    box-shadow: 0 8px 18px rgba(124, 92, 255, 0.12);
  }
  .context-group strong {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
  }
  .context-group span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }
  .control-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
  }
  .fake-input, .fake-select {
    min-width: 92px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 700;
  }
  .swatches {
    display: flex;
    gap: 6px;
    margin-top: 8px;
  }
  .swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--line);
  }
  .timeline-panel {
    padding: 12px 14px;
    overflow-x: auto;
  }
  .timeline-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
  }
  .timeline-head h2 {
    font-size: 18px;
  }
  .timeline-head .page-kicker {
    margin-top: 2px;
    font-size: 12px;
  }
  .timeline-canvas {
    position: relative;
    min-width: 900px;
    display: grid;
    gap: 8px;
    padding-top: 30px;
  }
  .time-ruler {
    position: absolute;
    inset: 0 0 auto 0;
    height: 28px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
  }
  .time-ruler span {
    border-left: 1px solid var(--line);
    padding-left: 6px;
    flex: 1;
  }
  .playhead {
    position: absolute;
    top: 2px;
    left: 28%;
    width: 66px;
    height: 214px;
    transform: translateX(-33px);
    display: grid;
    justify-items: center;
    z-index: 2;
    pointer-events: none;
  }
  output.fake-input {
    display: inline-flex;
    align-items: center;
  }
  .playhead-knob {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: ew-resize;
    margin: 0 auto;
    pointer-events: auto;
    user-select: none;
  }
  .playhead-line {
    width: 2px;
    flex: 1;
    background: var(--accent);
    pointer-events: none;
  }
  .track-row {
    height: 42px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    display: grid;
    grid-template-columns: 120px 1fr;
    overflow: hidden;
  }
  .track-label {
    background: var(--surface-soft);
    border-right: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding: 0 12px;
  }
  .track-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    min-height: 0;
  }
  .clip {
    height: 28px;
    border-radius: 7px;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: pointer;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  }
  .clip:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 18px rgba(124, 92, 255, 0.14);
  }
  .clip.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2), 0 10px 24px rgba(124, 92, 255, 0.18);
    transform: translateY(-1px);
  }
  .clip.video { width: 170px; }
  .clip.image { width: 135px; }
  .clip.audio {
    width: 460px;
    background: rgba(15, 144, 104, 0.14);
    border-color: rgba(15, 144, 104, 0.35);
    color: var(--success);
  }
  .clip.text {
    width: 320px;
    background: #FFF6E6;
    border-color: #FFE0A8;
    color: #B76B00;
  }
  .clip.caption {
    width: 360px;
    background: #EEF2FF;
    border-color: #CDD6FF;
    color: #4F46E5;
  }
  .lyrics-sync-panel {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 10px;
    display: grid;
    gap: 8px;
    min-height: 0;
  }
  .lyrics-sync-panel h3 {
    font-size: 14px;
  }
  .lyrics-sync-list {
    display: grid;
    gap: 6px;
    max-height: 330px;
    overflow-y: auto;
    padding-right: 2px;
  }
  .lyrics-sync-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    background: var(--surface-soft);
    color: var(--text);
    font-family: "Noto Sans Devanagari", "Mangal", "Nirmala UI", Arial, sans-serif;
    font-size: 12px;
    line-height: 1.45;
  }
  .lyrics-sync-line > div {
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .lyrics-sync-time {
    color: var(--muted);
    font-size: 12px;
    min-width: 42px;
    text-align: right;
  }
.preview-caption {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    max-width: 86%;
    color: white;
    background: rgba(0, 0, 0, 0.62);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 24px;
    line-height: 1.6;
    text-align: center;
    font-family: "Noto Sans Devanagari", "Mangal", "Nirmala UI", Arial, sans-serif;
    pointer-events: none;
    z-index: 2;
  }
  .clip.overlay {
    width: 190px;
    background: #FDF2F8;
    border-color: #FBCFE8;
    color: #BE185D;
  }
  .tools-shell {
    display: grid;
    gap: 16px;
  }
  .tools-header {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .pill-switch {
    display: flex;
    width: fit-content;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px;
    gap: 5px;
  }
  .pill-switch button {
    min-width: 96px;
    padding: 9px 18px;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
  }
  .pill-switch button.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 22px rgba(124, 92, 255, 0.22);
  }
  .tool-mode {
    display: none;
  }
  .tool-mode.active {
    display: grid;
    gap: 16px;
  }
  .tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
  }
  .tool-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .tool-card h2, .tool-card h3 {
    letter-spacing: -0.03em;
  }
  .tool-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
  }
  .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;
  }
  .ai-tools-page {
    display: grid;
    gap: 18px;
  }
  .ai-tools-header,
  .ai-workspace-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .ai-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    padding: 22px;
  }
  .ai-tools-header h2 {
    margin: 4px 0 6px;
    font-size: 28px;
    letter-spacing: -0.02em;
  }
  .ai-tools-header p {
    color: var(--muted);
    line-height: 1.55;
  }
  .ai-state-pill {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    transition: background 0.2s, color 0.2s;
    flex: 0 0 auto;
  }
  .ai-state-pill[data-state="generating"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
  }
  .ai-state-pill[data-state="ready"] {
    background: rgba(22, 169, 121, 0.12);
    color: var(--success);
    border-color: rgba(22, 169, 121, 0.3);
  }
  .ai-state-pill[data-state="error"] {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.25);
  }
  .ai-workspace-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .ai-tool-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }
  .ai-tool-chip {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }
  .ai-tool-chip:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--accent);
  }
  .ai-tool-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 700;
  }
  .ai-tool-chip[aria-selected="false"] {
    background: var(--surface-soft) !important;
    color: var(--muted) !important;
    border-color: var(--line) !important;
    font-weight: 500;
  }
  .ai-tool-chip[aria-selected="true"] {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
    font-weight: 700;
  }
  .tool-lock {
    font-size: 13px;
    line-height: 1;
  }
  .ai-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
  }
  .ai-panel {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .ai-panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
  }
  .ai-panel-head span,
  .ai-field-label,
  .ai-select-field span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
  }
  .ai-panel-head h3 {
    margin-top: 3px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
  }
  .ai-tool-input {
    width: 100%;
    min-height: 180px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
  }
  .ai-tool-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
  }
  .ai-tool-output {
    width: 100%;
    flex: 1;
    min-height: 180px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
  }
  .ai-tool-output::placeholder {
    color: var(--muted);
    opacity: 0.55;
  }
  .ai-helper-text {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
  }
  .ai-char-count {
    text-align: right;
    font-size: 11px;
    color: var(--muted);
    margin-top: -8px;
  }
  .ai-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .ai-select-field {
    display: grid;
    gap: 7px;
  }
  .ai-select-field .fake-select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 11px;
    color: var(--text);
    font-size: 14px;
    appearance: auto;
  }
  .ai-generate-btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 4px;
  }
  .ai-output-wrap {
    position: relative;
    flex: 1;
  }
  .ai-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
  }
  .ai-empty-state-locked {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 9px;
  }
  .ai-lock-sign {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 22px;
  }
  .ai-empty-state-locked strong {
    color: var(--text);
    font-size: 18px;
  }
  .ai-empty-state-locked span:last-child {
    max-width: 320px;
    line-height: 1.5;
  }
  .ai-output-wrap.has-output .ai-empty-state {
    display: none;
  }
  .ai-status {
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--muted);
  }
  .ai-status.success {
    color: var(--success);
  }
  .ai-status.error {
    color: #dc2626;
  }
  .ai-output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
  }
  .ai-output-actions .btn {
    flex: 1;
    text-align: center;
    font-size: 13px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
  }
  .source-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }
  .source-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 14px;
    min-height: 96px;
    color: var(--text);
    text-align: left;
  }
  .source-card.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .source-card strong {
    display: block;
    margin-bottom: 6px;
  }
  .source-picker-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 92px;
    position: relative;
  }
  .source-picker-card.active::after {
    content: "\2713";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
  }
  .source-picker-thumb {
    width: 112px;
    height: 64px;
    border-radius: 8px;
    background: var(--text);
    object-fit: cover;
  }
  .source-picker-details {
    display: grid;
    gap: 4px;
    min-width: 0;
  }
  .source-picker-details span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }
  .tool-preview {
    min-height: 230px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background:
      linear-gradient(135deg, rgba(124, 92, 255, 0.12), transparent 44%),
      var(--surface);
    display: grid;
    place-items: center;
    text-align: center;
    padding: 18px;
    position: relative;
    overflow: hidden;
  }
  .tool-preview h2 {
    font-size: 24px;
    margin-bottom: 8px;
  }
  .tool-preview video {
    width: 100%;
    max-height: 230px;
    border-radius: 10px;
    background: #111827;
  }
  .loop-preview > video:not(.loop-preview-bg) {
    width: auto;
    max-width: 100%;
    height: 230px;
    object-fit: contain;
    position: relative;
    z-index: 1;
  }
  .loop-preview-bg {
    position: absolute;
    inset: -24px;
    width: calc(100% + 48px) !important;
    height: calc(100% + 48px) !important;
    max-height: none !important;
    object-fit: cover;
    filter: blur(22px);
    opacity: 0.45;
    transform: scale(1.06);
    z-index: 0;
  }
  .loop-preview-overlay {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: white;
    font-weight: 700;
    font-size: 12px;
  }
  .loop-preview-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .loop-preview-scrubber {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .loop-preview-scrubber input {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
  }
  .loop-strip {
    display: grid;
    gap: 6px;
    margin-top: 10px;
  }
  .loop-strip-track {
    display: flex;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
  }
  .loop-strip-segment {
    display: grid;
    place-items: center;
    min-width: 68px;
    border-right: 1px solid var(--line);
    background: rgba(124, 92, 255, 0.12);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 700;
  }
  .loop-strip-segment:last-child {
    border-right: 0;
  }
  .loop-strip-markers {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
  .loop-source-summary {
    display: grid;
    gap: 10px;
  }
  .loop-source-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }
  .loop-source-thumb {
    width: 150px;
    height: 84px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #111827;
    object-fit: contain;
  }
  .loop-source-meta {
    display: grid;
    gap: 6px;
    min-width: 0;
    text-align: left;
  }
  .loop-source-meta .fake-input {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mix-sequence {
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }
  .mix-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    padding: 10px;
  }
  .mix-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 87, 255, 0.12);
  }
  .mix-card video {
    width: 112px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: #111827;
  }
  .mix-card-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-weight: 600;
  }
  .mix-card-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
  }
  .mix-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .mix-card-actions button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 7px 9px;
    font-weight: 700;
  }
  .mix-card-actions button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-strong);
  }
  .mix-card-actions button:disabled {
    background: var(--surface);
    color: var(--muted);
  }
  .mix-preview > video:not(.loop-preview-bg) {
    width: auto;
    max-width: 100%;
    height: 230px;
    object-fit: contain;
    position: relative;
    z-index: 1;
  }
  .loop-preview-toggle {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 2;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  }
  .speed-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }
  .speed-presets button, .small-pill {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 11px;
    color: var(--text);
    font-weight: 700;
  }
  .speed-presets button.active, .small-pill.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--line);
  }
  .placeholder-slider {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 45%, var(--accent-soft) 45%);
    margin-top: 12px;
  }
  .option-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
  }
  .mock-field {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 11px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }
  .tool-note {
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
  }
  .sequence-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    margin-top: 14px;
  }
  .sequence-card {
    flex: 0 0 160px;
    min-height: 112px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(160deg, var(--surface), var(--accent-soft));
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .drag-hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 10px;
  }
  .tool-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
  }
  .library-shell {
    display: grid;
    gap: 16px;
  }
  .library-header {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .library-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(34, 36, 54, 0.04);
  }
  .gallery-panel {
    display: none;
  }
  .gallery-panel.active {
    display: block;
  }
  .asset-grid, .project-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
  }
  .asset-card, .project-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    padding: 12px;
    display: grid;
    gap: 10px;
  }
  .asset-card {
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
  }
  .asset-card:hover {
    transform: translateY(-1px);
    border-color: var(--line);
  }
  .asset-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
    background: var(--surface);
  }
  .asset-thumb {
    min-height: 118px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background:
      linear-gradient(135deg, rgba(124, 92, 255, 0.14), transparent 50%),
      var(--accent-soft);
    display: grid;
    place-items: center;
    color: var(--accent-strong);
    font-weight: 700;
    overflow: hidden;
  }
  .library-title {
    font-size: 34px;
    margin-top: 10px;
  }
  .library-lead {
    font-size: 14px;
    margin-top: 8px;
  }
  .spacing-top-sm {
    margin-top: 12px;
  }
  .spacing-top-md {
    margin-top: 16px;
  }
  .spacing-top-note {
    margin-top: 14px;
  }
  .asset-thumb video {
    width: 100%;
    height: 118px;
    object-fit: cover;
  }
  video.asset-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
  }
  .vf-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.42);
    padding: 20px;
  }
  .vf-modal[hidden] {
    display: none;
  }
  .vf-modal-card {
    width: min(640px, 100%);
    max-height: 80vh;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    padding: 20px;
    display: grid;
    gap: 16px;
  }
  .vf-modal-card-small {
    width: min(420px, 100%);
  }
  .vf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .vf-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
  .modal-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
  }
  .vf-modal-card-small {
    width: min(320px, calc(100vw - 32px));
  }
  .auth-tabs {
    margin-bottom: 16px;
  }
  .auth-field {
    margin-bottom: 12px;
  }
  .auth-field label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--muted);
  }
  .auth-field input {
    font-size: 14px;
  }
  .auth-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
    text-align: center;
  }
  .auth-guest-note {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 12px;
    text-align: center;
  }
  .auth-guest-note p {
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px;
  }
  .user-menu-content {
    padding: 4px 0;
  }
  .user-menu-email {
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
  }
  .user-menu-plan {
    font-size: 12px;
    color: var(--muted);
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
  }
  .user-menu-content .btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .auth-signout {
    color: rgba(220, 38, 38, 1);
  }
  .feedback-form {
    display: grid;
    gap: 12px;
  }
  .feedback-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }
  .feedback-form textarea {
    min-height: 76px;
    resize: vertical;
  }
  .qa-log-panel {
    display: grid;
    gap: 14px;
  }
  .qa-checklist {
    display: grid;
    gap: 8px;
  }
  .qa-checklist-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    background: var(--surface);
  }
  .qa-checklist-row strong {
    font-size: 13px;
  }
  .qa-checklist-row button {
    padding: 7px 10px;
    font-size: 12px;
  }
  .qa-checklist-row button.active-pass {
    background: #E9FBEF;
    color: #147A3D;
    border-color: #BDEACB;
  }
  .qa-checklist-row button.active-fail {
    background: #FFF1F0;
    color: #B42318;
    border-color: #FFD0CC;
  }
  .qa-notes-label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }
  .qa-notes-label textarea {
    min-height: 90px;
    resize: vertical;
  }
  .help-steps {
    display: grid;
    gap: 12px;
  }
  .help-steps ol {
    margin: 0;
    padding-left: 22px;
    color: var(--text);
    font-weight: 700;
    line-height: 1.8;
  }
  .help-steps p {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .asset-card strong, .project-card strong {
    font-size: 14px;
  }
  .meta-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
  }
  .empty-state {
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--muted);
    padding: 22px;
    text-align: center;
    margin-top: 14px;
    font-weight: 700;
  }
  .login-prompt-copy {
    margin-bottom: 12px;
  }
  .login-prompt-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
  }
  .inline-warning {
    color: #8A5B00;
    font-size: 12px;
    font-weight: 700;
  }
  .inline-warning.success {
    color: #147A3D;
  }
  .inline-warning.error {
    color: #B42318;
  }
  .project-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .project-card {
    min-height: 178px;
  }
  .project-title-input {
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    min-width: 0;
  }
  .project-badge {
    width: fit-content;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 700;
  }
  .local-output-warning {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
  }
  .launch-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #D8D1FF;
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    padding: 10px;
    margin: 10px 0;
  }
  .launch-notice[hidden] {
    display: none;
  }
  .launch-notice .btn {
    padding: 6px 9px;
    font-size: 11px;
    white-space: nowrap;
  }
  .project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
  }
  .project-actions .btn {
    padding: 9px 11px;
    font-size: 12px;
  }
  .output-cleanup-panel {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }
  .output-file-list {
    display: grid;
    gap: 8px;
  }
  .output-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: var(--surface);
  }
  .output-file-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }
  .output-file-row span {
    color: var(--muted);
    font-size: 12px;
  }
  .gallery-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
  }
  .gallery-manager {
    display: grid;
    gap: 16px;
  }
  .gallery-manager-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .gallery-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .gallery-filter-tabs button {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    padding: 8px 12px;
    font-weight: 700;
  }
  .gallery-filter-tabs button:hover {
    color: var(--text);
    border-color: var(--accent);
  }
  .gallery-filter-tabs button.active {
    border-color: var(--line);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .gallery-search {
    width: min(320px, 100%);
    color: var(--text);
  }
  .gallery-manager-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(340px, 1.15fr);
    gap: 16px;
    align-items: start;
  }
  .gallery-list-shell,
  .gallery-detail-panel {
    min-height: 460px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }
  .gallery-list {
    display: grid;
    align-content: start;
    max-height: 620px;
    overflow: auto;
    padding: 8px;
  }
  .gallery-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    padding: 8px;
    text-align: left;
  }
  .gallery-row:hover,
  .gallery-row[aria-selected="true"] {
    border-color: var(--line);
    background: var(--surface);
  }
  .gallery-row-thumb {
    width: 52px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
  .gallery-row-thumb img,
  .gallery-row-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .gallery-row-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 14px;
  }
  .gallery-row-meta,
  .gallery-row-submeta {
    color: var(--muted);
    font-size: 12px;
  }
  .gallery-row-type {
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
  }
  .gallery-detail-panel {
    display: grid;
    gap: 14px;
    padding: 14px;
  }
  .gallery-preview {
    min-height: 260px;
    border-radius: 12px;
    background: var(--surface-soft);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
  }
  .gallery-preview img,
  .gallery-preview video {
    max-width: 100%;
    max-height: 380px;
    object-fit: contain;
  }
  .gallery-preview audio {
    width: min(520px, 100%);
    color-scheme: dark;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .gallery-detail-title {
    display: grid;
    gap: 4px;
  }
  .gallery-detail-title h2 {
    overflow-wrap: anywhere;
    color: var(--text);
  }
  .gallery-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .gallery-detail-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    padding: 10px;
  }
  .gallery-detail-item span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .gallery-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .gallery-danger {
    color: #B42318;
  }
  .selection-count {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }
  .drop-placeholder {
    border: 1px dashed var(--line);
    background: var(--surface);
    color: var(--accent-strong);
    font-weight: 700;
    border-radius: 8px;
    padding: 8px 14px;
    min-width: 180px;
    text-align: center;
  }
  @media (max-width: 900px) {
    .ai-panels,
    .ai-workspace-card {
      grid-template-columns: 1fr;
    }
  }
  @media (max-width: 980px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
      position: relative;
      height: auto;
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }
    .nav-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { position: relative; padding: 18px; height: auto; align-items: start; gap: 16px; }
    .top-actions { display: none; }
    .content { padding: 22px 18px 36px; }
    .hero-simple { padding: 36px 28px; }
    h1 { font-size: 38px; }
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .editor-grid { grid-template-columns: 1fr; }
    .context-panel { width: 100%; height: auto; max-height: 520px; }
    .preview-panel { height: auto; min-height: 420px; }
    .studio-toolbar { grid-template-columns: 1fr; align-items: start; }
    .studio-center { flex-wrap: wrap; }
    .tools-header { align-items: start; flex-direction: column; }
    .tool-grid { grid-template-columns: 1fr; }
    .ai-tools-header { flex-direction: column; }
    .ai-panels { grid-template-columns: 1fr; }
    .source-row { grid-template-columns: 1fr; }
    .library-header { align-items: start; flex-direction: column; }
    .asset-grid, .project-grid { grid-template-columns: 1fr; }
    .gallery-manager-grid { grid-template-columns: 1fr; }
    .gallery-manager-toolbar { align-items: stretch; flex-direction: column; }
    .gallery-search { width: 100%; }
  }
  @media (max-width: 620px) {
    .ai-workspace-card,
    .ai-panel,
    .ai-tools-header {
      padding: 14px;
    }
    .ai-options-grid {
      grid-template-columns: 1fr;
    }
    .ai-tool-input {
      min-height: 180px;
    }
    .ai-tool-output {
      min-height: 230px;
    }
    .ai-output-actions,
    .ai-generate-btn {
      width: 100%;
    }
    .ai-output-actions .btn,
    .ai-generate-btn {
      justify-content: center;
    }
    .caption-preset-grid,
    .caption-control-grid,
    .transition-preset-grid {
      grid-template-columns: 1fr;
    }
  }


