:root {
  --bg: #f2f3f4;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #edf0ef;
  --border: rgba(18, 50, 41, 0.1);
  --border-bright: rgba(18, 50, 41, 0.2);
  --text: #14231e;
  --muted: #5f7269;
  --accent: #047857;
  --accent-2: #0369a1;
  --grad-from: #34d399;
  --grad-to: #38bdf8;
  --amber: #b45309;
  --rose: #e11d48;
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -30vh -10vw auto -10vw;
  height: 70vh;
  background:
    radial-gradient(40% 60% at 20% 30%, rgba(56, 189, 248, 0.12), transparent 70%),
    radial-gradient(40% 60% at 80% 20%, rgba(52, 211, 153, 0.12), transparent 70%),
    radial-gradient(50% 60% at 50% 80%, rgba(168, 85, 247, 0.06), transparent 70%);
  filter: blur(20px);
  z-index: 0;
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(20px, 5vw, 64px) 12px;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 16px; }

.brand-logo {
  height: 46px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-logo-lg { height: 64px; }

.brand-mark {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  box-shadow: 0 8px 30px rgba(56, 189, 248, 0.3);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 13px 11px;
  border-left: 9px solid #07140f;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.stat-pill {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px clamp(20px, 5vw, 64px) 80px;
}

.dropzone {
  border: 1.5px dashed var(--border-bright);
  border-radius: 24px;
  background: #ffffff;
  padding: 56px 24px;
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent-2); }
.dropzone.drag {
  border-color: var(--accent);
  background: rgba(110, 231, 183, 0.08);
  transform: scale(1.005);
}

.dz-icon {
  width: 54px; height: 54px; margin: 0 auto 18px;
  border-radius: 16px;
  border: 1.5px solid var(--border-bright);
  background: var(--panel);
  position: relative;
}
.dz-icon::before {
  content: ""; position: absolute; left: 50%; top: 52%;
  width: 14px; height: 14px; transform: translate(-50%, -60%) rotate(45deg);
  border-left: 2.5px solid var(--accent); border-top: 2.5px solid var(--accent);
}
.dz-icon::after {
  content: ""; position: absolute; left: 50%; top: 30%;
  width: 2.5px; height: 22px; transform: translateX(-50%);
  background: var(--accent);
}

.dropzone h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.dropzone p { margin: 0; color: var(--muted); }
.dz-hint { display: block; margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.link {
  background: none; border: none; color: var(--accent-2);
  font: inherit; cursor: pointer; padding: 0; text-decoration: underline;
}

.library { margin-top: 44px; }
.lib-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.lib-head h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s;
  display: flex; flex-direction: column;
}
.card:hover { border-color: var(--border-bright); transform: translateY(-2px); background: var(--panel-2); }

.thumb {
  aspect-ratio: 16/9;
  background: #060709 center/cover no-repeat;
  position: relative;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.thumb .ph { color: #2c3142; font-size: 30px; font-weight: 700; letter-spacing: 2px; }

.card-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-name {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.queued .dot, .badge.processing .dot { background: var(--amber); animation: pulse 1.2s infinite; }
.badge.done .dot { background: var(--accent); }
.badge.error .dot { background: var(--rose); }
.badge.processing { color: var(--amber); }
.badge.done { color: var(--accent); }
.badge.error { color: var(--rose); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.progress {
  height: 4px; border-radius: 999px; background: var(--panel-2); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.stage-text { font-size: 12px; color: var(--muted); min-height: 16px; }

/* Drawer */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(4,5,8,0.6);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 5;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(640px, 94vw);
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  z-index: 6;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--border); gap: 16px;
}
.drawer-head h2 { margin: 0 0 4px; font-size: 18px; word-break: break-word; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); width: 34px; height: 34px; border-radius: 10px;
  cursor: pointer; font-size: 14px; flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--border-bright); }

.drawer-body { padding: 20px 24px 60px; overflow-y: auto; }

.section { margin-bottom: 28px; }
.section h4 {
  margin: 0 0 12px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); font-weight: 600;
}

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-item {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; background: var(--panel);
}
.meta-item .k { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.meta-item .v { font-size: 14px; font-weight: 500; word-break: break-word; }
.meta-item .v.na { color: var(--muted); font-weight: 400; }
.meta-item a { color: var(--accent-2); text-decoration: none; }
.meta-item a:hover { text-decoration: underline; }

.frames {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px;
}
.frame {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  position: relative; background: #060709; aspect-ratio: 16/9;
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .ts {
  position: absolute; bottom: 4px; right: 4px;
  font-family: var(--mono); font-size: 10px;
  background: rgba(0,0,0,0.7); padding: 2px 5px; border-radius: 5px;
}

.transcript { display: flex; flex-direction: column; gap: 8px; }
.seg {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel);
}
.seg .time { font-family: var(--mono); font-size: 11px; color: var(--accent-2); padding-top: 2px; }
.seg .who { font-size: 11px; color: var(--amber); font-weight: 600; margin-bottom: 2px; }
.seg .txt { font-size: 14px; line-height: 1.5; }

.info-line {
  font-size: 12.5px; color: var(--muted); margin-bottom: 14px;
  padding: 10px 12px; border-left: 2px solid var(--accent-2);
  background: var(--panel); border-radius: 0 8px 8px 0;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--border-bright); background: var(--panel);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.danger:hover { border-color: var(--rose); color: var(--rose); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

video.preview { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: #000; margin-bottom: 8px; }

.empty-state { color: var(--muted); font-size: 13px; padding: 8px 0; }

.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border-bright);
  padding: 10px 18px; border-radius: 12px; font-size: 13px;
  box-shadow: 0 10px 40px rgba(18, 50, 41, 0.18);
  animation: rise .3s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- card selection ---- */
.card { position: relative; }
.card.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card-check {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  width: 26px; height: 26px; border-radius: 8px;
  background: rgba(6,7,9,0.72); border: 1px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  backdrop-filter: blur(4px);
}
.card-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }

.card-del {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 26px; height: 26px; border-radius: 8px; padding: 0;
  background: rgba(6,7,9,0.72); border: 1px solid var(--border-bright);
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .14s ease, color .14s ease, border-color .14s ease, background .14s ease;
}
.card:hover .card-del, .card-del:focus-visible { opacity: 1; }
.card-del:hover { color: #fff; background: var(--rose, #f43f5e); border-color: var(--rose, #f43f5e); }
@media (hover: none) { .card-del { opacity: 1; } }

/* ---- producer panel ---- */
.producer { margin-top: 48px; }
.producer-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; max-width: 70ch; }
.review-quickstart {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin: 0 0 16px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
}
.review-quickstart .muted { font-size: 12.5px; max-width: 56ch; }
.instructions {
  width: 100%; resize: vertical; min-height: 110px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; font: inherit; font-size: 14px; line-height: 1.5;
}
.instructions:focus { outline: none; border-color: var(--accent); }
.instructions::placeholder { color: #5a5f72; }
.epic-instr-label {
  display: block; margin: 14px 2px 6px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--accent);
}
.epic-instr { min-height: 190px; border: 2px solid var(--accent); font-size: 14.5px; }
.epic-instr::placeholder { color: #6a7088; }
.base-brief { margin-top: 10px; }
.base-brief > summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted);
  list-style: none; user-select: none;
}
.base-brief > summary::before { content: "▸ "; }
.base-brief[open] > summary::before { content: "▾ "; }
.base-brief-text {
  margin-top: 6px; min-height: 0; font-size: 12.5px; color: var(--muted);
  background: var(--bg-1, var(--bg-2)); opacity: 0.85; cursor: default;
}
.base-brief-text:focus { border-color: var(--border); }
.instructions-hint { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.5; }

.producer-controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field select {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 13px; min-width: 180px; cursor: pointer;
}
.field select:focus { outline: none; border-color: var(--accent); }
.field-slider { min-width: 170px; }
.field-slider output { color: var(--text); font-weight: 600; }
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border);
  outline: none; cursor: pointer; padding: 0; margin: 8px 0 6px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); border: none; cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
  border: none; cursor: pointer;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 10px;
  padding: 10px 16px; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--accent); background: var(--panel); }
.btn.primary { background: var(--accent); color: #ffffff; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger { border-color: var(--rose); color: var(--rose); }

/* ---- plan output ---- */
.plan-out { margin-top: 22px; }
.plan-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding: 24px 0; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--border-bright); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.plan-error { color: var(--rose); font-size: 14px; padding: 16px; border: 1px solid var(--rose); border-radius: var(--radius); background: rgba(251,113,133,0.07); }

/* Target-length trim review (two-pass planning: approve/protect the cuts). */
.trim-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trim-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, #e2e2e2); border-radius: 10px; background: var(--panel, #fff); }
.trim-item.protected { border-color: var(--accent); background: rgba(80,140,255,0.06); }
.trim-what { flex: 1; font-size: 14px; }
.trim-why { font-size: 12px; margin-top: 3px; }
.trim-protect { flex: none; white-space: nowrap; }

.plan-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 26px 28px;
}
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-head h3 { margin: 0; font-size: 24px; letter-spacing: -0.02em; line-height: 1.2; }
.plan-actions { display: flex; gap: 10px; flex-shrink: 0; }
.plan-logline { color: var(--text); font-size: 16px; line-height: 1.5; margin: 12px 0 0; opacity: 0.92; }
.plan-journey { margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.plan-warning { color: var(--amber, #fbbf24); font-size: 13px; padding: 8px 12px; border: 1px solid rgba(251,191,36,0.45); border-radius: var(--radius); background: rgba(251,191,36,0.08); }
.plan-card h4 { margin: 26px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }

.plan-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px;
}
.chip .ck { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.06em; }

.arc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.arc > div {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; font-size: 13.5px; line-height: 1.5;
}
.arc span { display: block; color: var(--accent-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 7px; }

.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.plan-list li {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px; font-size: 13.5px; line-height: 1.55;
}
.plan-list .mono { font-family: var(--mono); font-size: 12px; color: var(--accent-2); }
.plan-list .tag {
  display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 7px; margin-right: 6px; color: var(--amber);
}
/* Expandable key-moment rows + planned-vs-rendered audit lines */
.km-list li.km-item { padding: 0; }
.km summary {
  cursor: pointer; user-select: none; padding: 13px 15px;
  list-style: none; display: block;
}
.km summary::-webkit-details-marker { display: none; }
.km summary::after {
  content: "▸"; float: right; color: var(--muted); font-size: 12px;
  transition: transform 0.15s ease;
}
.km[open] summary::after { transform: rotate(90deg); }
.km-body {
  padding: 0 15px 13px; display: flex; flex-direction: column; gap: 6px;
  border-top: 1px dashed var(--border); padding-top: 10px;
}
.km-audit {
  font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
.km-audit.km-missing { color: var(--amber); }

.plan-vo {
  background: var(--bg-2); border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 0;
  font-size: 14px; line-height: 1.6; font-style: italic;
}

/* Collapsed plan details + editable epic instructions in the plan card */
.plan-details { margin-top: 18px; }
.plan-details summary {
  cursor: pointer; user-select: none; font-size: 13px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 0;
}
.plan-details summary:hover { color: var(--accent); }
.plan-details[open] summary { color: var(--accent); }
.plan-epic { margin-top: 18px; }
.plan-epic textarea { width: 100%; resize: vertical; }

/* ---- produce video ---- */
.produce-out:not(:empty) { margin-top: 18px; }
.spinner.small { width: 15px; height: 15px; border-width: 2px; }

.produce-progress {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); padding: 16px 18px;
}
.pp-head { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.pp-head .pp-pct { margin-left: auto; font-family: var(--mono); color: var(--accent); font-size: 13px; }
.pp-note { margin: 10px 0 0; font-size: 12px; }
.progress.determinate { height: 6px; margin-top: 12px; }
.progress.determinate > span {
  width: 0; animation: none; transition: width 0.5s ease;
}

.produce-result {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.final-video {
  width: 100%; max-height: 540px; border-radius: 12px; background: #000;
  display: block; object-fit: contain;
}
.final-video.vertical { max-width: 320px; align-self: center; }
.produce-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.produce-meta span {
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; color: var(--muted);
}

/* Multi-format build: checkbox picker + per-format result grid */
.field-formats { align-items: flex-start; }
.format-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.format-checks .check {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  white-space: nowrap; cursor: pointer;
}
.format-checks .check input { accent-color: var(--accent); width: 16px; height: 16px; }
.formats-hint { font-size: 12px; margin-top: 6px; }

.produce-result-multi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.fmt-result {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.fmt-result .final-video { max-height: 360px; }
.fmt-result .final-video.vertical { max-width: 220px; }
.fmt-label { font-weight: 600; font-size: 13px; }

.producer .field[hidden],
.producer .check[hidden] { display: none; }

.prod-card {
  border: 1px solid var(--border, rgba(128,128,128,.25));
  border-radius: 14px;
  background: var(--panel, rgba(255,255,255,.55));
  padding: 16px 18px 18px;
  margin: 26px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.prod-card:first-of-type { margin-top: 14px; }

.prod-sec {
  margin: 0 0 12px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border, rgba(128,128,128,.25));
  padding-bottom: 6px;
}

.sel-count-row { margin-top: 6px; text-align: right; font-size: 12px; }

.dup-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 24, 22, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.dup-modal {
  background: var(--panel, #fff); color: inherit;
  border: 1px solid var(--border, rgba(128,128,128,.3));
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
  max-width: 440px; width: 100%; padding: 20px 22px;
}
.dup-modal h3 { margin: 0 0 8px; font-size: 16px; }
.dup-modal p { margin: 8px 0; font-size: 14px; }
.dup-list {
  margin: 8px 0; padding: 8px 12px 8px 26px; max-height: 140px; overflow: auto;
  background: rgba(128,128,128,.08); border-radius: 8px; font-size: 13px;
}
.dup-list li { margin: 2px 0; word-break: break-all; }
.dup-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

.screen-create .producer-controls.prod-row {
  flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 14px;
}
.screen-create .producer-controls.prod-row .field { min-width: 180px; flex: 1; }
.screen-create .producer-controls.prod-row .field-slider { max-width: 320px; }

.field-chrono { align-items: flex-start; margin: 10px 0 4px; }
.field-chrono .check {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  cursor: pointer; margin-top: 4px;
}
.field-chrono .check input { accent-color: var(--accent); width: 16px; height: 16px; }
.field-chrono select { margin-top: 4px; max-width: 340px; }

@media (max-width: 620px) {
  .arc { grid-template-columns: 1fr; }
  .producer-controls { flex-direction: column; align-items: stretch; }
  .field select { width: 100%; }
}

/* ============================================================
   Projects reorganization
   ============================================================ */

/* nav tabs */
.tabs { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.tab {
  background: none; border: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 18px; border-radius: 999px; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-bright); }

/* views share the same centered max-width as main */
.view { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 12px clamp(20px, 5vw, 64px) 80px; }
.view-projects { max-width: 1240px; }

/* two-pane workspace */
.workspace { display: grid; grid-template-columns: 290px 1fr; gap: 26px; align-items: start; }

.proj-rail {
  position: sticky; top: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 16px 14px;
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rail-head h3 { margin: 0; font-size: 15px; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.ghost { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn.ghost:hover { border-color: var(--rose); color: var(--rose); }

.proj-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.proj-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 12px;
  padding: 9px 10px; cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.proj-row:hover { background: var(--panel-2); }
.proj-row.active { background: var(--panel-2); border-color: var(--border-bright); }
.pr-logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: #808080; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  padding: 3px; box-sizing: border-box; overflow: hidden;
}
.pr-logo .logo-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.pr-logo.ph { background: #060709; color: var(--accent); font-weight: 700; font-size: 17px; }
.pr-text { min-width: 0; }
.pr-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pr-tag { font-size: 10px; color: var(--accent-2); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

/* main workspace */
.proj-empty { color: var(--muted); font-size: 14px; padding: 60px 20px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.proj-detail { display: flex; flex-direction: column; gap: 4px; }

.pm-top { display: flex; gap: 20px; align-items: flex-start; }
.pm-logo {
  width: 96px; height: 96px; border-radius: 18px; flex-shrink: 0;
  background: #808080; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  padding: 8px; box-sizing: border-box; overflow: hidden;
}
.pm-logo .logo-img {
  max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}
.pm-logo.ph { background: #060709; color: var(--accent); font-weight: 700; font-size: 38px; }
.pm-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pm-name {
  background: none; border: none; border-bottom: 1px solid transparent;
  color: var(--text); font: inherit; font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em; padding: 2px 0; width: 100%;
}
.pm-name:hover:not(:disabled) { border-bottom-color: var(--border); }
.pm-name:focus { outline: none; border-bottom-color: var(--accent); }
.pm-name:disabled { color: var(--text); opacity: 1; }
.pm-desc {
  background: var(--bg-2); color: var(--text); resize: vertical;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 13.5px; line-height: 1.5; width: 100%;
}
.pm-desc:focus { outline: none; border-color: var(--accent); }
.pm-desc:disabled { color: var(--muted); }

/* logo controls */
.logo-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0 8px; }
.logo-bar .field.block.grow { flex: 1 1 100%; }
.logo-ref-row { display: flex; gap: 8px; align-items: center; }
.logo-ref-thumb {
  width: 38px; height: 38px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border);
  background:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%, transparent 75%, #2a2a2a 75%) 0 0/12px 12px,
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%, transparent 75%, #2a2a2a 75%) 6px 6px/12px 12px;
}
.btn.ghost { color: var(--muted); }
.field.block { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field.block.grow { flex: 1; }
.field.block span { font-weight: 500; }
.text-input {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 13.5px; width: 100%;
}
.text-input:focus { outline: none; border-color: var(--accent); }
.text-input::placeholder { color: #8fa19a; }

/* progress measurement */
.progress-measure {
  margin-top: 28px; padding: 20px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--panel);
}
.progress-measure h3 { margin: 0 0 4px; }
.pm-subhead { margin: 22px 0 4px; font-size: 15px; }
.pm-music { margin-bottom: 18px; }
textarea.text-input { resize: vertical; line-height: 1.4; min-height: 2.6em; }
.pm-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.pm-checks { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.pm-checks .check {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text); cursor: pointer;
}
.pm-checks .check input { accent-color: var(--accent); width: 16px; height: 16px; }

.map-bg-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.map-bg-label { font-size: 13px; color: var(--text); }
.map-bg-end { font-size: 12px; color: var(--muted); }
.map-bg-row input[type="range"] {
  flex: 1; min-width: 160px; max-width: 320px; accent-color: var(--accent);
  height: 4px; cursor: pointer;
}
.map-bg-val { font-size: 12px; min-width: 2ch; text-align: right; }

/* Bundled caption fonts (also burned into renders) so the picker previews
   each option in its own typeface. */
@font-face { font-family: "Anton"; src: url("fonts/Anton-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("fonts/BebasNeue-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Bangers"; src: url("fonts/Bangers-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Archivo Black"; src: url("fonts/ArchivoBlack-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Poppins ExtraBold"; src: url("fonts/Poppins-ExtraBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Serif Display"; src: url("fonts/DMSerifDisplay-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Pacifico"; src: url("fonts/Pacifico-Regular.ttf") format("truetype"); font-display: swap; }

/* Caption-font dropdown with live font previews. */
.fontselect { position: relative; }
.fontselect-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-2); color: var(--text); font-size: 14px; cursor: pointer;
  text-align: left;
}
.fontselect-btn:focus { outline: none; border-color: var(--accent); }
.fontselect-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fontselect-caret { color: var(--muted); font-size: 11px; flex: none; }
.fontselect-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  box-shadow: 0 12px 28px rgba(18, 50, 41, 0.15);
}
.fontselect-item {
  padding: 9px 12px; border-radius: 7px; font-size: 18px; color: var(--text);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fontselect-item:hover { background: var(--bg-2); }
.fontselect-item[aria-selected="true"] { background: var(--accent); color: #ffffff; }

/* clip picker */
.picker-toolbar {
  display: flex; gap: 12px; align-items: flex-end; margin: 6px 0 10px; flex-wrap: wrap;
}
.picker-toolbar .picker-search { flex: 1; min-width: 180px; }
.picker-toolbar .field { min-width: 150px; }
.picker-toolbar .picker-add { align-self: stretch; white-space: nowrap; }

.picker-scroll {
  max-height: 360px; overflow-y: auto; margin: 0 0 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2);
  transition: border-color .12s ease, background .12s ease;
}
.picker-scroll.drag {
  border-color: var(--accent, #6ea8fe);
  background: color-mix(in srgb, var(--accent, #6ea8fe) 12%, var(--bg-2));
}
.picker-list { display: flex; flex-direction: column; }

/* clip rows */
.cliprow { border-bottom: 1px solid var(--border); }
.cliprow:last-child { border-bottom: none; }
.cliprow.picked { background: rgba(45, 212, 160, 0.07); }
.cliprow-head { display: flex; align-items: stretch; gap: 10px; padding: 8px 10px; }

.cliprow-sel {
  flex: none; align-self: center; display: inline-flex;
  align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--panel); border: 1.5px solid var(--border); border-radius: 50%;
  color: transparent; cursor: pointer; padding: 0;
  transition: border-color .15s, background .15s, color .15s;
}
.cliprow-sel:hover { border-color: var(--accent); }
.cliprow-sel-icon { font-weight: 800; font-size: 16px; line-height: 1; }
.cliprow-sel.on {
  background: var(--accent); border-color: var(--accent); color: #ffffff;
}

/* Editable playback-order number on selected rows: type a number or use the
   arrows; the rest of the selection renumbers around it. */
.cliprow-orderbox {
  flex: none; align-self: center; display: inline-flex; flex-direction: column;
  align-items: center; gap: 1px;
}
.cliprow-order {
  width: 34px; height: 24px; text-align: center;
  background: var(--panel); color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 6px;
  font: inherit; font-size: 13px; font-weight: 800; padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.cliprow-order::-webkit-outer-spin-button,
.cliprow-order::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.order-arrow {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 9px; line-height: 1; padding: 2px 8px;
}
.order-arrow:hover:not(:disabled) { color: var(--accent); }
.order-arrow:disabled { opacity: 0.25; cursor: default; }

.cliprow-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  background: none; border: none; color: var(--text); font: inherit;
  text-align: left; cursor: pointer; padding: 2px 4px;
}
.cliprow-name {
  font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cliprow-info:hover .cliprow-name { color: var(--accent); }
.cliprow-meta { font-size: 11.5px; color: var(--muted); }

/* Tiny at-a-glance thumbnail on the far right of each picker row. Sized to fit
   the existing row height so rows don't grow; the click-to-expand preview below
   still shows the larger thumbnail for closer inspection. */
.cliprow-thumb-mini {
  flex: none; align-self: center;
  width: 64px; height: 38px; border-radius: 6px;
  object-fit: cover; background: #060709;
  border: 1px solid var(--border);
}

/* Per-row "insert file name" button: drops the clip's file name into the Epic
   Edit Instructions at the last cursor position, so users can reference clips
   precisely without retyping long names. */
.cliprow-insname {
  flex: none; align-self: center;
  width: 28px; height: 28px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.cliprow-insname:hover, .cliprow-insname:focus-visible {
  color: #fff; background: var(--accent); border-color: var(--accent);
}

.cliprow-remove {
  flex: none; align-self: center;
  width: 28px; height: 28px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s, background .15s, border-color .15s;
}
.cliprow:hover .cliprow-remove, .cliprow-remove:focus-visible { opacity: 1; }
.cliprow-remove:hover {
  color: #fff; background: var(--rose, #f43f5e); border-color: var(--rose, #f43f5e);
}
@media (hover: none) { .cliprow-remove { opacity: 1; } }

/* Per-clip "Show on map" toggle, shown under the row only when the project's
   animated route map is enabled and the clip carries GPS. Indented to line up
   under the clip name. */
.cliprow-extra { padding: 0 10px 9px 92px; }
.cliprow-map {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.cliprow-map input { accent-color: var(--accent); width: 15px; height: 15px; }
.cliprow-map .map-outlier-tag { font-style: normal; color: var(--rose, #f43f5e); }

.cliprow-preview { padding: 0 10px 10px 92px; }
.cliprow-thumb {
  width: 180px; max-width: 100%; aspect-ratio: 16/9; border-radius: 8px;
  background: #060709 center/cover no-repeat; border: 1px solid var(--border);
}
.clip-editor { display: flex; flex-direction: column; gap: 10px; }
.clip-player {
  width: 100%; max-width: 440px; aspect-ratio: 16/9; border-radius: 8px;
  background: #000; border: 1px solid var(--border); display: block;
}
.trim-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trim-readout { font-size: 12.5px; color: var(--muted); }
.trim-readout b { color: var(--text); font-variant-numeric: tabular-nums; }
.trim-hint { font-size: 12px; }
.mute-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap; }
.mute-toggle input { accent-color: var(--accent, #e33); cursor: pointer; }

/* buffering overlay on video players ("Loading video… N% ready") */
.video-wrap { position: relative; display: block; align-self: center; width: 100%; }
.video-wrap > video { display: block; width: 100%; }
/* keep vertical videos centered + narrow now that the wrapper is the flex item */
.video-wrap:has(> .final-video.vertical) { max-width: 320px; }
.fmt-result .video-wrap:has(> .final-video.vertical) { max-width: 220px; }
.video-wrap > .final-video.vertical { max-width: none; }
.video-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 13px;
  text-align: center; padding: 12px; border-radius: 10px;
  pointer-events: none; z-index: 2;
}
.video-loading[hidden] { display: none; }

/* filmstrip trimmer (Instagram-Edits-style drag handles) */
.trim-strip {
  position: relative; height: 52px; width: 100%; max-width: 440px;
  border-radius: 8px; overflow: hidden; background: #101216;
  border: 1px solid var(--border);
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: pointer;
}
.trim-film { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.trim-shade {
  position: absolute; top: 0; bottom: 0; width: 0;
  background: rgba(4, 5, 8, 0.72); pointer-events: none;
}
.trim-shade-l { left: 0; }
.trim-shade-r { right: 0; }
.trim-frame {
  position: absolute; top: 0; bottom: 0; box-sizing: border-box;
  border-top: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent);
  pointer-events: none;
}
.trim-handle {
  position: absolute; top: 0; bottom: 0; width: 16px; margin-left: -8px;
  background: var(--accent); cursor: ew-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.trim-handle::before {
  /* widen the touch target without changing the visual width */
  content: ""; position: absolute; top: 0; bottom: 0; left: -8px; right: -8px;
}
.trim-handle-l { border-radius: 8px 0 0 8px; }
.trim-handle-r { border-radius: 0 8px 8px 0; }
.trim-handle span {
  width: 3px; height: 18px; border-radius: 2px; background: #06281d;
  pointer-events: none;
}
.trim-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 5px rgba(0, 0, 0, 0.65);
  pointer-events: none; z-index: 3;
}

/* deleted sections ("cut out the fumble"): red blocks over the filmstrip */
.cut-blocks { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cut-block {
  position: absolute; top: 0; bottom: 0;
  background: rgba(244, 63, 94, 0.38);
  border-left: 1.5px solid rgba(244, 63, 94, 0.9);
  border-right: 1.5px solid rgba(244, 63, 94, 0.9);
  background-image: repeating-linear-gradient(
    -45deg, transparent 0 6px, rgba(244, 63, 94, 0.28) 6px 12px);
}
.cut-x {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(244, 63, 94, 0.95); color: #fff;
  font-size: 11px; line-height: 20px; padding: 0; cursor: pointer;
  pointer-events: auto;
}
.cut-x:hover { background: #f43f5e; }

/* pending cut selection while in cut mode */
.cut-sel {
  position: absolute; top: 0; bottom: 0; box-sizing: border-box; z-index: 2;
  background: rgba(244, 63, 94, 0.30);
  border-top: 2.5px solid var(--rose, #f43f5e);
  border-bottom: 2.5px solid var(--rose, #f43f5e);
  pointer-events: none;
}
.cut-sel[hidden] { display: none; }
.cut-sel-handle {
  position: absolute; top: 0; bottom: 0; width: 16px;
  background: var(--rose, #f43f5e); cursor: ew-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.cut-sel-handle::before {
  /* widen the touch target without changing the visual width */
  content: ""; position: absolute; top: 0; bottom: 0; left: -8px; right: -8px;
}
.cut-sel-l { left: -16px; border-radius: 8px 0 0 8px; }
.cut-sel-r { right: -16px; border-radius: 0 8px 8px 0; }
.cut-sel-handle span {
  width: 3px; height: 18px; border-radius: 2px; background: #3d0713;
  pointer-events: none;
}
/* in cut mode the trim handles must not swallow the drag */
.clip-editor.cutting .trim-handle { pointer-events: none; opacity: 0.35; }

.cut-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cut-bar[hidden] { display: none; }
.trim-bar[hidden] { display: none; }
.cut-readout { font-size: 12.5px; color: var(--muted); }
.cut-readout b { color: var(--rose, #f43f5e); font-variant-numeric: tabular-nums; }

/* library drawer — assign to project */
.assign-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.assign-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text);
}
.assign-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  padding: 0 2px; border-radius: 999px;
}
.assign-x:hover { color: var(--rose, #f43f5e); }
.assign-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign-select {
  flex: 1; min-width: 160px; padding: 7px 10px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  font-size: 13px;
}
.assign-empty { margin: 0; font-size: 12.5px; }

.producer { margin-top: 28px; }
.producer h3, .proj-videos h3 { font-size: 17px; margin: 0 0 6px; letter-spacing: -0.01em; }
.proj-videos { margin-top: 40px; }
.pv-video { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #000; display: block; border-bottom: 1px solid var(--border); }
.pv-poster { width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; background: #000; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; padding: 0; }
.pv-poster .pv-play { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.12); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; padding-left: 4px; transition: background 0.15s ease, transform 0.15s ease; }
.pv-poster:hover .pv-play { background: rgba(255,255,255,0.22); transform: scale(1.06); }
.dl-progress { margin-top: 10px; }
.dl-progress .dl-pct { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* modal */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(4,5,8,0.66); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%); background: var(--bg-2);
  border: 1px solid var(--border-bright); border-radius: var(--radius);
  padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 18px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .proj-rail { position: static; max-height: none; }
}

/* graphic size editor */
.sizer-modal { width: min(780px, 100%); }
.sizer-intro { margin: 0; }
.sizer-body { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.sizer-preview-col { display: flex; flex-direction: column; gap: 10px; }
.sizer-format { width: 100%; }
.sizer-stage {
  display: flex; align-items: center; justify-content: center; min-height: 320px;
}
.sizer-frame {
  position: relative; background: #808080; border-radius: 6px;
  overflow: hidden; box-shadow: 0 16px 50px rgba(18, 50, 41, 0.2);
}
.sizer-check {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.sizer-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.sz-logo {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
}
/* The three burned-in graphics are draggable in the preview to reposition them. */
.sz-logo, .sz-caption, .sz-cc, .sz-progress {
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.sz-logo:active, .sz-caption:active, .sz-cc:active, .sz-progress:active { cursor: grabbing; }
.sz-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sz-logo canvas { display: block; }
.sz-logo-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(255,255,255,0.7); border-radius: 6px; box-sizing: border-box;
  color: rgba(255,255,255,0.9); font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
}
.sz-caption {
  position: absolute; left: 50%; transform: translateX(-50%);
  color: #ffe14d; text-align: center; white-space: nowrap; line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,0.85); font-weight: 700;
}
.sz-cc {
  position: absolute; left: 50%; transform: translateX(-50%);
  color: #fff; text-align: center; white-space: nowrap; line-height: 1.15;
  background: rgba(0,0,0,0.55); border-radius: 3px;
  font-family: 'DejaVu Sans', 'Helvetica Neue', Arial, sans-serif;
}
.sz-progress {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 96%;
}
.sz-amount { color: #fff; font-weight: 800; line-height: 1; text-shadow: 0 2px 6px rgba(0,0,0,0.85); }
.sz-desc { color: #eee; line-height: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.85); }
.sz-bar { background: rgba(255,255,255,0.35); overflow: hidden; }
.sz-bar-fill { width: 62%; height: 100%; background: #f2f2f2; }
.sz-goal { color: #ececec; line-height: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.85); }
.sizer-controls { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 18px; }
.sizer-ctl { display: flex; flex-direction: column; gap: 6px; }
.sizer-ctl-head { display: flex; justify-content: space-between; font-size: 13px; }
.sizer-ctl input[type=range] { width: 100%; }
.sizer-val { color: var(--accent, #6cf); font-variant-numeric: tabular-nums; }
.sizer-actions { margin-top: 6px; flex-wrap: wrap; }

/* logo lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(4,5,8,0.82); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 40px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox .lb-tile {
  background: #808080; border: 1px solid var(--border-bright);
  border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,0.6);
  padding: 36px; cursor: zoom-out; display: flex;
}
.lightbox .lb-img {
  max-width: min(680px, 92vw); max-height: 86vh; object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.55));
}
.lightbox .lb-close {
  position: absolute; top: 22px; right: 24px;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border-bright);
  color: var(--text); font-size: 16px; cursor: pointer;
}
.lightbox .lb-close:hover { border-color: var(--accent); }

/* GPX route item panel (inside the picker row) */
.gpx-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
.gpx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}
.gpx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.gpx-field { min-width: 180px; }
.gpx-field > span { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.gpx-field b { color: var(--text); font-variant-numeric: tabular-nums; }
.gpx-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.gpx-status { font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gpx-ready { color: var(--accent); }
.gpx-err { max-width: 100%; }
.gpx-preview { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.gpx-preview-video {
  max-width: min(260px, 100%);
  max-height: 380px;
  border-radius: 10px;
  background: #000;
}
.gpx-preview-note { margin: 0; font-size: 12px; max-width: 420px; }
.gpx-detail-thumb {
  display: block;
  max-width: min(320px, 100%);
  border-radius: 10px;
  margin-bottom: 12px;
}

/* Spoken setup notes ("epic journey note …") */
.voice-note-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(110, 231, 183, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.voice-note-banner strong { color: var(--accent); font-weight: 600; }
.voice-filled {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent) inset;
}

/* ── Project timeline modal ─────────────────────────────────────────── */
.tl-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 5, 9, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.tl-modal {
  width: min(760px, 100%); max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(18, 50, 41, 0.2);
  overflow: hidden;
}
.tl-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.tl-head h3 { margin: 0; font-size: 16px; }
.tl-head-actions { display: flex; gap: 8px; }
.tl-body { padding: 18px 20px; overflow-y: auto; }
.tl-summary { margin: 0 0 14px; }
.tl-day {
  margin: 18px 0 8px; font-size: 13px; font-weight: 600;
  color: var(--accent); letter-spacing: 0.02em;
  position: sticky; top: 0; background: var(--bg-2); padding: 4px 0;
}
.tl-day:first-of-type { margin-top: 0; }
.tl-entry {
  border: 1px solid var(--border);
  border-left: 2.5px solid var(--border-bright);
  border-radius: 8px;
  padding: 11px 13px; margin-bottom: 10px;
  background: var(--panel);
}
.tl-entry.is-used { border-left-color: var(--accent); }
.tl-entry-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-time {
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tl-importflag {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--accent-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
}
.tl-desc { margin: 7px 0 0; font-size: 13.5px; line-height: 1.5; }
.tl-used { margin-top: 8px; font-size: 12.5px; }
.tl-unused { color: var(--muted); }
.tl-loc { color: var(--accent-2); text-decoration: none; font-size: 12.5px; }
.tl-loc:hover { text-decoration: underline; }
.tl-raw {
  margin: 0; padding: 14px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 12px; line-height: 1.5; color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
}

/* ===================== Auth gate ===================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 7, 12, 0.72);
  backdrop-filter: blur(10px);
}
.auth-overlay[hidden] { display: none; }
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 30px 80px rgba(18, 50, 41, 0.22);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.auth-brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.auth-tagline { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-submit { width: 100%; justify-content: center; padding: 12px; margin-top: 4px; }
.auth-error {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rose);
  background: rgba(251, 113, 133, 0.08);
  color: var(--rose);
  font-size: 13px;
}
.auth-error[hidden] { display: none; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu[hidden] { display: none; }
.user-email { color: var(--muted); font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Editable "Caption for sharing" on a finished video card. */
.cap-field { display: flex; flex-direction: column; gap: 5px; margin: 4px 0 10px; }
/* Caption block under the freshly built video on the Create screen */
.produce-cap { max-width: 560px; margin: 14px auto 4px; }
.produce-cap .btn-row { align-items: center; gap: 10px; }
.produce-cap .formats-hint { flex: 1; min-width: 0; }
.cap-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cap-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 40px;
  font: inherit; font-size: 13px; line-height: 1.4;
  color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
}
.cap-input:focus { outline: none; border-color: var(--border-bright); background: var(--panel-2); }
.cap-input::placeholder { color: var(--muted); }

/* ---- Per-video cost breakdown ---- */
.cost-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.cost-loading { font-size: 13px; }
.cost-loading.err { color: var(--rose); }
.cost-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.cost-head.sub { margin-top: 6px; }
.cost-head.sub .cost-total-label,
.cost-head.sub .cost-total { color: var(--muted); font-weight: 500; }
.cost-total-label { font-size: 13px; font-weight: 600; }
.cost-total {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}
.cost-head.sub .cost-total { font-size: 15px; }
.cost-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.cost-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
}
.cost-lines {
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.cost-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cost-op { font-size: 13px; font-weight: 500; }
.cost-detail { grid-column: 1; font-size: 11.5px; }
.cost-amt {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-family: var(--mono);
  font-size: 13px;
}
.cost-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--muted);
}
.cost-note { margin: 10px 0 0; font-size: 11.5px; line-height: 1.5; }

/* ---- Admin pricing editor ---- */
.pricing-modal { max-width: 640px; width: 92vw; }
.pricing-intro { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; }
.pricing-body { max-height: 60vh; overflow-y: auto; }
.price-svc { margin-bottom: 18px; }
.price-svc h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--accent-2);
}
.price-model {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.price-model-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.price-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.price-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.price-input { width: 130px; font-family: var(--mono); }

/* Blocking import overlay — stays up until every uploaded clip is ready. */
body.upload-locked { overflow: hidden; }
.upload-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(4, 5, 8, 0.82); backdrop-filter: blur(5px);
}
.upload-overlay-card {
  text-align: center; max-width: 380px; width: 100%;
  background: var(--bg-2); border: 1px solid var(--border-bright);
  border-radius: var(--radius); padding: 32px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 24px 60px rgba(18, 50, 41, 0.2);
}
.upload-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--border-bright); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.upload-overlay-title { font-size: 18px; font-weight: 650; color: var(--text); }
.upload-overlay-sub { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.upload-overlay-count { font-size: 13px; font-weight: 600; color: var(--accent); margin-top: 2px; }

/* ============================================================
   MOBILE APP SHELL  (live UI — supersedes the old desktop chrome
   .topbar/main/.tabs/.view/.workspace/.proj-rail/.proj-row, which
   are no longer emitted into the DOM)
   ============================================================ */

.app-shell {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}

.screens { position: relative; flex: 1 1 auto; min-height: 0; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.screen[hidden] { display: none; }

.screen-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 16px calc(28px + env(safe-area-inset-bottom));
}
/* centre + cap width so it reads well on tablets / desktop too */
.screen-scroll > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* in-screen top bar (journey / create) */
.screen-topbar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-title-wrap .topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub { font-size: 12.5px; color: var(--muted); }
.topbar-spacer { flex: 1; }

/* sub-screen helpers */
.tl-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.film-stage { display: flex; flex-direction: column; }
.create-topbar .create-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.create-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn.round {
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 22px; line-height: 1; display: flex;
  align-items: center; justify-content: center; flex: none;
}

/* ---------- bottom tab bar ---------- */
.tabbar {
  flex: none; position: sticky; bottom: 0; z-index: 8;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tabbtn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font: inherit; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 4px 0; border-radius: 12px;
}
.tabbtn svg { width: 24px; height: 24px; }
.tabbtn span { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
.tabbtn.active { color: var(--accent); }

/* ---------- home / shared headers ---------- */
.home-top, .you-top, .lib-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.home-top .brand-mark, .you-top .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.home-top h1, .you-top h1 { font-size: 20px; }
.home-title { font-size: 26px; letter-spacing: -0.02em; margin: 10px 0 16px; }
.screen-home .home-title { text-align: center; }
.lib-top { margin-bottom: 4px; }

.btn.pill { border-radius: 999px; }
.new-journey { font-weight: 600; }
.new-journey .plus { font-size: 16px; line-height: 1; margin-right: -2px; }

/* ---------- journey list (home) ---------- */
.journey-list { display: flex; flex-direction: column; gap: 12px; }
.journeys-empty { text-align: center; padding: 48px 20px; }

.journey-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 14px;
  transition: border-color .18s, background .18s, transform .18s;
}
.journey-card:hover { border-color: var(--border-bright); background: var(--panel-2); }
.journey-card:active { transform: scale(0.99); }
.jc-logo {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  background: #808080; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  padding: 5px; overflow: hidden;
}
.jc-logo .logo-img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.jc-logo.ph { background: #060709; color: var(--accent); font-weight: 700; font-size: 22px; }
.jc-text { flex: 1; min-width: 0; }
.jc-name { font-size: 15.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jc-stats { margin-top: 8px; display: flex; gap: 8px; }
.jc-stat { font-size: 11.5px; color: var(--muted); }
.jc-stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.jc-chev { color: var(--muted); font-size: 22px; flex: none; }

/* ---------- journey detail ---------- */
.journey-hero { text-align: center; padding: 8px 0 4px; }
.journey-hero .pm-logo { margin: 0 auto 14px; width: 110px; height: 110px; }
.journey-name { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 6px; line-height: 1.15; }
.journey-desc { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 auto 12px; max-width: 46ch; }
.journey-pills { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* collapsible settings trays — one per section, one open at a time */
/* Side margins must stay `auto`: the shared `.screen-scroll > *` rule centers
   every section at max-width 760px, and a shorthand `margin: 18px 0 8px`
   zeroed those auto margins — pinning the whole settings block flush left. */
.journey-settings { margin: 18px auto 8px; }
.journey-settings > h2 { font-size: 17px; margin: 0 0 10px; letter-spacing: -0.01em; }
.setting-tray {
  margin: 0 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel); overflow: hidden;
}
.setting-tray > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  gap: 10px; padding: 14px 16px;
  font-size: 14px; font-weight: 600;
}
.setting-tray > summary::-webkit-details-marker { display: none; }
.setting-tray .tray-label { flex: none; }
.setting-tray .tray-hint {
  flex: 1; min-width: 0; text-align: right;
  color: var(--muted); font-weight: 400; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.setting-tray[open] .tray-hint { visibility: hidden; }
.tray-chev { flex: none; color: var(--muted); transition: transform .2s; }
.setting-tray[open] .tray-chev { transform: rotate(180deg); }
.tray-body { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.settings-form { display: flex; flex-direction: column; gap: 22px; }

.setting-group { display: block; }
.setting-group h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: -0.01em; }
.setting-group .field.block { margin-bottom: 12px; }
.setting-group.logo-bar { display: block; margin: 0; }
.btn.block { width: 100%; justify-content: center; }
.logo-or { display: flex; align-items: center; text-align: center; gap: 10px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.logo-or::before, .logo-or::after { content: ""; flex: 1; height: 1px; background: rgba(18, 50, 41, 0.14); }

/* big primary call-to-action button (gradient) */
.btn.cta {
  width: 100%; justify-content: center; padding: 14px 18px;
  font-size: 15px; font-weight: 700; border: none; border-radius: 14px;
  color: #07140f; background: linear-gradient(135deg, var(--grad-from), var(--grad-to));
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.28);
}
.btn.cta:hover { filter: brightness(1.04); }
.btn.cta:disabled { opacity: .5; filter: none; box-shadow: none; cursor: not-allowed; }
.btn.cta .spark, .btn.cta .sparkle { font-size: 14px; }

.create-cta-bar { margin-top: 18px; }

/* ---------- create screen producer (single column) ---------- */
.screen-create .producer { margin-top: 4px; }
.screen-create .producer-controls { flex-direction: column; align-items: stretch; }
.screen-create .producer-controls .field select,
.screen-create .producer-controls .field .text-input { width: 100%; }
.screen-create .producer-controls #selCount { text-align: right; }

/* ---------- library ---------- */
.screen-library .dropzone { padding: 36px 20px; border-radius: 20px; }
.screen-library .library { margin-top: 0; }

/* ---------- you ---------- */
.you-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); padding: 18px;
}
.you-card .user-menu { flex-direction: column; align-items: stretch; gap: 12px; }
.you-row { display: flex; flex-direction: column; gap: 4px; }
.you-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.you-card .user-email { max-width: none; font-size: 15px; color: var(--text); }
.you-foot { text-align: center; margin-top: 22px; }

.section-title { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.01em; }

/* journey detail name input shouldn't read as the borderless desktop title */
.setting-group .pm-name {
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 400; padding: 9px 12px; border-radius: 10px;
}
.setting-group .pm-desc { min-height: 3em; }

/* wider screens: relax the single-column producer + grids */
@media (min-width: 720px) {
  .screen-create .producer-controls { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .screen-create .producer-controls .field { min-width: 180px; }
}

/* --- Episode versions (Film screen) + version count badge ------------------ */
.ver-badge {
  display: inline-block; margin-left: 6px; vertical-align: middle;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted);
  font: inherit; font-size: 11px; cursor: pointer;
}
button.ver-badge:hover { border-color: var(--border-bright); color: var(--text); }

/* --- Full-screen clip editor sheet ----------------------------------------- */
.clip-sheet {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: var(--bg, #0b0d12);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.clip-sheet.open { transform: translateY(0); }
.clip-sheet-top {
  flex: 0 0 auto;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.clip-sheet-body {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px));
}
.clip-sheet-body .clip-editor { max-width: 860px; margin: 0 auto; }
.clip-sheet-body .clip-player { width: 100%; max-height: 52vh; background: #000; border-radius: 12px; }

/* --- "Editing episode" banner on the Create screen -------------------------- */
.edit-banner {
  background: var(--panel); border: 1px solid var(--border-bright, var(--border));
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.edit-banner-text { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.eb-preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.eb-preview .pv-poster { border-bottom: 0; aspect-ratio: 16/9; max-height: 46vh; }
.eb-preview .pv-video { border-bottom: 0; aspect-ratio: auto; max-height: 46vh; }
.eb-quality { display: flex; align-items: center; gap: 6px; margin: 0; }
.eb-quality > span { font-size: 12px; color: var(--muted); }
.eb-quality select { width: auto; padding: 6px 8px; font-size: 13px; }
.versions { margin-top: 18px; }
.versions-h { font-size: 14px; margin: 0 0 10px; color: var(--text); }
.ver-list { display: flex; flex-direction: column; gap: 8px; }
.ver-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.ver-row.cur { border-color: var(--border-bright); background: var(--panel-2); }
.ver-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.ver-q { font-weight: 600; font-size: 13px; }
.ver-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text);
}
button.ver-chip { cursor: pointer; }
button.ver-chip:hover { border-color: var(--border-bright); }
.ver-chip.err { color: var(--rose); border-color: var(--rose); }
.ver-stat { font-size: 12px; color: var(--muted); }
.ver-stat.err { color: var(--rose); }
.ver-cur { font-size: 12px; color: var(--accent); white-space: nowrap; }
.ver-act { flex: 0 0 auto; }
.make-version {
  margin-top: 14px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.make-version > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.make-version .mv-hint { margin: 8px 0; font-size: 12.5px; }
.make-version .mv-formats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.make-version .field { display: block; margin-bottom: 10px; }
.make-version .mv-status { font-size: 12.5px; margin-bottom: 8px; }

/* Make-another-version build progress (Film screen) */
.mv-progress:empty { display: none; }
.mv-progress { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.mvp-row {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.mvp-row .pp-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.mvp-row .pp-head .pp-pct { margin-left: auto; color: var(--muted); }
.mvp-label { font-weight: 600; font-size: 12.5px; }
.mvp-ok { margin-left: auto; color: var(--accent); font-size: 12.5px; }
.mvp-err { margin-left: auto; color: var(--rose); font-size: 12.5px; }

/* Editable "Recorded" date/time inside an expanded picker row */
.capture-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 2px 2px;
}
.capture-label { font-size: 0.85rem; color: var(--text-dim, #5f7269); }
.capture-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.85rem;
  color-scheme: light;
}
.capture-hint { font-size: 0.75rem; flex-basis: 100%; }

/* ---- Strava modal ---- */
.strava-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.strava-modal { background: var(--panel, #16181d); border: 1px solid var(--border-bright); border-radius: 12px; padding: 16px; width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column; gap: 10px; }
.strava-modal-head { display: flex; align-items: center; justify-content: space-between; }
.strava-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 80px; }
.strava-act { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: transparent; border: 1px solid var(--border-bright); border-radius: 8px; padding: 8px 10px; color: inherit; cursor: pointer; font: inherit; }
.strava-act:hover { border-color: var(--accent, #7aa2ff); }
.strava-act:disabled { opacity: 0.6; cursor: default; }
.strava-act-name { font-weight: 600; }
.strava-modal-foot { display: flex; justify-content: flex-end; }

/* ===== Logo Style Helper (inline, inside the Logo settings tray) ===== */
.lsh-inline { display: flex; flex-direction: column; }
.lsh-inline .field span, .lsh-inline label { color: var(--text); }
.lsh-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px; margin: 10px 0 16px;
}
.lsh-tile {
  background: var(--bg-2, #eef0f4); border: 2px solid transparent;
  border-radius: 10px; padding: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: inherit; font: inherit;
}
.lsh-tile img {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.28));
}
.lsh-tile span {
  color: var(--text, #1a1d29); font-size: 11px; line-height: 1.2; text-align: center; opacity: 0.85;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lsh-tile:hover { border-color: rgba(0,0,0,0.3); }
.lsh-tile.selected { border-color: #2f6fed; background: rgba(47,111,237,0.10); }

/* Logo Style Helper — special action tiles & preview overlay */
.lsh-tile-special {
  background: #ffffff; border: 2px dashed rgba(0,0,0,0.28);
  justify-content: center;
}
.lsh-tile-special:hover { border-color: rgba(0,0,0,0.5); }
.lsh-tile-special.selected { border-style: solid; border-color: #2f6fed; background: rgba(47,111,237,0.10); }
.lsh-tile-special .lsh-special-icon {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 42px; line-height: 1; color: #2f6fed;
}
.lsh-tile-special span { font-weight: 700; }

.lsh-preview-overlay {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lsh-preview-card {
  background: #8a8f99; border-radius: 14px; padding: 28px;
  max-width: min(560px, 92vw);
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.lsh-preview-img {
  max-width: 100%; max-height: 55vh; object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}
.lsh-preview-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.lsh-preview-actions .btn { background: #ffffff; color: #1a1d29; }
.lsh-preview-actions .btn.primary { background: #2f6fed; color: #ffffff; }

/* Transcript scrubbing panel in the clip editor */
.clip-transcript { margin-top: 14px; border-top: 1px solid var(--line, #e5e5e5); padding-top: 10px; }
.ct-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ct-title { font-weight: 600; }
.ct-hint { margin: 6px 0 8px; }
.ct-body { line-height: 1.9; user-select: none; -webkit-user-select: none; touch-action: none; }
.ct-spk { display: block; margin-top: 8px; font-weight: 700; font-size: 12px; color: #556; }
.ct-seg { cursor: pointer; padding: 2px 3px; border-radius: 4px; }
.ct-seg:hover { background: rgba(0, 0, 0, 0.06); }
.ct-seg.ct-pend { text-decoration: line-through; background: rgba(220, 60, 60, 0.16); color: #a33; }
.ct-seg.ct-cut { text-decoration: line-through; background: rgba(220, 60, 60, 0.28); color: #822; }
.ct-stage-note { margin: 6px 0; font-size: 13px; color: #a33; font-weight: 600; }
.btn.ct-attn { animation: ctPulse 1.4s ease-in-out infinite; }
@keyframes ctPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 60, 60, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(220, 60, 60, 0); }
}
.ct-prev-status { margin: 6px 0; font-size: 13px; color: #2563eb; font-weight: 600; }
/* Result preview mode: the strip/markers describe the ORIGINAL timeline, so
   freeze them out while the baked-in-cuts file is playing. */
.clip-editor.ct-previewing .trim-strip,
.clip-editor.ct-previewing .trim-bar,
.clip-editor.ct-previewing .cut-bar { opacity: 0.35; pointer-events: none; }

/* Two-pass target-length trim review card */
.trim-review {
  border: 1px solid var(--border, #d8dce2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--card-bg, #fff);
}
.trim-review h3 { margin: 0 0 6px; font-size: 1rem; }
.trim-group { margin-top: 10px; }
.trim-head { font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
.trim-item { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.trim-item input { margin-top: 3px; }
.trim-item em { font-style: normal; font-size: .8rem; }
.trim-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.trim-note { margin-top: 8px; font-size: .85rem; }
