/* =========================================================
   EZVids — design tokens
   ========================================================= */
:root {
  --bg: #050608;
  --surface: rgba(24, 26, 32, 0.72);
  --surface-solid: #14161b;
  --surface-raised: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #f5f5f7;
  --text-2: #a1a1a8;
  --text-3: #6e6e76;

  --accent: #0a84ff;
  --accent-2: #2997ff;
  --accent-soft: rgba(10, 132, 255, 0.16);
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;

  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 12px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --fast: 180ms;
  --medium: 320ms;
  --slow: 520ms;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --glass: saturate(180%) blur(24px);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, sans-serif;
  --tabbar-space: 120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(60% 45% at 50% -8%, rgba(10, 132, 255, 0.22), transparent 70%),
    radial-gradient(40% 35% at 100% 0%, rgba(94, 92, 230, 0.12), transparent 70%);
}

/* =========================================================
   Buttons & controls
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition:
    transform var(--fast) var(--ease),
    background var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease),
    opacity var(--fast) var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(180deg, #1a8cff, #0a74e8);
  color: #fff;
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 30px rgba(10, 132, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-small {
  height: 38px;
  padding: 0 18px;
  font-size: 14px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-btn:active {
  transform: scale(0.92);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* iOS-style switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-2);
  font-weight: 500;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background var(--medium) var(--ease);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform var(--medium) var(--ease-spring);
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* Segmented control */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
}

.segmented button {
  position: relative;
  z-index: 1;
  min-width: 82px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: color var(--medium) var(--ease);
}

.segmented button.is-active {
  color: var(--text);
}

.segmented-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: 82px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform var(--medium) var(--ease);
}

.segmented[data-active="timeline"] .segmented-thumb {
  transform: translateX(82px);
}

/* =========================================================
   Layout
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 max(24px, env(safe-area-inset-left));
  background: rgba(5, 6, 8, 0.6);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* The EZVids logo (a round badge) beside the name. */
.brand-logo {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.brand-logo-large {
  width: 40px;
  height: 40px;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px var(--tabbar-space);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: view-in var(--slow) var(--ease) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* =========================================================
   EZ Find — hero, upload, progress
   ========================================================= */
.hero {
  text-align: center;
  padding: 72px 0 44px;
  animation: view-in var(--slow) var(--ease) both;
}

.hero h1 {
  margin: 0;
  font-size: clamp(40px, 6.2vw, 72px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 700;
  background: linear-gradient(180deg, #ffffff 30%, #9ea6b4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* The gradient only paints inside the box: room for the tails of g, y, p
     on the last line (they were cut off), without moving what's below. */
  padding-bottom: 0.22em;
  margin-bottom: -0.14em;
}

.hero p {
  max-width: 560px;
  margin: 18px auto 0;
  font-size: 19px;
  color: var(--text-2);
}

.upload-card,
.progress-card {
  max-width: 760px;
  margin: 0 auto 56px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  animation: card-in var(--slow) var(--ease) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 220px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--medium) var(--ease),
    background var(--medium) var(--ease),
    transform var(--medium) var(--ease);
}

.dropzone:hover {
  border-color: rgba(41, 151, 255, 0.55);
  background: rgba(41, 151, 255, 0.04);
}

.dropzone.is-dragging {
  border-color: var(--accent-2);
  background: rgba(41, 151, 255, 0.09);
  transform: scale(1.01);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(48, 209, 88, 0.45);
  background: rgba(48, 209, 88, 0.05);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
  border-radius: 16px;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid rgba(41, 151, 255, 0.25);
  transition: transform var(--medium) var(--ease-spring), color var(--medium), background var(--medium);
}

.dropzone:hover .dropzone-icon {
  transform: translateY(-3px);
}

.dropzone.has-file .dropzone-icon {
  color: var(--green);
  background: rgba(48, 209, 88, 0.14);
  border-color: rgba(48, 209, 88, 0.3);
}

.dropzone-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.dropzone-title {
  font-size: 18px;
  font-weight: 600;
}

.dropzone-sub {
  color: var(--text-2);
  font-size: 14px;
  word-break: break-all;
}

.dropzone-types {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.form-error {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.25);
  color: #ff8a80;
  font-size: 14px;
  animation: card-in var(--medium) var(--ease) both;
}

.progress-card {
  margin-top: 72px;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 26px;
}

.progress-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.progress-elapsed {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--medium) var(--ease);
}

.step-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background var(--medium) var(--ease), transform var(--medium) var(--ease-spring);
}

.steps li.is-active {
  color: var(--text);
}

.steps li.is-active .step-dot {
  background: var(--accent-2);
  transform: scale(1.2);
}

.steps li.is-active .step-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  animation: pulse 1.6s var(--ease) infinite;
}

.steps li.is-done {
  color: var(--text-2);
}

.steps li.is-done .step-dot {
  background: var(--green);
}

@keyframes pulse {
  from {
    opacity: 0.7;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(1.7);
  }
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #5ac8fa);
  transition: width 800ms var(--ease);
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.progress-message {
  margin: 16px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

.progress-card.is-error .progress-fill {
  background: var(--red);
}

.progress-card.is-error .progress-fill::after,
.progress-card.is-error .step-dot::after {
  display: none;
}

.progress-card.is-error .progress-message {
  color: #ff8a80;
}

.progress-error-actions {
  margin-top: 18px;
}

.progress-cancel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.progress-cancel[hidden],
.progress-card.is-error .progress-cancel {
  display: none;
}

.progress-cancel-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

/* =========================================================
   EZ Find — results
   ========================================================= */
.results {
  padding-top: 40px;
  /* Room for the selection bar above the tab bar. */
  padding-bottom: 70px;
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.results-head h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.results-sub {
  margin: 6px 0 0;
  color: var(--text-2);
}

.results-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.clip-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 16px;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  outline: none;
  transition:
    transform var(--medium) var(--ease),
    border-color var(--medium) var(--ease),
    box-shadow var(--medium) var(--ease),
    background var(--medium) var(--ease);
  animation: card-in var(--slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.clip-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
}

.clip-card:focus-visible {
  border-color: var(--accent-2);
}

.clip-card.is-selected {
  border-color: rgba(10, 132, 255, 0.85);
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.12), var(--surface) 40%);
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.5), 0 24px 60px rgba(10, 132, 255, 0.16);
}

.clip-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

/* The whole frame: a vertical clip fills the card; a landscape one isn't cropped (its captions would be cut off). */
.clip-thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform var(--slow) var(--ease);
}

.clip-card:hover .clip-thumb video {
  transform: scale(1.03);
}

.clip-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 22%, transparent 70%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

.badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-variant-numeric: tabular-nums;
}

.badge-duration {
  left: 10px;
  bottom: 10px;
}

.badge-top {
  left: 10px;
  top: 10px;
  color: #ffd60a;
}

.badge-top svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  stroke: none;
}

.play-hint {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translate(-50%, -50%) scale(0.85);
  opacity: 0;
  transition: opacity var(--medium) var(--ease), transform var(--medium) var(--ease-spring);
  pointer-events: none;
}

.play-hint svg {
  width: 20px;
  height: 20px;
  fill: #fff;
  stroke: none;
  margin-left: 3px;
}

.clip-card:hover .play-hint {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.clip-card.is-previewing .play-hint {
  opacity: 0;
}

.select-toggle {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: transparent;
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    transform var(--medium) var(--ease-spring);
}

.select-toggle svg {
  width: 16px;
  height: 16px;
  stroke-width: 3;
  transform: scale(0.4);
  transition: transform var(--medium) var(--ease-spring);
}

.select-toggle:hover {
  transform: scale(1.08);
}

.select-toggle:active {
  transform: scale(0.9);
}

.clip-card.is-selected .select-toggle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.clip-card.is-selected .select-toggle svg {
  transform: scale(1);
}

.clip-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 6px 0;
}

.clip-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 5px;
}

.clip-title {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clip-desc {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clip-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 4px 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.score-ring {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.score-ring svg {
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
  stroke-width: 3.5;
}

.score-ring .track {
  stroke: rgba(255, 255, 255, 0.1);
}

.score-ring .value {
  stroke: var(--tone, var(--accent-2));
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1100ms var(--ease);
}

.score-ring.is-drawn .value {
  stroke-dashoffset: var(--offset, 100);
}

.score-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-label {
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.score-label small {
  display: none;
}

.tone-high {
  --tone: var(--green);
}

.tone-mid {
  --tone: var(--accent-2);
}

.tone-low {
  --tone: var(--orange);
}

.sound-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  max-width: 100%;
  margin-bottom: 2px;
  padding: 7px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 12px;
}

.sound-chip svg {
  width: 14px;
  height: 14px;
  color: #bf5af2;
}

.sound-chip span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.score-help {
  margin-top: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.score-help summary {
  padding: 16px 20px;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 500;
  list-style: none;
}

.score-help summary::-webkit-details-marker {
  display: none;
}

.score-help summary::before {
  content: "ⓘ";
  margin-right: 8px;
}

.score-help-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 0 20px 20px;
}

.score-help h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.score-help p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

/* =========================================================
   Selection bar & tab bar
   ========================================================= */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 22px;
  border-radius: 999px;
  background: rgba(30, 32, 38, 0.82);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transform: translate(-50%, 24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--medium) var(--ease-spring), opacity var(--medium) var(--ease);
}

.selection-bar.is-visible {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.selection-count {
  font-weight: 600;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  padding: 6px;
  border-radius: 999px;
  background: rgba(24, 26, 32, 0.76);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  transform: translateX(-50%);
}

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 112px;
  padding: 8px 0 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color var(--medium) var(--ease);
}

.tab svg {
  width: 22px;
  height: 22px;
  transition: transform var(--medium) var(--ease-spring);
}

.tab:hover {
  color: var(--text-2);
}

.tab.is-active {
  color: var(--text);
}

.tab.is-active svg {
  color: var(--accent-2);
  transform: scale(1.06);
}

.tab:active svg {
  transform: scale(0.9);
}

.tab-indicator {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 112px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: transform var(--medium) var(--ease-spring), width var(--medium) var(--ease-spring), opacity var(--fast) var(--ease);
}

.tab-indicator.is-hidden {
  opacity: 0;
}

.tab-badge {
  position: absolute;
  top: 4px;
  right: 30px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  animation: pop var(--medium) var(--ease-spring);
}

@keyframes pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

/* =========================================================
   Preview modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 32px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transition: opacity var(--medium) var(--ease);
}

.modal-sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  width: min(1060px, 100%);
  max-height: min(860px, calc(100vh - 64px));
  border-radius: 30px;
  overflow: hidden;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(18px) scale(0.965);
  transition: opacity var(--medium) var(--ease), transform var(--slow) var(--ease);
}

.modal.is-open .modal-backdrop {
  opacity: 1;
}

.modal.is-open .modal-sheet {
  opacity: 1;
  transform: none;
}

.modal-close {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 16px;
}

.modal-media {
  position: relative;
  display: grid;
  place-items: center;
  background: #000;
  min-height: 0;
}

.modal-media video {
  width: 100%;
  height: 100%;
  max-height: min(860px, calc(100vh - 64px));
  object-fit: contain;
  background: #000;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 24, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--medium) var(--ease), background var(--fast);
}

.nav-arrow.prev {
  left: 16px;
}

.nav-arrow.next {
  right: 16px;
}

.modal-media:hover .nav-arrow:not(:disabled) {
  opacity: 1;
}

.nav-arrow:hover {
  background: rgba(40, 40, 46, 0.8);
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 36px 32px 28px;
  overflow-y: auto;
}

.modal-info h2 {
  margin: 8px 48px 8px 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.modal-description {
  margin: 0 0 18px;
  color: var(--text-2);
}

.detail-blocks {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-block {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.detail-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.detail-score {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--text));
}

.detail-score small {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
}

.criteria {
  display: grid;
  gap: 8px;
}

.criterion {
  display: grid;
  grid-template-columns: 70px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.criterion-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.criterion-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent-2);
  transition: width 900ms var(--ease);
}

.criterion b {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.detail-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fact {
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--text-2);
}

.fact b {
  color: var(--text);
}

.sfx-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.modal-actions .btn {
  flex: 1;
}

#modalSelect.is-selected {
  background: var(--accent-soft);
  border-color: rgba(10, 132, 255, 0.5);
  color: var(--accent-2);
}

/* =========================================================
   Editor
   ========================================================= */
.editor-empty {
  max-width: 420px;
  margin: 120px auto 0;
  text-align: center;
  animation: card-in var(--slow) var(--ease) both;
}

.editor-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.editor-empty-icon svg {
  width: 32px;
  height: 32px;
}

.editor-empty h2 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.editor-empty p {
  margin: 0 0 24px;
  color: var(--text-2);
}

.editor {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 340px;
  gap: 20px;
  padding-top: 28px;
  min-height: calc(100vh - 60px - var(--tabbar-space));
}

.panel-label {
  margin: 4px 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.editor-clip-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-clip {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
  animation: card-in var(--medium) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.editor-clip:hover {
  background: rgba(255, 255, 255, 0.05);
}

.editor-clip.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.editor-clip video {
  width: 54px;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
  pointer-events: none;
}

.editor-clip-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.editor-clip-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.editor-clip .dot-unsaved {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--orange);
  vertical-align: middle;
}

.editor-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.stage-head h2 {
  margin: 6px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stage-frame {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 420px;
  border-radius: var(--radius-lg);
  background: #000;
  border: 1px solid var(--border);
  overflow: hidden;
}

.stage-frame video {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 60px - var(--tabbar-space) - 110px);
  object-fit: contain;
  animation: view-in var(--slow) var(--ease) both;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.tool svg {
  width: 22px;
  height: 22px;
}

.tool:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.tool:active:not(:disabled) {
  transform: scale(0.95);
}

.tool.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.tool:disabled {
  cursor: default;
  color: var(--text-3);
  opacity: 0.6;
}

.tool em {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tool-panel {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  animation: card-in var(--medium) var(--ease) both;
}

.tool-panel h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.hint {
  margin: 4px 0 18px;
  color: var(--text-2);
  font-size: 13px;
}

.timeline {
  position: relative;
  height: 34px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 8px),
    rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.timeline-range {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: 8px;
  border: 2px solid #ffd60a;
  background: rgba(255, 214, 10, 0.16);
  transition: left var(--medium) var(--ease), width var(--medium) var(--ease);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin: 6px 2px 16px;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.trim-row {
  display: grid;
  grid-template-columns: 44px 64px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.trim-label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.trim-value {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.stepper button {
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.stepper button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.stepper button:active:not(:disabled) {
  transform: scale(0.92);
}

.stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}

.trim-length {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}

.trim-length span {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.panel-actions .btn {
  flex: 1;
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(36, 38, 44, 0.9);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  font-size: 14px;
  font-weight: 500;
  transform: translate(-50%, -16px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--medium) var(--ease-spring), opacity var(--medium) var(--ease);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.is-error {
  color: #ff8a80;
  border-color: rgba(255, 69, 58, 0.35);
}

/* =========================================================
   Responsive
   ========================================================= */
/* =========================================================
   Editor — live preview & captions
   ========================================================= */
.stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* The preview stays in view while the (taller) tool panel scrolls. */
.editor {
  align-items: start;
}

.editor-stage {
  position: sticky;
  top: 80px;
}

.editor-stage .stage-frame {
  flex: none;
  min-height: 0;
  height: min(68vh, calc(100vh - 60px - var(--tabbar-space) - 150px));
}

.segmented-compact button {
  min-width: 76px;
  height: 30px;
  font-size: 12px;
}

.segmented-compact .segmented-thumb {
  width: 76px;
}

.segmented-compact[data-active="rendered"] .segmented-thumb {
  transform: translateX(76px);
}

.stage-player {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.stage-player video {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 60px - var(--tabbar-space) - 160px);
  object-fit: contain;
  background: #000;
}

.caption-overlay {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
}

.caption-line {
  position: absolute;
  left: 7%;
  right: 7%;
  line-height: 1.18;
  white-space: normal;
  overflow-wrap: break-word;
  paint-order: stroke fill;
  transition: opacity 120ms var(--ease);
}

.caption-line span.is-spoken {
  transition: color 60ms linear;
}

.caption-line .caption-box {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.live-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.live-controls .icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.live-controls .icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

.live-controls .icon-pause,
.live-controls.is-playing .icon-play {
  display: none;
}

.live-controls.is-playing .icon-pause {
  display: block;
}

.live-controls input[type="range"] {
  flex: 1;
}

.live-time {
  min-width: 92px;
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Shared form controls */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2) var(--fill, 0%), rgba(255, 255, 255, 0.12) var(--fill, 0%));
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent-2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform var(--fast) var(--ease-spring);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

input[type="color"] {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

select {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px,
    rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}

select option {
  background: var(--surface-solid);
}

/* Captions panel */
.panel-title-row,
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-small .switch-track {
  width: 38px;
  height: 23px;
}

.switch-small .switch-thumb {
  width: 19px;
  height: 19px;
}

.switch-small input:checked + .switch-track .switch-thumb {
  transform: translateX(15px);
}

.switch-small .switch-label {
  font-size: 13px;
}

.caption-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: opacity var(--medium) var(--ease);
}

.caption-controls.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

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

.preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 9px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.05)),
    linear-gradient(135deg, #2b3445, #13161d);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.preset:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.preset:active {
  transform: scale(0.96);
}

.preset.is-active {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(10, 132, 255, 0.2);
}

.preset-sample {
  height: 30px;
  display: flex;
  align-items: center;
  font-size: 20px;
  line-height: 1;
  paint-order: stroke fill;
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > label,
.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field output,
.sub-label output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.sub-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}

.field-row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: var(--swatch);
  transition: transform var(--fast) var(--ease-spring), border-color var(--fast) var(--ease);
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.swatches input[type="color"] {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.swatches input[type="color"]::-webkit-color-swatch {
  border-radius: 50%;
}

.chip-toggle {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.chip-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: rgba(10, 132, 255, 0.5);
  color: var(--accent-2);
}

.segmented-icons {
  margin-left: auto;
}

.segmented-icons button {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 28px;
  border-radius: 999px;
}

.segmented-icons button svg {
  width: 16px;
  height: 16px;
}

.segmented-icons button.is-active {
  background: rgba(255, 255, 255, 0.14);
}

.advanced {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.advanced summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "›";
  display: inline-block;
  margin-left: 8px;
  transition: transform var(--medium) var(--ease);
}

.advanced[open] summary::after {
  transform: rotate(90deg);
}

.advanced[open] > .field {
  margin-top: 16px;
  animation: card-in var(--medium) var(--ease) both;
}

/* Sound panel */
.sound-suggestions {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.12), rgba(10, 132, 255, 0.08));
  border: 1px solid rgba(191, 90, 242, 0.25);
  animation: card-in var(--medium) var(--ease) both;
}

.suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.suggestion-head .eyebrow {
  color: #d29bff;
}

.suggestion-text {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-2);
}

.suggestion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.suggestion-row .suggestion-what {
  flex: 1;
  min-width: 0;
}

.suggestion-row .suggestion-what small {
  display: block;
  color: var(--text-3);
  font-size: 11px;
}

.mixer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.mixer-row {
  display: grid;
  grid-template-columns: 96px 1fr 44px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.mixer-row output {
  text-align: right;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sound-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 600;
}

.link-btn:hover {
  text-decoration: underline;
}

.sound-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 6px;
  border-radius: 12px;
  font-size: 13px;
  transition: background var(--fast) var(--ease);
}

.sound-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sound-row.is-current {
  background: var(--accent-soft);
  border: 1px solid rgba(10, 132, 255, 0.35);
}

.sound-row .sound-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sound-row .sound-meta {
  color: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.play-btn {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.play-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.play-btn:active {
  transform: scale(0.9);
}

.play-btn.is-playing {
  background: var(--accent);
  border-color: var(--accent);
}

.mini-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--fast) var(--ease);
}

.mini-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.mini-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.mini-btn.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.icon-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
}

.icon-x:hover {
  background: rgba(255, 69, 58, 0.15);
  color: var(--red);
}

.icon-x svg {
  width: 14px;
  height: 14px;
}

.effect-track {
  position: relative;
  height: 26px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 10%),
    rgba(255, 255, 255, 0.04);
}

.effect-marker {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 4px;
  margin-left: -2px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #bf5af2;
  box-shadow: 0 0 10px rgba(191, 90, 242, 0.6);
  cursor: pointer;
  animation: pop var(--medium) var(--ease-spring);
}

.effect-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  opacity: 0.8;
  pointer-events: none;
}

.effect-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border-radius: 12px;
  background: rgba(191, 90, 242, 0.08);
  font-size: 13px;
  animation: card-in var(--fast) var(--ease) both;
}

.effect-row.is-outside {
  opacity: 0.45;
}

.effect-row .sound-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.time-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.time-stepper button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: 13px;
}

.time-stepper button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.time-stepper span {
  min-width: 42px;
  text-align: center;
}

.sfx-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.sfx-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.sfx-chip:hover {
  border-color: rgba(191, 90, 242, 0.5);
  background: rgba(191, 90, 242, 0.08);
}

.sfx-chip:active {
  transform: scale(0.97);
}

.sfx-chip .play-btn {
  width: 26px;
  height: 26px;
}

.sfx-chip .sound-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.empty-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  font-size: 12px;
}

/* Reframed live preview: the player takes the output shape and the video is
   positioned inside it so only the kept area shows. */
.stage-player.is-reframed {
  width: auto;
  height: auto;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: width var(--medium) var(--ease), height var(--medium) var(--ease);
}

.stage-player.is-reframed video {
  position: absolute;
  max-width: none;
  max-height: none;
  object-fit: fill;
  animation: none;
}

.stage-player.is-reframed.is-fit video {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stage-player.is-draggable {
  cursor: grab;
}

.stage-player.is-dragging {
  cursor: grabbing;
}

.fit-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.drag-hint {
  position: absolute;
  white-space: nowrap;
  left: 50%;
  top: 14px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 600;
  transform: translateX(-50%);
  pointer-events: none;
  animation: card-in var(--medium) var(--ease) both;
}

/* Reframe panel */
.aspect-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.aspect-option {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.aspect-option:hover {
  border-color: var(--border-strong);
}

.aspect-option:active {
  transform: scale(0.97);
}

.aspect-option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.aspect-shape {
  grid-row: span 2;
  justify-self: center;
  width: var(--w);
  height: var(--h);
  border-radius: 4px;
  border: 2px solid currentColor;
  color: var(--text-2);
}

.aspect-option.is-active .aspect-shape {
  color: var(--accent-2);
  background: rgba(41, 151, 255, 0.15);
}

.aspect-name {
  font-size: 14px;
  font-weight: 700;
}

.aspect-option small {
  font-size: 11px;
  color: var(--text-3);
}

.reframe-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
  transition: opacity var(--medium) var(--ease);
}

.reframe-controls.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.segmented-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.segmented-modes button {
  min-width: 0;
}

.segmented-modes .segmented-thumb {
  width: calc((100% - 6px) / 3);
}

.segmented-modes[data-active="manual"] .segmented-thumb {
  transform: translateX(100%);
}

.segmented-modes[data-active="fit"] .segmented-thumb {
  transform: translateX(200%);
}

.reframe-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

.reframe-status .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.minimap-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.minimap-wrap canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #000;
  cursor: grab;
  touch-action: none;
}

.reframe-buttons {
  display: flex;
  gap: 8px;
}

/* Sound timeline under the video */
/* The preview gets what the timeline under it leaves (public/timeline.js sets --timeline-h). */
.editor.has-timeline .editor-stage .stage-frame {
  height: max(240px, calc(100vh - 60px - var(--tabbar-space) - var(--stage-head-h, 110px) - 40px - var(--timeline-h, 300px)));
  min-height: 0;
}

/* Too little room for the preview and the timeline: the column scrolls with the page. */
.editor-stage.is-tall {
  position: static;
}

.sound-timeline {
  margin-top: 12px;
  padding: 12px 14px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  user-select: none;
  animation: card-in var(--medium) var(--ease) both;
}

.timeline-ruler {
  position: relative;
  height: 20px;
  margin-left: 78px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.timeline-ruler span {
  position: absolute;
  bottom: 3px;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.timeline-ruler span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 1px;
  height: 4px;
  background: var(--text-3);
}

.timeline-lanes {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}

.lane {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  align-items: center;
}

.lane-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.lane-body {
  position: relative;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  overflow: hidden;
}

.lane-effects .lane-body {
  height: 52px;
}

.lane-body canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.music-bar {
  position: absolute;
  inset: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(10, 132, 255, 0) 0, rgba(10, 132, 255, 0.4) 3%, rgba(10, 132, 255, 0.4) 97%, rgba(10, 132, 255, 0) 100%);
  border: 1px solid rgba(41, 151, 255, 0.45);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}

.music-bar small {
  color: var(--text-2);
  font-weight: 500;
}

.lane-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--text-3);
  pointer-events: none;
}

.effect-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  min-width: 48px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(191, 90, 242, 0.65);
  background: linear-gradient(180deg, rgba(191, 90, 242, 0.5), rgba(191, 90, 242, 0.28));
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  transition: box-shadow var(--fast) var(--ease);
}

.effect-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2b6ff;
}

.effect-block.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(191, 90, 242, 0.7);
}

.effect-block.is-dragging {
  cursor: grabbing;
  z-index: 2;
}

.effect-block.is-outside {
  opacity: 0.4;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 78px;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -5px;
  border: 6px solid transparent;
  border-top-color: #fff;
}

.timeline-tip {
  margin: 8px 0 0 78px;
  font-size: 11px;
  color: var(--text-3);
}

.kf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.kf-buttons {
  display: flex;
  gap: 6px;
}

.kf-buttons .mini-btn:disabled {
  opacity: 0.35;
}

.kf-lane {
  height: 40px;
  background:
    linear-gradient(90deg, rgba(41, 151, 255, 0.08), rgba(41, 151, 255, 0.02)),
    rgba(255, 255, 255, 0.035);
}

.kf-diamond {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 3px;
  background: var(--accent);
  transform: rotate(45deg);
  cursor: grab;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform var(--fast) var(--ease-spring), background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  animation: pop var(--medium) var(--ease-spring);
}

.kf-diamond:hover {
  transform: rotate(45deg) scale(1.15);
}

.kf-diamond.is-current {
  background: #ffd60a;
}

.kf-diamond.is-selected {
  background: #ffd60a;
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.4), 0 0 16px rgba(255, 214, 10, 0.8);
}

.kf-selected {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 10px;
  background: rgba(255, 214, 10, 0.08);
  border: 1px solid rgba(255, 214, 10, 0.35);
  font-size: 13px;
}

.kf-selected[hidden] {
  display: none;
}

.kf-selected .sub-label {
  flex: 1;
  margin: 0;
}

.effect-row.is-selected {
  box-shadow: 0 0 0 1px rgba(191, 90, 242, 0.8);
}

/* Split & Transitions */
.unapplied-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 159, 10, 0.15);
  border: 1px solid rgba(255, 159, 10, 0.4);
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
  animation: pop var(--medium) var(--ease-spring);
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(191, 90, 242, 0.15);
  border: 1px solid rgba(191, 90, 242, 0.45);
  color: #e2b6ff;
  font-size: 12px;
  font-weight: 600;
  animation: pop var(--medium) var(--ease-spring);
}

.split-button {
  width: 100%;
  margin-bottom: 12px;
}

.history-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.history-buttons .mini-btn:disabled {
  opacity: 0.35;
}

.segment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.segment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
  animation: card-in var(--fast) var(--ease) both;
}

.segment-row:hover {
  border-color: var(--border-strong);
}

.segment-row.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.segment-row.is-removed {
  opacity: 0.55;
}

.segment-row.is-removed .segment-name {
  text-decoration: line-through;
}

.segment-swatch {
  flex-shrink: 0;
  width: 10px;
  height: 28px;
  border-radius: 4px;
  background: var(--seg-colour);
}

.segment-name {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.segment-name small {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.edit-summary {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-2);
}

.preview-edit {
  width: 100%;
  margin-bottom: 4px;
}

.segment-lane {
  height: 54px;
  overflow: visible;
}

.segment-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--seg-colour);
  font-size: 11px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.75);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--fast) var(--ease), opacity var(--fast) var(--ease);
}

.segment-block.is-removed {
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 12px), rgba(255, 255, 255, 0.03);
  border-style: dashed;
  color: var(--text-3);
}

.segment-block.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(41, 151, 255, 0.6);
  z-index: 1;
}

.join-handle {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  padding: 0 6px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #1c1f26;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: transform var(--fast) var(--ease-spring), background var(--fast) var(--ease);
}

.join-handle:hover {
  transform: scale(1.1);
}

.join-handle.has-transition {
  background: #bf5af2;
}

.join-handle.is-selected {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 0 16px rgba(41, 151, 255, 0.9);
}

.join-handle.is-edge {
  border-radius: 8px;
  font-size: 10px;
}

/* Extras: keyword pop, progress bar, safe zones, post kit, tighten pauses */
.extras-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 214, 10, 0.07), rgba(191, 90, 242, 0.06));
  border: 1px solid rgba(255, 214, 10, 0.18);
}

.field-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

.progress-preview {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--bar, 6px);
  pointer-events: none;
}

.progress-preview span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bar-colour, #fff);
}

.safe-zones {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.safe-zone {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 69, 58, 0.9);
  background: rgba(255, 69, 58, 0.18);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  overflow: hidden;
}

.safe-zone-label {
  position: absolute;
  left: 8px;
  top: 10%;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 11px;
  font-weight: 700;
}

.safe-zone-warning {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(10% + 28px);
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 159, 10, 0.92);
  color: #000;
  font-size: 11px;
  font-weight: 700;
}

.post-kit {
  display: flex;
  gap: 6px;
}

/* The title keeps room; the buttons wrap underneath when space is short. */
.stage-head {
  flex-wrap: wrap;
}

.stage-head > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
}

.stage-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.extras-box .field-label {
  display: block;
}

.extras-box .field-label-row {
  align-items: flex-start;
}

.post-kit a.mini-btn {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

#safeZoneToggle.is-on {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.6);
}

.tighten-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.tighten-box .segmented-icons {
  margin-left: 0;
}

.tighten-box .segmented-icons button {
  padding: 0 10px;
  font-size: 11px;
}

.tighten-box .segmented-icons button.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.overlap-zone {
  position: absolute;
  top: 3px;
  bottom: 3px;
  z-index: 1;
  border-radius: 6px;
  background: repeating-linear-gradient(135deg, rgba(191, 90, 242, 0.55) 0 4px, rgba(191, 90, 242, 0.25) 4px 8px);
  border: 1px solid rgba(226, 182, 255, 0.8);
  pointer-events: none;
}

.transition-preview {
  position: relative;
  margin-bottom: 8px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}

.transition-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tp-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-2);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  transition: opacity var(--medium) var(--ease);
}

.tp-overlay:empty {
  opacity: 0;
}

.tp-sound {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  font-size: 14px;
}

.draft-note {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-3);
}

.transition-target {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  color: var(--text-2);
}

.transition-target strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 15px;
}

.transition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.transition-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.transition-option:hover {
  border-color: var(--border-strong);
}

.transition-option:active {
  transform: scale(0.96);
}

.transition-option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent);
}


/* Spacious editor layout (wide screens). Remove this block to go back to the
   compact layout. */
@media (min-width: 1081px) {
  body.in-editor main {
    max-width: 1760px;
    padding: 0 40px var(--tabbar-space);
  }

  .editor {
    grid-template-columns: 236px minmax(0, 1fr) 384px;
    gap: 36px;
    padding-top: 36px;
  }

  .editor-stage .stage-frame {
    height: calc(100vh - 60px - var(--tabbar-space) - 160px);
    min-height: 440px;
  }

  .editor.has-timeline .editor-stage .stage-frame {
    height: max(280px, calc(100vh - 60px - var(--tabbar-space) - var(--stage-head-h, 110px) - 50px - var(--timeline-h, 300px)));
    min-height: 0;
  }

  .stage-player video {
    max-height: none;
  }

  .tool-panel {
    padding: 26px;
  }

  .tool-grid {
    gap: 10px;
    padding: 10px;
  }

  .tool {
    padding: 16px 4px 14px;
  }

  .editor-clip-list {
    gap: 12px;
  }

  .editor-clip {
    grid-template-columns: 64px 1fr;
    padding: 10px;
  }

  .editor-clip video {
    width: 64px;
  }
}

.clip-thumb.is-broken::before {
  content: "Preview unavailable";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 13px;
}

@media (max-width: 1080px) {
  .editor {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .editor-clips {
    grid-column: 1 / -1;
    order: 3;
  }

  .editor-clip-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .editor-clip {
    flex: 0 0 220px;
  }
}

@media (max-width: 820px) {
  main {
    padding: 0 16px var(--tabbar-space);
  }

  .hero {
    padding: 44px 0 30px;
  }

  .hero p {
    font-size: 17px;
  }

  .upload-card,
  .progress-card {
    padding: 18px;
  }

  .progress-card {
    margin-top: 32px;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 12px;
  }

  .clip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }


  .score-help-body {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 0;
    align-items: end;
  }

  .modal-sheet {
    grid-template-columns: 1fr;
    max-height: 94vh;
    border-radius: 28px 28px 0 0;
    overflow-y: auto;
    transform: translateY(40px);
  }

  .modal-media video {
    max-height: 56vh;
  }

  .nav-arrow {
    opacity: 1;
  }

  .editor {
    grid-template-columns: 1fr;
  }

  .stage-frame {
    min-height: 0;
  }

  .stage-frame video {
    max-height: 62vh;
  }
}

@media (max-width: 480px) {
  .upload-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .results-tools {
    width: 100%;
    justify-content: space-between;
  }

  .tab {
    width: 96px;
  }


  .clip-card {
    padding: 8px 8px 12px;
    border-radius: 20px;
  }

  .clip-title {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 820px) {
  .editor-stage {
    position: static;
  }

  .editor-stage .stage-frame {
    height: 56vh;
  }
}

/* The preview box always has a definite size, and the normal (not reframed)
   player fills it exactly with the video fitted inside. Before this, the
   video's height came from a percentage of an auto-sized parent, so a tall
   rendered clip could grow far past the box and show a zoomed-in strip. */
.editor-stage .stage-frame {
  position: relative;
}

.editor-stage .stage-player:not(.is-reframed) {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
}

.editor-stage .stage-player:not(.is-reframed) video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Cut tool: the start/end card and the split card share one Apply and Reset
   (in the split card), so the start/end card's own buttons are hidden. */
.editor.is-splitting #trimPanel .panel-actions {
  display: none;
}

/* Split tab: the segment lane is the only timeline, with its own transport. */
.editor.is-splitting #liveControls {
  display: none;
}

.split-transport {
  margin: 0 0 10px;
  padding: 4px 12px 4px 4px;
  background: transparent;
}

.split-transport .icon-btn {
  width: 32px;
  height: 32px;
}

.split-transport .live-time {
  min-width: 0;
  text-align: left;
}

.split-keys {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
}

@media (max-width: 700px) {
  .split-keys {
    display: none;
  }
}

/* ----- EZFind: coming soon -------------------------------------------------- */
.tab-soon {
  position: absolute;
  top: 2px;
  right: 8px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.coming-soon {
  max-width: 480px;
  margin: 110px auto 0;
  text-align: center;
  animation: card-in var(--slow) var(--ease) both;
}

.coming-soon-mark {
  position: relative;
  display: grid;
  margin-left: auto;
  margin-right: auto;
  place-items: center;
  width: 84px;
  height: 84px;
  margin-bottom: 20px;
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(10, 132, 255, 0.22), rgba(94, 92, 230, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent-2);
  box-shadow: 0 18px 48px rgba(10, 132, 255, 0.18);
}

.coming-soon-mark::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 34px;
  border: 1px solid rgba(10, 132, 255, 0.25);
  animation: soon-ring 3.2s var(--ease) infinite;
}

.coming-soon-mark svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

@keyframes soon-ring {
  0% { opacity: 0.9; transform: scale(0.92); }
  70%, 100% { opacity: 0; transform: scale(1.12); }
}

.coming-soon-pill {
  display: block;
  width: fit-content;
  margin: 0 auto 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coming-soon h2 {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.035em;
}

.coming-soon p {
  margin: 0 auto 8px;
  color: var(--text-2);
  line-height: 1.55;
}

.coming-soon-sub {
  font-size: 13px;
  color: var(--text-3) !important;
}

.coming-soon-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .coming-soon-mark::after {
    animation: none;
    opacity: 0.4;
  }
}

/* ----- Results overview: where the clips come from ------------------------- */
.clip-overview {
  margin: -8px 0 26px;
}

.overview-strip {
  position: relative;
  height: 34px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 8.33%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  overflow: hidden;
}

.overview-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(10, 132, 255, 0.55);
  border-radius: 7px;
  background: linear-gradient(rgba(10, 132, 255, 0.24), rgba(10, 132, 255, 0.24)), #0b0d12;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.overview-clip:hover {
  background: linear-gradient(rgba(10, 132, 255, 0.4), rgba(10, 132, 255, 0.4)), #0b0d12;
  transform: translateY(-1px);
}

.overview-clip.is-top {
  border-color: rgba(255, 214, 10, 0.7);
  background: linear-gradient(rgba(255, 214, 10, 0.2), rgba(255, 214, 10, 0.2)), #0b0d12;
}

.overview-clip.is-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.overview-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.overview-summary {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

/* ----- Transitions: where (boundary strip) and style (demo gallery) --------- */
.tx-label {
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.tx-label span {
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.join-strip {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.join-chip {
  flex: none;
  display: grid;
  gap: 2px;
  min-width: 76px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  text-align: left;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.join-chip:hover {
  border-color: var(--border-strong);
}

.join-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent);
}

.join-swatches {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
}

.join-swatches i {
  width: 14px;
  height: 6px;
  border-radius: 3px;
}

.join-chip-title {
  font-size: 13px;
  font-weight: 700;
}

.join-chip-detail {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.join-chip.has-transition .join-chip-detail {
  color: #d9a6ff;
}

.transition-option {
  gap: 3px;
  padding: 10px 6px 9px;
}

.tx-name {
  margin-top: 4px;
  font-size: 12px;
}

.tx-note {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  line-height: 1.25;
}

.duration-presets {
  display: flex;
  gap: 6px;
  margin: 6px 0 8px;
}

.duration-presets .mini-btn.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

/* The demo: <b> is shot A, <i> is shot B. Animated while hovered or chosen. */
@property --dot {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.tx-demo {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.tx-demo b,
.tx-demo i {
  position: absolute;
  inset: 0;
}

.tx-demo b {
  background: linear-gradient(135deg, #2997ff, #0a5cd6);
}

.tx-demo i {
  background: linear-gradient(135deg, #bf5af2, #ff375f);
  opacity: 0;
}

.tx-demo.tx-none i,
.tx-demo.tx-fadein i,
.tx-demo.tx-fadeout i {
  display: none;
}

.tx-demo.tx-fadein b {
  opacity: 0.25;
}

.transition-option:is(:hover, :focus-visible, .is-active) .tx-demo * {
  animation-duration: var(--tx-loop, 2.4s);
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.transition-option:is(:hover, :focus-visible, .is-active) .tx-cut i { animation-name: tx-cut; animation-timing-function: step-end; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-fade i { animation-name: tx-fade; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-dissolve i { animation-name: tx-dissolve; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-wipe i { animation-name: tx-wipe; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slide b { animation-name: tx-slide-out; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slide i { animation-name: tx-slide-in; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-dip b { animation-name: tx-dip-a; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-dip i { animation-name: tx-dip-b; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-fadein b { animation-name: tx-fade-in; }
.tx-demo.tx-flash { background: #fff; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-flash b { animation-name: tx-dip-a; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-flash i { animation-name: tx-dip-b; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-wiperight i { animation-name: tx-wipe-right; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-wipeup i { animation-name: tx-wipe-up; opacity: 1; }
.tx-softwipe i {
  -webkit-mask: linear-gradient(90deg, transparent 0 40%, #000 60%) 0 0 / 300% 100% no-repeat;
  mask: linear-gradient(90deg, transparent 0 40%, #000 60%) 0 0 / 300% 100% no-repeat;
}
.transition-option:is(:hover, :focus-visible, .is-active) .tx-softwipe i { animation-name: tx-soft-wipe; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slideright b { animation-name: tx-slide-out-right; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slideright i { animation-name: tx-slide-in-left; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slideup b { animation-name: tx-slide-out-up; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-slideup i { animation-name: tx-slide-in-up; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-zoom b { animation-name: tx-zoom-a; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-zoom i { animation-name: tx-fade; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-circle i { animation-name: tx-circle; opacity: 1; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-blur b { animation-name: tx-blur-a; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-blur i { animation-name: tx-blur-b; }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-pixelate i { animation-name: tx-fade; animation-timing-function: steps(5); }
.transition-option:is(:hover, :focus-visible, .is-active) .tx-fadeout b { animation-name: tx-fade-out; }

.tx-dissolve i {
  -webkit-mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.6px)) 0 0 / 6px 6px;
  mask: radial-gradient(circle, #000 var(--dot), transparent calc(var(--dot) + 0.6px)) 0 0 / 6px 6px;
}

@keyframes tx-cut { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 1; } }
@keyframes tx-fade { 0%, 30% { opacity: 0; } 70%, 100% { opacity: 1; } }
@keyframes tx-dissolve { 0%, 30% { --dot: 0px; } 70%, 100% { --dot: 4.5px; } }
@keyframes tx-wipe { 0%, 30% { clip-path: inset(0 0 0 100%); } 70%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes tx-slide-out { 0%, 30% { transform: translateX(0); } 70%, 100% { transform: translateX(-100%); } }
@keyframes tx-slide-in { 0%, 30% { transform: translateX(100%); } 70%, 100% { transform: translateX(0); } }
@keyframes tx-dip-a { 0%, 25% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes tx-dip-b { 0%, 50% { opacity: 0; } 75%, 100% { opacity: 1; } }
@keyframes tx-fade-in { 0%, 20% { opacity: 0; } 70%, 100% { opacity: 1; } }
@keyframes tx-fade-out { 0%, 30% { opacity: 1; } 80%, 100% { opacity: 0; } }
@keyframes tx-wipe-right { 0%, 30% { clip-path: inset(0 100% 0 0); } 70%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes tx-wipe-up { 0%, 30% { clip-path: inset(100% 0 0 0); } 70%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes tx-soft-wipe { 0%, 30% { -webkit-mask-position: 0 0; mask-position: 0 0; } 70%, 100% { -webkit-mask-position: 100% 0; mask-position: 100% 0; } }
@keyframes tx-slide-out-right { 0%, 30% { transform: translateX(0); } 70%, 100% { transform: translateX(100%); } }
@keyframes tx-slide-in-left { 0%, 30% { transform: translateX(-100%); } 70%, 100% { transform: translateX(0); } }
@keyframes tx-slide-out-up { 0%, 30% { transform: translateY(0); } 70%, 100% { transform: translateY(-100%); } }
@keyframes tx-slide-in-up { 0%, 30% { transform: translateY(100%); } 70%, 100% { transform: translateY(0); } }
@keyframes tx-zoom-a { 0%, 30% { transform: scale(1); opacity: 1; } 70%, 100% { transform: scale(1.8); opacity: 0; } }
@keyframes tx-circle { 0%, 30% { clip-path: circle(0% at 50% 50%); } 70%, 100% { clip-path: circle(75% at 50% 50%); } }
@keyframes tx-blur-a { 0%, 30% { filter: blur(0); opacity: 1; } 70%, 100% { filter: blur(6px); opacity: 0; } }
@keyframes tx-blur-b { 0%, 30% { filter: blur(6px); opacity: 0; } 70%, 100% { filter: blur(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .transition-option .tx-demo * {
    animation: none !important;
  }
}

/* ----- Brand button (goes Home) ------------------------------------------- */
button.brand {
  padding: 6px 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

button.brand:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tab-badge-warn {
  background: var(--orange);
}

/* ----- Home ----------------------------------------------------------------- */
.home-hero {
  padding: 56px 0 28px;
}

.home-hero h1 {
  margin: 0 0 6px;
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.home-hero p {
  margin: 0;
  color: var(--text-2);
}

.home-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.35);
  color: #ffd29a;
  font-size: 14px;
}

.home-alert-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 18px;
}

.home-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.home-project {
  display: flex;
  gap: 18px;
  min-height: 220px;
}

.home-project-media {
  flex: none;
  width: 124px;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.home-project-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-project-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-project-body h3 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.home-facts,
.home-status {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-2);
}

.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.home-empty {
  margin: auto;
  max-width: 420px;
  text-align: center;
}

.home-empty h3 {
  margin: 8px 0 6px;
  font-size: 20px;
}

.home-empty p {
  margin: 0 0 14px;
  color: var(--text-2);
}

.home-loading,
.home-muted {
  margin: auto;
  color: var(--text-3);
  font-size: 14px;
}

.home-shortcuts {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.shortcut:hover {
  background: rgba(255, 255, 255, 0.05);
}

.shortcut svg {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shortcut span {
  display: grid;
}

.shortcut strong {
  font-size: 14px;
}

.shortcut small {
  font-size: 12px;
  color: var(--text-3);
}

.home-section {
  margin-top: 28px;
}

.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.home-section-head h3 {
  margin: 0;
  font-size: 18px;
}

.home-exports {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* ----- Library ------------------------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 40px;
  margin-bottom: 24px;
}

.page-head h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.035em;
}

.library-usage {
  display: grid;
  gap: 6px;
  min-width: 220px;
  font-size: 12px;
  color: var(--text-2);
  text-align: right;
}

.usage-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.usage-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.library-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 69, 58, 0.1);
  color: #ff9f97;
}

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

.export-card {
  display: flex;
  flex-direction: column;
  padding: 10px 10px 14px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: card-in var(--slow) var(--ease) both;
}

.export-card.is-missing {
  opacity: 0.7;
}

.export-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.export-card.is-compact .export-thumb {
  aspect-ratio: 4 / 5;
}

.export-thumb img,
video.export-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

video.export-thumb {
  object-fit: contain;
  cursor: auto;
}

.export-thumb .play-hint {
  opacity: 0;
}

.export-thumb:hover .play-hint,
.export-thumb:focus-visible .play-hint {
  opacity: 1;
}

.export-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-3);
  font-size: 13px;
}

.export-body {
  padding: 10px 4px 0;
  min-width: 0;
}

.export-body h3 {
  margin: 0 0 3px;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-meta {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-expiry {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: var(--text-2);
}

.export-expiry.is-soon {
  background: rgba(255, 159, 10, 0.14);
  color: #ffc56b;
}

.export-expiry.is-protected {
  background: rgba(48, 209, 88, 0.12);
  color: #7ee29b;
}

.export-expiry.is-missing {
  background: rgba(255, 69, 58, 0.12);
  color: #ff9f97;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.mini-btn.is-on {
  border-color: rgba(48, 209, 88, 0.5);
  color: #7ee29b;
}

.mini-btn.danger:hover,
.mini-btn.danger.is-armed {
  border-color: rgba(255, 69, 58, 0.6);
  color: #ff9f97;
}

@media (max-width: 760px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    padding-top: 32px;
  }

  .home-hero h1 {
    font-size: 32px;
  }

  .library-usage {
    text-align: left;
  }
}

.home-empty .spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Links styled as buttons (Download / Open in the Library). */
a.mini-btn {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

/* ----- Sounds: recently used and your own sounds --------------------------- */
.recent-sounds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 16px;
}

.recent-sounds .sub-label {
  width: 100%;
  margin: 0;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.recent-chip .play-btn {
  width: 24px;
  height: 24px;
}

.recent-use {
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.recent-use:hover {
  color: var(--text);
}

.your-sounds {
  margin: 4px 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.your-sounds summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.my-sound {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.my-sound:first-child {
  margin-top: 8px;
}

.my-sound-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.my-sound-text .sound-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-sound.is-missing .sound-meta,
.sound-row.is-missing .sound-meta {
  color: #ff9f97;
}

.play-btn.is-off {
  opacity: 0.3;
}

.rename-input {
  width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

/* ----- Upload screen ------------------------------------------------------------- */
.upload-note {
  font-size: 13px;
  color: var(--text-3);
}

/* The drop zone's engraved artwork: faint grooves with a light lower edge. */
.dropzone {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.dropzone-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  transition: opacity var(--medium) var(--ease), transform var(--slow) var(--ease);
}

.engrave-dark {
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 2;
}

.engrave-light {
  stroke: rgba(255, 255, 255, 0.055);
  stroke-width: 2;
}

.dropzone:hover .dropzone-art,
.dropzone.is-dragging .dropzone-art {
  opacity: 1;
  transform: scale(1.015);
}

.dropzone.has-file .dropzone-art {
  opacity: 0.5;
}

/* Faint flowing lines behind everything. Only transforms animate, so it
   stays cheap; it holds still for people who prefer reduced motion. */
.flow-lines {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  fill: none;
  stroke: rgba(120, 170, 255, 0.07);
  stroke-width: 1.2;
}

.flow-lines g {
  will-change: transform;
}

.flow-a {
  animation: flow-drift 38s ease-in-out infinite alternate;
}

.flow-b {
  stroke: rgba(160, 140, 255, 0.05);
  animation: flow-drift 52s ease-in-out infinite alternate-reverse;
}

@keyframes flow-drift {
  from { transform: translate3d(-40px, 0, 0); }
  to { transform: translate3d(40px, -18px, 0); }
}

/* The editor is busy enough: the lines fade back there. */
body.in-editor .flow-lines {
  opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
  .flow-lines g {
    animation: none;
  }
}

.upload-actions {
  flex-wrap: wrap;
}

/* ----- Trim box: draggable ------------------------------------------------------ */
.trim-timeline {
  overflow: visible;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.trim-timeline .timeline-range {
  cursor: grab;
}

.trim-timeline.is-dragging .timeline-range {
  cursor: grabbing;
  transition: none;
  background: rgba(255, 214, 10, 0.24);
}

.trim-handle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 12px;
  border-radius: 4px;
  background: #ffd60a;
  cursor: ew-resize;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  outline: none;
}

.trim-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 30%;
  bottom: 30%;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.45);
}

.trim-handle[data-handle="start"] {
  left: -7px;
}

.trim-handle[data-handle="end"] {
  right: -7px;
}

.trim-handle:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.45);
}

.trim-tip {
  display: block;
  margin: -10px 0 16px;
}

.trim-view-note {
  color: var(--text-3);
  opacity: 0.8;
}

/* Five tabs must fit a phone screen. */
@media (max-width: 560px) {
  .tab {
    width: 66px;
  }

  .tab span:not(.tab-badge):not(.tab-soon) {
    font-size: 10px;
  }

  .tab-soon {
    display: none;
  }
}

/* Flow artwork: lines near the clearing are cut deepest; outer ones fade out. */
.dropzone-art .flow-deep { stroke-width: 2.4; }
.dropzone-art .flow-mid { stroke-width: 1.8; stroke-opacity: 0.75; }
.dropzone-art .flow-faint { stroke-width: 1.4; stroke-opacity: 0.45; }

.engrave-dark {
  stroke: rgba(0, 0, 0, 0.6);
}

.engrave-light {
  stroke: rgba(150, 190, 255, 0.075);
}

.dropzone {
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

/* =========================================================
   Long Form
   ========================================================= */
.lf-empty {
  max-width: 520px;
  margin: 110px auto 0;
  text-align: center;
}

.lf-empty h2 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.lf-empty p {
  margin: 0 0 22px;
  color: var(--text-2);
}

.lf-empty .sub-label {
  display: block;
  margin-top: 12px;
}

#view-longform.is-dropping::after {
  content: "Drop to add these videos";
  position: fixed;
  inset: 70px 20px 120px;
  z-index: 40;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  background: rgba(10, 132, 255, 0.08);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
}

.lf {
  padding-top: 28px;
}

.lf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.lf-head-text {
  min-width: 0;
  flex: 1;
}

.lf-save-state {
  margin-left: 8px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.lf-name {
  width: 100%;
  max-width: 560px;
  margin: 2px 0;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lf-name:hover,
.lf-name:focus {
  outline: none;
  border-bottom-color: var(--border-strong);
}

.lf-meta {
  font-size: 13px;
  color: var(--text-2);
}

.lf-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lf-head-actions select,
.lf-field select {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.lf-main {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.lf-panel {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.lf-panel h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.lf-media {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.lf-media:first-child {
  border-top: 0;
}

.lf-media img {
  flex: none;
  width: 56px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: #000;
}

.lf-media-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.lf-media-text strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lf-media-text small {
  font-size: 11px;
  color: var(--text-3);
}

.lf-stage {
  min-width: 0;
}

.lf-player {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 60px - var(--tabbar-space) - 330px);
  min-height: 220px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.lf-player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.lf-render-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.lf-live-note {
  display: block;
  margin-top: 6px;
}

.lf-insp-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.lf-insp-title strong {
  display: block;
  font-size: 14px;
  word-break: break-word;
}

.lf-insp-title small,
.lf-note {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

.lf-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.lf-trim-row {
  display: grid;
  grid-template-columns: 32px 56px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.lf-trim-row span {
  color: var(--text-3);
}

.lf-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0;
}

.lf-actions-grid .mini-btn {
  justify-content: center;
}

.lf-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  font-size: 13px;
}

.lf-field label {
  color: var(--text-2);
}

.lf-inline {
  display: flex;
  gap: 6px;
}

.lf-inline select:first-child {
  flex: 1;
}

.lf-remove {
  width: 100%;
  justify-content: center;
}

.lf-audio-head {
  margin-top: 22px !important;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.lf-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.lf-progress .progress-bar {
  flex: 1;
  margin: 0;
}

.lf-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(48, 209, 88, 0.08);
  border: 1px solid rgba(48, 209, 88, 0.3);
  font-size: 14px;
}

.lf-result small {
  display: block;
  color: var(--text-2);
}

.lf-result-actions {
  display: flex;
  gap: 6px;
}

.lf-timeline-box {
  margin-top: 18px;
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.lf-timeline-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lf-timeline-tools .sub-label {
  flex: 1;
  margin: 0;
}

.lf-zoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}

.lf-zoom input {
  width: 110px;
}

.lf-track-wrap {
  overflow-x: auto;
  padding: 0 12px 6px;
}

.lf-ruler {
  position: relative;
  height: 20px;
  cursor: pointer;
}

.lf-ruler span {
  position: absolute;
  top: 2px;
  font-size: 10px;
  color: var(--text-3);
  transform: translateX(-50%);
  white-space: nowrap;
}

.lf-track {
  position: relative;
  height: 78px;
  touch-action: none;
  user-select: none;
}

.lf-piece {
  position: absolute;
  top: 6px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background-color: #10131a;
  background-size: auto 100%;
  background-repeat: repeat-x;
  cursor: grab;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.lf-piece::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0.55));
}

.lf-piece.is-selected {
  z-index: 2;
  border-color: #ffd60a;
  box-shadow: 0 0 0 1px #ffd60a;
}

.lf-piece.is-dragging {
  z-index: 5;
  cursor: grabbing;
  opacity: 0.85;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* A piece's filmstrip fills it; its sound runs along the bottom; the label sits on top. */
.lf-piece-strip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lf-piece-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 22px;
  z-index: 1;
  pointer-events: none;
}

.lf-piece::before {
  z-index: 1;
}

.lf-snap-line {
  position: absolute;
  top: -6px;
  bottom: -6px;
  z-index: 6;
  width: 0;
  border-left: 1px dashed #ffd60a;
  pointer-events: none;
}

.lf-piece-label {
  position: absolute;
  z-index: 2;
  left: 8px;
  right: 8px;
  top: 5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lf-piece-label small {
  margin-left: auto;
  color: var(--text-2);
  font-weight: 500;
}

.lf-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  background: #ffd60a;
  cursor: ew-resize;
  z-index: 3;
}

.lf-edge[data-edge="start"] {
  left: 0;
}

.lf-edge[data-edge="end"] {
  right: 0;
}

.lf-join {
  position: absolute;
  top: 0;
  z-index: 4;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
  cursor: pointer;
}

.lf-join.has-transition {
  border-color: rgba(191, 90, 242, 0.7);
  color: #d9a6ff;
}

/* Joins sit at the bottom of the row (the pieces' names are at the top). A cut
   is a small dot that grows when you point at it. */
.lf-join {
  top: auto;
  bottom: 6px;
}

.lf-join.is-cut {
  min-width: 0;
  width: 12px;
  height: 12px;
  padding: 0;
  opacity: 0.55;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.lf-join.is-cut:hover,
.lf-join.is-cut:focus-visible {
  opacity: 1;
  transform: translateX(-50%) scale(1.5);
}

.lf-join.has-transition {
  height: 20px;
  padding: 0 5px;
  font-size: 10px;
}

/* Narrow pieces: just their number; tiny ones: nothing. */
.lf-piece.is-narrow .lf-piece-label {
  font-size: 10px;
}

.lf-piece.is-narrow .lf-piece-label > :not(b) {
  display: none;
}

.lf-piece.is-narrow .lf-piece-label {
  color: transparent;
}

.lf-piece.is-narrow .lf-piece-label b {
  color: var(--text);
}

.lf-piece.is-tiny .lf-piece-label {
  display: none;
}

.lf-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 6;
}

.lf-drop-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  z-index: 7;
  pointer-events: none;
}

@media (max-width: 1080px) {
  .lf-main {
    grid-template-columns: 1fr;
  }

  .lf-player {
    max-height: 56vh;
  }
}

@media (max-width: 560px) {
  /* Seven tabs share the screen evenly, so the bar fits any phone (it ran 8 px past both edges). */
  .tabbar {
    width: calc(100vw - 16px);
  }

  .tab {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .tab span:not(.tab-badge):not(.tab-soon) {
    max-width: 100%;
    font-size: 9px;
    letter-spacing: -0.1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ----- Editing assistant ------------------------------------------------------- */
.assistant {
  margin-top: 12px;
}

.assistant-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.1), rgba(191, 90, 242, 0.08)), var(--surface);
  border: 1px solid rgba(120, 150, 255, 0.28);
}

.assistant-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.assistant-bar input::placeholder {
  color: var(--text-3);
}

/* While the assistant is thinking, Plan becomes Stop. */
.assistant-bar .btn.is-stop {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 4px 0;
}

.assistant-chips button {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.assistant-chips button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.assistant-chips .sub-label {
  margin: 0 0 0 auto;
}

.assistant-result {
  position: relative;
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  /* Never taller than the screen: long plans scroll inside the panel. */
  max-height: max(260px, calc(100vh - 360px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.assistant-reply {
  margin: 0 0 10px;
  color: var(--text);
}

.assistant-reply.is-error {
  color: #ff9f97;
}

.assistant-reply .spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.assistant-you {
  display: block;
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 12px;
}

.assistant-actions {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.assistant-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.assistant-action input {
  accent-color: var(--accent);
}

/* "Which of your songs?": the list, with a renaming tip beside it. */
/* Side by side when there's room; the tip moves underneath in a narrow panel. */
.assistant-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  align-items: flex-start;
}

.assistant-picker-list {
  flex: 1 1 160px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.assistant-picker-list .sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.assistant-picker-list .play-btn,
.assistant-picker-list .mini-btn {
  flex-shrink: 0;
}

.assistant-picker-list .picker-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 5px;
  overflow: hidden;
  background: #000;
}

.assistant-picker-list .picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.assistant-picker-list .sound-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-picker-list .sub-label {
  margin: 0 0 2px;
}

.assistant-tip {
  flex: 1 1 160px;
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
}

.assistant-tip strong {
  color: var(--text);
  font-size: 13px;
}

.assistant-tip .btn {
  justify-self: start;
}

.assistant-unsupported {
  margin: 0 0 10px;
  font-size: 13px;
  color: #ffc56b;
}

.assistant-outcomes {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.assistant-outcomes .is-ok {
  color: #7ee29b;
}

.assistant-outcomes .is-skipped {
  color: var(--text-3);
}

.assistant-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.assistant-buttons .sub-label {
  margin: 0;
}

/* The assistant has its own card in the left column, under the clips, so it
   never moves when tools change and never covers the preview or timelines. */
.editor-clips .assistant {
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.07), rgba(191, 90, 242, 0.05)), var(--surface);
  border: 1px solid rgba(120, 150, 255, 0.22);
}

.assistant-head {
  margin: 0 2px 10px;
  font-size: 13px;
  font-weight: 600;
}

.editor-clips .assistant-bar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
}

.editor-clips .assistant-bar input {
  flex: 1 1 100%;
  padding: 2px 4px;
  font-size: 13px;
}

.editor-clips .assistant-bar .btn {
  margin-left: auto;
}

.editor-clips .assistant-chips {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
}

.editor-clips .assistant-chips button {
  text-align: left;
}

.editor-clips .assistant-result {
  font-size: 13px;
}

/* ----- Post to… dialog ---------------------------------------------------------- */
.publish-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.publish-dialog[hidden] {
  display: none;
}

.publish-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.publish-sheet {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: card-in var(--medium) var(--ease) both;
}

.publish-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.publish-head h2 {
  margin: 0;
  font-size: 22px;
}

.publish-platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.publish-platforms button {
  padding: 9px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.publish-platforms button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.publish-checks {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.publish-checks .is-ok {
  color: #7ee29b;
}

.publish-checks .is-warn {
  color: #ffc56b;
}

.publish-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 14px;
}

.publish-steps > li > span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.publish-field {
  margin-top: 6px;
}

.publish-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.publish-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.publish-note {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

@media (max-width: 520px) {
  .publish-platforms {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ----- Editor Export menu ------------------------------------------------------- */
.export-menu {
  position: relative;
}

.export-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  display: grid;
  min-width: 250px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.export-menu-list[hidden] {
  display: none;
}

.export-menu-list > * {
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.export-menu-list > *:hover,
.export-menu-list > *:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

/* ----- In-app dialog (replaces prompt/confirm) ----------------------------------- */
.app-dialog {
  z-index: 90;
}

.app-dialog-sheet {
  width: min(420px, 100%);
}

.app-dialog-sheet h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.app-dialog-message {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 14px;
}

.app-dialog-input {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
}

.app-dialog-input:focus {
  outline: none;
  border-color: var(--accent);
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0 0 18px;
  font-size: 13px;
}

.shortcut-list dt {
  color: var(--text);
  white-space: nowrap;
}

.shortcut-list dd {
  margin: 0;
  color: var(--text-2);
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  font: 600 12px/1.5 inherit;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.music-fades {
  margin: 8px 0 4px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.music-fades[hidden] {
  display: none;
}

.app-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn.btn-danger {
  background: var(--red);
  box-shadow: none;
}

.lf-player video.is-standby {
  opacity: 0;
  pointer-events: none;
}

/* =========================================================
   Accounts
   ========================================================= */
body.needs-signin main,
body.needs-signin .tabbar,
body.needs-signin .selection-bar,
body.needs-signin .account {
  visibility: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: radial-gradient(60% 50% at 50% 0%, rgba(10, 132, 255, 0.16), transparent 70%), rgba(5, 6, 8, 0.82);
  backdrop-filter: blur(10px);
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  padding: 30px 28px 26px;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: card-in var(--slow) var(--ease) both;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.auth-sub {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  width: 100%;
  margin-bottom: 18px;
}

.auth-tabs button {
  flex: 1;
}

.auth-tabs[data-active="signup"] .segmented-thumb {
  transform: translateX(100%);
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-2);
}

.auth-field input,
.auth-password {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-password {
  display: flex;
  align-items: center;
  padding: 0;
}

.auth-password input {
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
}

.auth-password input:focus {
  box-shadow: none;
}

.auth-password:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-password button {
  height: 100%;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-hint {
  color: var(--text-3);
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.auth-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-remember small {
  color: var(--text-3);
}

.auth-remember[hidden] {
  display: none;
}

.auth-submit {
  width: 100%;
  height: 46px;
  margin-top: 4px;
}

.auth-links {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.auth-message {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(48, 209, 88, 0.1);
  border: 1px solid rgba(48, 209, 88, 0.3);
  font-size: 13.5px;
  color: #b7f0c6;
}

.auth-check-email {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.auth-mail-icon svg {
  width: 56px;
  height: 56px;
  padding: 12px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.account {
  position: relative;
  margin-left: auto;
}

/* First-run guide: three numbered steps. */
.guide-sheet {
  width: min(480px, 100%);
}

.guide-logo {
  display: block;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 50%;
}

.guide-sheet h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.guide-steps {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.guide-num {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.guide-steps strong {
  font-size: 15px;
}

.guide-steps p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.5;
}

/* On a phone the buttons stack, the main one on top, instead of running past the edge. */
@media (max-width: 480px) {
  .guide-sheet .app-dialog-buttons {
    flex-direction: column-reverse;
  }
}

.guide-steps p.guide-limits {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
}

.guide-tip {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 13px;
}

/* Feedback: always in the top bar, so testers and users can reach the team from anywhere. */
.feedback-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.feedback-button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.feedback-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.feedback-button + .account {
  margin-left: 12px;
}

body.needs-signin .feedback-button {
  display: none;
}

.feedback-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.feedback-kinds .mini-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.feedback-message {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.feedback-message:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback-note {
  margin: 8px 0 14px;
  color: var(--text-3);
  font-size: 12px;
}

.feedback-error {
  margin: -6px 0 12px;
  color: var(--red);
  font-size: 13px;
}

.account-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.35), rgba(191, 90, 242, 0.3));
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 240px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-head {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.account-menu-head strong {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-plan {
  font-size: 12px;
  color: var(--text-3);
}

.account-menu > button {
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.account-menu > button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.claim-banner {
  background: rgba(10, 132, 255, 0.1);
  border-color: rgba(10, 132, 255, 0.35);
  color: var(--text);
}

.auth-tabs .segmented-thumb {
  width: calc(50% - 3px);
}

/* Long Form's shape switch: the chosen shape is highlighted directly. */
#lfFormat .segmented-thumb {
  display: none;
}

#lfFormat button.is-active {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: var(--text);
}

/* ----- Account menu: plan usage ------------------------------------------------- */
.account-usage {
  display: grid;
  gap: 10px;
  padding: 4px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.usage-row-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
}

.usage-row-text span:last-child {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.usage-meter {
  display: block;
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.usage-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.usage-row.is-near .usage-meter span {
  background: var(--orange);
}

.usage-row.is-full .usage-meter span {
  background: var(--red);
}

.account-menu {
  min-width: 280px;
}

/* The exact sentences an assistant action will cut or keep. */
.assistant-quotes {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-2);
}

.assistant-quotes.is-cut li {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 69, 58, 0.7);
}

.assistant-quotes li.more {
  text-decoration: none;
  color: var(--text-3);
}

.assistant-quotes b {
  font-weight: 600;
  color: var(--text);
}

.assistant-action span {
  display: block;
}

/* ----- Editor columns fit the screen ----------------------------------------------
   The preview column stays in view while the page scrolls, so it must never be
   taller than the space between the header and the tab bar: the preview takes
   whatever height the controls and timeline below it leave (it used to have a
   fixed height that guessed their size, and the timeline ended up under the
   tab bar). The clip list and assistant scroll within their own column. */
@media (min-width: 821px) {
  .editor-stage {
    height: calc(100vh - 80px - var(--tabbar-space));
    min-height: 420px;
  }

  .editor .editor-stage .stage-frame,
  .editor.has-timeline .editor-stage .stage-frame {
    flex: 1 1 0;
    height: auto;
    min-height: 180px;
  }

  .editor-stage > :not(.stage-frame) {
    flex: none;
  }

  .editor-clips {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 80px - var(--tabbar-space));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* While clips are selected, a bar floats above the tab bar: leave room for it so
   the last row of clip cards can still be scrolled clear of it. */
body.has-selection main {
  padding-bottom: calc(var(--tabbar-space) + 72px);
}

/* Shorter screens (most laptops): a slimmer sound timeline, so it and a usable
   preview both fit above the tab bar. */
@media (min-width: 821px) and (max-height: 920px) {
  #soundTimeline {
    margin-top: 8px;
    padding: 8px 12px 6px;
  }

  #soundTimeline .lane-body {
    height: 30px;
  }

  #soundTimeline .lane-effects .lane-body {
    height: 36px;
  }

  #soundTimeline .timeline-tip {
    display: none;
  }
}

@media (min-width: 821px) and (max-height: 760px) {
  .editor .editor-stage .stage-frame,
  .editor.has-timeline .editor-stage .stage-frame {
    min-height: 140px;
  }
}

/* Clip preview: the info column scrolls inside the window, and Select / Edit
   stay pinned at its bottom. Before, a clip with a longer description grew the
   column past the window, which cut the two buttons off. */
@media (min-width: 821px) {
  .modal-sheet {
    grid-template-rows: minmax(0, 1fr);
  }

  .modal-info {
    min-height: 0;
  }
}

.modal-actions {
  position: sticky;
  bottom: -28px;
  margin: 0 -32px -28px;
  padding: 18px 32px 28px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--surface-solid) 22px);
}

/* ----- Media page (the Library, renamed) and the Media picker ------------------------ */
.media-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}

.media-tabs button {
  min-width: 96px;
}

.media-count {
  margin-left: 4px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.media-search,
.media-sort {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.media-search {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
}

.media-search:focus,
.media-sort:focus {
  outline: none;
  border-color: var(--accent);
}

.media-add {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.media-add[hidden] {
  display: none;
}

.media-note {
  margin: -8px 0 16px;
  color: var(--text-2);
  font-size: 13px;
}

.media-used {
  color: var(--accent-2);
}

.media-sounds {
  max-width: 720px;
}

.media-sounds .my-sound {
  padding: 10px 4px;
}

.media-picker-sheet {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
}

.media-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.media-picker-head h2 {
  margin: 0;
  font-size: 20px;
}

.media-picker-upload {
  align-self: flex-start;
  margin-bottom: 14px;
}

#mediaPicker .media-search {
  max-width: none;
  flex: none;
  margin: 8px 0 12px;
}

.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  min-height: 120px;
  margin-bottom: 16px;
  overflow-y: auto;
}

.media-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.media-pick:hover,
.media-pick:focus-visible {
  border-color: var(--border-strong);
}

.media-pick.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.media-pick-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.media-pick-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-pick-thumb .badge-duration {
  position: absolute;
  left: 6px;
  bottom: 6px;
}

.media-pick-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.35);
  color: transparent;
  font-size: 12px;
  font-weight: 700;
}

.media-pick.is-selected .media-pick-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.media-pick-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-pick-meta {
  color: var(--text-3);
  font-size: 12px;
}

.media-sort {
  flex: none;
  width: auto;
}

/* Uploaded videos are usually landscape: a 16:9 thumbnail showing the whole
   frame (clip cards keep their tall shape). */
.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.media-card .export-thumb {
  aspect-ratio: 16 / 9;
  background: #000;
}

.media-card .export-thumb img {
  object-fit: contain;
}

.media-tabs button {
  border-radius: 999px;
}

.media-tabs button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Videos Clip Finder has already transcribed: finding clips again costs no transcription. */
.badge-transcribed {
  left: 10px;
  top: 10px;
  color: #fff;
  background: rgba(48, 209, 88, 0.85);
}

/* ----- Long Form: toolbar, piece volume, fades ------------------------------------- */
.lf-timeline-tools {
  flex-wrap: wrap;
}

.lf-toolbar {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.lf-toolbar-gap {
  flex: 1;
}

.lf-toolbar .mini-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.lf-zoom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lf-keys {
  width: 30px;
  height: 30px;
}

#lfToolHint {
  flex-basis: 100%;
  margin: 2px 0 0;
}

.lf-player {
  position: relative;
}

/* Black over the picture where the video fades in or out (live preview). */
.lf-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.lf-volume input[type="range"] {
  flex: 1;
  min-width: 0;
}

.lf-volume output {
  min-width: 42px;
  font-variant-numeric: tabular-nums;
}

.lf-fades {
  flex-wrap: wrap;
  gap: 10px;
}

.lf-fades label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

/* Wide Long Form: the side panels are as tall as the video column and scroll
   inside themselves, so a long panel never pushes the timeline off screen. */
@media (min-width: 1081px) {
  .lf-main {
    align-items: stretch;
  }

  .lf-main > .lf-panel {
    contain: size;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* "Lower the music while people talk" (Editor Sound panel and Long Form). */
.duck-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.duck-toggle[hidden],
.lf-music-extra[hidden] {
  display: none;
}

.duck-toggle input {
  accent-color: var(--accent);
}

.lf-music-extra {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

/* ----- Long Form: text on screen ---------------------------------------------------- */
.lf-text-lane {
  position: relative;
  height: 34px;
  margin-top: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  touch-action: none;
  user-select: none;
}

/* The empty Text row is one big "Add text" button, so it's easy to find. */
.lf-text-empty {
  position: absolute;
  inset: 3px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px dashed rgba(10, 132, 255, 0.5);
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.07);
  color: var(--accent-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.lf-text-empty small {
  color: var(--text-3);
  font-weight: 400;
}

.lf-text-empty:hover {
  background: rgba(10, 132, 255, 0.16);
  border-color: var(--accent);
}

/* "Add text" in the toolbar stands out from the editing buttons. */
.mini-btn.lf-add-text {
  background: var(--accent-soft);
  border-color: rgba(10, 132, 255, 0.45);
  color: var(--accent-2);
  font-weight: 600;
}

.mini-btn.lf-add-text b {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 2px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
}

.mini-btn.lf-add-text:hover:not(:disabled) {
  background: rgba(10, 132, 255, 0.26);
}

.lf-text-block {
  position: absolute;
  top: 3px;
  height: 28px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid rgba(191, 90, 242, 0.6);
  border-radius: 7px;
  background: rgba(191, 90, 242, 0.25);
  color: var(--text);
  font: 600 12px/26px inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
}

.lf-text-block.is-lower {
  border-color: rgba(255, 214, 10, 0.6);
  background: rgba(255, 214, 10, 0.18);
}

.lf-text-block.is-caption {
  border-color: rgba(100, 210, 255, 0.6);
  background: rgba(100, 210, 255, 0.18);
}

.lf-text-block.is-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.lf-text-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.lf-text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.lf-text-styles {
  margin-bottom: 10px;
}

/* The live preview of texts; sizes follow src/titles.js (fractions of the
   frame's short side, --u = 1 px at 1080p). */
.lf-titles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: Arial, sans-serif;
}

.lf-title {
  position: absolute;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.lf-title small {
  font-size: 0.68em;
  font-weight: 400;
}

.lf-title.is-title {
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: calc(65px * var(--u));
  text-align: center;
  font-size: calc(96px * var(--u) * var(--s));
  font-weight: 700;
  text-shadow: 0 0 calc(3px * var(--u)) rgba(0, 0, 0, 0.6), calc(4px * var(--u)) calc(4px * var(--u)) 0 rgba(0, 0, 0, 0.6);
}

.lf-title.is-lower,
.lf-title.is-caption {
  bottom: calc(100px * var(--u));
  font-size: calc(54px * var(--u) * var(--s));
}

.lf-title.is-lower {
  left: calc(65px * var(--u));
  align-items: flex-start;
  font-weight: 700;
}

.lf-title.is-caption {
  left: 0;
  right: 0;
  bottom: calc(90px * var(--u));
  align-items: center;
  font-size: calc(50px * var(--u) * var(--s));
}

.lf-title.is-lower > *,
.lf-title.is-caption > * {
  padding: calc(6px * var(--u)) calc(14px * var(--u));
  background: rgba(0, 0, 0, 0.6);
}

/* ----- Long Form: a calmer layout ----------------------------------------------------
   One row of header actions, more space between areas, the right panel split
   into tabs (Selected · Audio · Video), and the timeline toolbar in groups. */
.lf-head {
  align-items: center;
  margin-bottom: 22px;
}

.lf-head-actions {
  gap: 12px;
}

#lfProjects {
  width: auto;
  max-width: 220px;
  flex: none;
}

.lf-main {
  gap: 26px;
}

.lf-panel {
  padding: 18px;
}

.lf-panel-tabs {
  display: flex;
  width: 100%;
  margin-bottom: 18px;
}

.lf-panel-tabs button {
  flex: 1;
  border-radius: 999px;
}

.lf-panel-tabs button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.lf-panel-section h4 {
  margin-bottom: 14px;
}

.lf-panel-section > * + * {
  margin-top: 12px;
}

.lf-panel-note {
  margin: 0 0 14px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.lf-timeline-box {
  margin-top: 24px;
  padding: 14px 18px 16px;
}

.lf-toolbar {
  gap: 8px;
}

.lf-sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--border-strong);
}

#lfToolHint {
  color: var(--text-3);
  font-size: 12px;
}

.lf-info {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-3);
  font-size: 13px;
  cursor: help;
}

.lf-info:hover,
.lf-info:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.lf-bin-panel .sub-label {
  font-size: 12px;
  color: var(--text-3);
}

/* Wide screens: the video gives up height so the whole workspace (header,
   video, timeline with its Text row) fits above the tab bar without scrolling
   on common laptop screens. Very short windows still scroll. */
@media (min-width: 1081px) {
  .lf-player {
    max-height: calc(100vh - 60px - var(--tabbar-space) - 450px);
    min-height: 200px;
  }

  .lf-name {
    font-size: 26px;
  }

  .lf-head {
    margin-bottom: 18px;
  }
}

/* The player keeps the output's shape (--lf-ratio, set by longform.js) when its
   height is limited, instead of stretching wide with black bars at the sides. */
@media (min-width: 1081px) {
  .lf-player {
    max-width: calc(max(100vh - 60px - var(--tabbar-space) - 450px, 200px) * var(--lf-ratio, 1.7778));
  }
}

@media (max-width: 1080px) {
  .lf-player {
    max-width: calc(56vh * var(--lf-ratio, 1.7778));
  }
}

/* The assistant's earlier messages about this clip, above the current one (folded). */
.assistant-thread summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
}

.assistant-thread[open] summary {
  margin-bottom: 4px;
}

.assistant-thread .assistant-turn + .assistant-turn {
  margin-top: 6px;
}

.assistant-thread {
  display: block;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  opacity: 0.75;
}

.assistant-turn {
  margin: 0;
  font-size: 12px;
  color: var(--text-2);
}

.assistant-turn em {
  color: var(--green, #30d158);
  font-style: normal;
}

/* ----- Cutaways (public/cutaways.js) ----- */

/* The live preview, under the caption text: the frame is the whole picture
   (full screen) or the picture-in-picture box; the video inside is sized and
   shifted for the zoom (public/cutaways.js, same maths as the export). */
.stage-player .caption-overlay .cutaway-frame {
  position: absolute;
  overflow: hidden;
  background: #000;
}

.stage-player .caption-overlay .cutaway-video {
  position: absolute;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: fill;
  background: #000;
}

/* In the Cutaways tool, the cutaway on screen can be dragged (moved, or panned when zoomed). */
.editor.is-cutaways .caption-overlay .cutaway-frame {
  pointer-events: auto;
  cursor: grab;
  outline: 1px dashed rgba(255, 255, 255, 0.5);
}

.editor.is-cutaways .caption-overlay .cutaway-frame.is-dragging {
  cursor: grabbing;
}

.cutaway-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.cutaway-add-row .btn {
  flex: 1 1 160px;
}

/* The Media picker's "Free stock footage" tab. */
.picker-tabs {
  margin-bottom: 12px;
}

.stock-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stock-search .media-search {
  flex: 1 1 220px;
  margin: 0;
}

.stock-search select {
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.stock-pick .media-pick-thumb {
  position: relative;
}

.stock-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stock-credit {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.stock-credit a {
  color: var(--text-2);
}

.cutaway-list {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.cutaway-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.cutaway-item:hover {
  border-color: var(--border-strong);
}

.cutaway-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cutaway-item.is-off {
  opacity: 0.65;
}

.cutaway-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.cutaway-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cutaway-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.cutaway-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cutaway-meta {
  font-size: 11.5px;
  color: var(--text-2);
}

.cutaway-status {
  font-size: 11.5px;
  color: var(--orange);
}

.cutaway-editor {
  display: grid;
  gap: 4px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.cutaway-editor-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cutaway-editor-buttons .danger {
  color: var(--red);
}

/* The lane: each cutaway is a block showing its thumbnail, with a right edge to drag. */
.cutaway-lane {
  height: 54px;
  overflow: visible;
  cursor: pointer;
}

.cutaway-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  display: flex;
  align-items: flex-end;
  padding: 0 14px 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.1)), var(--thumb, none) center / cover, #7d5bd6;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.cutaway-block span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cutaway-block.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(41, 151, 255, 0.6);
  z-index: 1;
}

.cutaway-edge {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  background: rgba(255, 255, 255, 0.25);
}

.cutaway-block:hover .cutaway-edge,
.cutaway-block.is-selected .cutaway-edge {
  background: rgba(255, 255, 255, 0.55);
}

/* ----- Cutaway suggestions (B3) ----- */

.cutaway-suggest {
  width: 100%;
  margin-bottom: 10px;
}

.cutaway-suggestions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.suggest-head {
  margin: 0;
}

.suggestion {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.suggestion.is-added {
  border-color: rgba(48, 209, 88, 0.45);
}

.suggest-moment {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.suggest-moment span {
  font-size: 11.5px;
  color: var(--text-2);
}

.suggest-moment:hover strong {
  text-decoration: underline;
}

.suggest-show {
  margin: 0;
  font-size: 12.5px;
  color: var(--text);
}

.suggest-show span {
  color: var(--text-3);
}

.suggest-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.suggest-option {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}

.suggest-option:hover,
.suggest-option:focus-visible {
  border-color: var(--accent);
}

.suggest-option.is-busy {
  opacity: 0.5;
  cursor: progress;
}

.suggest-thumb {
  position: relative;
  display: block;
  aspect-ratio: 9 / 12;
  border-radius: 7px;
  overflow: hidden;
  background: #000;
}

.suggest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.suggest-label {
  font-size: 10.5px;
  line-height: 1.25;
  padding: 0 2px 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.suggest-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.suggest-added {
  margin: 0;
  font-size: 12.5px;
  color: var(--green);
}

/* ----- Account basics (C): Google sign-in, account settings ----- */

.auth-google {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-google[hidden] {
  display: none;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.auth-google-btn svg {
  width: 18px;
  height: 18px;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.account-menu > .account-menu-link {
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  text-decoration: none;
}

.account-menu > .account-menu-link:hover {
  background: rgba(255, 255, 255, 0.07);
}

.account-sheet {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.account-who {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--text-2);
}

.account-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.account-section[hidden] {
  display: none;
}

.account-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.account-note {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.account-note[hidden] {
  display: none;
}

.account-note a {
  color: var(--accent-2);
}

.account-danger h3 {
  color: var(--red);
}

.auth-legal {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.auth-legal a {
  color: var(--text-2);
}

.account-deleted {
  max-width: 520px;
  margin: 18vh auto 0;
  padding: 0 16px;
  text-align: center;
}

.account-deleted p {
  color: var(--text-2);
}

.account-deleted a {
  color: var(--accent-2);
}

/* A new clip whose finished video is still being made (it can be edited meanwhile). */
.badge-preparing {
  right: 10px;
  bottom: 10px;
  font-size: 11.5px;
}

.badge-preparing .spinner {
  width: 11px;
  height: 11px;
}

.badge-preparing.is-failed {
  color: #ffc56b;
}


#previewMode button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Media: each upload on its own row, with progress and Cancel. */
.upload-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
}

.upload-list:empty {
  display: none;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 180px) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  font-size: 13px;
}

.upload-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.upload-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 200ms linear;
}

.upload-status {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  white-space: nowrap;
}

.upload-row.is-done .upload-status {
  color: var(--green);
}

.upload-row.is-failed .upload-status {
  color: var(--red);
  white-space: normal;
}

@media (max-width: 560px) {
  .upload-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .upload-bar {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* Cutaways timeline: where a cutaway covers your clip (feature B). */
.cutaway-clip-lane {
  cursor: pointer;
}

.cutaway-cover {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 8px;
  pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.55) 0 6px, rgba(0, 0, 0, 0.25) 6px 12px);
  box-shadow: inset 0 0 0 1px rgba(125, 91, 214, 0.9);
}

.cutaway-cover.is-box {
  background: rgba(125, 91, 214, 0.22);
}

.cutaway-cover.is-selected {
  box-shadow: inset 0 0 0 2px #fff;
}

/* Fix words: the clip's caption lines, each word clickable. */
.caption-words {
  margin: 4px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-raised);
}

.caption-words summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
}

.caption-word-list {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.caption-word-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13.5px;
  line-height: 1.7;
}

.caption-line-time {
  flex: none;
  border: 0;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
}

.caption-line-time:hover {
  color: var(--accent-2);
}

.caption-word {
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  padding: 0 2px;
  border-radius: 5px;
  cursor: text;
}

.caption-word:hover {
  background: var(--accent-soft);
}

.caption-word.is-fixed {
  color: var(--accent-2);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.caption-word-input {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 0 4px;
  width: auto;
  min-width: 3ch;
}

.caption-hidden {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-3);
}

.caption-hidden-word {
  border: 1px dashed var(--border-strong);
  background: none;
  color: var(--text-2);
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  padding: 0 6px;
  cursor: pointer;
}

/* The save line with Undo / Redo beside it, under the clip's title. */
.stage-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.history-buttons {
  display: inline-flex;
  gap: 4px;
}

.history-buttons .mini-btn {
  min-width: 30px;
  padding-inline: 8px;
  font-size: 14px;
}

.history-buttons .mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Autosave: "Saving… / Saved ✓ · updating video… / Saved ✓ · video ready" under the clip's title. */
.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-3);
  transition: color var(--fast) var(--ease);
}

.save-state:disabled {
  cursor: default;
}

.save-state.is-ready {
  color: var(--green);
}

.save-state.is-updating,
.save-state.is-waiting,
.save-state.is-saving {
  color: var(--text-2);
}

.save-state.is-error {
  color: var(--orange);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.save-state .spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.save-state:empty {
  display: none;
}

/* ----- The one timeline under the video (public/timeline.js) ----- */
.editor.has-timeline #liveControls {
  display: none; /* the timeline's own play button and time replace it */
}

.edit-timeline-box {
  padding: 8px 12px 10px;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  min-width: 0;
}

.timeline-toolbar .split-keys {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--text-3);
}

.timeline-range-actions {
  display: inline-flex;
  gap: 6px;
  flex: 1 1 auto;
}

.mini-btn.is-danger {
  border-color: rgba(255, 69, 58, 0.6);
  background: rgba(255, 69, 58, 0.16);
  color: #ffb4ae;
}

.timeline-zoom {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.timeline-zoom .mini-btn {
  min-width: 30px;
  padding-inline: 9px;
}

.timeline-zoom .mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

/* Room on the right for the clip's end handle and the last ruler time, so nothing pokes out (no scrollbar at Fit). */
.timeline-inner {
  min-width: 100%;
  box-sizing: border-box;
  padding-right: 16px;
}

/* Row labels stay put while a zoomed-in timeline scrolls. */
.timeline-scroll .lane-label {
  position: sticky;
  left: 0;
  z-index: 4;
  align-self: stretch;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, var(--surface-solid) 80%, transparent);
}

.edit-timeline-box .timeline-lanes {
  gap: 4px;
  padding-top: 6px;
}

.edit-timeline-box .lane-body {
  height: 30px;
  border-radius: 8px;
}

.edit-timeline-box .lane-video .lane-body {
  height: 48px;
  overflow: visible;
}

.edit-timeline-box .lane-captions .lane-body {
  height: 24px;
}

.edit-timeline-box .lane-effects .lane-body,
.edit-timeline-box .lane-cutaways .lane-body {
  height: 34px;
}

.edit-timeline-box .lane[hidden] {
  display: none;
}

/* The video row: picture thumbnails, with each part outlined in its colour. */
.clip-lane .filmstrip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  opacity: 0.85;
  pointer-events: none;
}

.clip-lane .clip-part {
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55));
  border: 2px solid var(--seg-colour);
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0 2px 5px;
}

.clip-part-number {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.clip-lane .join-handle {
  min-width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  padding: 0;
  font-size: 10px;
}

.cut-marker {
  position: absolute;
  top: -9px;
  z-index: 3;
  width: 20px;
  height: 18px;
  margin-left: -10px;
  border: 1px solid rgba(255, 69, 58, 0.7);
  border-radius: 6px;
  background: #2a1414;
  color: #ff8a80;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.cut-marker:hover {
  background: #4a1d1d;
}

.trim-edge {
  position: absolute;
  top: -3px;
  bottom: -3px;
  z-index: 3;
  width: 12px;
  border-radius: 4px;
  background: #ffd60a;
  cursor: ew-resize;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.trim-edge.is-start {
  left: 0;
  margin-left: -6px;
}

.trim-edge.is-end {
  left: 100%;
  margin-left: -6px;
}

.trim-edge::after {
  content: "";
  position: absolute;
  inset: 12px 4px;
  border-left: 1px solid rgba(0, 0, 0, 0.5);
  border-right: 1px solid rgba(0, 0, 0, 0.5);
}

/* While dragging: the time the edge is at. */
.trim-edge.is-dragging::before {
  content: attr(data-time);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 6px;
  background: #ffd60a;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.fade-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.fade-mark.is-in {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.75), transparent);
}

.fade-mark.is-out {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.75), transparent);
}

/* The captions row. */
.caption-chip {
  position: absolute;
  top: 2px;
  bottom: 2px;
  overflow: hidden;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(255, 214, 10, 0.16);
  border: 1px solid rgba(255, 214, 10, 0.35);
  color: #ffe58a;
  font-size: 10.5px;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.caption-chip:hover {
  background: rgba(255, 214, 10, 0.28);
}

/* A selected stretch, across every row. */
.timeline-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  background: rgba(10, 132, 255, 0.18);
  border-left: 2px solid var(--accent-2);
  border-right: 2px solid var(--accent-2);
  pointer-events: none;
}

.edit-timeline-box .timeline-playhead {
  z-index: 6;
}

/* Short screens (e.g. a 1366×768 laptop): slimmer timeline rows, so the preview,
   the timeline and the tab bar all fit without scrolling. */
@media (max-height: 820px) {
  .edit-timeline-box {
    padding: 6px 10px 8px;
  }

  .edit-timeline-box .timeline-toolbar {
    margin-bottom: 2px;
  }

  .edit-timeline-box .timeline-toolbar .icon-btn {
    width: 28px;
    height: 28px;
  }

  .edit-timeline-box .timeline-lanes {
    gap: 3px;
    padding-top: 4px;
  }

  .edit-timeline-box .lane-body {
    height: 20px;
  }

  .edit-timeline-box .lane-video .lane-body {
    height: 36px;
  }

  .edit-timeline-box .lane-captions .lane-body {
    height: 18px;
  }

  .edit-timeline-box .lane-effects .lane-body,
  .edit-timeline-box .lane-cutaways .lane-body {
    height: 24px;
  }

  .edit-timeline-box .timeline-ruler {
    height: 16px;
  }

  .editor.has-timeline .editor-stage .stage-frame {
    height: max(160px, calc(100vh - 60px - var(--tabbar-space) - var(--stage-head-h, 110px) - 40px - var(--timeline-h, 300px))) !important;
  }
}

.timeline-toolbar .live-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ----- Text and emoji on clips (public/text.js) ----- */
.tool-grid {
  grid-template-columns: repeat(4, 1fr);
}

.text-style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 6px 0 14px;
}

.text-style {
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #2a2d35;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.text-style:hover {
  transform: translateY(-1px);
  border-color: var(--accent-2);
}

.text-style-sample {
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.text-style.is-hook .text-style-sample {
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
  font-size: 17px;
}

.text-style.is-title .text-style-sample {
  font-size: 18px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}

.text-style.is-pop .text-style-sample {
  font-family: Impact, sans-serif;
  font-weight: 400;
  font-size: 19px;
  color: #ffd60a;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
}

.text-style.is-box .text-style-sample {
  background: #111;
  padding: 3px 8px;
}

.text-style.is-note .text-style-sample {
  background: #ffd60a;
  color: #111;
  padding: 3px 8px;
}

.emoji-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.emoji-search {
  flex: 0 1 190px;
  min-width: 0;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 170px;
  overflow-y: auto;
  margin: 6px 0 14px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.emoji-pick {
  aspect-ratio: 1;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  padding: 3px;
  transition: transform var(--fast) var(--ease-spring), background var(--fast) var(--ease);
}

.emoji-pick:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.15);
}

.emoji-pick img {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay-list {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.overlay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.overlay-row.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.overlay-row.is-outside {
  opacity: 0.55;
}

.overlay-row img,
.overlay-row-t {
  flex: none;
  width: 28px;
  height: 28px;
}

.overlay-row-t {
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #2a2d35;
  font-weight: 800;
}

.overlay-row-t.is-pop,
.overlay-row-t.is-note {
  color: #ffd60a;
}

.overlay-row-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-row-name small {
  font-weight: 400;
  color: var(--text-3);
  font-size: 11.5px;
}

.overlay-editor {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.overlay-editor input[type="text"] {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.overlay-editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-transform: capitalize;
}

.overlay-editor-head img {
  width: 32px;
  height: 32px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip-row .mini-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
}

/* The timeline's Text row. */
.edit-timeline-box .lane-overlays .lane-body {
  height: 26px;
}

.overlay-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(191, 90, 242, 0.28);
  border: 1px solid rgba(191, 90, 242, 0.7);
  color: #f1d9ff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: grab;
}

.overlay-block.is-emoji {
  background: rgba(255, 159, 10, 0.22);
  border-color: rgba(255, 159, 10, 0.7);
}

.overlay-block img {
  height: 16px;
  width: 16px;
  flex: none;
}

.overlay-block.is-selected {
  z-index: 2;
  box-shadow: 0 0 0 2px #fff;
}

.overlay-edge {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
}

.overlay-block.is-selected .overlay-edge,
.overlay-block:hover .overlay-edge {
  background: rgba(255, 255, 255, 0.35);
}

/* The live preview: text and emoji where and when they'll be. */
.overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ov-item {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 85%;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  user-select: none;
}

.ov-item.anim-pop {
  animation: ov-pop 260ms var(--ease) both;
}

.ov-item.anim-fade {
  animation: ov-fade 220ms ease-out both;
}

@keyframes ov-pop {
  0% { transform: translate(-50%, -50%) scale(0.45); opacity: 0; }
  25% { opacity: 1; }
  65% { transform: translate(-50%, -50%) scale(1.08); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes ov-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.editor.is-texting .overlay-layer .ov-item {
  pointer-events: auto;
  cursor: move;
}

.editor.is-texting .overlay-layer .ov-item.is-selected {
  outline: 2px dashed rgba(255, 255, 255, 0.85);
  outline-offset: 4px;
}

/* ----- The Brand tool (public/brand.js) ----- */
.brand-clip {
  margin: 8px 0 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.brand-status {
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}

.brand-status.is-on {
  color: var(--green);
}

.brand-status small {
  font-weight: 400;
  color: var(--text-3);
}

.brand-section {
  display: grid;
  gap: 10px;
  margin: 6px 0 16px;
}

.brand-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-thumb {
  width: 96px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: repeating-conic-gradient(#2a2d35 0 25%, #1c1f26 0 50%) 50% / 12px 12px;
  border: 1px solid var(--border);
}

.brand-logo-buttons {
  display: flex;
  gap: 6px;
}

.brand-colours {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 16px;
}

.brand-colour {
  position: relative;
  display: inline-flex;
}

.brand-colour input[type="color"] {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

.brand-colour-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: #3a3d45;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
}

.brand-caption-sample {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: #1c1f26;
  font-weight: 700;
  font-size: 16px;
  -webkit-text-stroke: 1px #000;
  paint-order: stroke fill;
}

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

.brand-part-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-part-name small {
  color: var(--text-3);
}

.brand-auto {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

/* The logo on the live preview, where the export puts it. */
.brand-logo-preview {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}

/* ----- "Make it postable" (public/postable.js) ----- */
.make-postable {
  background: linear-gradient(135deg, #0a84ff, #bf5af2);
  border: 0;
  box-shadow: 0 4px 18px rgba(191, 90, 242, 0.35);
}

.make-postable:hover {
  filter: brightness(1.08);
}

.postable-sheet {
  max-width: 460px;
}

.postable-steps {
  list-style: none;
  margin: 14px 0 6px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.postable-step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  color: var(--text-3);
  transition: color var(--fast) var(--ease);
}

.postable-step b {
  display: block;
  font-weight: 600;
}

.postable-step small {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
}

.postable-step.is-working,
.postable-step.is-done {
  color: var(--text);
}

.postable-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-raised);
  font-weight: 800;
  font-size: 13px;
}

.postable-step.is-done .postable-mark {
  background: rgba(48, 209, 88, 0.2);
  color: var(--green);
}

.postable-mark .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.postable-error {
  margin: 4px 0 0;
  color: var(--orange);
  font-size: 13px;
}

.postable-error:empty {
  display: none;
}

/* Narrower screens: the shorter label keeps the buttons above the video on one line. */
.make-postable .label-short {
  display: none;
}

@media (max-width: 1500px) {
  .make-postable .label-long {
    display: none;
  }

  .make-postable .label-short {
    display: inline;
  }
}

/* "Rendered" while the clip's video is still catching up with your changes. */
#previewMode [data-mode="rendered"].is-waiting {
  color: var(--text-3);
}

#previewMode [data-mode="rendered"].is-waiting::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--orange);
  vertical-align: 1px;
  animation: lf-ask-pulse 1.2s ease-in-out infinite;
}

/* ----- Long Form: Words panel (public/lfwords.js) ----- */
.lf-words-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(10, 132, 255, 0.3);
}

.lf-words-card > div {
  flex: 1;
  min-width: 0;
}

.lf-words-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}

.lf-words-card small.is-error {
  color: var(--red);
}

.lf-words-card .progress-bar {
  margin-top: 8px;
}

.lf-words-block {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border);
}

.lf-words-block + .lf-words-block {
  margin-top: 10px;
}

.lf-words-tools:empty {
  display: none;
}

.lf-switch {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
}

.lf-switch small,
.lf-clean-row small {
  color: var(--text-3);
  font-size: 12px;
}

.lf-cap-presets,
.lf-cap-row,
.lf-clean-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.lf-cap-row .sub-label {
  margin: 0 2px 0 4px;
}

.lf-block-title {
  font-size: 13px;
}

.lf-clean-row select {
  padding: 4px 6px;
  font-size: 12px;
}

.lf-clean-row .mini-btn b {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 11px;
}

.lf-transcript-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lf-transcript-head h4 {
  margin: 4px 0 0;
}

.lf-transcript-head {
  position: relative;
}

#lfTranscriptBig {
  position: absolute;
  top: 0;
  right: 0;
}

/* The big view: over the page, wide, easy to read and select in. */
.lf-transcript-box.is-big {
  position: fixed;
  inset: 76px max(16px, calc(50vw - 520px)) 120px;
  z-index: 160;
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lf-transcript-box.is-big .lf-transcript {
  flex: 1;
  max-height: none;
  font-size: 18px;
  line-height: 1.9;
}

body.lf-transcript-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.55);
}

.lf-transcript {
  max-height: min(62vh, 560px);
  overflow-y: auto;
  padding: 4px 6px 4px 2px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  user-select: none;
  overscroll-behavior: contain;
}

.lf-tpiece {
  margin: 0 0 12px;
}

.lf-tpiece-head {
  display: block;
  margin-bottom: 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.lf-tpiece-head:hover {
  color: var(--text-2);
}

.lf-w {
  padding: 1px 1px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.lf-w:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.lf-w.is-current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.lf-w.is-selected {
  color: #fff;
  background: rgba(10, 132, 255, 0.55);
}

.lf-w.is-filler {
  color: var(--orange);
}

.lf-w.is-fixed {
  text-decoration: underline dotted var(--accent-2);
  text-underline-offset: 3px;
}

.lf-w.is-hidden {
  text-decoration: line-through;
  opacity: 0.5;
}

.lf-w-edit {
  width: 9em;
  padding: 0 4px;
  font: inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: 4px;
}

.lf-pause {
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-3);
  font-size: 10px;
  vertical-align: 1px;
}

.lf-selection-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  font-size: 12px;
}

.lf-selection-bar > span {
  flex: 1;
}

/* Captions over the Long Form player (same look as the Editor's, see captionCss). */
.lf-captions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lf-caption-line {
  position: absolute;
  left: 7%;
  right: 7%;
  line-height: 1.18;
  overflow-wrap: break-word;
  paint-order: stroke fill;
}

.lf-caption-line .caption-box {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ----- Long Form: the assistant bar (public/lfask.js) ----- */
.lf-ask {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  transition: border-color var(--fast) var(--ease);
}

.lf-ask:focus-within {
  border-color: var(--accent);
}

.lf-ask-icon {
  color: var(--accent-2);
}

.lf-ask input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}

.lf-ask.is-busy .lf-ask-icon {
  animation: lf-ask-pulse 1s ease-in-out infinite;
}

@keyframes lf-ask-pulse {
  50% {
    opacity: 0.3;
  }
}

.lf-ask-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  font-size: 13px;
}

.lf-ask-result > p,
.lf-ask-result > ul,
.lf-ask-result > div {
  flex-basis: 100%;
  margin: 0;
}

.lf-ask-done {
  padding: 0;
  list-style: none;
  color: var(--green);
}

.lf-ask-skip {
  color: var(--text-3);
}

.lf-ask-skip.is-error {
  color: var(--red);
}

.lf-ask-actions {
  display: flex;
  gap: 6px;
}

/* Four tabs (Selected, Words, Audio, Video) fit the inspector's width. */
.lf-panel-tabs button {
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}

.lf-clean-row select {
  flex: 0 0 auto;
  width: auto;
}

/* ----- Long Form: speed and colour per piece ----- */
.lf-subhead {
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.lf-tint {
  position: absolute;
  inset: 0;
  opacity: 0;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.lf-speeds {
  display: flex;
  width: 100%;
}

.lf-speeds button {
  flex: 1;
  min-width: 0;
  padding-left: 2px;
  padding-right: 2px;
  font-size: 12px;
}

.lf-colour-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Each preset shows a small sample of its look. */
.lf-colour-chip::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  background: conic-gradient(#ff5f57, #febc2e, #28c840, #0a84ff, #bf5af2, #ff5f57);
  filter: var(--chip-filter);
  vertical-align: -1px;
}

.lf-colour-row label {
  min-width: 74px;
}

/* ----- Long Form: the Audio row (public/lfaudio.js) ----- */
.lf-audio-lane {
  position: relative;
  height: 34px;
  margin-top: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  touch-action: none;
  user-select: none;
}

.lf-audio-block {
  position: absolute;
  top: 3px;
  height: 28px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid rgba(48, 209, 88, 0.6);
  border-radius: 7px;
  background: rgba(48, 209, 88, 0.2);
  color: var(--text);
  font: 600 12px/26px inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
}

.lf-audio-block.is-voice {
  border-color: rgba(255, 159, 10, 0.65);
  background: rgba(255, 159, 10, 0.2);
}

.lf-text-block.is-past {
  border-style: dashed;
  border-color: var(--orange);
  background: rgba(255, 159, 10, 0.15);
}

.lf-audio-block.is-selected {
  box-shadow: 0 0 0 2px #fff;
}

.lf-audio-empty {
  position: absolute;
  inset: 3px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px dashed rgba(48, 209, 88, 0.45);
  border-radius: 8px;
  background: rgba(48, 209, 88, 0.05);
  color: var(--green);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.lf-audio-empty small {
  color: var(--text-3);
  font-weight: 400;
}

.lf-audio-empty:hover {
  background: rgba(48, 209, 88, 0.12);
}

.lf-audio-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 13px;
}

.lf-audio-bar .lf-volume {
  gap: 8px;
}

.lf-audio-bar .icon-x {
  margin-left: auto;
}

.mini-btn.lf-record.is-recording {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  animation: lf-ask-pulse 1.2s ease-in-out infinite;
}

.lf-menu-wrap {
  position: relative;
}

/* The export menu opens downwards, from the header. */
.lf-export-menu {
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  left: auto;
  width: 300px;
}

.lf-export-choice {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lf-export-choice:hover {
  background: var(--surface-raised);
}

.lf-export-choice.is-last {
  border-color: rgba(10, 132, 255, 0.45);
}

.lf-export-choice span {
  font-size: 12px;
  color: var(--text-2);
}

.lf-export-choice small {
  color: var(--text-3);
  font-size: 11px;
}

.lf-record-panel {
  width: 320px;
  padding: 12px;
}

.lf-record-panel .lf-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12px;
}

.lf-record-panel .panel-actions {
  margin-top: 12px;
}

/* The microphone's level: --level 0–1, green from a speaking level. */
.lf-mic-meter {
  position: relative;
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 35%, rgba(48, 209, 88, 0.18) 35% 85%, rgba(255, 69, 58, 0.2) 85%);
}

.lf-mic-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--level, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, #8e8e93 0 35%, var(--green) 35% 85%, var(--red) 85%);
  background-size: calc(100% / max(var(--level, 0), 0.01)) 100%;
  transition: width 60ms linear;
}

.lf-mic-meter.is-mini {
  display: inline-block;
  width: 36px;
  height: 6px;
  margin-left: 6px;
  vertical-align: 1px;
}

.lf-sound-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.lf-menu-title {
  margin: 4px 6px 8px;
  font-size: 12px;
  font-weight: 600;
}

.lf-menu-title small {
  color: var(--text-3);
  font-weight: 400;
}

.lf-sound-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lf-sound-play {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.lf-sound-add {
  flex: 1;
  display: flex;
  justify-content: space-between;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.lf-sound-add:hover {
  background: var(--surface-raised);
}

.lf-sound-add small {
  color: var(--text-3);
}

/* ----- Long Form: chapters (public/lfchapters.js) ----- */
/* A row of their own above the ruler, only there when there are chapters. */
.lf-chapter-marks {
  position: relative;
  height: 0;
}

.lf-chapter-marks.has-chapters {
  height: 20px;
}

.lf-chapter-mark {
  position: absolute;
  top: 1px;
  z-index: 2;
  max-width: 160px;
  height: 18px;
  padding: 0 6px 0 7px;
  overflow: hidden;
  border: 0;
  border-left: 2px solid #ffd60a;
  border-radius: 0 6px 6px 0;
  background: rgba(255, 214, 10, 0.18);
  color: #ffd60a;
  font: 600 10px/18px inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.lf-chapter-mark:hover {
  background: rgba(255, 214, 10, 0.32);
}

.lf-chapter-list {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.lf-chapter-list li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 6px;
}

.lf-chapter-time {
  min-width: 46px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 214, 10, 0.4);
  border-radius: 6px;
  background: rgba(255, 214, 10, 0.1);
  color: #ffd60a;
  font: 600 12px/1 inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.lf-chapter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lf-chapter-problems {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--orange);
  font-size: 12px;
}

.lf-chapter-ok {
  margin: 10px 0 0;
  color: var(--green);
  font-size: 12px;
}

/* ----- Long Form: B-roll (public/lfbroll.js) ----- */
.lf-broll-lane {
  position: relative;
  height: 40px;
  margin-top: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  touch-action: none;
  user-select: none;
}

.lf-broll-block {
  position: absolute;
  top: 3px;
  height: 34px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(100, 210, 255, 0.7);
  border-radius: 7px;
  background: rgba(100, 210, 255, 0.2) center / auto 100% repeat-x;
  color: #fff;
  font: 600 12px/32px inherit;
  text-align: left;
  cursor: grab;
}

.lf-broll-block span {
  display: block;
  height: 100%;
  padding: 0 14px 0 8px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.15));
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.lf-broll-block.is-selected {
  box-shadow: 0 0 0 2px #fff;
}

.lf-broll-edge {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  background: rgba(100, 210, 255, 0.85);
  cursor: ew-resize;
}

.lf-broll-empty {
  position: absolute;
  inset: 3px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px dashed rgba(100, 210, 255, 0.45);
  border-radius: 8px;
  background: rgba(100, 210, 255, 0.05);
  color: #64d2ff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.lf-broll-empty small {
  color: var(--text-3);
  font-weight: 400;
}

.lf-broll-empty:hover {
  background: rgba(100, 210, 255, 0.12);
}

.lf-broll-corners {
  display: inline-flex;
  gap: 4px;
}

/* The B-roll player over the live preview: where the export puts it. */
.lf-broll-video {
  position: absolute;
  object-fit: cover;
  pointer-events: none;
}

.lf-broll-video.is-full {
  inset: 0;
  width: 100%;
  height: 100%;
}

/* (.lf-player video pins every side; a box sets only its corner's two) */
.lf-player .lf-broll-video.is-box {
  inset: auto;
  width: var(--size, 35%);
  height: auto;
  object-fit: contain;
  background: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* --m: 4 % of the frame's shorter side, as in the export. */
.lf-player .lf-broll-video.is-box.at-tl { top: var(--m); left: var(--m); }
.lf-player .lf-broll-video.is-box.at-tr { top: var(--m); right: var(--m); }
.lf-player .lf-broll-video.is-box.at-bl { bottom: var(--m); left: var(--m); }
.lf-player .lf-broll-video.is-box.at-br { bottom: var(--m); right: var(--m); }
.lf-player .lf-broll-video.is-box.at-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* ----- AI Images (public/aiimages.js) ----- */
.ai-layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 24px;
  align-items: start;
}

.ai-create {
  position: sticky;
  top: 80px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.ai-create .field-label {
  display: block;
  margin: 14px 0 6px;
}

.ai-create .field-label:first-child {
  margin-top: 0;
}

.ai-create textarea {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  resize: vertical;
}

.ai-create textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-ideas {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.ai-idea {
  flex: none;
  max-width: 230px;
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: 12px/1.4 inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ai-idea:hover {
  border-color: var(--accent);
  color: var(--text);
}

.ai-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* What's chosen is unmistakable (founder: "no feedback once you press it"). */
.ai-styles .mini-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ai-styles .mini-btn.is-active::before {
  content: "✓ ";
}

.ai-create .segmented button.is-active {
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 132, 255, 0.35);
}

.ai-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.ai-reference {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.ai-reference-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}

.ai-create-btn {
  width: 100%;
  margin-top: 18px;
}

.ai-working {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(10, 132, 255, 0.35);
  font-weight: 600;
}

.ai-working small {
  color: var(--text-3);
  font-weight: 400;
}

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

.ai-card {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Every card the same height; the picture whole and centred, whatever its shape. */
.ai-card-img {
  display: grid;
  place-items: center;
  height: 230px;
  overflow: hidden;
  background: #000;
}

.ai-card-img img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ai-card figcaption {
  padding: 10px 12px 12px;
}

.ai-card p {
  display: -webkit-box;
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ai-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ai-card-actions .icon-x {
  margin-left: auto;
}

.ai-empty {
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  /* minmax(0, …): the row of ideas scrolls inside the column instead of widening the page on phones. */
  .ai-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-create {
    position: static;
  }
}

/* The picker inside the Thumbnail maker. */
.ai-picker {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
}

.ai-picker-card {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 64px);
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.ai-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-picker-make {
  display: flex;
  gap: 8px;
}

.ai-picker-make input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}

.ai-pick-frame {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-2);
}

.ai-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.ai-pick {
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #000;
  aspect-ratio: 3 / 2;
  cursor: pointer;
}

.ai-pick:hover {
  border-color: var(--accent);
}

.ai-pick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-btn.thumb-ai-btn {
  border-color: rgba(191, 90, 242, 0.55);
  background: rgba(191, 90, 242, 0.16);
  color: #e0b8ff;
  font-weight: 700;
}

/* ----- The Thumbnail maker (public/thumbnail.js) ----- */
/* Its button in Long Form's header: a colour of its own, so it's easy to find. */
.btn.lf-thumb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #ff375f, #ff9f0a);
  box-shadow: 0 6px 20px rgba(255, 55, 95, 0.35);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), filter var(--fast) var(--ease);
}

.btn.lf-thumb-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 26px rgba(255, 55, 95, 0.5);
}

.btn.lf-thumb-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.thumb-open {
  overflow: hidden;
}

/* The maker is full-screen: the app's own bars step aside (toasts still show above it). */
body.thumb-open .topbar,
body.thumb-open .tabbar {
  display: none;
}

.thumb-maker {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.thumb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}

.thumb-title {
  margin-right: auto;
}

.thumb-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thumb-body {
  flex: 1;
  display: grid;
  grid-template-columns: 290px 1fr 320px;
  min-height: 0;
}

.thumb-side {
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.thumb-side:last-child {
  border-right: 0;
  border-left: 1px solid var(--border);
}

.thumb-side h4 {
  margin: 4px 0 10px;
}

.thumb-side .field-label {
  display: block;
  margin: 12px 0 6px;
}

.thumb-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.04), transparent 60%),
    repeating-conic-gradient(rgba(255, 255, 255, 0.025) 0 25%, transparent 0 50%) 0 0 / 24px 24px;
}

#thumbCanvas {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.thumb-feed {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 200px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  outline: 1px solid var(--border-strong);
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.thumb-frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.thumb-frame {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #000;
  aspect-ratio: 16 / 9;
  cursor: pointer;
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-frame span {
  position: absolute;
  right: 3px;
  bottom: 2px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 9px;
}

.thumb-frame.is-active {
  border-color: var(--accent);
}

.thumb-slider {
  display: grid;
  grid-template-columns: 82px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12px;
  color: var(--text-2);
}

.thumb-slider output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.thumb-styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.thumb-style {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 10px 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(135deg, #3a3a44, #1c1c22);
  cursor: pointer;
}

.thumb-style canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 300 / 110;
}

.thumb-restyle {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.thumb-restyle-chip {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--text-2);
  font: 600 11px/1.4 inherit;
  cursor: pointer;
}

.thumb-restyle-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.thumb-align {
  display: flex;
  width: 100%;
  margin: 6px 0;
}

.thumb-align button {
  flex: 1;
}

.thumb-more {
  margin-top: 8px;
  padding: 6px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.thumb-more summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.thumb-more[open] summary {
  margin-bottom: 6px;
  color: var(--text);
}

.thumb-style small {
  color: var(--text-3);
  font-size: 10px;
}

.thumb-style:hover {
  border-color: var(--accent);
}

.thumb-ideas-btn {
  margin-top: 8px;
}

.thumb-ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.thumb-idea {
  font-weight: 700;
}

.thumb-emojis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.thumb-emoji-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.thumb-emoji-search:focus {
  outline: none;
  border-color: var(--accent);
}

.thumb-emoji-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.thumb-emoji-tab {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: 600 11px/1.4 inherit;
  cursor: pointer;
}

.thumb-emoji-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.thumb-emoji-none {
  grid-column: 1 / -1;
}

.thumb-emoji {
  padding: 3px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

.thumb-emoji img {
  width: 100%;
  display: block;
}

.thumb-emoji:hover {
  background: var(--surface-raised);
}

.thumb-selected {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(10, 132, 255, 0.4);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.thumb-selected h4 {
  margin-top: 0;
}

.thumb-selected textarea {
  width: 100%;
  padding: 8px;
  font: 700 15px/1.3 inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  resize: vertical;
}

.thumb-selected select {
  flex-basis: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .thumb-body {
    grid-template-columns: 240px 1fr 270px;
  }
}
