/*
 * Avora Shorts — design system
 * Geist · Antonio · warm-black hierarchy · creator-focused
 */

/* ── Fonts ──────────────────────────────────────────────────────────────── */
/* Antonio — Avora brand face, used for ALL text */
@font-face { font-family:"Antonio"; src:url("/fonts/Antonio-Regular.ttf")  format("truetype"); font-weight:400; }
@font-face { font-family:"Antonio"; src:url("/fonts/Antonio-Medium.ttf")   format("truetype"); font-weight:500; }
@font-face { font-family:"Antonio"; src:url("/fonts/Antonio-SemiBold.ttf") format("truetype"); font-weight:600; }
@font-face { font-family:"Antonio"; src:url("/fonts/Antonio-Bold.ttf")     format("truetype"); font-weight:700; }
/* Geist Mono — code / timestamps only */
@font-face { font-family:"Geist Mono"; src:url("/fonts/GeistMono-Regular.ttf") format("truetype"); font-weight:400; }
@font-face { font-family:"Geist Mono"; src:url("/fonts/GeistMono-Medium.ttf")  format("truetype"); font-weight:500; }

/* ── Tokens (dark default) ──────────────────────────────────────────────── */
:root {
  --bg:        #07090F;
  --surface:   #0E0E11;
  --surface-2: #131317;
  --surface-3: #1A1A1F;
  --surface-4: #22222A;
  --border:    #1C1C21;
  --border-2:  #2A2A33;
  --border-3:  #3A3A45;
  --text:      #FFFFFF;
  --text-2:    #D4D4D8;
  --text-3:    #8B8B92;
  --text-4:    #5E5E66;
  --text-mute: #3F3F46;
  --accent:    #FFFFFF;
  --accent-2:  #F0F0F2;
  --accent-dim: rgba(255,255,255,.07);
  --viral-a:   #FF7A1A;       /* force-viral hero tint */
  --viral-b:   #FF2D55;
  --success:   #34D399;
  --warning:   #FBBF24;
  --danger:    #F87171;
  --radius:    10px;
  --radius-sm: 7px;
}
[data-theme="light"] {
  --bg:        #FAFAFA;
  --surface:   #FFFFFF;
  --surface-2: #F2F2F4;
  --surface-3: #E8E8EB;
  --surface-4: #DEDEE2;
  --border:    #E5E5EA;
  --border-2:  #D4D4D8;
  --border-3:  #B4B4BA;
  --text:      #0B0B0E;
  --text-2:    #2A2A33;
  --text-3:    #6B6B72;
  --text-4:    #9494A0;
  --text-mute: #BBBBC2;
  --accent:    #0B0B0E;
  --accent-2:  #1A1A1F;
  --accent-dim: rgba(0,0,0,.06);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  margin:0; padding:0;
  background: var(--bg); color: var(--text);
  font-family:"Antonio", -apple-system, "Helvetica Neue", sans-serif;
  font-size: 14px; letter-spacing: 0.25px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; user-select: none; }
input, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--text-3); }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--border-3); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, .navbtn:focus-visible, .segbtn:focus-visible { outline-offset: 1px; }

code { font-family: "Geist Mono", monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ── Top bar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center;
  padding: 0 28px;
  height: 60px;
  border-bottom: 1px solid rgba(56,189,248,0.08);
  gap: 22px;
  position: sticky; top: 0;
  background: rgba(7,9,15,0.55);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  min-width: 90px;
  flex-shrink: 0;
}
.logo-mark { width: 22px; height: 22px; color: var(--text); }
.wordmark {
  font-family:"Antonio",sans-serif;
  font-weight: 700; font-size: 14px; letter-spacing: 3px;
  color: var(--text);
}

.topnav {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  flex: 1 1 auto;      /* grow to fill, allowed to shrink */
  min-width: 0;        /* allow shrinking below content size */
  max-width: 600px;    /* don't let it eat the whole bar */
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.navbtn {
  background: transparent; border: none;
  color: var(--text-3);
  padding: 6px 14px;
  font-size: 12px; font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.navbtn:hover { color: var(--text); }
.navbtn.active {
  background: var(--surface);
  color: var(--text);
  /* keep weight stable to prevent layout shift */
  box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 0 0 1px var(--border);
}
[data-theme="light"] .navbtn.active { box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 0 0 1px var(--border-2); }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.lang-select, .llm-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 500;
}
.lang-select:hover, .llm-select:hover { border-color: var(--border-2); color: var(--text); }

/* ── Segmented control ──────────────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 0;
}
.segbtn {
  background: transparent; border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 500;
  color: var(--text-3);
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.segbtn:hover { color: var(--text); }
.segbtn.active {
  background: var(--surface); color: var(--text);
  /* Don't change weight — that causes width jitter. Use shadow for emphasis. */
  box-shadow: 0 1px 2px rgba(0,0,0,.22), inset 0 0 0 1px var(--border);
}
[data-theme="light"] .segbtn.active { box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 0 0 1px var(--border-2); }
.segmented.small { padding: 2px; }
.segmented.small .segbtn { padding: 5px 10px; font-size: 11.5px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  height: 34px;
  font-size: 13px; font-weight: 500;
  letter-spacing: -0.05px;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn:active { background: var(--surface-3); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.primary {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent);
  padding: 8px 18px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.1px;
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.btn.primary:active { transform: translateY(0); }
.btn.primary:disabled, .btn:disabled {
  background: var(--surface-2); color: var(--text-mute);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.7;
}

.ghostbtn {
  background: transparent; border: none;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  transition: background .12s, color .12s;
}
.ghostbtn:hover { background: var(--surface-2); color: var(--text); }
.ghostbtn:active { background: var(--surface-3); }
.ghostbtn.small { padding: 3px 8px; font-size: 11px; }

.badge {
  background: var(--surface-3); color: var(--text-3);
  padding: 1px 7px; border-radius: 4px; font-size: 11px;
}
.kbd {
  font-family: "Geist Mono", monospace;
  background: var(--surface-2); border: 1px solid var(--border-2);
  padding: 1px 6px; border-radius: 4px; font-size: 11px;
  color: var(--text-3);
}

/* ── Tabviews ───────────────────────────────────────────────────────────── */
.tabview { display: none; }
.tabview.active { display: block; }

/* Tab exit — old tab slides & blurs out */
.tabview.tab-exit {
  display: block !important;
  pointer-events: none;
  animation: tab-cinematic-exit 0.22s cubic-bezier(0.55,0,1,0.45) both;
}

/* Tab enter — new tab wipes in from direction */
.tabview.tab-enter {
  display: block !important;
  animation: tab-cinematic-enter 0.44s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes tab-cinematic-exit {
  0%   { opacity:1; transform:translateX(0) scale(1); filter:none; }
  100% { opacity:0; transform:translateX(calc(var(--tab-dir,1) * -40px)) scale(0.978);
         filter:blur(8px) brightness(0.55) saturate(0); }
}

@keyframes tab-cinematic-enter {
  0%   { opacity:0; transform:translateX(calc(var(--tab-dir,1) * 54px)) scale(0.982);
         filter:blur(12px) brightness(1.9) saturate(0); }
  28%  { opacity:0.85; filter:blur(2px) brightness(1.15) saturate(0.6); }
  60%  { transform:translateX(0) scale(1); filter:blur(0) brightness(1.04) saturate(1.25); }
  100% { opacity:1; transform:translateX(0) scale(1); filter:none; }
}

/* Stagger cascade — children appear one-by-one inside entering tab */
.tab-stagger {
  animation: tab-item-stagger 0.48s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: calc(var(--si,0) * 38ms + 60ms);
}
@keyframes tab-item-stagger {
  from { opacity:0; transform:translateY(14px) scale(0.99); filter:blur(3px); }
  to   { opacity:1; transform:translateY(0)    scale(1);    filter:none; }
}

/* Tab flash + scan line — subtle electric-blue sweep on tab switch */
.av-tab-flash {
  position:fixed; inset:0; z-index:9992; pointer-events:none;
  background: linear-gradient(180deg,
    rgba(56,189,248,0.08) 0%,
    rgba(56,189,248,0.02) 30%,
    transparent 60%
  );
  animation: av-tab-flash-fade 0.44s ease-out forwards;
}
.av-tab-flash::after {
  content:'';
  position:absolute; left:0; right:0; height:1px; top:0;
  background: linear-gradient(90deg, transparent 5%, rgba(56,189,248,0.65) 30%, rgba(180,230,255,0.9) 50%, rgba(56,189,248,0.65) 70%, transparent 95%);
  box-shadow: 0 0 7px 2px rgba(56,189,248,0.22);
  animation: av-tab-scan 0.36s cubic-bezier(0.35,0,0.75,1) forwards;
}
@keyframes av-tab-flash-fade {
  0%   { opacity:0; }
  12%  { opacity:0.5; }
  100% { opacity:0; }
}
@keyframes av-tab-scan {
  from { top:0; opacity:1; }
  to   { top:100%; opacity:0; }
}
.page-shell { max-width: 1180px; margin: 0 auto; padding: 32px 28px 72px; }
.page-shell.narrow { max-width: 720px; }
.page-title {
  font-family:"Antonio",sans-serif;
  font-weight: 700; font-size: 32px; letter-spacing: 0.5px;
  margin: 0 0 6px;
  line-height: 1.1;
}
.page-sub { color: var(--text-3); font-size: 13px; margin: 0 0 26px; max-width: 640px; line-height: 1.5; }

.section { padding: 18px 20px; margin-bottom: 16px; }
.section .card-head { padding: 0 0 14px; }
.section + .section { margin-top: -2px; }

/* ── Cards (shared) ─────────────────────────────────────────────────────── */
.card {
  background: rgba(14,14,17,0.70);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.card-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px 18px 8px;
}
.card-title {
  color: var(--text); font-size: 13px; font-weight: 700;
  letter-spacing: 0.4px; font-family:"Antonio",sans-serif;
}
.card-sub  { color: var(--text-4); font-size: 12px; font-weight: 400; }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║                    GENERATOR — Hero + Concept                    ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.generator-shell { max-width: 1180px; margin: 0 auto; padding: 36px 28px 60px; }

.hero { margin-bottom: 36px; }
.hero-title {
  font-family:"Antonio",sans-serif;
  font-weight: 700; font-size: 48px; letter-spacing: 0.5px;
  margin: 0 0 6px;
}
.hero-sub { color: var(--text-3); font-size: 14px; margin: 0 0 22px; }

.force-row {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: stretch;
}
.prompt-input.large {
  flex: 1;
  font-size: 15px;
  padding: 0 18px;
  height: 52px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  transition: border-color .15s, background .15s;
}
.prompt-input.large:hover { border-color: var(--border-3); }
.prompt-input.large:focus { border-color: var(--text-3); background: var(--surface-2); }
.prompt-input.large::placeholder { color: var(--text-4); }

.force-btn {
  background: linear-gradient(135deg, var(--viral-a) 0%, var(--viral-b) 100%);
  border: none; color: #fff;
  padding: 14px 26px;
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: 10px;
  display: inline-flex; align-items: center; gap: 9px;
  height: 52px;
  box-shadow: 0 6px 18px rgba(255, 45, 85, 0.30), inset 0 1px 0 rgba(255,255,255,.22);
  transition: box-shadow .18s, filter .15s;
  flex-shrink: 0;
}
.force-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 26px rgba(255, 45, 85, 0.42), inset 0 1px 0 rgba(255,255,255,.25);
}
.force-btn:active { filter: brightness(.95); box-shadow: 0 3px 10px rgba(255, 45, 85, 0.30); }
.force-btn .bolt { font-size: 17px; line-height: 1; }
.force-btn:disabled { opacity: 0.65; cursor: not-allowed; }
[data-theme="light"] .force-btn { box-shadow: 0 6px 18px rgba(255, 45, 85, 0.22); }

.gen-controls {
  display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end;
  margin-bottom: 4px;
}
.gen-controls .ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gen-controls .ctl label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  white-space: nowrap;
}
.gen-controls .ctl .select { min-width: 160px; }
.gen-controls .ctl .segmented { flex-shrink: 0; }

/* Concept history strip */
.concept-history { margin-bottom: 24px; }
.ch-label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 8px;
}
.ch-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 12px 5px 5px;
  font-size: 12px; color: var(--text-2);
  transition: background .15s, border-color .15s;
  max-width: 240px;
}
.ch-chip:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.ch-score {
  flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-4); color: var(--text);
  font-size: 10px; font-weight: 700; font-family: "Geist Mono", monospace;
}
.ch-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Concept result */
.concept { animation: fadeIn .25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.concept-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.concept-head > div:first-child { flex: 1; min-width: 280px; }
.concept-title {
  font-family:"Antonio",sans-serif;
  font-weight: 700; font-size: 26px; letter-spacing: 0.3px;
  line-height: 1.15;
  word-break: break-word;
}
.concept-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.concept-meta .chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: default;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.concept-meta .chip.long-form {
  background: linear-gradient(135deg, rgba(255,122,26,.15), rgba(255,45,85,.15));
  border-color: rgba(255,122,26,.4);
  color: var(--text);
  font-weight: 600;
}
.concept-meta .chip.long-form::before { content: "● "; color: var(--viral-a); }
.concept-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

/* ── Storyboard filmstrip ───────────────────────────────────────────────── */
.storyboard-wrap {
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.storyboard-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 14px;
}
.storyboard {
  display: flex; gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.storyboard::-webkit-scrollbar { height: 8px; }

.sb-frame {
  position: relative;
  flex-shrink: 0;
  scroll-snap-align: start;
  animation: sbIn .3s ease-out backwards;
}
.storyboard .sb-frame:nth-child(1) { animation-delay: 0s; }
.storyboard .sb-frame:nth-child(2) { animation-delay: .04s; }
.storyboard .sb-frame:nth-child(3) { animation-delay: .08s; }
.storyboard .sb-frame:nth-child(4) { animation-delay: .12s; }
.storyboard .sb-frame:nth-child(5) { animation-delay: .16s; }
.storyboard .sb-frame:nth-child(n+6) { animation-delay: .2s; }
@keyframes sbIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.sb-frame.ar-916 { width: 150px; height: 267px; }   /* 9:16 */
.sb-frame.ar-169 { width: 280px; height: 158px; }   /* 16:9 */

.sb-screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 2px rgba(0,0,0,.4);
  display: flex; flex-direction: column;
}
[data-theme="light"] .sb-screen { box-shadow: 0 8px 24px rgba(0,0,0,.14); }

.sb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 9px;
}
.sb-tc {
  font-family: "Geist Mono", monospace;
  font-size: 9px; color: rgba(255,255,255,.7);
  background: rgba(0,0,0,.4);
  padding: 2px 6px; border-radius: 4px;
  backdrop-filter: blur(4px);
}
.sb-hookbadge {
  font-size: 8px; font-weight: 800; letter-spacing: 0.8px;
  color: #fff;
  background: linear-gradient(135deg, var(--viral-a), var(--viral-b));
  padding: 2px 6px; border-radius: 4px;
}
.sb-visual {
  flex: 1;
  padding: 4px 11px;
  font-size: 10px; line-height: 1.35;
  color: rgba(255,255,255,.55);
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}
.sb-caption {
  position: absolute; left: 8px; right: 8px;
  text-align: center;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9);
  line-height: 1.2;
  padding: 4px;
}
.sb-frame.ar-916 .sb-caption { font-size: 13px; }
.sb-frame.ar-169 .sb-caption { font-size: 15px; }
.sb-caption.center { top: 50%; transform: translateY(-50%); }
.sb-caption.lower  { bottom: 34px; }
/* Platform caption flavors */
.sb-caption.cap-yt  { font-family: "Antonio", sans-serif; }
.sb-caption.cap-tt  { text-transform: uppercase; letter-spacing: .3px; }
.sb-caption.cap-ig  { font-style: italic; }
.sb-caption.cap-ytl { font-family: "Antonio", sans-serif; text-transform: uppercase; }

.sb-audio {
  padding: 6px 9px;
  font-size: 8.5px; color: rgba(255,255,255,.45);
  font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
}
.sb-num {
  position: absolute; top: -7px; left: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-4); color: var(--text-2);
  border: 1px solid var(--border-2);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.sb-progress {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--viral-a), var(--viral-b));
}
/* Playback highlight */
.sb-frame { transition: transform .2s, filter .2s; }
.sb-frame.sb-playing { transform: scale(1.04); }
.sb-frame.sb-playing .sb-screen {
  box-shadow: 0 0 0 2px var(--viral-a), 0 12px 30px rgba(255,45,85,.35);
}
.sb-frame.sb-playing .sb-num { background: var(--viral-a); color: #fff; border-color: var(--viral-a); }
.storyboard:has(.sb-playing) .sb-frame:not(.sb-playing) { filter: brightness(.6); }

.concept-grid {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px;
}
.concept-grid .card { padding-bottom: 18px; }

.hook-text {
  margin: 0 18px 18px;
  padding: 16px 18px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 16px; font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.shots { margin: 0 18px; display: flex; flex-direction: column; gap: 8px; }
.shot-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.shot-row .tc { font-family:"Geist Mono",monospace; font-size: 11px; color: var(--text-3); padding-top: 2px; white-space: nowrap; }
.shot-row > div:last-child { min-width: 0; }
.shot-row .visual { color: var(--text); font-size: 13px; line-height: 1.45; margin-bottom: 6px; overflow-wrap: anywhere; }
.shot-row .ost {
  color: var(--text-2); font-size: 11px; padding: 2px 8px;
  background: var(--surface-4); border-radius: 4px;
  display: inline-block; margin: 0 6px 4px 0;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.shot-row .audio {
  color: var(--text-4); font-size: 11px; font-style: italic;
  display: inline-block; vertical-align: middle;
}
@media (max-width: 540px) {
  .shot-row { grid-template-columns: 1fr; }
  .shot-row .tc { padding-top: 0; }
}

.scores {
  margin: 0 18px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.score-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center; gap: 10px;
}
.score-row .pname { color: var(--text-2); font-size: 12px; font-weight: 500; }
.score-row .pbar-outer {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.score-row .pbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--viral-a), var(--viral-b));
  transition: width .35s ease-out;
}
.score-row .pbar-fill.cool {
  background: linear-gradient(90deg, var(--text-3), var(--text));
}
.score-row .pval {
  color: var(--text); font-size: 13px; font-weight: 700;
  text-align: right;
  font-family: "Geist Mono", monospace;
}
.score-row.best .pname::before { content: "★ "; color: var(--viral-a); }

/* ── Real virality evidence (corpus-grounded) ───────────────────────────── */
.virality-evidence {
  margin: 6px 18px 18px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ve-headline {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px;
}
.ve-score {
  font-family: "Antonio",sans-serif;
  font-size: 36px; font-weight: 700; line-height: 1;
  color: var(--text);
  background: linear-gradient(135deg, var(--viral-a), var(--viral-b));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ve-label {
  color: var(--text-3); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.2px;
}
.ve-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ve-bar-row {
  display: grid; grid-template-columns: 80px 1fr 32px;
  align-items: center; gap: 10px;
}
.ve-bar-label { color: var(--text-3); font-size: 11px; }
.ve-bar-track {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px; height: 6px; overflow: hidden;
}
.ve-bar-fill {
  height: 100%; background: var(--text-2);
  transition: width .35s ease-out;
}
.ve-bar-val {
  font-family: "Geist Mono", monospace;
  font-size: 11px; color: var(--text-2); text-align: right;
}
.ve-evidence {
  color: var(--text-2); font-size: 12px; line-height: 1.5;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 8px;
}
.ve-verdict { color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 1.5; padding: 4px 0 0; }
.ve-neighbors { margin-top: 12px; }
.ve-neighbors summary {
  color: var(--text-3); font-size: 11px; cursor: pointer;
  padding: 6px 0; user-select: none;
}
.ve-neighbors summary:hover { color: var(--text); }
.ve-neighbor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 11px;
  margin-top: 5px;
}
.ve-neighbor .vnt { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-neighbor .vnm { color: var(--text-4); font-size: 10.5px; font-family: "Geist Mono", monospace; margin-top: 2px; }

/* Section labels inside the virality block */
.ve-section-label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  margin: 16px 0 8px;
}

/* Retention curve sparkline */
.retention-sparkline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
}
.rc-svg { width: 100%; height: 70px; display: block; }
.rc-line { fill: none; stroke: url(#rcGrad); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.rc-area { fill: rgba(255, 122, 26, 0.10); stroke: none; }
.rc-mark { fill: var(--viral-b); }
.rc-mark.rc-rehook { fill: var(--success); }
.rc-mark.rc-hook   { fill: var(--viral-a); }
/* Use --viral-a/--viral-b directly since SVG can't use CSS gradient via stroke; fall back to flat color */
.rc-line { stroke: var(--viral-b); }
.rc-axis {
  display: flex; justify-content: space-between;
  font-family: "Geist Mono", monospace;
  font-size: 10px; color: var(--text-3);
  margin-top: 4px;
}

/* Improvement advisor rows */
.ve-advice { display: flex; flex-direction: column; gap: 8px; }
.advice-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
}
.adv-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; margin-bottom: 6px;
}
.adv-fix {
  color: var(--text); font-size: 13px; font-weight: 600;
  line-height: 1.4;
}
.adv-lift {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--viral-a), var(--viral-b));
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 4px;
  letter-spacing: 0.3px;
  font-family: "Geist Mono", monospace;
}
.adv-why  { color: var(--text-2); font-size: 11.5px; line-height: 1.5; margin-bottom: 4px; }
.adv-ev   { color: var(--text-4); font-size: 11px; line-height: 1.4; font-style: italic; }

/* Hook variants rack */
.hook-variants {
  margin: 0 18px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.hook-variants-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 4px;
}
.hv-row {
  display: grid; grid-template-columns: 36px 1fr 56px;
  align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  transition: background .15s, border-color .15s;
}
.hv-row:hover { background: var(--surface-3); border-color: var(--border-2); }
.hv-lever {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-3);
  text-align: center;
}
.hv-line { color: var(--text); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.hv-score {
  text-align: right; font-family: "Geist Mono", monospace;
  font-size: 13px; font-weight: 700; color: var(--text);
}

.kvgrid {
  margin: 0 18px 12px;
  display: grid; grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 14px; font-size: 12px;
}
.kvgrid .k {
  color: var(--text-3); text-transform: uppercase; font-size: 10px;
  letter-spacing: 1.2px; font-weight: 700; padding-top: 2px;
  white-space: nowrap;
}
.kvgrid .v {
  color: var(--text-2); line-height: 1.5;
  min-width: 0; overflow-wrap: anywhere;
}
@media (max-width: 540px) {
  .kvgrid { grid-template-columns: 1fr; gap: 2px 0; }
  .kvgrid .k { padding-top: 8px; }
}

.caps { margin: 0 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.cap-row {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 7px;
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.cap-row .copy { color: var(--text-4); font-size: 11px; cursor: pointer; }
.cap-row .copy:hover { color: var(--text); }

.tags { margin: 0 18px 14px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  background: var(--surface-3); color: var(--text-2);
  padding: 3px 9px; border-radius: 4px; font-size: 11px;
  font-family: "Geist Mono", monospace;
}

.kvline {
  margin: 0 18px 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2); font-size: 12px; line-height: 1.5;
}
.kvline.emph { color: var(--text); font-weight: 600; border-color: var(--border-2); }

.hero-skel {
  display: flex; flex-direction: column; gap: 10px; padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.hero-skel::after {
  /* shimmer sweep */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.04) 50%, transparent 70%);
  animation: shimmer 1.8s linear infinite;
}
.skel-bar { height: 14px; background: var(--surface-2); border-radius: 6px; animation: pulse 1.4s ease-in-out infinite; }
.skel-bar:nth-child(1) { width: 70%; }
.skel-bar:nth-child(2) { width: 92%; }
.skel-bar:nth-child(3) { width: 60%; }
.skel-text {
  color: var(--text-3); font-size: 12px; margin-top: 12px;
  display: flex; align-items: center; gap: 6px;
  position: relative; z-index: 1;
}
.skel-text b { color: var(--text-2); font-weight: 600; }
.skel-text::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--viral-a);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:.55; } 50% { opacity:.85; } }
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.8); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║                      NICHES                                       ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.niche-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding-top: 8px;
}
.niche-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  transition: background .15s, border-color .15s, transform .12s;
  cursor: pointer;
  min-height: 140px;
}
.niche-card:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  transform: translateY(-2px);
}
.niche-card:active { transform: translateY(0); }
.niche-card .emoji { font-size: 22px; }
.niche-card .name { color: var(--text); font-size: 14px; font-weight: 600; }
.niche-card .desc { color: var(--text-3); font-size: 11.5px; line-height: 1.45; }
.niche-card .heat {
  align-self: flex-start;
  background: linear-gradient(90deg, var(--viral-a), var(--viral-b));
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  letter-spacing: 0.4px;
}

.niche-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding-top: 8px;
}

.nd-body { padding: 4px 4px 14px; display: flex; flex-direction: column; gap: 14px; }
.nd-body .label { color: var(--text-3); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 6px; }
.nd-list { display: flex; flex-direction: column; gap: 6px; }
.nd-list .row {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 12px; font-size: 12px;
}
.nd-list .row .t { color: var(--text); font-weight: 600; }
.nd-list .row .why { color: var(--text-3); font-size: 11px; margin-top: 3px; }
.nd-actions { display: flex; justify-content: flex-end; padding: 12px 4px 0; }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║                      EDITOR TAB                                   ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.editor-topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; row-gap: 10px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 28px 0;
  background: transparent;
  border: none;
}
.editor-topbar .segmented { background: var(--surface); }
.editor-topbar .ai-toggle {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  transition: background .15s, border-color .15s;
}
.editor-topbar .ai-toggle:hover { background: var(--surface-2); border-color: var(--border-2); }
.ai-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3);
  cursor: pointer; user-select: none;
}
.ai-toggle input { accent-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 28px 48px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 14px; }
.section-header { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.section-title { color: var(--text); font-size: 14px; font-weight: 700; font-family:"Antonio",sans-serif; letter-spacing:0.3px; }

.drop-zone {
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: 14px;
  padding: 50px 40px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.drop-zone:hover { background: var(--surface-2); border-color: var(--border-3); }
.drop-zone.active { background: var(--surface-3); border-color: var(--accent); }
.drop-zone.compact { padding: 24px 40px; }
.dz-icon { font-size: 22px; color: var(--text-4); margin-bottom: 10px; }
.dz-title { color: var(--text-2); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.dz-sub { color: var(--text-4); font-size: 11px; letter-spacing: 0.1px; }

.dz-mini {
  margin: 0 16px 14px; padding: 16px;
  border: 1px dashed var(--border); border-radius: 8px;
  text-align: center; background: var(--surface-2);
  cursor: pointer; transition: all .15s;
}
.dz-mini:hover { border-color: var(--border-2); background: var(--surface-3); }
.dz-mini.active { border-color: var(--accent); background: var(--surface-3); }
.dz-mini-text { color: var(--text-3); font-size: 12px; }

.empty-state {
  color: var(--text-4); font-size: 12px;
  text-align: center; padding: 36px 16px;
}
.queue-list, .output-list { padding: 6px; display: flex; flex-direction: column; gap: 4px; }

.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  transition: background .15s, border-color .15s;
}
.row:hover { background: var(--surface-3); border-color: var(--border-2); }
.row .row-name { overflow: hidden; }
.row .row-name .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dot { font-size: 8px; width: 12px; text-align: center; color: var(--text-mute); }
.row-dot.active { color: var(--accent); }
.row-dot.ok { color: var(--success); }
.row-dot.err { color: var(--danger); }
.row-dot.warn { color: var(--warning); }
.row-name { flex: 1; min-width: 0; }
.row-name .name { color: var(--text); font-size: 13px; font-weight: 500; }
.row-name .meta { color: var(--text-4); font-size: 11px; margin-top: 2px; }
.row-status { color: var(--text-3); font-size: 11px; font-weight: 500; margin-right: 4px; min-width: 80px; text-align: right; }
.row-status.ok { color: var(--success); }
.row-status.err { color: var(--danger); }
.row-action {
  background: transparent; border: none;
  color: var(--text-4); font-size: 14px;
  padding: 4px 8px; border-radius: 5px;
}
.row-action:hover { color: var(--danger); background: var(--surface-4); }
.output-row .play {
  background: var(--accent); color: var(--bg);
  padding: 4px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 600;
  text-decoration: none;
}

.audio-stats { margin: 0 16px 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.audio-stats .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.audio-stats .v { color: var(--text); font-size: 16px; font-weight: 600; }
.audio-stats .l { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.audio-stats .extra { margin-top: 8px; color: var(--text-3); font-size: 11px; }

.settings { padding-bottom: 18px; }
.setting { padding: 8px 18px; display: flex; flex-direction: column; gap: 6px; }
.setting-label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.3px; text-transform: uppercase;
}
.select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px;
  color: var(--text); font-size: 13px;
}
.select:focus { outline: none; border-color: var(--border-2); }
.check { display: flex; align-items: center; gap: 9px; padding: 5px 18px; color: var(--text-2); font-size: 13px; }
.check input { accent-color: var(--accent); }
.hr { border-top: 1px solid var(--border); margin: 8px 18px; }

.progress-row { display: flex; flex-direction: column; gap: 6px; }
.progress-bar { background: var(--surface-2); height: 3px; border-radius: 2px; overflow: hidden; }
.progress-fill { background: var(--accent); height: 100%; width: 0%; transition: width .2s; }
.progress-label { color: var(--text-3); font-size: 11px; font-family: "Geist Mono", monospace; }

.log-card { display: flex; flex-direction: column; }
.log {
  margin: 0 14px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2); font-family: "Geist Mono", monospace;
  font-size: 11px; padding: 12px 14px;
  height: 260px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.log.mini { height: 120px; font-size: 11px; }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║                         SCHEDULE                                  ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.sched-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  align-items: end;
}
.sched-form .ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sched-form .ctl.wide { grid-column: 1 / -1; }
.sched-form textarea.text-input { font-family: inherit; resize: vertical; min-height: 64px; }
.sched-form .ctl label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
}
.sched-form .ctl > button { align-self: flex-start; }
.next-slot { font-size: 11px; margin-left: 0; align-self: center; display: block; margin-top: 6px; }

/* Platform multi-select checkboxes */
.platform-checks {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.pchk {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px; color: var(--text-2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pchk:hover { background: var(--surface-2); border-color: var(--border-2); }
.pchk input { accent-color: var(--accent); margin: 0; }
.pchk input:checked + span { color: var(--text); font-weight: 500; }
.composer-actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
#composeStatus { font-size: 12px; }

/* AI-filled draft cards (one per platform) */
.draft-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 10px;
  overflow: hidden;
}
.draft-card[open] { background: var(--surface); border-color: var(--border-2); }
.draft-card summary {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.draft-card summary::-webkit-details-marker { display: none; }
.draft-card summary::before {
  content: "▸"; color: var(--text-3); font-size: 11px;
  transition: transform .15s;
}
.draft-card[open] summary::before { transform: rotate(90deg); }
.dc-plat {
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  padding: 3px 9px; border-radius: 4px;
  letter-spacing: 0.3px;
}
.dc-title {
  flex: 1; color: var(--text); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dc-body {
  padding: 4px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.dc-field { display: flex; flex-direction: column; gap: 5px; }
.dc-field label {
  color: var(--text-3); font-size: 10px; font-weight: 700;
  letter-spacing: 1.1px; text-transform: uppercase;
}
.dc-field input, .dc-field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--text); font-size: 13px;
  font-family: inherit;
  width: 100%; outline: none;
  resize: vertical;
}
.dc-field textarea { line-height: 1.5; }
.dc-field input:focus, .dc-field textarea:focus { border-color: var(--border-2); background: var(--surface); }

.sched-list { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.sched-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 140px 100px 80px;
  align-items: center; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  transition: background .15s, border-color .15s;
}
.sched-row:hover { background: var(--surface-3); border-color: var(--border-2); }
.sched-row .icon { font-size: 14px; color: var(--text-3); }
.sched-row .main { min-width: 0; }
.sched-row .main .title { color: var(--text); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-row .main .meta { color: var(--text-4); font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-row .when { color: var(--text-2); font-size: 12px; font-family: "Geist Mono", monospace; }
.sched-row .status {
  font-size: 10px; padding: 3px 9px; border-radius: 4px; text-align: center;
  background: var(--surface-3); color: var(--text-3); font-weight: 600;
  letter-spacing: 0.4px; text-transform: uppercase;
}
.sched-row .status.posted    { background: rgba(52,211,153,.15);  color: var(--success); }
.sched-row .status.failed    { background: rgba(248,113,113,.15); color: var(--danger); }
.sched-row .status.uploading { background: rgba(251,191,36,.15);  color: var(--warning); }
.sched-row .status.cancelled { background: var(--surface-3);      color: var(--text-4); }
.sched-row .actions { text-align: right; }

/* Autoposter pill + activity log */
.autopost-pill {
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  padding: 3px 9px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-3);
}
.autopost-pill.ok   { background: rgba(52,211,153,.15); color: var(--success); }
.autopost-pill.warn { background: rgba(251,191,36,.15); color: var(--warning); }
.autopost-log {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 240px; overflow-y: auto;
  padding-top: 6px;
}
.apl-row {
  display: grid;
  grid-template-columns: 18px 70px 110px minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11.5px;
}
.apl-row.ok  .apl-icon { color: var(--success); }
.apl-row.err .apl-icon { color: var(--danger); }
.apl-row.info .apl-icon { color: var(--text-3); }
.apl-action { color: var(--text-2); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.apl-plat { color: var(--text-3); font-size: 11px; }
.apl-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apl-err { color: var(--danger); font-family: "Geist Mono", monospace; font-size: 10.5px; }
.apl-when { color: var(--text-4); font-family: "Geist Mono", monospace; font-size: 10.5px; }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║                         PRESETS                                   ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.preset-list { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.preset-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px;
}
.preset-row .pk {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-3);
  background: var(--surface-3); padding: 3px 8px; border-radius: 4px;
}
.preset-row .pn { color: var(--text); font-size: 13px; font-weight: 500; flex: 1; }
.preset-row .pd { color: var(--text-4); font-size: 11px; font-family: "Geist Mono", monospace; }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: modalFade .18s ease-out;
}
.modal-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-theme="light"] .modal-bg { background: rgba(0,0,0,.40); }
.modal-body {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 26px 28px;
  width: min(900px, 92vw); max-height: 86vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: modalIn .22s cubic-bezier(.2,.7,.3,1);
}
[data-theme="light"] .modal-body { box-shadow: 0 24px 60px rgba(0,0,0,.18); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-body.small { width: min(520px, 92vw); }
.modal-body.wide  { width: min(1040px, 96vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; color: var(--text); font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.modal-sub { color: var(--text-3); font-size: 12px; margin: 0 0 18px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.template-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all .15s;
}
.template-card:hover { background: var(--surface-3); border-color: var(--border-2); }
.template-card .head { display: flex; align-items: center; gap: 10px; }
.template-card .icon { font-size: 22px; color: var(--text); }
.template-card .name { color: var(--text); font-size: 15px; font-weight: 600; }
.template-card .music-badge { margin-left: auto; color: var(--text-3); background: var(--surface-4); border-radius: 4px; padding: 1px 6px; font-size: 11px; }
.template-card .desc { color: var(--text-2); font-size: 12px; line-height: 1.5; }
.template-card .use { color: var(--text-4); font-size: 11px; font-style: italic; }
.template-card .actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

.text-input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 12px;
  color: var(--text); font-size: 13px;
  width: 100%; outline: none;
}
.text-input.small { width: auto; padding: 6px 10px; font-size: 12px; }
.text-input:focus { border-color: var(--border-2); }

.inline-label { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; }
.inline-label .select.small { padding: 6px 10px; font-size: 12px; }

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 14px 0 0;
  overflow-x: auto;
}
.tab {
  background: transparent; border: none;
  color: var(--text-3); padding: 10px 14px;
  font-size: 12px; font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panes { padding: 14px 0 0; }
.tab-pane  { display: none; }
.tab-pane.active { display: flex; flex-direction: column; gap: 12px; }

.tool-row { display: flex; align-items: center; gap: 10px; }
.tool-row.vertical { flex-direction: column; align-items: stretch; }
.tool-desc { color: var(--text-3); font-size: 12px; margin: 0; }

.result-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-family: "Geist Mono", monospace;
  font-size: 12px; padding: 14px 16px;
  min-height: 220px; max-height: 50vh;
  overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  margin: 0;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-2);
  padding: 4px 12px; border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

.lib-list {
  margin-top: 12px; max-height: 60vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.lib-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.lib-row .name { color: var(--text); font-size: 13px; font-weight: 500; }
.lib-row .meta { color: var(--text-4); font-size: 11px; margin-top: 2px; }
.lib-row .chip-uses {
  background: var(--surface-3); color: var(--text-3);
  border-radius: 4px; padding: 1px 7px; font-size: 11px;
  margin-right: 6px;
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-host {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 380px;
  padding: 12px 16px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0; transform: translateX(16px) scale(.97);
  transition: opacity .24s ease, transform .24s cubic-bezier(.2,.7,.3,1);
}
[data-theme="light"] .toast { box-shadow: 0 12px 32px rgba(0,0,0,.16); }
.toast.show { opacity: 1; transform: none; }
.toast-icon {
  flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  background: var(--text-3);
}
.toast-msg { line-height: 1.4; }
.toast-success .toast-icon { background: var(--success); color: #06281d; }
.toast-error   .toast-icon { background: var(--danger);  color: #2a0a0a; }
.toast-warn    .toast-icon { background: var(--warning); color: #2a1e02; }
.toast-info    .toast-icon { background: var(--text-3); }
.toast-error   { border-color: rgba(248,113,113,.4); }
.toast-success { border-color: rgba(52,211,153,.4); }

.dot { font-size: 8px; }
.dot-muted   { color: var(--text-mute); }
.dot-active  { color: var(--accent); }
.dot-ok      { color: var(--success); }
.dot-err     { color: var(--danger); }
.dot-warn    { color: var(--warning); }

/* ── Higgsfield tab ─────────────────────────────────────────────────────── */
.hf-shell { max-width: 1300px; }
.hf-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}
.hf-launch-group { display: flex; gap: 8px; align-items: center; flex-shrink: 0; padding-top: 6px; }
.hf-launch-btn {
  background: var(--viral-a); color: #fff; border: none;
  padding: 8px 20px; border-radius: var(--radius-sm); font-weight: 600;
  letter-spacing: .3px; text-decoration: none; display: inline-flex;
  align-items: center; gap: 4px; transition: opacity .15s;
}
.hf-launch-btn:hover { opacity: .85; }

.hf-layout {
  display: grid; grid-template-columns: 1fr 420px; gap: 20px; align-items: start;
}
.hf-controls { display: flex; flex-direction: column; gap: 0; }

.hf-scene { min-height: 90px; resize: vertical; }

.hf-chips {
  display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px;
}
.chip-btn {
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text-2); padding: 5px 13px; border-radius: 20px;
  font-size: 12px; font-weight: 500; transition: background .12s, border-color .12s, color .12s;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--border-3); color: var(--text); }
.chip-btn.active {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}

.hf-preview-col { display: flex; flex-direction: column; gap: 0; position: sticky; top: 60px; }
.hf-preview-card { }
.hf-prompt-out {
  min-height: 200px; resize: vertical; font-size: 12.5px;
  line-height: 1.6; color: var(--text-2);
}
.hf-prompt-tips {
  display: flex; gap: 8px; align-items: center;
  padding-top: 8px; color: var(--text-4); font-size: 11px;
}
.hf-tip-sep { color: var(--border-3); }

.hf-saved-list {
  display: flex; flex-direction: column; gap: 6px;
}
.hf-saved-item {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; cursor: pointer;
  transition: border-color .12s; font-size: 12px; color: var(--text-2);
  line-height: 1.5;
}
.hf-saved-item:hover { border-color: var(--border-3); color: var(--text); }
.hf-saved-item strong { display: block; color: var(--text); font-size: 12px; margin-bottom: 2px; }

@media (max-width: 1100px) {
  .hf-layout { grid-template-columns: 1fr; }
  .hf-preview-col { position: static; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .niche-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .concept-grid { grid-template-columns: 1fr; }
  .niche-row, .niche-grid { grid-template-columns: 1fr 1fr; }
  .sched-form { grid-template-columns: 1fr 1fr; }
  .sched-form .ctl.wide { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; }
  .editor-topbar { padding: 14px 20px 0; }
  .topnav { gap: 0; }
  .navbtn { padding: 6px 11px; font-size: 11.5px; }
  .topbar { gap: 14px; padding: 0 20px; }
  .page-shell, .generator-shell { padding: 24px 20px 60px; }
  .hero-title { font-size: 36px; }
  .page-title { font-size: 26px; }
}
@media (max-width: 720px) {
  .niche-row, .niche-grid { grid-template-columns: 1fr; }
  .sched-form { grid-template-columns: 1fr; }
  .force-row { flex-direction: column; }
  .force-btn { width: 100%; justify-content: center; }
  .prompt-input.large { width: 100%; }
  .hero-title { font-size: 30px; }
  .concept-head { flex-direction: column; }
  .concept-actions { width: 100%; }
  .gen-controls { gap: 12px; }
  .gen-controls .ctl .select { min-width: 0; width: 100%; }
  .topbar-right .lang-select, .topbar-right .llm-select { padding: 4px 7px; font-size: 11px; }
}

/* ── Cinematic Engine ──────────────────────────────────────────────────────── */

/* Canvas & particle layer — above all content, screen blend so they glow through UI */
#av-particles {
  position:fixed; inset:0; z-index:9998; pointer-events:none;
  mix-blend-mode: screen;
}

/* Z-index stack */
.av-aurora  { z-index:0; }
.av-orbs    { z-index:0; }
.av-grain   { z-index:9997; pointer-events:none; mix-blend-mode: screen; }
.av-sweep   { z-index:9997; mix-blend-mode: screen; }
.av-vignette { z-index:9996; }
header, main, footer { position:relative; z-index:2; }

/* Aurora */
.av-aurora {
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(ellipse 90% 40% at 50% 105%, rgba(56,189,248,0.28) 0%, transparent 60%),
    radial-gradient(ellipse 55% 50% at 8%  28%,  rgba(56,189,248,0.18) 0%, transparent 55%),
    radial-gradient(ellipse 45% 60% at 92% 58%,  rgba(56,189,248,0.16) 0%, transparent 55%);
  mix-blend-mode: screen;
  animation: aurora-in 2s ease forwards, aurora-shift 30s ease-in-out infinite 2s;
}
@keyframes aurora-in { from { opacity:0; } to { opacity:1; } }
@keyframes aurora-shift {
  0%,100% { transform: scale(1) translateY(0); }
  50%     { transform: scale(1.04) translateY(-1%); }
}

/* Orbs container */
.av-orbs { position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden; mix-blend-mode: screen; }
.av-orbs-flash { filter: brightness(1.18); transition: filter 0.28s ease-out; }
.av-orb   { position:absolute; border-radius:50%; filter:blur(90px); }

.av-orb-1 { width:500px; height:500px; top:-5%; left:-10%;
  background: radial-gradient(circle, rgba(56,189,248,0.55), transparent 70%);
  opacity:0.65; animation: orb-drift-1 34s ease-in-out infinite; }

.av-orb-2 { width:380px; height:380px; bottom:5%; right:-8%;
  background: radial-gradient(circle, rgba(56,189,248,0.48), transparent 70%);
  opacity:0.60; animation: orb-drift-2 40s ease-in-out infinite; }

.av-orb-3 { width:300px; height:300px; top:40%; left:38%;
  background: radial-gradient(circle, rgba(200,220,255,0.22), transparent 70%);
  opacity:0.45; animation: orb-drift-3 46s ease-in-out infinite; }

.av-orb-4 { width:240px; height:240px; top:65%; left:8%;
  background: radial-gradient(circle, rgba(56,189,248,0.45), transparent 70%);
  opacity:0.55; animation: orb-drift-4 37s ease-in-out infinite; }

@keyframes orb-drift-1 {
  0%   { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
  25%  { transform: translate(calc(3vw + var(--mx,0px)),   calc(2vh + var(--my,0px))); }
  60%  { transform: translate(calc(5vw + var(--mx,0px)),   calc(-1vh + var(--my,0px))); }
  80%  { transform: translate(calc(2vw + var(--mx,0px)),   calc(3vh + var(--my,0px))); }
  100% { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
}
@keyframes orb-drift-2 {
  0%   { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
  33%  { transform: translate(calc(-4vw + var(--mx,0px)),  calc(-2vh + var(--my,0px))); }
  66%  { transform: translate(calc(-2vw + var(--mx,0px)),  calc(-4vh + var(--my,0px))); }
  100% { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
}
@keyframes orb-drift-3 {
  0%   { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
  40%  { transform: translate(calc(2vw + var(--mx,0px)),   calc(-3vh + var(--my,0px))); }
  70%  { transform: translate(calc(-1vw + var(--mx,0px)),  calc(2vh + var(--my,0px))); }
  100% { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
}
@keyframes orb-drift-4 {
  0%   { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
  35%  { transform: translate(calc(4vw + var(--mx,0px)),   calc(1vh + var(--my,0px))); }
  70%  { transform: translate(calc(1vw + var(--mx,0px)),   calc(-2vh + var(--my,0px))); }
  100% { transform: translate(calc(0vw + var(--mx,0px)),   calc(0vh + var(--my,0px))); }
}

/* Sweep */
.av-sweep {
  position:fixed; top:0; left:0; width:100%; height:2px;
  background: linear-gradient(to right, transparent 0%, rgba(56,189,248,0.18) 30%, rgba(56,189,248,0.28) 50%, rgba(56,189,248,0.18) 70%, transparent 100%);
  z-index:1; pointer-events:none; opacity:0;
  animation: scan-pass 12s linear infinite;
}
@keyframes scan-pass {
  0%   { transform: translateY(0vh);   opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 0.6; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* Vignette */
.av-vignette {
  position:fixed; inset:0; z-index:1; pointer-events:none;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 50%, rgba(7,9,15,0.65) 100%);
}

/* Film grain */
.av-grain {
  position:fixed; inset:0; z-index:1; pointer-events:none; opacity:0.032;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='1'/></svg>");
  background-repeat: repeat;
  animation: grain-flicker 0.12s steps(1) infinite;
}
@keyframes grain-flicker {
  0%  { opacity:0.022; transform:translate(0,0); }
  25% { opacity:0.038; transform:translate(-1%,-1%); }
  50% { opacity:0.028; transform:translate(1%,0); }
  75% { opacity:0.042; transform:translate(0,1%); }
}

/* Nav glass */
header { transition: background 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease; }
header.glass {
  background: rgba(7,9,15,0.75);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(56,189,248,0.12);
}

/* Reveal */
[data-reveal] { opacity:0; transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16,1,0.3,1); }
[data-reveal="up"]    { transform: translateY(52px); }
[data-reveal="down"]  { transform: translateY(-32px); }
[data-reveal="left"]  { transform: translateX(-52px); }
[data-reveal="right"] { transform: translateX(52px); }
[data-reveal="scale"] { transform: scale(0.90); }
[data-reveal="fade"]  { transform: none; }
[data-reveal].revealed { opacity:1; transform: none !important; }

/* Hero animate */
.hero-animate { opacity:0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16,1,0.3,1); }
.hero-animate.hero-in { opacity:1; transform:none; }

/* Title split */
.ct-char { display:inline-block; opacity:0; transform:translateY(18px); transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16,1,0.3,1); transition-delay: calc(var(--ci) * 0.035s); }
[data-cinematic-title].ct-active .ct-char { opacity:1; transform:none; }

/* Hero glow */
.av-hero-glow {
  position:absolute; inset:0; z-index:1; pointer-events:none;
  opacity:0; transition: opacity 0.6s ease;
  background: radial-gradient(circle 380px at var(--gx,50%) var(--gy,50%), rgba(56,189,248,0.10) 0%, rgba(56,189,248,0.03) 35%, transparent 65%);
  mix-blend-mode: screen;
}

/* Heading pulse — only on large display titles, not tiny card headings */
.av-glow-pulse { animation: heading-breathe 9s ease-in-out infinite; }
@keyframes heading-breathe {
  0%,100% { text-shadow: none; }
  50%     { text-shadow: 0 0 22px rgba(56,189,248,0.16), 0 0 6px rgba(56,189,248,0.08); }
}

/* Section divider — soft centered gradient, replaces hard border-bottom */
section[style*="border-bottom"] { border-bottom: 0 !important; position: relative; }
section[style*="border-bottom"]::after {
  content:''; position:absolute; bottom:0; left:50%; transform:translateX(-50%);
  width:50%; max-width:500px; height:1px;
  background: linear-gradient(to right, transparent, rgba(56,189,248,0.22), transparent);
  pointer-events:none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .av-aurora, .av-orb, .av-sweep, .av-grain, .av-glow-pulse { animation: none !important; }
  [data-reveal] { opacity:1 !important; transform: none !important; }
  .hero-animate { opacity:1 !important; transform: none !important; }
  .tabview.tab-exit, .tabview.tab-enter, .tab-stagger,
  .av-tab-flash, .av-tab-flash::after { animation: none !important; }
}

/* Mobile */
@media (max-width: 768px) {
  .av-aurora { opacity: 0.7; }
  .av-grain { opacity: 0.018; }
}
