:root {
  color-scheme: dark;
  --bg: #070a16;
  --panel: rgba(16, 22, 45, 0.84);
  --line: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #a9b4cc;
  --violet: #8b5cf6;
  --blue: #38bdf8;
  --teal: #2dd4bf;
  --danger: #fb7185;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(88, 28, 135, 0.24), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(14, 116, 144, 0.18), transparent 32%),
    linear-gradient(180deg, #070a16 0%, #0a0e1d 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    radial-gradient(circle at 20% 20%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 30%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 70%, white 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 85%, white 0 1px, transparent 1.5px);
  background-size: 190px 190px, 260px 260px, 230px 230px, 300px 300px;
}

.background-orb {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
}
.orb-one { background: var(--violet); top: 15%; left: -140px; }
.orb-two { background: var(--blue); bottom: 10%; right: -160px; }

.topbar {
  position: relative;
  z-index: 1;
  max-width: 1420px;
  margin: 0 auto;
  padding: 30px 28px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 23px;
  background: linear-gradient(135deg, rgba(139,92,246,.95), rgba(56,189,248,.85));
  box-shadow: 0 12px 32px rgba(88, 28, 135, 0.42);
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(22px, 3vw, 32px); margin-bottom: 0; letter-spacing: -0.035em; }
h2 { font-size: clamp(25px, 4vw, 40px); margin-bottom: 12px; letter-spacing: -0.04em; }
h3 { font-size: 18px; margin-bottom: 0; }

.eyebrow {
  margin-bottom: 7px;
  color: #b8a8ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.status-pill, .mini-stats span {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  color: #cbd5e1;
  border-radius: 999px;
}
.status-pill { padding: 10px 14px; font-size: 12px; white-space: nowrap; }
.status-pill.good { color: #9ff4d9; border-color: rgba(45,212,191,.35); }
.status-pill.bad { color: #fecdd3; border-color: rgba(251,113,133,.35); }

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1420px;
  margin: 0 auto;
  padding: 12px 28px 44px;
  display: grid;
  gap: 22px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-radius: 25px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr);
  gap: 26px;
  align-items: stretch;
}

.hero-copy { padding: 8px 4px; }
.hero-description {
  max-width: 850px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.72;
  margin-bottom: 22px;
}

.automatic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.automatic-grid div {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.028);
  border-radius: 14px;
  padding: 13px;
  min-height: 72px;
}
.automatic-grid strong { display: block; font-size: 12px; margin-bottom: 5px; }
.automatic-grid span { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }

.rotation-card {
  border: 1px solid rgba(139, 92, 246, .28);
  background: linear-gradient(180deg, rgba(67, 38, 126, .21), rgba(6, 11, 26, .6));
  border-radius: 19px;
  padding: 20px;
}
.rotation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  color: #dbe4f3;
  font-size: 12px;
}
.rotation-row strong { color: #93c5fd; }
.rotation-note { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 15px 0 0; }

.primary-button, .secondary-button, .copy-button {
  border: 0;
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  border-radius: 13px;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.primary-button {
  width: 100%;
  min-height: 58px;
  background: linear-gradient(100deg, #7c3aed, #2563eb 58%, #0891b2);
  box-shadow: 0 15px 35px rgba(37, 99, 235, .25);
  font-size: 15px;
}
.primary-button:hover, .secondary-button:hover, .copy-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-star { margin-right: 8px; }
.secondary-button, .copy-button {
  padding: 10px 13px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  font-size: 12px;
}
.copy-button.copied { background: rgba(45, 212, 191, .18); border-color: rgba(45,212,191,.4); }

.security-note { margin: 11px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
code { color: #c4b5fd; }

.output-card { padding: 26px; min-height: 680px; }
.state-box {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}
.state-box p { max-width: 610px; color: var(--muted); line-height: 1.65; }
.state-icon { font-size: 50px; color: #9e8df8; margin-bottom: 18px; }
.error-box h2 { color: #fecdd3; }

.loader {
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: var(--violet);
  border-right-color: var(--blue);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track {
  width: min(520px, 90%);
  height: 7px;
  margin: 18px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.065);
}
.progress-bar {
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--blue), var(--teal));
  animation: progress 2.2s ease-in-out infinite;
}
@keyframes progress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}
.loading-note { font-size: 11px; }

.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.result-header, .copy-card-header, .compact-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.mini-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.mini-stats span { padding: 7px 10px; font-size: 11px; }

.copy-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(7, 12, 27, .56);
}
.copy-card.featured {
  border-color: rgba(139, 92, 246, .4);
  background: linear-gradient(180deg, rgba(67, 38, 126, .19), rgba(7, 12, 27, .68));
}
.director-note { margin: 11px 0 0; color: #a9c8e4; font-size: 12px; line-height: 1.5; }
.output-textarea {
  width: 100%;
  margin-top: 14px;
  min-height: 260px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  background: #070b18;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.56;
  padding: 14px;
  resize: vertical;
  outline: none;
}
.output-textarea.large { min-height: 650px; }
.output-textarea.narration { min-height: 310px; }
.voice-brief { margin-top: 12px; color: #cbd5e1; font-size: 12px; line-height: 1.55; }

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.body-copy { margin-top: 12px; color: #d6deeb; font-size: 13px; line-height: 1.62; }
.source-list { display: grid; gap: 9px; margin-top: 15px; }
.source-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.025);
}
.source-item a, .source-item strong { color: #a5e7ff; font-size: 12px; text-decoration: none; }
.source-item span { display: block; color: #9aa7c0; font-size: 10px; margin-top: 4px; }
.source-item p { color: #c8d1e0; font-size: 11px; line-height: 1.48; margin: 7px 0 0; }

.scene-list { display: grid; gap: 11px; margin-top: 14px; }
.scene {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: rgba(255,255,255,.025);
}
.scene-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.scene-number { font-weight: 900; color: #c4b5fd; }
.scene-time { color: var(--muted); font-size: 11px; }
.scene p { margin-bottom: 8px; color: #d6deeb; font-size: 12px; line-height: 1.5; }
.scene details { color: var(--muted); font-size: 12px; }
.scene summary { cursor: pointer; color: #9bdff7; margin-top: 8px; }
.scene pre { white-space: pre-wrap; font: inherit; line-height: 1.55; color: #cbd5e1; }

.compact-card { align-items: center; }
.compact-card p { margin-bottom: 8px; line-height: 1.5; }
.hashtags { color: #7dd3fc; }

.social-post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}
.social-post-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: rgba(255,255,255,.025);
}
.social-post-card p { margin-top: 9px; color: #d6deeb; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.social-post-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.social-post-header h4 { color: #c4b5fd; font-size: 14px; }
.social-title { color: #e2e8f0 !important; }
.social-copy-button { padding: 8px 11px; }
.fallback-caption { margin-top: 14px; color: var(--muted); font-size: 12px; }
.fallback-caption summary { cursor: pointer; color: #9bdff7; }

.warning-card {
  margin-top: 14px;
  padding: 17px;
  border: 1px solid rgba(251,191,36,.28);
  background: rgba(120, 75, 0, .12);
  border-radius: 15px;
}
.warning-card h3 { color: #fde68a; }
.warning-card li { color: #f5deb0; margin-top: 7px; font-size: 12px; line-height: 1.5; }

footer {
  position: relative;
  z-index: 1;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0 28px 34px;
  text-align: center;
  color: #74819c;
  font-size: 11px;
}

@media (max-width: 980px) {
  .hero-card { grid-template-columns: 1fr; }
  .automatic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details-grid { grid-template-columns: 1fr; }
  .social-post-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; padding: 22px 16px 12px; }
  .status-pill { display: none; }
  .page-shell { padding: 8px 12px 30px; }
  .panel { border-radius: 18px; }
  .hero-card, .output-card { padding: 17px; }
  .automatic-grid { grid-template-columns: 1fr; }
  .result-header, .copy-card-header, .compact-card { flex-direction: column; align-items: stretch; }
  .output-textarea.large { min-height: 480px; }
  .state-box { min-height: 500px; padding: 18px; }
}

/* Generation feedback: full-screen progress and completion notification. */
#loadingState {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100vh;
  padding: 24px;
  background: rgba(4, 7, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.loading-panel {
  position: relative;
  width: min(680px, 100%);
  padding: clamp(26px, 5vw, 48px);
  padding-bottom: clamp(76px, 7vw, 92px);
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(22, 28, 56, 0.98), rgba(8, 12, 28, 0.98));
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.62);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.loading-panel h2 {
  max-width: 560px;
}

.loading-panel > p:not(.eyebrow) {
  max-width: 570px;
}

.loading-cancel-button {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(251, 113, 133, 0.55);
  border-radius: 50%;
  background: rgba(31, 10, 24, 0.92);
  color: #fecdd3;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  font: 700 28px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.loading-cancel-button:hover,
.loading-cancel-button:focus-visible {
  transform: scale(1.06);
  border-color: rgba(251, 113, 133, 0.95);
  background: rgba(65, 16, 38, 0.98);
  outline: none;
}

.loading-cancel-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.progress-summary,
.loading-meta {
  width: min(560px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.progress-summary {
  margin-top: 20px;
  color: #dbeafe;
  font-size: 13px;
}

.progress-summary strong {
  font-size: 18px;
  color: #ffffff;
}

.progress-summary span,
.loading-meta {
  color: var(--muted);
  font-size: 11px;
}

#loadingState .progress-track {
  width: min(560px, 100%);
  height: 12px;
  margin: 12px 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.28);
}

#loadingState .progress-bar {
  width: 0;
  animation: none;
  transition: width 0.65s ease;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.42);
}

#loadingState .loading-note {
  margin: 20px 0 0;
  color: #8794ae;
}

.primary-button.is-loading .button-star {
  display: inline-block;
  animation: spin 1.1s linear infinite;
}

.notification-toast {
  position: fixed;
  z-index: 1200;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 17, 36, 0.97);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.notification-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.notification-toast.success {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 20px 60px rgba(13, 148, 136, 0.16);
}

.notification-toast.error {
  border-color: rgba(251, 113, 133, 0.48);
  box-shadow: 0 20px 60px rgba(190, 24, 93, 0.16);
}

@media (max-width: 680px) {
  #loadingState {
    padding: 12px;
  }

  .loading-panel {
    padding: 26px 18px 76px;
    border-radius: 18px;
  }

  .loading-cancel-button {
    right: 16px;
    bottom: 16px;
  }

  .progress-summary strong {
    font-size: 16px;
  }

  .notification-toast {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loadingState .progress-bar,
  .notification-toast {
    transition: none;
  }
}


.separate-prompt-list { display: grid; gap: 14px; margin-top: 16px; }
.separate-prompt-card {
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(8, 15, 30, .55);
  border-radius: 16px;
  padding: 16px;
}
.separate-prompt-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.separate-prompt-header h4 { margin: 3px 0 2px; font-size: 15px; }
.prompt-step { color: #c4b5fd; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.prompt-tool { color: #9bdff7; font-size: 11px; margin: 0; }
.prompt-settings { color: #cbd5e1; font-size: 11px; line-height: 1.55; margin: 12px 0 10px; }
.asset-prompt { min-height: 190px; }
@media (max-width: 680px) {
  .separate-prompt-header { flex-direction: column; }
  .prompt-copy-button { width: 100%; }
}

.workflow-guide {
  padding: 26px;
}
.workflow-guide-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
}
.workflow-guide-head .hero-description {
  margin-bottom: 0;
}
.sync-rule {
  flex: 0 0 auto;
  border: 1px solid rgba(45, 212, 191, .38);
  background: rgba(45, 212, 191, .09);
  color: #a7f3d0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
}
.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.workflow-steps article {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  border-radius: 15px;
  padding: 15px;
  min-height: 148px;
}
.workflow-steps span {
  display: inline-block;
  margin-bottom: 16px;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}
.workflow-steps strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}
.workflow-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.guide-note {
  margin: 16px 0 0;
  color: #9bdff7;
  font-size: 12px;
  line-height: 1.55;
}
@media (max-width: 1050px) {
  .workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .workflow-guide { padding: 17px; }
  .workflow-guide-head { flex-direction: column; }
  .workflow-steps { grid-template-columns: 1fr; }
  .workflow-steps article { min-height: 0; }
  .sync-rule { width: 100%; text-align: center; }
}

.topic-picker {
  margin: 4px 0 18px;
  padding: 18px;
  border: 1px solid rgba(139, 92, 246, .28);
  border-radius: 17px;
  background: rgba(7, 12, 27, .48);
}
.topic-picker-head,
.archive-head,
.archive-item,
.archive-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.topic-picker-head { align-items: center; }
.secondary-button.compact { padding: 9px 12px; }
.secondary-button.active {
  border-color: rgba(45, 212, 191, .5);
  background: rgba(45, 212, 191, .12);
  color: #b8fff0;
}
.topic-search-label {
  display: block;
  margin: 15px 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.topic-search {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 8, 20, .78);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}
.topic-search:focus { border-color: rgba(56, 189, 248, .55); }
.topic-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  margin-top: 10px;
  padding-right: 4px;
  overflow-y: auto;
}
.topic-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.topic-option:hover { border-color: rgba(56, 189, 248, .38); background: rgba(56, 189, 248, .05); }
.topic-option.selected {
  border-color: rgba(139, 92, 246, .72);
  background: linear-gradient(135deg, rgba(124, 58, 237, .18), rgba(37, 99, 235, .1));
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .18);
}
.topic-number {
  flex: 0 0 auto;
  min-width: 30px;
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}
.topic-option-copy { min-width: 0; }
.topic-option-copy strong { display: block; font-size: 12px; line-height: 1.35; }
.topic-option-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.topic-selection-summary { margin: 11px 0 0; color: #a9c8e4; font-size: 11px; line-height: 1.5; }

.archive-panel { padding: 26px; }
.archive-head { align-items: center; }
.archive-head .hero-description { margin-bottom: 0; }
.archive-count {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: 999px;
  background: rgba(56, 189, 248, .08);
  color: #bcecff;
  font-size: 12px;
  font-weight: 800;
}
.archive-list { display: grid; gap: 10px; margin-top: 20px; }
.archive-item {
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.archive-item-copy { min-width: 0; }
.archive-item-copy h3 { margin-bottom: 7px; }
.archive-item-copy > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.archive-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.archive-meta span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #b9c5d9;
  font-size: 9px;
}
.archive-actions { flex: 0 0 auto; align-items: center; }

@media (max-width: 900px) {
  .topic-catalog { grid-template-columns: 1fr; }
  .archive-item { align-items: stretch; }
  .archive-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 680px) {
  .topic-picker-head,
  .archive-head,
  .archive-item { flex-direction: column; align-items: stretch; }
  .topic-picker,
  .archive-panel { padding: 16px; }
  .topic-catalog { max-height: 440px; }
  .archive-count { text-align: center; }
}

/* Built-in VPS authentication */
.auth-gate {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(500px, 100%);
  padding: 30px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.auth-intro,
.auth-security-note {
  color: var(--muted);
  line-height: 1.6;
}

.auth-intro { font-size: 14px; }
.auth-security-note { margin: 18px 0 0; font-size: 11px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.auth-tab {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-tab.active {
  color: white;
  background: rgba(139,92,246,.22);
}

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

.auth-form label {
  margin-top: 5px;
  color: #dbe4f3;
  font-size: 12px;
  font-weight: 750;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 8, 20, .66);
  color: white;
  padding: 12px 13px;
  font: inherit;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(56,189,248,.65);
  box-shadow: 0 0 0 3px rgba(56,189,248,.12);
}

.auth-form .primary-button { margin-top: 10px; }

.auth-error {
  margin: 16px 0 0;
  border: 1px solid rgba(251,113,133,.35);
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(127,29,29,.2);
  color: #fecdd3;
  font-size: 12px;
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  background: rgba(255,255,255,.045);
  color: #dbe4f3;
  font-size: 11px;
}

.account-pill button {
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(255,255,255,.07);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.account-pill button:disabled,
.auth-form button:disabled {
  opacity: .55;
  cursor: wait;
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .auth-card { padding: 23px; }
}

/* Facebook and Instagram standalone Did You Know feed-post creator */
.feed-post-creator-card {
  border-color: rgba(56, 189, 248, .3);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, .09), transparent 36%),
    rgba(8, 15, 30, .58);
}

.feed-post-creator-head,
.feed-post-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.feed-post-creator-head .body-copy {
  max-width: 760px;
  margin-bottom: 0;
}

.feed-post-create-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 250px;
  margin-top: 2px;
}

.feed-post-pack {
  margin-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, .17);
  padding-top: 20px;
}

.feed-post-summary {
  border: 1px solid rgba(45, 212, 191, .25);
  border-radius: 16px;
  padding: 16px;
  background: rgba(45, 212, 191, .065);
}

.feed-post-summary h4 {
  margin: 4px 0 8px;
  color: #f8fafc;
  font-size: 18px;
}

.feed-post-summary p:last-child {
  margin: 0;
  color: #d6deeb;
  font-size: 12px;
  line-height: 1.55;
}

.feed-facts {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,.025);
}

.feed-facts strong {
  color: #c4b5fd;
  font-size: 12px;
}

.feed-facts ul {
  margin: 10px 0 0 18px;
  padding: 0;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
}

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

.feed-output-card,
.feed-carousel-copy {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 16px;
  padding: 15px;
  background: rgba(4, 10, 24, .48);
}

.feed-output-card h4,
.feed-carousel-copy h4 {
  color: #c4b5fd;
  font-size: 13px;
}

.feed-output-text {
  min-height: 270px;
  margin-top: 12px;
}

.feed-carousel-copy {
  margin-top: 14px;
}

.feed-slide-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.feed-slide {
  min-height: 150px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 13px;
  padding: 12px;
  background: rgba(255,255,255,.025);
}

.feed-slide span {
  display: block;
  margin-bottom: 12px;
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.feed-slide strong {
  display: block;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
}

.feed-slide p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 1050px) {
  .feed-slide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .feed-post-creator-head,
  .feed-post-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .feed-post-create-button,
  .feed-post-summary .copy-button {
    width: 100%;
  }

  .feed-post-output-grid,
  .feed-slide-grid {
    grid-template-columns: 1fr;
  }

  .feed-output-text { min-height: 230px; }
}

.archive-feed-badge {
  border-color: rgba(45, 212, 191, .28) !important;
  color: #a7f3d0 !important;
  background: rgba(45, 212, 191, .07) !important;
}

/* Universe with Lumo content dashboard additions */
.dashboard-panel { padding: 28px; }
.dashboard-head, .campaign-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; }
.dashboard-accordion { display: grid; gap: 12px; margin-top: 18px; }
.dashboard-section { border: 1px solid var(--line); border-radius: 16px; background: rgba(7,12,27,.48); overflow: hidden; }
.dashboard-section > summary { cursor: pointer; padding: 16px 18px; font-weight: 900; color: #d8ccff; list-style: none; }
.dashboard-section > summary::-webkit-details-marker { display: none; }
.dashboard-section[open] > summary { border-bottom: 1px solid var(--line); background: rgba(139,92,246,.08); }
.dashboard-form { padding: 18px; display: grid; gap: 13px; }
.dashboard-form label, .production-state-card label { display: grid; gap: 7px; color: #cbd5e1; font-size: 12px; font-weight: 700; }
.dashboard-form input, .dashboard-form textarea, .dashboard-form select,
.production-state-card input, .production-state-card textarea, .production-state-card select {
  width: 100%; border: 1px solid rgba(148,163,184,.24); border-radius: 10px; background: #070b18; color: var(--text); padding: 11px 12px; font: inherit; outline: none;
}
.dashboard-form input:focus, .dashboard-form textarea:focus, .dashboard-form select:focus,
.production-state-card input:focus { border-color: rgba(139,92,246,.75); box-shadow: 0 0 0 3px rgba(139,92,246,.13); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.compact-form .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-list { display: grid; gap: 9px; padding: 0 18px 18px; }
.dashboard-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: rgba(255,255,255,.025); }
.dashboard-list-item h4 { margin: 0 0 5px; font-size: 14px; color: #e8e4ff; }
.dashboard-list-item p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dashboard-list-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.dashboard-list-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; font-size: 10px; color: #b9c7dc; }
.quality-dashboard { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 15px; }
.quality-metric { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.025); }
.quality-metric strong { display: block; font-size: 22px; color: #c4b5fd; margin-bottom: 5px; }
.quality-metric span { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }
.quality-wide { grid-column: span 3; }
.quality-warning-list, .fact-verification-list, .duplicate-list { display: grid; gap: 8px; margin-top: 10px; }
.quality-row { border-top: 1px solid rgba(148,163,184,.13); padding-top: 9px; font-size: 11px; color: #d6deeb; line-height: 1.5; }
.quality-row a { color: #7dd3fc; }
.campaign-actions { display: flex; flex-wrap: wrap; gap: 10px; min-width: min(100%, 420px); }
.small-primary { min-height: 44px; width: auto; padding: 10px 16px; }
.campaign-pack { margin-top: 16px; display: grid; gap: 14px; }
.campaign-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.campaign-output { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.025); }
.campaign-output h4 { margin: 0; color: #c4b5fd; }
.campaign-output textarea { min-height: 220px; }
.week-plan { display: grid; grid-template-columns: repeat(7, minmax(130px,1fr)); gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.week-day { border: 1px solid var(--line); border-radius: 12px; padding: 11px; background: rgba(255,255,255,.025); min-width: 130px; }
.week-day strong { display: block; color: #f4c453; margin-bottom: 5px; }
.week-day span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.headline-list, .myth-fact-box { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: rgba(7,12,27,.6); }
.headline-list li { margin-top: 8px; color: #d6deeb; font-size: 12px; }
.myth-fact-box p { color: #d6deeb; font-size: 12px; line-height: 1.55; }
.checklist-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.checklist-item { display: flex !important; grid-template-columns: auto 1fr !important; align-items: center; gap: 8px !important; border: 1px solid var(--line); border-radius: 11px; padding: 10px; background: rgba(255,255,255,.025); }
.checklist-item input { width: auto !important; }
.production-cost-grid { margin-top: 14px; grid-template-columns: minmax(180px,.4fr) minmax(0,1fr); }
.archive-feed-badge { color: #9ff4d9 !important; border-color: rgba(45,212,191,.35) !important; }
.archive-campaign-badge { color: #fde68a !important; border-color: rgba(251,191,36,.35) !important; }
.metric-good { color: #9ff4d9 !important; }
.metric-warn { color: #fde68a !important; }
.metric-bad { color: #fecdd3 !important; }

@media (max-width: 980px) {
  .dashboard-head, .campaign-head { flex-direction: column; }
  .form-grid, .compact-form .form-grid, .quality-dashboard { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .quality-wide { grid-column: span 2; }
  .checklist-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .campaign-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .form-grid, .compact-form .form-grid, .quality-dashboard, .checklist-grid, .production-cost-grid { grid-template-columns: 1fr; }
  .quality-wide { grid-column: span 1; }
  .dashboard-panel { padding: 18px; }
  .campaign-actions { min-width: 0; width: 100%; }
  .campaign-actions button { width: 100%; }
}
.brand-assets-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.brand-asset-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.025); display: grid; gap: 10px; }
.brand-asset-card strong { color: #e8e4ff; }
.brand-asset-card p { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
.brand-asset-card input[type="file"] { padding: 9px; }
.brand-asset-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 10px; background: #050816; border: 1px solid rgba(148,163,184,.2); }
@media (max-width: 620px) { .brand-assets-grid { grid-template-columns: 1fr; } }

.prompt-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 2px;
  padding: 10px 14px;
  border: 1px solid rgba(124, 58, 237, .32);
  border-radius: 12px;
  background: rgba(124, 58, 237, .10);
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.prompt-group-heading:first-child { margin-top: 0; }
.prompt-group-heading small { color: #93c5fd; font-size: 10px; letter-spacing: .04em; }
.prompt-index-row { display: flex; align-items: center; gap: 10px; }
.prompt-timing {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(244, 196, 83, .3);
  border-radius: 999px;
  padding: 3px 8px;
  color: #fde68a;
  background: rgba(244, 196, 83, .08);
  font-size: 10px;
  font-weight: 850;
}
.separate-prompt-card.kling-multishot {
  border-color: rgba(96, 165, 250, .24);
  background: rgba(8, 18, 38, .68);
}
.separate-prompt-card.kling-multishot .asset-prompt { min-height: 520px; }

.lumo-character-profile-card {
  border: 1px solid rgba(124, 58, 237, .42);
  border-radius: 15px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(124,58,237,.11), rgba(5,8,22,.72));
  display: grid;
  gap: 12px;
}
.lumo-character-profile-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.lumo-character-profile-head strong { color: #e8e4ff; font-size: 14px; }
.lumo-character-profile-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; max-width: 760px; }
.compact-profile-head { margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(148,163,184,.15); }
.lumo-profile-prompt { min-height: 390px; }
.lumo-presence-prompt { min-height: 170px; }
.lumo-character-steps { margin: 0; padding-left: 21px; color: #cbd5e1; font-size: 11px; line-height: 1.65; }
.lumo-character-steps li + li { margin-top: 3px; }
@media (max-width: 680px) {
  .lumo-character-profile-head { flex-direction: column; }
  .lumo-character-profile-head .copy-button { width: 100%; }
}

/* Episode versioning and Kling prompt-length guard */
.archive-meta .archive-version-badge {
  border-color: rgba(244, 196, 83, .48);
  background: rgba(244, 196, 83, .1);
  color: #ffe7a0;
  font-weight: 900;
}
.regenerate-version-button {
  border-color: rgba(139, 92, 246, .55);
  background: rgba(124, 58, 237, .12);
  color: #ddd2ff;
}
.regenerate-version-button:hover:not(:disabled) {
  border-color: rgba(167, 139, 250, .9);
  background: rgba(124, 58, 237, .22);
}
.prompt-character-count {
  margin: -3px 0 9px;
  color: #9bdff7;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}
