/* MVapp - Calitoy Experience. Dark, cinematic, accessible. */
:root {
  --bg: #07070a;
  --bg-2: #0e0e14;
  --panel: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.09);
  --text: #ece8e1;
  --muted: #9a958c;
  --gold: #d9a85b;
  --gold-2: #f1cf8f;
  --moon: #c9ced6;
  --anim: #8f7cf2;
  --live: #e0794f;
  --danger: #ff8f7a;
  --ok: #7fd6a4;
  --radius: 16px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: radial-gradient(1200px 600px at 80% -10%, #1a1626 0%, transparent 60%), var(--bg);
  color: var(--text); font: 400 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--gold); color: #000; padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }
.grain { pointer-events: none; position: fixed; inset: 0; z-index: 50; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* header / footer */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px clamp(16px, 4vw, 48px); background: rgba(7, 7, 10, .72); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-moon { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, var(--moon) 45%, #6b7280);
  box-shadow: 0 0 18px rgba(201, 206, 214, .45); }
.brand-word { font: 600 15px var(--sans); letter-spacing: .32em; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { color: var(--text); font-size: 14px; }
.site-footer { padding: 40px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; }
main { padding: 0 clamp(16px, 4vw, 48px) 60px; }

/* type */
.eyebrow { display: inline-block; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.display { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.02; margin: 0 0 12px; font-size: clamp(34px, 5vw, 56px); }
.display em { font-style: italic; color: var(--gold-2); }
h4 { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 18px 0 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 12px 20px; border-radius: 999px; font: 600 14px var(--sans); cursor: pointer;
  transition: transform .25s var(--ease), background .25s, border-color .25s, box-shadow .25s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: rgba(241, 207, 143, .5); }
.btn-primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a1206; border-color: transparent;
  box-shadow: 0 8px 30px -10px rgba(217, 168, 91, .6); }
.btn-primary:hover { box-shadow: 0 12px 36px -10px rgba(217, 168, 91, .8); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* badges */
.badge { font-size: 10px; letter-spacing: .18em; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid; }
.badge-anim { color: #c9bfff; border-color: rgba(143, 124, 242, .5); background: rgba(143, 124, 242, .12); }
.badge-live { color: #ffc2a8; border-color: rgba(224, 121, 79, .5); background: rgba(224, 121, 79, .12); }
.badge-none { color: var(--muted); border-color: var(--line); }

/* seg filter */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel); }
.seg-btn { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 999px; font: 500 13px var(--sans); cursor: pointer; transition: background .2s, color .2s; }
.seg-btn.is-active { background: rgba(241, 207, 143, .14); color: var(--gold-2); }

/* hero */
.hero { position: relative; min-height: 78vh; display: grid; place-items: center; text-align: center; overflow: hidden; margin: 0 calc(-1 * clamp(16px, 4vw, 48px)); }
.hero-moon { position: absolute; width: min(70vw, 620px); aspect-ratio: 1; border-radius: 50%; top: 8%;
  background: radial-gradient(circle at 38% 34%, rgba(255, 255, 255, .22), rgba(201, 206, 214, .08) 45%, transparent 70%);
  filter: blur(2px); animation: drift 18s ease-in-out infinite alternate; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 40%; background: linear-gradient(transparent, var(--bg)); }
.hero-inner { position: relative; z-index: 1; max-width: 760px; padding: 80px 20px; }
.hero-title { font-size: clamp(54px, 10vw, 120px); }
.hero-lede { font-size: clamp(16px, 2vw, 19px); color: #cfc9bf; max-width: 600px; margin: 0 auto 28px; }
@keyframes drift { from { transform: translate3d(-3%, 0, 0) scale(1); } to { transform: translate3d(3%, 4%, 0) scale(1.06); } }

/* gallery */
.reel-tools { display: flex; justify-content: center; margin: 10px 0 28px; }
.gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.film-card { height: 100%; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2); transition: transform .45s var(--ease), border-color .3s, box-shadow .45s var(--ease); }
.film-card:hover { transform: translateY(-4px); border-color: rgba(241, 207, 143, .3); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9); }
.film-poster { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: end start; padding: 16px;
  background: radial-gradient(120% 90% at 20% 10%, var(--c1), transparent 60%), radial-gradient(100% 100% at 90% 100%, var(--c2), transparent 70%), #0b0b10; }
.film-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .65)); }
.film-poster video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.film-poster .badge { position: absolute; top: 12px; right: 12px; z-index: 2; backdrop-filter: blur(6px); }
.poster-style { position: relative; z-index: 1; font: italic 500 22px/1.1 var(--serif); color: #fff; text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.film-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.film-title { font: 600 26px/1.1 var(--serif); margin: 0; }
.logline { margin: 4px 0; color: #ddd7cd; }
.listen { margin-top: auto; padding-top: 8px; }

/* details */
.more { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.more summary { cursor: pointer; color: var(--gold-2); font-size: 13px; font-weight: 500; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+ "; }
.more[open] summary::before { content: "– "; }
.storyline { white-space: pre-line; color: #d6d0c6; }
.scenes { padding-left: 20px; margin: 0; color: #d6d0c6; }
.scenes li { margin-bottom: 6px; }
.palette { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.palette li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.prompt { white-space: pre-wrap; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; background: #050507; border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: #cfd3da; }

/* admin */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 40px 0 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
input[type="search"], .form input { background: #0b0b10; border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 11px 14px; font: 14px var(--sans); min-width: 240px; }
input:focus { border-color: rgba(241, 207, 143, .5); outline: none; box-shadow: 0 0 0 3px rgba(241, 207, 143, .15); }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.song-card { height: 100%; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 18px 20px; }
.song-head { display: flex; gap: 14px; align-items: flex-start; }
.pos { font: 500 13px ui-monospace, monospace; color: var(--gold); padding-top: 6px; }
.song-title-wrap { flex: 1; min-width: 0; }
.song-title { font: 600 24px/1.1 var(--serif); margin: 0; }
.band-edit { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; }
.band-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.band-input { background: #0b0b10; border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 3px 8px; font: 500 12px var(--sans); width: 130px; max-width: 48vw; transition: border-color .2s, box-shadow .2s; }
.band-input:focus { outline: none; border-color: var(--gold); }
.band-input.saved-ok { border-color: #3ddc84; box-shadow: 0 0 0 2px rgba(61,220,132,.2); }
.band-input.saved-err { border-color: #ff6b6b; box-shadow: 0 0 0 2px rgba(255,107,107,.2); }
.meta { margin: 4px 0 0; }
.style-line { margin: 12px 0 2px; }
.style { color: var(--gold-2); font-weight: 600; }
.job { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.song-card .more { margin-bottom: 14px; }
.job-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.status-pill { font: 600 11px var(--sans); letter-spacing: .12em; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.status-pill[data-st="COMPLETED"] { color: var(--ok); border-color: rgba(127, 214, 164, .4); }
.status-pill[data-st="IN_QUEUE"], .status-pill[data-st="IN_PROGRESS"] { color: var(--gold-2); border-color: rgba(241, 207, 143, .4); animation: pulse 1.6s ease-in-out infinite; }
.status-pill[data-st="FAILED"], .status-pill[data-st^="HTTP_"], .status-pill[data-st="NETWORK_ERROR"], .status-pill[data-st="TIMED_OUT"] { color: var(--danger); border-color: rgba(255, 143, 122, .4); }
.job-error { color: var(--danger); overflow-wrap: anywhere; }
.job-video { width: 100%; border-radius: 10px; margin-top: 6px; background: #000; }
@keyframes pulse { 50% { opacity: .55; } }
.alert { color: var(--danger); background: rgba(255, 143, 122, .08); border: 1px solid rgba(255, 143, 122, .3); padding: 10px 14px; border-radius: 10px; }
.queue-item[hidden] { display: none; }

/* login */
.login-wrap { min-height: 72vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  border-radius: 22px; padding: 36px 32px; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9); }
.form { display: grid; gap: 8px; margin-top: 18px; }
.form label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.form input { min-width: 0; width: 100%; }
.form .btn { margin-top: 16px; }

/* motion */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in, .no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media (max-width: 560px) {
  .queue { grid-template-columns: 1fr; }
  .brand-sub, .nav-user { display: none; }
  input[type="search"] { min-width: 0; width: 100%; }
}

/* Script / shot list / story builds */
.script-text { white-space: pre-line; font-size: 13px; line-height: 1.6; margin-top: 8px; }
.shot-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.shot { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: rgba(255, 255, 255, .02); }
.shot p { margin: 6px 0 0; }
.shot-prompt { font-style: italic; }
.story { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; margin-bottom: 4px; }
.story-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.story-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.shot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.shot-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.shot-chip[data-st="DONE"] { color: var(--ok); }
.shot-chip[data-st="FAILED"] { color: var(--danger); }
.shot-chip[data-st="RENDERING"] { color: var(--gold-2); }
.btn-gold { background: transparent; color: var(--gold-2); border: 1px solid rgba(241, 207, 143, .5); }
.btn-gold:hover:not(:disabled) { background: rgba(241, 207, 143, .1); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(220, 80, 80, .55); }
.btn-danger:hover:not(:disabled) { background: rgba(220, 80, 80, .12); }
.btn-warn { background: transparent; color: #e6b450; border: 1px solid rgba(230, 180, 80, .5); }
.btn-warn:hover:not(:disabled) { background: rgba(230, 180, 80, .12); }
.drive-stop-msg { color: var(--danger); }
.status-pill[data-st="QUEUED"], .status-pill[data-st="GENERATING_SHOTS"], .status-pill[data-st="ASSEMBLING"], .status-pill[data-st="STARTING"] { color: var(--gold-2); border-color: rgba(241, 207, 143, .4); animation: pulse 1.6s ease-in-out infinite; }
.status-pill[data-st="PARTIAL"] { color: var(--gold-2); }

/* Artist likeness panel */
.likeness-panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 24px; }
.lk-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.lk-title { margin: 4px 0 6px; font-size: 20px; }
.lk-refs { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 10px; }
.lk-ref { position: relative; width: 88px; height: 88px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.lk-ref.is-primary { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lk-ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lk-tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: rgba(0,0,0,.7); color: var(--gold-2); padding: 2px 6px; border-radius: 999px; }
.lk-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lk-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.lk-form input[type="file"] { display: block; margin-top: 6px; max-width: 100%; color: var(--muted); font-size: 12px; }
.lk-check { display: flex; gap: 6px; align-items: center; }
.lk-msg:empty { display: none; }
.story.full { margin-top: 10px; }

/* stills-first stage */
.stills { margin-top: 14px; }
.stills-grid { display: flex; gap: 12px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding-bottom: 12px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior-x: contain; }
.stills-grid::-webkit-scrollbar { height: 8px; }
.stills-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.still { margin: 0; flex: 0 0 220px; scroll-snap-align: start; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.still img { display: block; width: 100%; aspect-ratio: 1280 / 704; object-fit: cover; }
.still figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; font-size: 13px; }
.still { position: relative; }
.still[data-st="approved"] { border-color: #5fbf7f; }
.still[data-st="rejected"] { border-color: #c45b5b; opacity: .7; }

/* Jev - AI director / QA */
.jev-badge { position: absolute; top: 6px; left: 6px; z-index: 2; font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 6px; border-radius: 6px; cursor: help; background: rgba(20,22,28,.78); color: #cfd3dc; border: 1px solid var(--line); }
.jev-badge[data-verdict="pass"] { background: rgba(46,120,70,.92); color: #e8fff0; border-color: #5fbf7f; }
.jev-badge[data-verdict="fail"] { background: rgba(150,46,46,.92); color: #ffecec; border-color: #c45b5b; }
.jev-badge[data-verdict="error"] { background: rgba(120,100,30,.9); color: #fff6d8; border-color: #c9a53a; }
.jev-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.jev-flags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.jev-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); cursor: help; }
.jev-flag .jev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.jev-flag[data-on="1"] { color: #e8fff0; border-color: #5fbf7f; background: rgba(46,120,70,.18); }
.jev-flag[data-on="1"] .jev-dot { background: #5fbf7f; }
.jev-global { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px; display: grid; gap: 8px; }
.jev-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.jev-model { margin-left: auto; }
.jev-msg:empty { display: none; }
.jev-sweep { border-top: 1px dotted var(--line); padding-top: 8px; display: grid; gap: 8px; }
.jev-sweep .js-jev-sweep-status:empty { display: none; }
.jev-treat-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04); white-space: nowrap; }
.jev-treat-badge.ok { background: rgba(46,120,70,.18); border-color: #5fbf7f; }
.jev-treat-badge.low { background: rgba(150,46,46,.18); border-color: #c45b5b; }


/* Per-song production pipeline */
.pipeline { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 4px; margin-bottom: 4px; }
.pipe-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pipe-title { font: 600 15px var(--sans); letter-spacing: .04em; margin: 0; color: var(--text); }
.stages { list-style: none; padding: 0; margin: 12px 0 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.stage { position: relative; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line);
  border-left: 3px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(255, 255, 255, .02); }
.stage-n { font: 600 10px ui-monospace, monospace; color: var(--muted); letter-spacing: .1em; }
.stage-label { font: 600 13px var(--sans); color: var(--text); }
.stage-msg { line-height: 1.35; }
.stage[data-state="locked"] { opacity: .55; }
.stage[data-state="locked"] .stage-label { color: var(--muted); }
.stage[data-state="ready"] { border-left-color: var(--gold); }
.stage[data-state="in-progress"] { border-left-color: var(--gold-2); animation: pulse 1.6s ease-in-out infinite; }
.stage[data-state="done"] { border-left-color: var(--ok); }
.stage[data-state="done"] .stage-label::after { content: " \2713"; color: var(--ok); }
.pipe-msg:empty { display: none; }
.pipe-msg { margin: 10px 0 0; }
.pipe-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pipe-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.pipe-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.pipe-form input[type="file"] { display: block; margin-top: 6px; max-width: 100%; color: var(--muted); font-size: 12px; }
.pipe-form textarea { width: 100%; box-sizing: border-box; margin-top: 6px; background: #0b0b10; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 9px 11px; font: 13px var(--sans); resize: vertical; }

/* Editable treatment (open prompt) */
.treatment-edit { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; }
.treatment-edit .te-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; }
.treatment-edit label { display: flex; flex-direction: column; gap: .2rem; }
.treatment-edit input[type="text"], .treatment-edit select, .treatment-edit textarea {
  width: 100%; font: inherit; padding: .4rem .5rem; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.25); color: inherit;
}
.treatment-edit textarea { resize: vertical; }
.treatment-edit .prompt-edit { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.treatment-edit .te-actions { display: flex; align-items: center; gap: .6rem; }
.treatment-edit .te-msg.err { color: #ff8080; }


/* Secondary characters panel */
.characters-panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 24px; }
.ch-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ch-cameo { align-self: center; }
.ch-list { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ch-card { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255, 255, 255, .02); }
.ch-thumb { position: relative; flex: 0 0 72px; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; background: #0b0b10; }
.ch-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-noimg { text-align: center; padding: 4px; }
.ch-tag { position: absolute; left: 3px; bottom: 3px; font-size: 9px; background: rgba(0,0,0,.72); color: var(--gold-2); padding: 2px 5px; border-radius: 999px; }
.ch-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ch-name { font-size: 15px; }
.ch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.js-ch-addfiles-label { cursor: pointer; }
.ch-form { display: grid; gap: 10px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin-top: 6px; }
.ch-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ch-form label { display: flex; flex-direction: column; gap: 4px; }
.ch-form input[type="text"] { background: #0b0b10; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 11px; font: 14px var(--sans); min-width: 0; width: 100%; }
.ch-form input[type="file"] { color: var(--muted); font-size: 12px; margin-top: 4px; }
.ch-msg:empty { display: none; }

/* Separate story lead */
.js-separate-lead select.js-sl-char { width: 100%; box-sizing: border-box; margin-top: 6px; background: #0b0b10; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 11px; font: 13px var(--sans); }
.js-separate-lead .sl-msg:empty { display: none; }

/* Per-scene note + reference asset (inside a still caption) */
.scene-extra { flex-basis: 100%; margin-top: 6px; padding-top: 6px; }
.scene-extra summary { font-size: 12px; }
.scene-extra form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.scene-extra textarea { width: 100%; box-sizing: border-box; background: #0b0b10; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 9px; font: 12.5px var(--sans); resize: vertical; }
.scene-extra input[type="file"] { color: var(--muted); font-size: 11px; }
.scene-extra .js-scene-asset-link { display: inline-block; margin-top: 6px; }
.scene-extra .scene-msg:empty { display: none; }

/* Export / breakout */
.exports { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; margin-bottom: 4px; }
.exports-eyebrow { margin: 0; }
.export-downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.export-downloads:empty { display: none; }
.export-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; border: 1px solid rgba(241, 207, 143, .5); color: var(--gold-2); border-radius: 999px; padding: 4px 12px; }
.export-link:hover { background: rgba(241, 207, 143, .1); text-decoration: none; }
.export-msg:empty { display: none; }
.remake-msg:empty { display: none; }

/* ── Per-song card redesign: collapsed clip + Open/Edit/Download/Share ──────── */
.song-head { align-items: center; }
.song-head .js-card-toggle { margin-left: auto; flex: 0 0 auto; }

.card-clip { margin-top: 12px; }
.card-clip .card-video { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #000; display: block; }
.card-clip .no-video { margin: 10px 0 2px; padding: 22px; text-align: center; border: 1px dashed var(--line);
  border-radius: var(--radius); background: var(--panel); }

.card-body { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-actions .card-export-links { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: 4px; }
.card-actions .export-link { white-space: nowrap; }
.card-actions .card-share-msg { margin-left: 4px; }

.card-edit { margin-top: 14px; display: flex; flex-direction: column; gap: 18px; }
.card-edit .te-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px 18px; }
.card-edit .te-panel .logline { margin: 6px 0 12px; }
.card-edit .te-panel .style-line { margin: 2px 0 10px; }



/* ======================================================= DIRECTOR TIMELINE EDITOR */
.page-editor-index .project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.page-editor-index .project-row { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; background: var(--panel); }
.page-editor-index .project-link { display: flex; flex-direction: column; gap: 3px; color: var(--text); flex: 1; }
.page-editor-index .project-title { font: 600 18px var(--serif); }
.editor-picker { padding: 0 clamp(16px, 4vw, 48px) 48px; }

/* toolbar */
.editor-root { display: flex; flex-direction: column; height: calc(100vh - 64px); }
.editor-toolbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px clamp(14px, 3vw, 32px); border-bottom: 1px solid var(--line); background: var(--bg-2); }
.editor-title { font: 600 22px var(--serif); margin: 0; }
.editor-sub { display: block; }
.tb-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.tb-field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.tb-field select, .tb-field input[type=range] { color: var(--text); }
.tb-field select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.tb-field output { font-size: 12px; color: var(--gold-2); }
.tb-check { flex-direction: row; align-items: center; gap: 6px; }
.tb-actions { display: flex; gap: 8px; }
.editor-banner { padding: 8px clamp(14px, 3vw, 32px); font-size: 13px; background: rgba(143,124,242,.12); border-bottom: 1px solid var(--line); }
.editor-banner.is-error { background: rgba(220,80,80,.14); color: var(--danger); }
.editor-banner.is-ok { background: rgba(127,214,164,.12); color: var(--ok); }
.editor-banner.is-info { background: rgba(217,168,91,.12); color: var(--gold-2); }

/* body split */
.editor-body { display: flex; flex: 1; min-height: 0; }
.timeline-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.lane-heads { display: grid; grid-template-columns: 64px 2fr 1.3fr 1.3fr 0.8fr; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 3; }
.lane-head { padding: 8px 10px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); border-left: 1px solid var(--line); }
.lane-head-ruler { border-left: 0; }
.timeline-scroll { flex: 1; overflow: auto; }
.timeline-grid { position: relative; display: grid; grid-template-columns: 64px 2fr 1.3fr 1.3fr 0.8fr; min-height: 100%; }
.lane { position: relative; border-left: 1px solid var(--line); }
.lane-ruler { border-left: 0; background: var(--bg); }

/* ruler */
.ruler-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.ruler-label { position: absolute; left: 4px; top: 1px; font-size: 10px; color: var(--muted); }

/* shots */
.lane-shots { background: repeating-linear-gradient(transparent, transparent 46px, rgba(255,255,255,.02) 46px, rgba(255,255,255,.02) 47px); }
.shot-block { position: absolute; left: 6px; right: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--bg-2); cursor: pointer; display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s; }
.shot-block:hover { border-color: var(--gold); }
.shot-block.is-selected { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(241,207,143,.4); }
.shot-block.is-fill { border-style: dashed; }
.shot-block.is-locked { opacity: .78; }
.shot-block.is-styled { border-left: 3px solid var(--anim); }
.shot-thumb { flex: 1; min-height: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-thumb.no-thumb::after { content: "no preview"; color: var(--muted); font-size: 11px; }
.shot-meta { display: flex; justify-content: space-between; padding: 3px 7px; font-size: 11px; background: rgba(0,0,0,.45); }
.shot-num { font-weight: 600; }
.shot-dur { color: var(--gold-2); }
.shot-tags { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 7px 5px; }
.tag { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag-fill { color: var(--gold-2); border-color: rgba(217,168,91,.5); }
.tag-perf { color: var(--live); border-color: rgba(224,121,79,.5); }
.tag-style { color: var(--anim); border-color: rgba(143,124,242,.5); }
.tag-sings { color: var(--gold); border-color: rgba(217,168,91,.7); }
.tag-lock { color: var(--moon); }
.tag-storyline { color: var(--anim); border-color: rgba(143,124,242,.5); }
.tag-performance { color: var(--live); border-color: rgba(224,121,79,.6); }
.tag-still { color: var(--gold-2); border-color: rgba(217,168,91,.5); }
/* inspector authoring helpers */
.insp-textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px 9px; font: 400 13px var(--sans); margin-bottom: 8px; resize: vertical; }
.insp-lbl { display: block; margin-bottom: 4px; }
.insp-still { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #000; margin-bottom: 8px; display: block; }
.insp-file { font-size: 12px; color: var(--muted); max-width: 170px; }
.insp-sep { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
/* tracks/assembly modal */
.modal-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.modal-row .insp-num { flex: 1; min-width: 150px; }
.modal-card select, .modal-card input[type="number"] { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 8px; }
.track-stats { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; }
.track-stat { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.insp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.insp-check input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.cut-handle { position: absolute; left: 0; right: 0; bottom: -5px; height: 11px; cursor: ns-resize; z-index: 2; display: flex; align-items: center; justify-content: center; }
.cut-grip { width: 34px; height: 3px; border-radius: 2px; background: var(--gold); opacity: .5; }
.cut-handle:hover .cut-grip { opacity: 1; }

/* lyrics */
.lyric-block { position: absolute; left: 6px; right: 6px; padding: 4px 8px; border-left: 2px solid var(--gold); font: 500 13px var(--serif);
  color: var(--text); display: flex; align-items: center; overflow: hidden; cursor: pointer; }
.lyric-text { overflow: hidden; text-overflow: ellipsis; }

/* auto lyrics (transcribed) lane */
.lane-autolyrics { background: rgba(120,170,255,.04); }
.lane-head-auto { display: flex; flex-direction: column; gap: 3px; }
.lh-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lh-title { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.lh-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; letter-spacing: normal; text-transform: none; color: var(--muted); cursor: pointer; }
.lh-toggle input { width: 13px; height: 13px; accent-color: #7aa6ff; cursor: pointer; }
.lh-toggle input:disabled { cursor: not-allowed; }
.lh-sub { font-size: 10px; letter-spacing: normal; text-transform: none; color: var(--muted); }
.btn-xs { padding: 2px 7px; font-size: 11px; letter-spacing: normal; text-transform: none; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; }
.btn-xs:hover { border-color: #7aa6ff; }
.btn-xs:disabled { opacity: .5; cursor: not-allowed; }
.al-line { position: absolute; left: 6px; right: 6px; padding: 3px 7px; border-left: 2px solid #7aa6ff; background: rgba(120,170,255,.08);
  border-radius: 3px; font: 500 12px var(--serif); color: var(--text); overflow: hidden; cursor: text; box-sizing: border-box; }
.al-line:hover { background: rgba(120,170,255,.16); }
.al-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-edit { width: 100%; background: var(--bg); color: var(--text); border: 1px solid #7aa6ff; border-radius: 3px; font: 500 12px var(--serif); padding: 1px 4px; box-sizing: border-box; }
.al-empty { padding: 10px; font-size: 11px; color: var(--muted); }

/* audio / beats */
.beat-line { position: absolute; left: 0; right: 55%; border-top: 1px solid rgba(255,255,255,.12); }
.beat-line.is-down { right: 0; border-top: 1px solid var(--gold); opacity: .7; }
.beat-empty { padding: 10px; }

/* playhead */
.playhead { position: absolute; left: 64px; right: 0; height: 0; border-top: 2px solid var(--live); z-index: 5; cursor: ns-resize; }
.playhead::before { content: ""; position: absolute; left: -7px; top: -6px; width: 0; height: 0; border: 6px solid transparent; border-left-color: var(--live); }
.playhead-time { position: absolute; right: 4px; top: -16px; font-size: 10px; color: var(--live); background: var(--bg); padding: 0 4px; border-radius: 4px; }

/* inspector */
.inspector { width: 360px; flex-shrink: 0; overflow-y: auto; padding: 16px; background: var(--bg-2); }
.inspector-empty .scrub-video { width: 100%; margin-top: 12px; border-radius: 10px; background: #000; }
.insp-title { font: 600 18px var(--serif); margin: 0 0 10px; }
.insp-video { width: 100%; border-radius: 10px; background: #000; margin-bottom: 10px; max-height: 220px; }
.insp-scene { margin: 0 0 10px; }
.insp-section { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.insp-h { margin: 0 0 8px; }
.insp-num { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.insp-num input { width: 110px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 8px; }
.insp-select { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 7px 9px; margin-bottom: 8px; }
.insp-btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.insp-preview { margin-top: 8px; }
.insp-jev { margin-top: 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); }
.jev-verdict { font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.jev-ok { color: var(--ok); } .jev-bad { color: var(--danger); } .jev-neutral { color: var(--muted); }
.jev-reasons { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { width: min(560px, 92vw); background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.modal-card h3 { font: 600 20px var(--serif); margin: 0 0 8px; }
.modal-card textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px; font: 400 14px var(--sans); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }


/* --- Review: "mark the area of concern" annotation overlay on asset thumbnails --- */
.anno-wrap { position: relative; display: inline-block; max-width: 100%; width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.anno-wrap.no-thumb { min-height: 120px; }
.anno-img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.anno-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.anno-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid var(--danger); background: rgba(255, 143, 122, 0.35); box-shadow: 0 0 0 1px rgba(0,0,0,0.6); cursor: pointer; }
.anno-box { position: absolute; border: 2px solid var(--danger); background: rgba(255, 143, 122, 0.18); box-shadow: 0 0 0 1px rgba(0,0,0,0.5); cursor: pointer; }
.anno-box.is-live { border-style: dashed; cursor: crosshair; pointer-events: none; }
.anno-idx { position: absolute; top: -9px; left: -9px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--danger); color: #1a0d0a; font: 700 11px/16px var(--sans); text-align: center; }
.anno-note { width: 100%; margin-top: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px 10px; font: 400 13px var(--sans); }



/* =========================================================================
   MOBILE / RESPONSIVE  (added v24)
   Desktop layout is untouched — these rules only apply inside breakpoints.
   Goal: the admin app (dashboard, editor, wizard, gallery, login) is usable
   on a small touchscreen. Tap targets >= ~40px, no horizontal page overflow,
   timeline scrolls horizontally instead of being squashed, panels & modals
   stack full-width and stay scrollable.
   ========================================================================= */
@media (max-width: 768px) {
  /* header / nav collapse */
  .site-header { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .site-nav { gap: 10px 14px; flex-wrap: wrap; width: 100%; }
  .site-nav a { font-size: 14px; }
  main { padding-left: 16px; padding-right: 16px; }

  /* finger-friendly controls */
  .btn { min-height: 42px; padding: 11px 18px; }
  .btn-sm { min-height: 38px; }
  .btn-xs { min-height: 30px; }
  .seg-btn { min-height: 38px; }

  /* admin header + cards */
  .admin-head { padding: 24px 0 18px; }
  .filters { width: 100%; }
  input[type="search"] { min-width: 0; width: 100%; }
  .queue { grid-template-columns: 1fr; gap: 14px; }
  .song-card { padding: 16px; }
  .card-actions { gap: 10px; }
  .card-actions .btn { flex: 1 1 auto; white-space: nowrap; }

  /* likeness / characters / pipeline panels stack full width */
  .lk-forms, .pipe-forms, .ch-list, .ch-form-row { grid-template-columns: 1fr; }
  .stages { grid-template-columns: 1fr 1fr; }

  /* ---- timeline editor ---- */
  /* Drop the viewport-locked height so the page scrolls naturally on a phone,
     and stack the inspector below the timeline. */
  .editor-root { height: auto; }
  .editor-toolbar { gap: 12px; padding: 12px 16px; }
  .tb-controls { margin-left: 0; width: 100%; gap: 14px; }
  /* Action buttons wrap onto multiple rows instead of overflowing off-screen,
     and keep their labels on a single line so the pill buttons don't collapse
     into tall circles. */
  .tb-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .tb-actions .btn { flex: 1 1 auto; white-space: nowrap; border-radius: 12px;
    min-width: max-content; height: auto; }
  .editor-body { flex-direction: column; min-height: 0; }

  /* The timeline-wrap becomes the single scroll container (both axes), so the
     lane heads and the grid share one horizontal scroll offset and stay
     aligned. A min-width keeps the 5 columns legible; momentum scroll on iOS. */
  .timeline-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 68vh;
  }
  .timeline-scroll { overflow: visible; }
  .lane-heads, .timeline-grid { min-width: 680px; }

  /* inspector / review + block-detail panels go full width, stacked */
  .inspector { width: 100%; max-height: none; flex-shrink: 1; }

  /* modals fit the viewport and scroll */
  .modal { padding: 12px; }
  .modal-card { width: 94vw; max-height: 90vh; overflow-y: auto; padding: 18px; }
  .modal-row .insp-num { min-width: 0; }

  /* gallery reflows */
  .gallery { grid-template-columns: 1fr; }

  /* avoid iOS auto-zoom on focus for the main forms (needs >=16px) */
  .form input, input[type="search"], .nv-inputrow textarea { font-size: 16px; }
  .login-card { padding: 28px 22px; }
}

@media (max-width: 480px) {
  .site-header { padding: 10px 14px; }
  main { padding-left: 14px; padding-right: 14px; }
  .display { font-size: clamp(28px, 8vw, 38px); }
  .stages { grid-template-columns: 1fr; }
  .card-actions .btn, .card-actions .card-export-links { flex-basis: 100%; }

  /* timeline: a touch narrower min-width but still legible */
  .lane-heads, .timeline-grid { min-width: 560px; }
  .timeline-wrap { max-height: 60vh; }

  /* editor toolbar fields stack */
  .tb-controls { gap: 12px; }
  .tb-field { width: 100%; }
  .tb-field.tb-check { width: auto; }

  .login-card { padding: 24px 18px; }
}
