*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
  min-height: 100vh;
  color: #e5e7eb;
  /* Avoid potential background tiling in web app view */
  background: radial-gradient(ellipse at 10% -10%, #1f2937 0%, rgba(17,24,39,0) 60%),
              radial-gradient(ellipse at 100% 0%, #0b1324 0%, #0b1120 60%);
  background-repeat: no-repeat, no-repeat;
}
/* Hoverable side rail — frosted, macOS-inspired */
#side-rail {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(11, 17, 32, 0.5);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(12px) saturate(140%);
  z-index: 1000;
  transition: background .2s ease, border-color .2s ease;
}
#side-rail:hover { background: rgba(11, 17, 32, 0.65); border-color: rgba(255,255,255,0.18); }
#side-rail .nav-item {
  display: grid;
  grid-template-columns: 20px auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: #cbd5e1;
  text-decoration: none;
  white-space: nowrap;
  min-width: 44px;
  border: 1px solid transparent;
}
#side-rail .nav-item .label { max-width: 0; overflow: hidden; transition: max-width .25s ease; }
#side-rail:hover .nav-item .label { max-width: 180px; }
#side-rail .nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; border-color: rgba(255,255,255,0.12); }
#side-rail .nav-item.active { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border-color: transparent; box-shadow: 0 10px 30px rgba(99,102,241,0.35); }
#side-rail .icon { width: 20px; text-align: center; }
@media (max-width: 900px) { #side-rail { right: 10px; } }
@media (max-width: 640px) { #side-rail { display: none; } }
#card-monthly {
  padding-top: 46px !important;
}
main {
  max-height: 80vh;
  overflow: scroll;
  /* Hide scrollbars but keep scrolling */
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
main::-webkit-scrollbar { display: none; } /* Chrome, Safari */
/* Docs pages should scroll the full document, not a constrained main */
.docs main { max-height: none; overflow: visible; }

/* Docs aesthetics — Apple-inspired minimalism */
.docs .section-title { font-weight: 800; letter-spacing: -0.01em; }
.docs article.card { scroll-margin-top: 86px; }
.docs .header-inner { padding: 16px 28px; }
.docs .container { padding: 0 32px; }
.docs .card {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
  backdrop-filter: saturate(130%);
}
.docs .section-header h2 { font-size: 20px; color: #e5e7eb; letter-spacing: -0.01em; }
.docs .content { font-size: 16px; line-height: 1.75; color: #cbd5e1; }
.docs .content h3 { font-size: 18px; color: #e5e7eb; margin: 16px 0 10px; letter-spacing: -0.01em; }
.docs .content p { margin: 8px 0 12px; }
.docs .content ul, .docs .content ol { padding-left: 20px; }
.docs .content li { margin: 6px 0; }
.docs .cards > .card { margin-bottom: 18px; }
.docs a { color: #c7d2fe; text-decoration: none; }
.docs a:hover { color: #ffffff; }
.docs a:focus-visible { outline: 2px solid rgba(99,102,241,0.5); outline-offset: 2px; border-radius: 8px; }

/* Mobile-only: prevent horizontal overflow on docs */
@media (max-width: 768px) {
  body.docs { overflow-x: hidden; }
  .docs .container,
  .docs .cards,
  .docs .card,
  .docs .content,
  .docs-yt-mobile,
  .docs-yt-mobile .yt-wrap { max-width: 100%; overflow-x: hidden; }
  .docs iframe,
  .docs img,
  .docs .content pre,
  .docs .content code { max-width: 100%; }
}

/* Docs TOC */
#docs-toc { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#docs-toc nav a { color: #cbd5e1; padding: 8px 12px; border-radius: 10px; font-size: 15px; }
#docs-toc nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
/* Responsive docs grid */
.docs-grid { display:grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) {
  .docs .header-inner { flex-wrap: wrap; gap: 10px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 768px) {
  .docs .container { padding: 0 16px; }
  .docs-grid { grid-template-columns: 1fr; }
  #docs-toc { position: static; top: auto; }
  #docs-toc nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #docs-toc nav a { padding: 10px 12px; background: rgba(255,255,255,0.04); }
}
@media (max-width: 480px) {
  #docs-toc nav { grid-template-columns: 1fr; }
}
.brand-title {
  font-family: sans-serif !important;
  font-size: 22px !important;
}
#app { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 15px); padding: 30px; }
.header-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.divider { height: 1px; width: 100%; background: rgba(255,255,255,0.08); margin: 0 0 16px; border-radius: 1px; }
.brand h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.02em; }
.tagline { margin: 0; color: #9ca3af; font-size: 14px; }
.actions-right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: stretch; }
.grid.fill { flex: 1; }
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: saturate(120%);
}
.section-header { display: flex; justify-content: space-between; align-items: stretch; margin-bottom: 12px; }
.section-header h2 { margin: 0; font-size: 16px; letter-spacing: 0.02em; color: #cbd5e1; }
.controls-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.controls-inline .toolbar-divider { align-self: stretch; width: 1px; background: rgba(255,255,255,0.12); margin: 0 6px; border-radius: 1px; }
.controls-stack { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.quick-settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-settings {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
}
.quick-settings.hidden { display: none; }
.quick-settings .qs-item { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.badge-pro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
}

/* Platinum badge style to match Create with AI button gradient */
.badge-platinum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #ffffff;
}

/* Neutral badge style for Free plan */
.badge-free {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.16);
}

.badge-beta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #111827;
}

/* Fancy range slider matching app style */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px; /* visual track height */
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99,102,241,0.5), rgba(139,92,246,0.5));
  outline: none;
  position: relative;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.35);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 0;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25), 0 10px 30px rgba(99,102,241,0.35);
  cursor: pointer;
  margin-top: -4px; /* center thumb on 10px track (18-10)/2 */
}
.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 0;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25), 0 10px 30px rgba(99,102,241,0.35);
  cursor: pointer;
}
.range::-moz-range-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(99,102,241,0.35), rgba(139,92,246,0.35)); }
.range::-moz-range-progress { height: 10px; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.range::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99,102,241,0.35), rgba(139,92,246,0.35));
}
.range::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99,102,241,0.35), rgba(139,92,246,0.35));
}
.range:focus { filter: brightness(1.05); }

/* Filled portion using background-size trick via JS */
.range.fillable {
  background-image: linear-gradient(90deg, #6366f1, #8b5cf6);
  background-repeat: no-repeat;
  background-size: 0% 100%;
}
.pro-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 0;
}

.pro-cta .pro-cta-text { font-size: 14px; }
.pro-cta .pro-cta-note { font-size: 12px; opacity: 0.8; margin-left: auto; }
.pro-cta .pro-cta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cta-button {
  padding: 8px 14px;
  border-radius: 6px;
  background: #374151;
  color: white;
  text-decoration: none;
}
.cta-button.primary { background: #6366f1; }
.cta-button:hover { filter: brightness(1.1); }
.link-button {
  background: transparent;
  color: #93c5fd;
  text-decoration: underline;
}
.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
button {
  padding: 10px 20px;
  border: none;
  background: #374151;
  color: #ffffff;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, filter 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
button:hover { filter: brightness(1.1); }
.primary { background: #6366f1; color: #ffffff; box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35); }
.secondary { background: #374151; color: #ffffff; }
#layout-toggle.segmented { display:inline-flex; background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); padding:4px; border-radius:12px; }
#layout-toggle .seg-btn { background: transparent; color:#cbd5e1; border:0; border-radius:8px; padding:6px 10px; cursor:pointer; }
#layout-toggle .seg-btn.active { background:#6366f1; color:#fff; box-shadow: 0 8px 20px rgba(99,102,241,0.35); }
#file-list { display: none; }
#sections-container { display: grid; gap: 12px; }
.section-block { border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 10px; background: rgba(255,255,255,0.03); }
.section-block-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-block-header h3 { margin: 0; font-size: 14px; color: #cbd5e1; }
.section-block-actions { display: flex; gap: 8px; }
.media-list { list-style: none; padding: 0; }
.media-list li { display: inline-flex; align-items: flex-start; gap: 8px; margin: 5px; position: relative; }
.media-list li video { border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.25); }
#file-list li {
  display: inline-block;
  margin: 5px;
  position: relative;
}
#file-list li video {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
#status {
  min-height: 20px;
  text-align: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
#status:empty {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
#status.error {
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}
/* Success status appearance */
#status.success {
  color: #14532d;
  background-color: #dcfce7;
  border: 1px solid #86efac;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}
#status.success ~ #status-floating {
  background: rgba(6, 95, 70, 0.95);
  border-color: rgba(16, 185, 129, 0.35);
}
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: #0f172a;
  padding: 24px;
  border-radius: 14px;
  width: auto;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  text-align: left;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
/* Features modal styles */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.feat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
}
.feat-title { margin: 0 0 6px; font-size: 14px; color: #e5e7eb; }
.feat-desc { margin: 0; font-size: 13px; color: #9ca3af; }
.modal-content.preview {
  width: min(92vw, 1000px);
  max-width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
/* Constrain Settings modal and allow inner scrolling */
#settings-modal .modal-content {
  width: min(92vw, 820px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#settings-modal .settings-grid {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
/* Settings modal header styling */
.modal-content h2 {
  font-size: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 8px;
}
.modal-content h3 { font-size: 13px; color: #94a3b8; margin: 0 0 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-group { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 12px; text-align: left; }
.field { margin: 10px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.two > label { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="number"] { border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.02); color: #e5e7eb; border-radius: 10px; padding: 10px 12px; }
.modal-content input.disabled { opacity: 0.5; }
.modal-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 10px; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
  overflow: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.preview-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pagination-left { display: flex; align-items: center; gap: 8px; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pagination button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 12px;
}
.pagination button.active {
  background: #6366f1;
  color: #ffffff;
  border-color: transparent;
}
.pagination-right { display: flex; align-items: center; gap: 10px; }
.pagination-jump { display: inline-flex; align-items: center; gap: 6px; }
.pagination-jump input[type="number"] {
  width: 64px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
  color: #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
}
.clip-card {
  position: relative;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  padding: 8px;
}
.clip-video { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); }
.clip-thumb { display:flex; align-items:center; justify-content:center; position:relative; background: rgba(0,0,0,0.25); cursor: pointer; }
.clip-thumb .play-overlay { position:absolute; width:42px; height:42px; border-radius:50%; background: rgba(0,0,0,0.45); border:1px solid rgba(255,255,255,0.18); display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800; font-size:18px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.clip-thumb:hover .play-overlay { filter: brightness(1.15); }
.clip-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; }
.clip-actions { display: flex; align-items: center; gap: 6px; }
.clip-length { font-size: 12px; color: #cbd5e1; background: rgba(0,0,0,0.25); padding: 2px 6px; border-radius: 6px; }
.clip-excluded { opacity: 0.45; }
.modal-content label {
  display: flex;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
}
.modal-content input[type="email"] {
  flex: 1;
  margin-left: 10px;
  padding: 5px 10px;
}
.modal-content input[type="number"] {
  flex: 1;
  margin-left: 10px;
  padding: 5px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
/* Script viewer header buttons spacing */
.modal-content .header-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
input[type="checkbox"] {
  margin-right: 8px;
}
.modal-content input[type="checkbox"],
.quick-settings input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: box-shadow .2s ease, filter .2s ease, background .2s ease, border-color .2s ease;
}
.modal-content input[type="checkbox"]:hover,
.quick-settings input[type="checkbox"]:hover { filter: brightness(1.08); }
.modal-content input[type="checkbox"]:focus-visible,
.quick-settings input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.35);
}
.modal-content input[type="checkbox"]:checked,
.quick-settings input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(99,102,241,0.35);
}
.modal-content input[type="checkbox"]:checked::after,
.quick-settings input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 5px;
  width: 6px;
  height: 10px;
  border: 2px solid #ffffff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}
.modal-content input[type="checkbox"]:disabled,
.quick-settings input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.dark-mode {
  background: #1e1e1e;
  color: #f1f1f1;
}
.dark-mode .modal-content {
  background: #2e2e2e;
  color: #f1f1f1;
}
.dark-mode button { background: #374151; color: #ffffff; }
.dark-mode .primary { background: #6366f1; color: #ffffff; }
/* Settings save-location input and browse button styling */
.modal-content #save-location {
  flex: 1;
  margin-left: 10px;
  padding: 5px 10px;
}
.modal-content #browse-save-location {
  margin-left: 10px;
  padding: 5px 10px;
}
/* Style history list to match the preview visuals */
#history-list {
  list-style: none;
  padding: 0;
  overflow-y: auto;
  margin-bottom: 20px;
  min-height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  
}
#history-list li {
  display: inline-block;
  margin: 5px;
  width: 97%;
}
#history-list li video {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.pro-large #history-list li video { width: 100% !important; height: 235px !important; }
.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.mini-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 12px;
}
.mini-btn:hover { filter: brightness(1.08); }
.actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.actions.hidden {
  display: none;
}
#result-actions #open-folder {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}
#result-actions #open-folder:hover { filter: brightness(1.05); }
#result-actions #open-folder::before {
  content: '📂';
  margin-right: 6px;
}
#progress-bar {
  width: 100%;
  height: 20px;
  margin: 10px 0;
}
#time-remaining {
  text-align: center;
  font-size: 14px;
  margin-bottom: 10px;
}
/* Floating status bubble (always visible) */
#status-floating {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  background: rgba(17, 24, 39, 0.94);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e5e7eb;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  max-width: 60vw;
  font-size: 13px;
  pointer-events: none;
}
#status-floating.processing {
  background: linear-gradient(180deg, rgba(34,197,94,0.12), rgba(34,197,94,0.06)), rgba(17,24,39,0.94);
  border-color: rgba(34,197,94,0.35);
  box-shadow: 0 10px 30px rgba(34,197,94,0.25);
}
#status-floating .muted { color: #9ca3af; }
#status.error ~ #status-floating {
  background: rgba(127, 29, 29, 0.95);
  border-color: rgba(248, 113, 113, 0.35);
}
/* Friendly loading message */
.loading-message {
  text-align: center;
  font-style: italic;
  color: #a1a1aa;
  margin: 8px 0 12px;
}
.dark-mode .loading-message {
  color: #ccc;
}
a {
  color: #93c5fd;
}
.dark-mode a {
  color: #c7d2fe;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

/* Shared header & nav styles (moved from landing) so docs header renders correctly */
header.sticky { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px); background: rgba(11, 17, 32, 0.7); border-bottom: 1px solid rgba(255,255,255,0.08); width: 100%; }
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge { width: 32px; height: 32px; border-radius: 9px; background: #000; display: flex; align-items: center; justify-content: center; }
.brand-badge span { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
nav { display: none; gap: 24px; }
@media (min-width: 768px) { nav { display: flex; } }
nav a { color: #94a3b8; transition: color .2s ease; text-decoration: none; }
nav a:hover { color: #e5e7eb; }

/* Global busy overlay for visible loading while adding files */
#busy-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px) saturate(120%);
}
#busy-overlay.visible { display: flex; }
#busy-overlay .busy-content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
#busy-overlay .busy-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #ffffff;
  animation: vs-spin 0.9s linear infinite;
}
#busy-overlay #busy-text {
  color: #e5e7eb;
  font-weight: 800;
  letter-spacing: 0.01em;
}
@keyframes vs-spin { to { transform: rotate(360deg); } }

/* Header dropdown */
.dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: 6px; color: #94a3b8; text-decoration: none; }
.dropdown-toggle:hover { color: #e5e7eb; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(11,17,32,0.9);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: none;
  flex-direction: column;
  z-index: 100;
}
.dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu { display: flex; }
.dropdown.open .dropdown-menu { display: flex; }
.dropdown-menu a {
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  white-space: nowrap;
}
.dropdown-menu a:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* Button styles for header links */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.bg-gradient-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #ffffff; box-shadow: 0 10px 30px rgba(99,102,241,0.35); }
.bg-gradient-primary:hover { filter: brightness(0.95); }
.btn-ghost { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #e5e7eb; }
.btn-ghost:hover { filter: brightness(1.05); }
.dark-mode #file-list, .dark-mode #history-list {
  border-color: rgba(255, 255, 255, 0.193);
}
/* Drag and drop area style */
.pro-active #drop-area {
  border: 2px dashed rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background-color .2s ease, box-shadow .2s ease, border-color .2s ease, transform .1s ease;
}
.pro-active #drop-area.dragover {
  background-color: rgba(148, 163, 184, 0.08);
}
.pro-active #drop-area:hover {
  border-color: rgba(99,102,241,0.55);
  box-shadow: 0 10px 30px rgba(99,102,241,0.25);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  transform: translateY(-1px);
}
.remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none !important;
  color: #fff !important;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  width: 22px;
  height: 22px;
  text-align: center;
  line-height: 22px;
  font-weight: 800;
  z-index: 2;
  box-shadow: none;
}

/* Side action bar beside media thumbnails */
.media-actions {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}
.media-actions .remove-btn {
  position: static;
  background: rgba(239,68,68,0.16) !important;
  color: #fecaca !important;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  line-height: 1;
}
.dup-btn {
  background: rgba(99,102,241,0.16);
  color: #c7d2fe;
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 8px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

/* Audio lists (Pro) */
#bgm-list, #voice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
#bgm-list li, #voice-list li { position: relative; border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 8px; background: rgba(255,255,255,0.03); display: flex; align-items: center; gap: 8px; }
#bgm-list li.dragging, #voice-list li.dragging { opacity: 0.5; }
.audio-badge { font-size: 11px; color: #94a3b8; }
.audio-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handle { cursor: grab; user-select: none; }

.donate-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
  max-width: 300px;
  margin: 0;

  text-decoration: none;
  color: #e5e7eb;
}

.donate-container span {
  color: #e5e7eb;
}
/* Version footer styling */
#version-footer {
  width: 100%;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 0;
  max-height: 20px;
}

#banner {
  margin-bottom: 20px;
}

/* Keep top row (Create, Previous Projects) constrained so lower panels remain visible */
main.grid.fill > section.card:nth-of-type(1),
main.grid.fill > section.card:nth-of-type(2) {
  max-height: 62vh; /* keep headroom for the row below; adjust to taste */
  overflow: auto;
}
@media (max-height: 800px) {
  main.grid.fill > section.card:nth-of-type(1),
  main.grid.fill > section.card:nth-of-type(2) {
    max-height: 56vh;
  }
}
/* Script Shufflr two-column layout */
.script-shufflr-right { min-width: 0; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; background: rgba(255,255,255,0.03); padding: 12px; max-height: 380px; overflow: auto; }
.script-preview-header { font-size: 13px; color: #94a3b8; margin: 0 0 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.script-preview { font-size: 14px; line-height: 1.5; }

/* Script Shufflr status styling */
#script-shufflr-status {
  min-height: 22px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: #e5e7eb;
  font-weight: 600;
}
#script-shufflr-status.script-status-ready {
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.12);
  color: #bbf7d0;
}
#script-shufflr-status.script-status-busy {
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.12);
  color: #bfdbfe;
}
#script-shufflr-status.script-status-error {
  border-color: rgba(248,113,113,0.35);
  background: rgba(248,113,113,0.12);
  color: #fecaca;
}
.modal-content input.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Focus (flex) layout: one tall section per row */
.layout-flex main.grid.fill { display: flex; flex-direction: column; gap: 16px; max-height: none; overflow: auto; }
.layout-flex main.grid.fill > section.card { height: 75vh; max-height: 75vh; overflow: auto; }
.layout-flex main.grid.fill > section.card:nth-of-type(1),
.layout-flex main.grid.fill > section.card:nth-of-type(2) { max-height: 75vh; }
.layout-flex .grid { grid-template-columns: 1fr; }

/* Taller previews for Previous Projects in Focus layout */
.layout-flex #history-section #history-list li video { height: 50vh !important; width: 100% !important; }
/* Script history styles */
#script-history-list { list-style: none; padding: 0; margin: 0; }
#script-history-list .script-row { display:flex; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid rgba(255,255,255,0.08); }
#script-history-list .script-title-input { flex: 1; max-width: 250px; min-width: 0; border: none; border-bottom: 1px solid rgba(255,255,255,0.18); background: transparent; color: #e5e7eb; border-radius: 0; padding: 6px 2px; margin-bottom: 10px; font-size: 15px; }
#script-history-list .script-title-input:focus { outline: none; border-bottom-color: rgba(99,102,241,0.75); box-shadow: none; }
#script-history-list .script-actions { display:flex; gap:8px; }
/* YouTube section styles */
#youtube-section .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
#youtube-section .stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
}
#youtube-section .stat-label { font-size: 12px; color: #94a3b8; margin-bottom: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
#youtube-section .stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: #e5e7eb; }
#youtube-section .callout {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(99,102,241,0.35);
  border-radius: 12px;
}
#youtube-section .code-row .code { font-size: 18px; font-weight: 800; letter-spacing: 0.08em; }
#youtube-section, #youtube-section .controls-stack { min-width: 0; }
#youtube-section .list { list-style:none; margin:0; padding:0; width:100%; max-width:100%; overflow:auto; }
#youtube-section .script-row { padding:8px 0; border-bottom:1px solid rgba(255,255,255,0.06); }
#youtube-section .ytv-row { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; min-width:0; }
#youtube-section .ytv-title { flex:1 1 auto; min-width:0; color:#e5e7eb; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#youtube-section .ytv-meta { flex:0 0 auto; color:#94a3b8; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:50%; }

/* Focus mode: make Saved Scripts list fill available height */
.layout-flex #script-history-card .section-header { height: 100%; }
.layout-flex #script-history-card .section-header > .controls-stack { height: 100%; min-height: 0; }
.layout-flex #script-history-list { flex: 1 1 auto; min-height: 0; overflow: auto; max-height: none !important; }

/* Focus mode: make script name inputs full width, wrap actions below */
.layout-flex #script-history-list .script-row { flex-wrap: wrap; }
.layout-flex #script-history-list .script-title-input { flex: 1 1 100%; max-width: none; width: 100%; }

/* Docs: floating/mobile YouTube walkthrough embed */
.docs-yt-float {
  position: fixed;
  right: 16px;
  top: 100px;
  width: 360px;
  z-index: 600;
  display: none;
}
@media (min-width: 1200px) { .docs-yt-float { display: block; } }
.docs-yt-float .yt-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.docs-yt-float .yt-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.docs-yt-float .yt-open {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.16);
  color: #e5e7eb;
  font-size: 12px;
  text-decoration: none;
}
.docs-yt-float .yt-open:hover { filter: brightness(1.1); }

/* Collapse/expand controls for floating video (desktop) */
.docs-yt-float .yt-collapse,
.docs-yt-float .yt-expand {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.16);
  color: #e5e7eb;
  font-size: 12px;
  cursor: pointer;
}
.docs-yt-float .yt-collapse:hover,
.docs-yt-float .yt-expand:hover { filter: brightness(1.1); }
.docs-yt-float .yt-expand { display: none; }
.docs-yt-float.collapsed { width: auto; }
.docs-yt-float.collapsed .yt-wrap { display: none; }
.docs-yt-float.collapsed .yt-open { display: none; }
.docs-yt-float.collapsed .yt-collapse { display: none; }
.docs-yt-float.collapsed .yt-expand { display: inline-flex; position: static; }

.docs-yt-mobile { display: none; margin-top: 12px; }
@media (max-width: 768px) { .docs-yt-mobile { display: block; } }
.docs-yt-mobile .yt-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.docs-yt-mobile .yt-iframe { width: 100%; height: 100%; border: 0; }
.docs-yt-mobile .yt-caption { margin-top: 6px; font-size: 13px; color: #94a3b8; }
.docs-yt-mobile .yt-caption a { color: #c7d2fe; text-decoration: none; }
.docs-yt-mobile .yt-caption a:hover { color: #ffffff; }

/* Community Help styles */
.help-categories { display:flex; gap:8px; flex-wrap:wrap; }
.help-categories .help-cat { padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color:#e5e7eb; cursor:pointer; font-size:12px; }
.help-categories .help-cat.active { background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; box-shadow: 0 8px 22px rgba(99,102,241,0.35); }
.help-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:12px; margin-top:10px; }
.help-card { position:relative; background: rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); border-radius:14px; padding:14px; transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s cubic-bezier(.4,0,.2,1), border-color .25s ease; overflow:hidden; }
.help-card::before { content:""; position:absolute; inset:-1px; border-radius:16px; padding:1px; background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(139,92,246,0.25)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events:none; opacity:0; transition: opacity .25s ease; }
.help-card:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 16px 40px rgba(99,102,241,0.22); border-color: rgba(99,102,241,0.35); }
.help-card:hover::before { opacity: 1; }
.help-title {
  margin: 8px 0 4px;
  font-size: 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.help-meta { display:flex; align-items:center; justify-content: space-between; gap:8px; color:#94a3b8; font-size:12px; }
.help-icon { width:40px; height:40px; display:inline-flex; align-items:center; justify-content:center; border-radius:12px; background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); font-size:20px; box-shadow: 0 10px 24px rgba(0,0,0,0.35); cursor: pointer; }
hr.help-divider { border: 0; border-top: 1px solid rgba(255,255,255,0.08); margin: 10px 0; }
.help-badge { font-size:11px; padding:2px 8px; border-radius:999px; background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:#cbd5e1; }
.help-actions { display:flex; align-items:center; justify-content: space-between; gap:8px; margin-top:8px; }
.help-actions .secondary.help-open { padding:8px 12px; margin: 2px 4px; }
.help-like { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color:#e5e7eb; cursor:pointer; }
.help-like.liked { background: linear-gradient(135deg, #f472b6, #fb7185); border-color: transparent; color:#111827; box-shadow: 0 8px 22px rgba(236,72,153,0.35); }
.help-like .count { font-weight:700; }

/* Fancy toggle for Done */
.toggle { position: relative; display:inline-flex; align-items:center; justify-content:flex-start; width: 84px; height: 32px; border-radius: 999px; padding: 4px 8px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color:#e5e7eb; cursor: pointer; transition: background .25s ease, border-color .25s ease, box-shadow .25s ease, color .25s ease; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 999px; background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 6px 18px rgba(99,102,241,0.35); transition: transform .25s ease; }
.toggle .toggle-label { display:none; }
.toggle.on { background: linear-gradient(135deg, #6366f1, #8b5cf6); color:#ffffff; border-color: transparent; box-shadow: 0 10px 26px rgba(99,102,241,0.35); }
.toggle.on .knob { transform: translateX(50px); background: #ffffff; box-shadow: 0 8px 24px rgba(255,255,255,0.35); }
.help-done-toggle { margin: 2px 4px; }
.help-done { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:#94a3b8; }
.help-done input { margin:0; }
.help-progress-row { display:flex; align-items:center; gap:10px; margin-top:6px; }
.help-progress-bar { flex:1; height:10px; border-radius:999px; background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); overflow:hidden; }
.help-progress-bar #help-progress-fill { width:0%; height:100%; background: linear-gradient(90deg, #22d3ee, #3b82f6); transition: width .25s ease; }