:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #12161c;
  --surface-2: #171c23;
  --surface-3: #1d242d;
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --panel2: var(--surface-2);
  --text: #f4f7fb;
  --muted: #9aa6b5;
  --muted-2: #c3cad4;
  --line: #29313d;
  --border: var(--line);
  --primary: #4f8cff;
  --primary-hover: #6fa2ff;
  --primary-deep: #ffffff;
  --primaryDeep: #ffffff;
  --accent: #2fc7a3;
  --warn: #f5b84b;
  --danger: #ff6b6b;
  --buttonBg: #1c2633;
  --buttonText: var(--text);
  --button-border: #364355;
  --buttonBorder: #364355;
  --ghostBg: rgba(255, 255, 255, 0.04);
  --ghostBorder: rgba(255, 255, 255, 0.12);
  --glass: rgba(18, 22, 28, 0.86);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --radius-sm: 6px;
  --container: 1180px;
  --yt: #ff4d4f;
  --tt: #2fd3e0;
  --ig: #ec4899;
  --fb: #3b82f6;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% -10%, rgba(79, 140, 255, 0.13), transparent 34rem),
    radial-gradient(circle at 100% 0%, rgba(47, 199, 163, 0.09), transparent 28rem),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

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

.container {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 24px;
}

header,
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  /* Solid instead of a blur: backdrop blur is recalculated on every scroll and lags on slower devices. */
  background: rgba(11, 13, 16, 0.97);
}

header .container,
.site-header .container {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand,
.logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand img,
.logo img {
  display: block;
  width: auto;
  height: 44px;
  max-width: min(220px, 52vw);
  object-fit: contain;
  border-radius: var(--radius-sm);
}

nav,
.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

nav a,
.site-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

nav a:hover,
.site-nav a:hover,
nav a.active,
.site-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.15;
}

h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.2;
}

h4 {
  margin: 0 0 8px;
}

p {
  margin: 0 0 14px;
}

.muted,
.muted-text,
.text-muted,
.pricing-subtitle {
  color: var(--muted);
}

.page-hero,
.hero-band,
.storyboard-hero,
.studio-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 28px 0 18px;
  margin: 0 0 8px;
}

.page-hero p,
.hero-band p,
.storyboard-hero p,
.studio-hero p {
  max-width: 740px;
  color: var(--muted);
}

.card,
.panel,
.video-card,
.dashboard-section,
.storyboard-panel,
.storyboard-card,
.studio-card,
.pricing-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel,
.card,
.video-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card:hover,
.video-card:hover {
  border-color: #3a4657;
}

.card-head,
.timeline-header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head h2,
.card-head h3,
.timeline-header h2,
.studio-card h3,
.storyboard-panel h2,
.storyboard-panel h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

button,
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--buttonBorder);
  border-radius: var(--radius-sm);
  background: var(--buttonBg);
  color: var(--buttonText);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
}

button:hover,
.btn:hover {
  border-color: #506073;
  background: #243041;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.primary,
.btn-primary,
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.primary:hover,
.btn-primary:hover,
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.secondary,
.btn-secondary,
.btn.secondary {
  background: var(--ghostBg);
  border-color: var(--ghostBorder);
  color: var(--text);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.28);
  color: #ff9c9c;
}

.primary-link {
  color: var(--primary-hover);
  font-weight: 750;
}

label,
.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select,
.form-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0f141a;
  color: var(--text);
  font: inherit;
}

textarea,
textarea.autosize {
  min-height: 110px;
  resize: vertical;
}

select {
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-actions,
.video-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.tabs,
.toggle-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.toggle-btn {
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.toggle-btn.active {
  background: rgba(79, 140, 255, 0.18);
  color: var(--text);
}

.upload-drop,
.upload-zone,
.empty-preview,
.empty-state {
  border: 1px dashed #3a4657;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
}

.upload-drop,
.upload-zone {
  padding: 28px;
  cursor: pointer;
}

.upload-drop.dragover,
.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.08);
}

.upload-zone.has-video {
  padding: 16px;
  cursor: default;
  border-style: solid;
}

.upload-drop-icon,
.empty-state-icon {
  color: var(--primary);
  font-size: 28px;
  line-height: 1;
  margin-bottom: 8px;
}

.upload-drop-text {
  color: var(--text);
  font-weight: 800;
}

.upload-drop-info {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.video-card video,
video {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050608;
  object-fit: cover;
}

.video-card-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.video-card-meta {
  color: var(--muted);
  font-size: 12px;
}

#library-grid,
.videos-grid,
#images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.empty-state {
  padding: 44px 24px;
  color: var(--muted);
}

.dashboard-frame {
  display: grid;
  gap: 18px;
}

.section-grid,
.storyboard-shell,
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.pipeline-list,
.stats-grid,
.pricing-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.pipeline-item,
.stat,
.platform-row,
.summary-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.pipeline-item {
  min-height: 164px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.pipeline-item p,
.stat .sub {
  color: var(--muted);
  font-size: 13px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px;
}

.summary-label {
  min-width: 0;
}

.summary-label strong {
  display: block;
  color: var(--text);
}

.summary-label span {
  color: var(--muted);
  font-size: 12px;
}

.summary-value {
  color: var(--text);
  font-weight: 850;
  text-align: right;
}

.stat {
  padding: 16px;
}

.stat .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.stat .sub {
  display: block;
  margin-top: 8px;
}

.storyboard-shell {
  align-items: start;
}

.storyboard-panel,
.storyboard-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.storyboard-panel .btn {
  width: 100%;
}

.preview-player {
  min-width: 0;
}

.empty-preview {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.control-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted-2);
}

.control-btn.main {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.timeline-area,
#timeline-clips {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.timeline-area {
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-clip,
.timeline-add {
  flex: 0 0 auto;
  width: 106px;
  height: 88px;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
}

.timeline-clip.active {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.14);
  color: var(--text);
}

.timeline-clip-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 24px;
  padding: 2px 7px;
  display: none;
  color: #ffc1c1;
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.2);
}

.timeline-clip:hover .timeline-clip-delete {
  display: inline-flex;
}

.timeline-add {
  width: 48px;
  color: var(--primary-hover);
  border-style: dashed;
  font-size: 24px;
}

.storyboard-footer {
  display: flex;
  justify-content: flex-end;
  padding: 18px 0 0;
}

.studio-grid {
  margin-top: 12px;
}

.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}

.platform-row + .platform-row {
  margin-top: 8px;
}

.platform-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.thumbnail-canvas-container {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050608;
}

.thumbnail-canvas-container canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pro-tip-banner {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(245, 184, 75, 0.26);
  border-radius: var(--radius);
  background: rgba(245, 184, 75, 0.08);
  color: var(--muted-2);
  font-size: 13px;
}

.pro-tip-banner span {
  color: var(--warn);
  font-weight: 900;
}

.publish-btn {
  width: 100%;
  margin-top: 16px;
}

.pricing-section {
  margin-top: 28px;
}

.pricing-title {
  margin: 0 0 8px;
}

.pricing-tier {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pricing-price,
.plan-price {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 900;
}

.pricing-price span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.pricing-desc,
.faq-a {
  color: var(--muted);
}

.pricing-features,
.features-list {
  margin: 12px 0 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted-2);
}

.pricing-features li,
.features-list li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 22px;
}

.pricing-features li::before,
.features-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.68);
}

.modal-content {
  width: min(100%, 430px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-content.lg {
  width: min(100%, 760px);
}

.btn-close {
  min-height: 34px;
  padding: 4px 10px;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.modal-footer .right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  display: none;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow);
}

footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.checkout-container {
  width: min(100%, 860px);
  margin: 40px auto;
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.hero p {
  color: var(--muted);
  max-width: 780px;
}

.how-it-works,
.loved-by,
.testimonial-card,
.creator-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.how-it-works {
  padding: 16px;
}

.how-it-works-list {
  margin: 0 0 8px;
  padding-left: 18px;
  color: var(--muted);
}

.super-logo {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050608;
  object-fit: contain;
}

.loved-by,
.testimonials {
  margin-top: 32px;
}

.loved-by {
  padding: 20px;
}

.creators-grid,
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.creator-card {
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
}

.creator-img {
  width: 120px;
  height: 84px;
  object-fit: cover;
}

.creator-info,
.testimonial-card {
  padding: 14px;
}

.creator-role,
.testimonial-author {
  color: var(--text);
  font-weight: 800;
}

.creator-desc,
.testimonial-card {
  color: var(--muted);
}

.image-option {
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.image-option img {
  display: block;
  width: 100%;
  height: auto;
}

.hidden,
.display-none {
  display: none !important;
}

.block,
.display-block {
  display: block !important;
}

.flex {
  display: flex !important;
}

.text-center {
  text-align: center;
}

.text-decoration-none {
  text-decoration: none;
}

.w-full {
  width: 100%;
}

.bg-black {
  background: #000;
}

.border-ghost {
  border-color: var(--ghostBorder);
}

.mt-0 { margin-top: 0; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-32 { margin-top: 32px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-18 { margin-bottom: 18px; }
.my-12 { margin-top: 12px; margin-bottom: 12px; }
.m-0 { margin: 0; }
.p-40 { padding: 40px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.rounded-8 { border-radius: var(--radius); }
.ml-12 { margin-left: 12px; }
.video-title-input { flex: 1 1 220px; min-width: 0; }

@media (min-width: 768px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  }

  .section-grid {
    grid-template-columns: 1.25fr 0.95fr;
  }

  .storyboard-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .studio-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 16px;
  }

  header .container,
  .site-header .container {
    min-height: auto;
    align-items: flex-start;
  }

  nav,
  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  nav a,
  .site-nav a,
  .btn,
  button {
    min-height: 38px;
  }

  .page-hero,
  .hero-band,
  .storyboard-hero,
  .studio-hero {
    align-items: flex-start;
    padding-top: 22px;
  }

  .summary-row,
  .footer-inner {
    align-items: flex-start;
  }

  .storyboard-footer .btn,
  .pipeline-item .btn {
    width: 100%;
  }
}

/* ===================== FrameIXS v2.1 additions ===================== */

/* Header / nav */
.site-nav .nav-links,
.site-nav .nav-auth {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav .nav-auth {
  gap: 8px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.nav-toggle {
  display: none;
  width: 42px;
  min-height: 40px;
  padding: 0;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.account-menu {
  position: relative;
}

.account-btn {
  min-height: 38px;
  padding: 4px 10px 4px 4px;
  gap: 8px;
  border-radius: 999px;
  background: var(--ghostBg);
  border-color: var(--ghostBorder);
}

.avatar {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.account-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 240px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.account-dropdown a,
.account-dropdown button {
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 650;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.account-meta {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.account-meta span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.plan-chip {
  justify-self: start;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 199, 163, 0.14);
  color: var(--accent) !important;
  font-size: 11px;
  font-weight: 800;
}

/* Toast states */
.toast[data-kind="error"] { border-color: rgba(255, 107, 107, 0.45); }
.toast[data-kind="ok"] { border-color: rgba(47, 199, 163, 0.45); }

.loading {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(79, 140, 255, 0.06);
  font-size: 13px;
}

/* CinaFlux page */
.generate-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

@media (min-width: 900px) {
  .generate-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}

.engine-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 140, 255, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(79, 140, 255, 0.12), rgba(47, 199, 163, 0.06));
}

.engine-badge strong {
  display: block;
  font-size: 16px;
}

.engine-badge span {
  color: var(--muted);
  font-size: 12px;
}

.engine-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 199, 163, 0.16);
}

.demo-chip {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid rgba(245, 184, 75, 0.35);
  border-radius: 999px;
  color: var(--warn) !important;
  font-size: 11px !important;
  font-weight: 800;
  white-space: nowrap;
}

#video-container video,
#master-video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

/* Distributor source */
.source-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.14);
  color: var(--primary-hover);
  font-size: 12px;
  font-weight: 800;
}

.source-chip[data-state="empty"] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.source-card .empty-state {
  margin-top: 12px;
}

.source-card video {
  margin-top: 12px;
}

.source-clips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
}

.source-clip {
  flex: 0 0 auto;
  max-width: 220px;
  min-height: 34px;
  padding: 6px 10px;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  background: var(--ghostBg);
  border-color: var(--ghostBorder);
}

.source-clip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-clip strong {
  color: var(--primary-hover);
}

.source-clip.active {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.14);
  color: var(--text);
}

.source-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.source-status {
  color: var(--muted);
  font-size: 12px;
}

/* Thumbnail Lab */
.thumbnail-canvas-container {
  margin-top: 12px;
}

.thumb-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.thumb-tools .form-input {
  flex: 1 1 220px;
  width: auto;
}

.ima-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.ima-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ima-head h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.ima-head p {
  margin: 0;
  font-size: 13px;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.status-pill::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.status-pill[data-state="online"] { background: rgba(47, 199, 163, 0.14); color: var(--accent); }
.status-pill[data-state="offline"] { background: rgba(245, 184, 75, 0.12); color: var(--warn); }

.ima-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(245, 184, 75, 0.26);
  border-radius: var(--radius-sm);
  background: rgba(245, 184, 75, 0.06);
  color: var(--muted-2);
  font-size: 13px;
}

.ima-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ima-results:empty {
  display: none;
}

.ima-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.ima-result.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.25);
}

.ima-result .btn {
  min-height: 34px;
  font-size: 13px;
}

.ima-result-img {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  aspect-ratio: 16 / 9;
  background: #050608;
}

.ima-result-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--warn);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.preview-badge.ai {
  color: var(--accent);
}

.ima-settings {
  margin-top: 14px;
  font-size: 13px;
}

.ima-settings summary {
  cursor: pointer;
  color: var(--muted-2);
  font-weight: 750;
}

.ima-settings p {
  margin: 8px 0;
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.thumb-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

.thumb-mini img {
  width: 112px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.publish-log {
  margin-top: 12px;
}

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

.ok-text {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.publish-summary {
  display: grid;
  gap: 8px;
}

.publish-summary .summary-value {
  max-width: 60%;
  overflow-wrap: anywhere;
}

label.platform-row {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.timeline-clip {
  width: 132px;
  padding: 8px;
}

.timeline-clip-label {
  display: grid;
  gap: 2px;
  text-align: center;
  min-width: 0;
  width: 100%;
}

.timeline-clip-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}

.summary-clip {
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth pages */
.auth-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 220px);
  padding-top: 40px;
}

@media (min-width: 900px) {
  .auth-page { grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 56px; }
}

.auth-aside h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 18px 0 10px;
}

.auth-aside p {
  color: var(--muted);
  font-size: 16px;
}

.auth-points {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: grid;
  gap: 2px;
  padding: 12px 14px 12px 40px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.auth-points li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.auth-points span {
  color: var(--muted);
  font-size: 13px;
}

.auth-card {
  padding: 26px;
  gap: 12px;
}

.auth-card h1 {
  font-size: 30px;
  margin: 6px 0 2px;
}

.auth-card > p.muted,
#login-view > p.muted,
#forgot-view > p.muted {
  margin: 0 0 6px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.auth-switch a {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.auth-switch a.active {
  background: rgba(79, 140, 255, 0.18);
  color: var(--text);
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 0;
  min-width: 0;
}

.optional {
  color: var(--muted);
  font-weight: 500;
}

.field-error {
  min-height: 0;
  margin-top: 5px;
  color: #ff9c9c;
  font-size: 12px;
  font-weight: 650;
}

.field-error:empty {
  display: none;
}

.field-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.form-input[aria-invalid="true"] {
  border-color: rgba(255, 107, 107, 0.7);
  background: rgba(255, 107, 107, 0.05);
}

.password-wrap {
  position: relative;
}

.password-wrap .form-input {
  padding-right: 68px;
}

.pw-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 32px;
  padding: 4px 10px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-2);
  font-size: 12px;
}

.pw-meter {
  height: 4px;
  margin-top: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.pw-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.pw-meter span[data-level="ok"] { background: var(--warn); }
.pw-meter span[data-level="good"] { background: var(--primary); }
.pw-meter span[data-level="great"] { background: var(--accent); }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.label-row label {
  margin-bottom: 7px;
}

.link-btn {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-hover);
  font-size: 13px;
  font-weight: 750;
}

.link-btn:hover {
  background: none;
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
}

.auth-submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

.auth-foot {
  margin: 4px 0 0;
  text-align: center;
  font-size: 14px;
}

.auth-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.form-alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.form-alert.error {
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
  color: #ffc1c1;
}

.form-alert.info {
  border: 1px solid rgba(79, 140, 255, 0.35);
  background: rgba(79, 140, 255, 0.08);
  color: var(--muted-2);
}

/* Mobile */
@media (max-width: 900px) {
  header .container,
  .site-header .container {
    flex-wrap: wrap;
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
  }

  header .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 0 4px;
  }

  header.nav-open .site-nav {
    display: flex;
  }

  .site-nav .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav .nav-links a {
    justify-content: flex-start;
  }

  .site-nav .nav-auth {
    margin: 0;
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .account-dropdown {
    left: 0;
    right: auto;
  }

  .ima-results {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    display: none;
  }

  .auth-page {
    padding-top: 12px;
    min-height: 0;
  }
}

/* QA polish */
button.timeline-add {
  min-height: 0;
  padding: 0;
  font: inherit;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
}

#checkout-card { gap: 6px; }
#checkout-card h2 { margin: 0; }
#checkout-card .plan-price { margin: 4px 0 2px; }
#checkout-card p { margin: 0; }

.pricing-section:first-child { margin-top: 12px; }

.toast { pointer-events: none; }

@media (max-width: 760px) {
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .thumb-tools .btn { flex: 1 1 auto; }
}

/* Delete is reachable without hover (touch screens, keyboard) */
.timeline-clip.active .timeline-clip-delete,
.timeline-clip:focus-within .timeline-clip-delete { display: inline-flex; }
@media (hover: none) { .timeline-clip-delete { display: inline-flex; } }


/* ---------- Home: Analytics (layout from Infohub Studio Analytics Hub) ---------- */
.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;
}

.analytics-hub {
  display: grid;
  gap: 18px;
  margin-top: 10px;
}

.analytics-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.analytics-top h2 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 900;
  letter-spacing: -0.02em;
}

.analytics-top p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.analytics-range select {
  width: auto;
  min-width: 160px;
  font-size: 13px;
  font-weight: 800;
}

.analytics-trend {
  padding: 24px;
  border-radius: 14px;
  overflow: hidden;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.trend-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 850;
}

.trend-kicker {
  margin: 6px 0 0;
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.trend-total {
  text-align: right;
  line-height: 1;
}

.trend-total strong {
  display: block;
  font-size: 30px;
  font-weight: 900;
}

.trend-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.trend-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 16px 0 6px;
  padding: 0;
  list-style: none;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted-2);
}

.trend-legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.trend-legend li::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--c);
}

.trend-legend b {
  color: var(--c);
}

.trend-chart {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 240px auto;
  column-gap: 10px;
}

.trend-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: right;
  padding: 2px 0;
}

.trend-plot {
  position: relative;
  min-width: 0;
}

.trend-plot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trend-plot .grid {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.trend-plot .grid.base {
  stroke: rgba(255, 255, 255, 0.14);
}

.trend-plot .series {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.9;
}

.trend-plot .s-yt { stroke: var(--yt); }
.trend-plot .s-tt { stroke: var(--tt); }
.trend-plot .s-ig { stroke: var(--ig); }
.trend-plot .s-fb { stroke: var(--fb); }

.trend-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.trend-empty i {
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 4px;
}

.trend-empty strong {
  color: var(--text);
  font-size: 15px;
}

.trend-empty .btn {
  margin-top: 8px;
}

.trend-x {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.analytics-subhead {
  margin: 14px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 850;
}

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

.platform-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, transparent), rgba(255, 255, 255, 0.012) 60%), var(--surface);
  box-shadow: var(--shadow);
}

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

.platform-card-head i {
  font-size: 22px;
  color: var(--c);
}

.platform-card-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.platform-card-stat {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.platform-card-stat strong {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.platform-card-stat .delta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 64px;
  padding-bottom: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-bars i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--c) 35%, transparent);
}

.platform-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.money-list {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
}

.money-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  font-weight: 800;
}

.money-row strong {
  text-align: right;
  font-weight: 900;
}

.money-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.money-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--c);
}

@media (max-width: 900px) {
  .platform-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .analytics-trend {
    padding: 16px;
  }

  .analytics-range,
  .analytics-range select {
    width: 100%;
  }

  .trend-chart {
    grid-template-rows: 200px auto;
  }

  .trend-x span:nth-child(even) {
    visibility: hidden;
  }

  .money-row {
    grid-template-columns: 104px minmax(0, 1fr) 44px;
    gap: 10px;
    font-size: 12px;
  }
}


/* ---------- Distributor: connected accounts, publish, auto-post ---------- */
.status-pill[data-state="preview"] { background: rgba(79, 140, 255, 0.14); color: var(--primary-hover); }
.source-chip[data-state="ready"] { background: rgba(47, 199, 163, 0.14); color: var(--accent); }
.err-text { color: var(--danger); font-size: 13px; font-weight: 750; }

.accounts-card { margin-top: 4px; }

.social-banner {
  margin: 12px 0 0;
  padding: 11px 14px;
  border: 1px solid rgba(79, 140, 255, 0.3);
  border-radius: var(--radius);
  background: rgba(79, 140, 255, 0.08);
  color: var(--muted-2);
  font-size: 13px;
}
.social-banner strong { color: var(--text); }
.social-banner code, .publish-note code { color: var(--primary-hover); }

.account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 7%, transparent), rgba(255, 255, 255, 0.012) 55%), var(--surface);
}
.account-card[data-mode="off"] { border-top-color: color-mix(in srgb, var(--c) 45%, var(--line)); }

.acct-head { display: flex; align-items: center; gap: 10px; }
.acct-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.acct-head h4 { margin: 0; font-size: 15px; font-weight: 850; }
.acct-title .status-pill { padding: 2px 8px; font-size: 11px; }
.acct-icon {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--c); font-size: 17px;
}

.acct-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.acct-avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
}
.acct-initials {
  position: relative; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, #0f141a);
  color: var(--text); font-size: 14px; font-weight: 900;
}
.acct-initials i {
  position: absolute; right: -4px; bottom: -4px;
  width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface); color: var(--c); font-size: 11px;
}
.account-card[data-mode="off"] .acct-initials { opacity: 0.6; }
.acct-name { min-width: 0; display: grid; }
.acct-name strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-name span { color: var(--muted); font-size: 12px; }
.acct-note { margin: 0; min-height: 34px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.acct-actions { margin-top: auto; display: flex; }
.acct-actions .btn { width: 100%; }

.coming-soon-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.coming-label { color: var(--muted-2); font-size: 12px; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; margin-right: 4px; }
.coming-label i { color: var(--primary); margin-right: 4px; }
.soon-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px dashed var(--button-border); border-radius: 999px;
  color: var(--muted); font-size: 12px; font-weight: 750;
}
.coming-note { font-size: 12px; margin-left: 4px; }

/* Publish panel */
.target-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.target { min-width: 0; }
.target {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}
.target.on { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); background: color-mix(in srgb, var(--c) 6%, transparent); }
.target.off { opacity: 0.62; }
.target-head { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; cursor: pointer; font-size: 14px; font-weight: 750; color: var(--text); }
.target.off .target-head { cursor: default; }
.target-head input { width: 16px; height: 16px; accent-color: var(--primary); }
.target-head i { width: 18px; color: var(--c); }
.target-name { flex: 1; }
.mode-tag {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 850;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); text-decoration: none;
}
.mode-tag.live { background: rgba(47, 199, 163, 0.14); color: var(--accent); }
.mode-tag.demo { background: rgba(79, 140, 255, 0.14); color: var(--primary-hover); }
.mode-tag.off { color: var(--primary-hover); }
.mode-tag.off:hover { text-decoration: underline; }
.target-opts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 0 12px 12px 40px; font-size: 13px;
}
.target-opts label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted-2); font-size: 13px; white-space: nowrap; }
.target-opts select { width: auto; max-width: 100%; min-height: 34px; padding: 5px 10px; font-size: 13px; }
.target-opts .opt-hint { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.target-opts .opt-consent { flex-basis: 100%; white-space: normal; align-items: flex-start; font-size: 12px; }
.target-opts .opt-consent input { margin-top: 1px; }
.target-opts .opt-consent a { color: var(--primary-hover); }
.check-inline input { width: 15px; height: 15px; accent-color: var(--primary); }

.post-video-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; }
.post-video-label { color: var(--text); font-weight: 750; text-align: right; overflow-wrap: anywhere; }

.when-group {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin-top: 16px; padding: 4px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #0f141a;
}
.when-btn {
  min-height: 36px; padding: 0 4px; white-space: nowrap; font-size: 12.5px !important; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 13px;
}
.when-btn i { margin-right: 4px; }
.when-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.when-btn.active { background: var(--buttonBg); color: var(--text); box-shadow: inset 0 0 0 1px var(--button-border); }
.when-detail { margin-top: 12px; }
.publish-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; min-height: 16px; }

/* Auto-post + queue */
.autopost-grid {
  display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px; margin-top: 20px; align-items: start;
}
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: 13px; font-weight: 800; color: var(--muted-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #2a3340; transition: background 0.15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cfd6df; transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary-hover); outline-offset: 2px; }
.auto-intro { margin: 10px 0 14px; font-size: 13px; }
.cadence { display: grid; gap: 10px; }
.radio-row { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 14px; font-weight: 750; }
.radio-row input[type="radio"] { width: 15px; height: 15px; accent-color: var(--primary); }
.every-input { width: 64px !important; min-height: 34px; padding: 5px 8px; text-align: center; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding-left: 23px; }
.weekday-picker button {
  min-height: 32px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #0f141a; color: var(--muted); font-size: 12px;
}
.weekday-picker button[aria-pressed="true"] { border-color: var(--primary); background: rgba(79, 140, 255, 0.16); color: var(--text); }
.weekday-picker.is-disabled { opacity: 0.4; pointer-events: none; }
.time-row { display: flex; align-items: center; gap: 12px; }
.time-row .field-label { margin: 0; }
.time-row input { width: 140px; }
.next-slots { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.next-slots ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.next-slots li i { color: var(--primary); margin-right: 6px; }

.queue-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: #0f141a; }
.queue-tab { min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 12px; }
.queue-tab b { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 11px; }
.queue-tab.active { background: var(--buttonBg); color: var(--text); }
.queue-list { display: grid; gap: 8px; margin-top: 14px; }
.q-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-left: 3px solid var(--c);
  border-radius: var(--radius); background: rgba(255, 255, 255, 0.025);
}
.q-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-size: 17px; }
.q-main { min-width: 0; display: grid; gap: 3px; }
.q-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.q-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.q-when { color: var(--muted); font-size: 12px; }
.q-msg { margin: 2px 0 0; color: var(--muted-2); font-size: 12px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4px; font-size: 13px; }
.q-actions a { color: var(--primary-hover); font-weight: 750; text-decoration: none; }
.q-actions a:hover { text-decoration: underline; }
.q-status { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 850; white-space: nowrap; background: rgba(255, 255, 255, 0.06); color: var(--muted-2); }
.q-status[data-status="uploading"] { background: rgba(79, 140, 255, 0.16); color: var(--primary-hover); }
.q-status[data-status="posted"] { background: rgba(47, 199, 163, 0.15); color: var(--accent); }
.q-status[data-status="simulated"] { background: rgba(79, 140, 255, 0.1); color: var(--muted-2); }
.q-status[data-status="failed"] { background: rgba(255, 107, 107, 0.14); color: var(--danger); }
.q-status[data-status="canceled"] { color: var(--muted); }
.queue-empty { display: grid; justify-items: center; gap: 6px; padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); }
.queue-empty i { font-size: 22px; color: var(--primary); }
.queue-empty strong { color: var(--text); font-size: 15px; }

@media (max-width: 1100px) {
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .autopost-grid { grid-template-columns: 1fr; }
}

/* Home analytics: live/demo state per platform */
.platform-cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pc-state { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; letter-spacing: 0.04em; background: rgba(255, 255, 255, 0.06); color: var(--muted); text-decoration: none; }
.pc-state[data-mode="live"] { background: rgba(47, 199, 163, 0.14); color: var(--accent); }
.pc-state[data-mode="demo"] { background: rgba(79, 140, 255, 0.14); color: var(--primary-hover); }
a.pc-state:hover { color: var(--text); }
.platform-card-head .pc-left { display: flex; align-items: center; gap: 10px; }
.analytics-source { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .platform-cards.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.publish-log .platform-row { padding: 8px 12px; font-size: 13px; }
.publish-log .platform-row span { font-weight: 650; }

/* Keep the footer at the bottom of the window on short pages */
body { min-height: 100vh; }
body > footer { position: sticky; top: 100vh; }

/* ===== CinaFlux engine (Generate page) ===== */
.engine-chip {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 800;
  white-space: nowrap;
}
.engine-chip[data-state="ready"],
.engine-chip[data-state="local"] { border-color: rgba(47, 199, 163, 0.4); color: var(--accent) !important; }
.engine-chip[data-state="unsupported"] { border-color: rgba(245, 184, 75, 0.4); color: var(--warn) !important; }
.engine-dot[data-state="checking"] { background: var(--muted); box-shadow: 0 0 0 4px rgba(154, 166, 181, 0.14); }
.engine-dot[data-state="unsupported"] { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 184, 75, 0.16); }
.engine-note {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-2);
  font-size: 13px;
}
.engine-note[data-state="unsupported"] { background: rgba(245, 184, 75, 0.08); color: var(--warn); }

.format-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}
.format-pick legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 13px;
  font-weight: 750;
  color: var(--muted-2);
}
.format-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.format-option:hover { border-color: #3a4657; }
.format-option.active {
  border-color: var(--primary);
  background: rgba(79, 140, 255, 0.1);
}
.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.format-option:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.format-shape {
  flex: none;
  border: 2px solid var(--muted);
  border-radius: 4px;
}
.format-shape.long { width: 44px; height: 25px; }
.format-shape.short { width: 22px; height: 38px; margin: 0 11px; }
.format-option.active .format-shape { border-color: var(--primary-hover); background: rgba(79, 140, 255, 0.16); }
.format-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.format-text strong { font-size: 15px; }
.format-text span { color: var(--muted); font-size: 12px; }
.format-text .format-where { color: var(--muted-2); }

.cf-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.cf-settings > label:not(.check-inline) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  color: var(--muted-2);
}
.cf-sound { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; font-size: 14px; }
.cf-sound input { width: 16px; height: 16px; accent-color: var(--primary); }
.cf-more { margin: 12px 0 16px; }
.cf-more summary { cursor: pointer; color: var(--muted-2); font-size: 13px; font-weight: 700; }
.cf-more[open] summary { margin-bottom: 8px; }
.cf-more input { max-width: 260px; }
.plan-summary { font-size: 13px; }

.cf-progress {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}
.cf-progress-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; }
.cf-progress-top span:last-child { font-variant-numeric: tabular-nums; color: var(--muted-2); }
.cf-bar { height: 8px; margin: 8px 0; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.cf-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.25s linear; }
.cf-progress-hint { font-size: 12px; }
.cf-explain { font-size: 13px; }
.cf-explain code { font-size: 12px; }
.cf-result-note { margin: 0 0 12px; font-size: 13px; }
.cf-result-note[data-kind="demo"] { color: var(--warn); }
.cf-video-wrap { display: flex; justify-content: center; background: #000; border-radius: var(--radius); margin-bottom: 14px; }
#video-container .cf-video-wrap video { margin: 0; width: 100%; }
video.is-vertical,
#video-container video.is-vertical,
#master-video.is-vertical {
  aspect-ratio: 9 / 16;
  width: auto !important;
  max-width: 100%;
  height: min(70vh, 720px);
  object-fit: contain;
}
.video-card video.is-vertical { height: 320px; background: #000; }

/* Long form / Short form badge (Library, Storyboard, Distributor, queue) */
.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.5;
  white-space: nowrap;
  background: rgba(79, 140, 255, 0.14);
  color: var(--primary-hover);
}
.format-badge::before {
  content: "";
  width: 10px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.format-badge[data-format="short"] { background: rgba(236, 72, 153, 0.14); color: #f472b6; }
.format-badge[data-format="short"]::before { width: 6px; height: 10px; }
.format-badge[data-format="demo"] { background: rgba(245, 184, 75, 0.12); color: var(--warn); }
.format-badge[data-format="demo"]::before { display: none; }
.video-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.timeline-clip-label .format-badge { align-self: flex-start; margin: 2px 0; }

/* Distributor: format worked out from the clip */
.format-detect {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}
.format-detect[data-format="long"] { border-color: rgba(79, 140, 255, 0.35); }
.format-detect[data-format="short"] { border-color: rgba(236, 72, 153, 0.35); }
.target-note, .target-wait { margin: 4px 2px 0; font-size: 12.5px; }
.source-clip .format-badge { margin-left: auto; }
.q-title .format-badge { margin-left: 2px; }
#master-video.is-vertical { display: block; margin: 0 auto; height: min(62vh, 640px); background: #000; }

/* ---------- Header: single auth button ---------- */
.site-nav .nav-auth-btn { white-space: nowrap; }
.account-btn.active { border-color: var(--primary); }

/* ---------- Distributor: "Posting to" strip ---------- */
.connections-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}
.connections-strip h3 { margin: 0; font-size: 16px; }
.connection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 0;
  font-size: 13px;
}
.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
}
.connection-chip > i { color: var(--c, var(--primary)); }
.connection-chip .muted { font-weight: 500; }

/* ---------- Account page ---------- */
.account-page { padding-bottom: 40px; }
.account-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  background: none;
  border: 0;
  position: static;
}
.account-tabs a {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.account-tabs a:hover { color: var(--text); border-color: var(--primary); }
.account-section { margin-bottom: 20px; scroll-margin-top: 90px; }
.account-section h3 i { color: var(--primary); margin-right: 8px; }
.section-lead { margin: 6px 0 0; font-size: 14px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.account-section input:disabled { opacity: 0.7; cursor: not-allowed; }
.usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.usage-stat {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.usage-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.usage-stat strong { font-size: 24px; }
.usage-note { margin: 12px 0 0; font-size: 13px; }
@media (max-width: 720px) {
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Home: Start a video ---------- */
.quick-form { display: grid; gap: 12px; margin-top: 12px; }
.quick-form textarea { resize: vertical; min-height: 64px; font-size: 15px; }
.quick-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.quick-formats { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.quick-format { position: relative; cursor: pointer; }
.quick-format input { position: absolute; opacity: 0; pointer-events: none; }
.quick-format span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted-2); font-size: 13px; font-weight: 700;
}
.quick-format small { color: var(--muted); font-weight: 600; }
.quick-format input:checked + span { border-color: var(--primary); color: var(--text); background: rgba(79, 140, 255, 0.12); }
.quick-format input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.quick-ideas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.idea-chip {
  min-height: 0; padding: 5px 11px; border: 1px dashed var(--line); border-radius: 999px;
  background: transparent; color: var(--muted-2); font-size: 12px; font-weight: 600;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.idea-chip:hover { border-color: var(--primary); color: var(--text); }
@media (max-width: 720px) {
  .quick-row .btn { width: 100%; }
}

/* Free plan quota line on Generate */
.quota-note { margin: 10px 0 0; font-size: 13px; }
.quota-note[data-full="1"] { color: var(--danger); font-weight: 700; }

/* ---------- Terms / Privacy ---------- */
.legal-page { max-width: 780px; padding-top: 32px; padding-bottom: 48px; line-height: 1.65; }
.legal-page h1 { margin-bottom: 4px; }
.legal-page h2 { margin: 28px 0 8px; font-size: 19px; }
.legal-page ul { padding-left: 20px; display: grid; gap: 6px; }
.footer-links { display: flex; gap: 16px; font-size: 13px; }
.footer-links a { color: var(--muted-2); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }

/* Account: delete my account */
.danger-zone { margin-top: 22px; padding: 16px; border: 1px solid rgba(255, 107, 107, 0.35); border-radius: var(--radius); background: rgba(255, 107, 107, 0.05); }
.danger-zone h4 { margin: 0 0 6px; color: var(--danger); }
.danger-zone p { margin: 0 0 12px; font-size: 13px; }

/* Placeholder until script.js draws the login/account button (avoids showing the wrong one) */
.nav-auth-slot { display: inline-block; min-width: 132px; min-height: 38px; }
