/* ──────────── fonts: Selecta (sans) + Kalice (serif) ──────────── */
@font-face {
  font-family: 'Selecta';
  src: url('/fonts/Selecta-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Selecta';
  src: url('/fonts/Selecta-RegularItalic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Selecta';
  src: url('/fonts/Selecta-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Selecta';
  src: url('/fonts/Selecta-Bold.otf') format('opentype');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Kalice';
  src: url('/fonts/Kalice-Trial-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Kalice';
  src: url('/fonts/Kalice-Trial-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Kalice';
  src: url('/fonts/Kalice-Trial-Medium.otf') format('opentype');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Kalice';
  src: url('/fonts/Kalice-Trial-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme='light'] {
  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --ink-3: #8a8a8a;
  --line: #ebe7e1;
  --line-2: #d6d1c9;
  --paper: #fbf9f5;
  --paper-bar: rgba(251, 249, 245, 0.92);
  --card: #ffffff;
  --card-placeholder: linear-gradient(135deg, #f4efe7 0%, #ebe4d8 100%);
  --accent: #c8553d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.18);
  --chip-bg: rgba(26, 26, 26, 0.85);
  --chip-fg: #fbf9f5;
  --time-bg: rgba(255, 255, 255, 0.92);
}

[data-theme='dark'] {
  --ink: #f0ece4;
  --ink-2: #c2bdb3;
  --ink-3: #7c776e;
  --line: #2a2825;
  --line-2: #3a3733;
  --paper: #121110;
  --paper-bar: rgba(18, 17, 16, 0.92);
  --card: #1c1b19;
  --card-placeholder: linear-gradient(135deg, #232220 0%, #181715 100%);
  --accent: #e07a64;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
  --chip-bg: rgba(240, 236, 228, 0.92);
  --chip-fg: #1a1a1a;
  --time-bg: rgba(28, 27, 25, 0.9);
}

:root {
  --radius: 14px;
  --radius-sm: 8px;

  --font-serif: 'Kalice', 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Selecta', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', monospace;

  --card-w: 380px;
  --rail-w: 66px;
  --sidebar-w: 280px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ──────────── sidebar: icon rail that expands on hover ──────────── */
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: var(--rail-w);
  overflow: hidden;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}

.sidebar:hover {
  width: var(--sidebar-w);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* expand-only content: hidden in the rail, revealed on hover */
.sidebar .brand-text,
.sidebar-section-caret,
.sidebar-section-num,
.sidebar-section-cat,
.sidebar-section-headtotal,
.sidebar-item-text,
.cost-body {
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
}

.sidebar:hover .brand-text,
.sidebar:hover .sidebar-section-caret,
.sidebar:hover .sidebar-section-num,
.sidebar:hover .sidebar-section-cat,
.sidebar:hover .sidebar-section-headtotal,
.sidebar:hover .sidebar-item-text,
.sidebar:hover .cost-body {
  opacity: 1;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
}

.sidebar-brand-label {
  padding: 4px 20px 12px 15px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.sidebar:hover .sidebar-brand-label {
  opacity: 1;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 20px 8px 15px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.15s ease;
}

.sidebar-section-head:hover {
  color: var(--ink);
}

.sidebar-section-badge {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

.sidebar-section-head:hover .sidebar-section-badge {
  color: var(--ink);
}

.sidebar-section-headtotal {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: none;
}

.sidebar-section-caret {
  font-size: 8px;
  color: var(--ink-3);
  transition: transform 0.15s ease;
  display: inline-block;
  width: 8px;
}

.sidebar-section-head[aria-expanded='true'] .sidebar-section-caret {
  transform: rotate(90deg);
}

.sidebar-section-num {
  color: var(--ink-3);
}

.sidebar-section-cat {
  color: var(--ink);
}

.sidebar-section-items {
  display: flex;
  flex-direction: column;
}

.sidebar-section-items[hidden] {
  display: none;
}

.sidebar-item {
  appearance: none;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  padding: 7px 18px 7px 13px;
  margin: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font: inherit;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-item:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

.sidebar-item[aria-selected='true'] {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  border-left-color: var(--ink);
}

.sidebar-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-item:hover .sidebar-item-icon {
  color: var(--ink);
  border-color: var(--ink-3);
}

.sidebar-item[aria-selected='true'] .sidebar-item-icon {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.sidebar-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-item-label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.sidebar-item-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ──────────── cost panel ──────────── */
.cost-panel {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 18px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.cost-body[hidden] {
  display: none;
}

.cost-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 20px 8px;
}

.cost-total-amount {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.cost-total-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.cost-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 6px 20px 4px;
}

.cost-model {
  appearance: none;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  padding: 8px 18px;
  cursor: pointer;
  text-align: left;
  color: var(--ink-2);
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cost-model:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

.cost-model[aria-selected='true'] {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  border-left-color: var(--ink);
}

.cost-model-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.cost-model-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

.cost-model-price {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.cost-model[aria-selected='true'] .cost-model-price {
  color: var(--ink-2);
}

.cost-model-blurb {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-3);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ──────────── topbar ──────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 32px;
  background: var(--paper-bar);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  flex: 1;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 20px;
  font-style: italic;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.save-status {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  background: var(--card);
  white-space: nowrap;
}

.save-status[data-tone='ok'] {
  color: var(--ink-2);
}

.save-status[data-tone='warn'] {
  color: var(--accent);
  border-color: var(--accent);
}

.style-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

#style-select {
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.theme-icon {
  display: none;
}

[data-theme='light'] .theme-icon-moon,
[data-theme='dark'] .theme-icon-sun {
  display: block;
}

.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  padding: 8px 14px;
  font-size: 12px;
}

.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ──────────── film header (still constrained, centered) ──────────── */
.film {
  padding: 56px 0 96px;
}

.film-header {
  padding: 0 32px;
  margin: 0 0 48px 0;
}


.film-blurb {
  max-width: 64ch;
}

.film-title {
  max-width: 22ch;
}

.film-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.film-dot {
  color: var(--line-2);
}

.film-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 18px 0;
}

.film-blurb {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 22px 0;
}

.film-blurb-para {
  margin: 0 0 12px 0;
}

.film-blurb-para:last-child {
  margin-bottom: 0;
}

/* ──────────── timeline: one continuous horizontal strip ──────────── */
.frames {
  display: flex;
  align-items: flex-start;
  gap: 64px;
  padding: 8px 32px 32px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x proximity;
  scroll-padding-left: 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.frames::-webkit-scrollbar {
  height: 10px;
}
.frames::-webkit-scrollbar-track {
  background: transparent;
}
.frames::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
  border: 2px solid var(--paper);
}

.beat-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
}

.beat-group:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 8px;
  left: -32px;
  width: 1px;
  background: var(--line);
}

.beat-group-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
  width: fit-content;
  min-width: 300px;
}

.beat-group-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.beat-group-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.beat-group-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  margin-left: auto;
}

.beat-group-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.beat-group-reveal {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  flex-shrink: 0;
  border: 1px dashed var(--line-2);
  background: transparent;
  border-radius: var(--radius);
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 16px;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1.4;
}

.beat-group-reveal:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}

/* ──────────── frame card ──────────── */
.frame {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  width: var(--card-w);
  flex-shrink: 0;
  scroll-snap-align: start;
}

.frame:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
}

.frame.frame-is-hidden {
  opacity: 0.45;
  border-style: dashed;
}

.frame.frame-is-hidden:hover {
  opacity: 0.8;
}

.frame-image-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--line);
}

.frame-image-single,
.frame-image {
  position: relative;
}

.frame-image {
  aspect-ratio: 16 / 9;
  background: var(--card-placeholder);
  cursor: pointer;
  overflow: hidden;
}

.frame-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.frame-image:hover img {
  transform: scale(1.02);
}

.frame-image-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  pointer-events: none;
}

.frame-image-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  z-index: 2;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.frame-image-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-image-time {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--time-bg);
  color: var(--ink);
  border-radius: 4px;
}

/* ──────────── upload affordance per image slot ──────────── */

.frame-image-fileinput {
  display: none;
}

.frame-image-upload {
  appearance: none;
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 4;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.frame-image:hover .frame-image-upload,
.frame-image-upload:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

/* When the slot is empty, the pill is always visible. */
.frame-image:has(.frame-image-placeholder) .frame-image-upload {
  opacity: 1;
  transform: translateY(0);
}

.frame-image-upload:hover {
  background: var(--ink);
}

/* Drag-and-drop highlight on the whole 16:9 area. */
.frame-image.frame-image-dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
}

.frame-image.frame-image-dragover .frame-image-placeholder {
  color: var(--accent);
}

.frame-body {
  padding: 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.frame-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.frame-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.005em;
  outline: 0;
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: -4px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  cursor: text;
}

.frame-title:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.frame-title:focus {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.frame-title.frame-title-edited::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}

.frame-number {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

.beat-group-vo {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0 4px;
  max-width: 880px;
  /* Sticky to the left edge of the viewport while horizontally scrolling
     through this beat's cards. Each beat-group is a wide flex column
     containing its row of cards; the VO sticks at left:0 within it. */
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
}

.beat-group-vo-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 9px;
  flex-shrink: 0;
}

.beat-group-vo-line {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
}

.beat-group-vo-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 880px;
}

.beat-group-vo-lines .beat-group-vo-line {
  margin: 0;
}

.beat-group-vo-direction {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
  padding-top: 4px;
}

.beat-group-vo.beat-group-vo-silent .beat-group-vo-line {
  color: var(--ink-3);
  font-size: 13px;
  font-style: normal;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.frame-visual-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}

.frame-visual-toggle:hover {
  color: var(--ink);
}

.frame-visual-toggle::before {
  content: '▸';
  font-size: 9px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.frame-visual-toggle[aria-expanded='true']::before {
  transform: rotate(90deg);
}

.frame-visual-toggle-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
}

.frame-visual {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}

.frame-visual-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.frame-visual-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.frame-visual-editor-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.frame-visual-editor-tag {
  color: var(--ink-2);
}

.frame-visual-editor-dirty {
  color: var(--accent);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.04em;
}

.frame-visual-input {
  appearance: none;
  font: inherit;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
  min-height: 64px;
  transition: border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.frame-visual-input:hover {
  border-color: var(--line-2);
}

.frame-visual-input:focus {
  outline: 0;
  border-color: var(--ink-3);
  background: var(--card);
}

.frame-visual-reset {
  appearance: none;
  align-self: flex-start;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.15s ease;
}

.frame-visual-reset:hover {
  color: var(--accent);
}

.frame-camera {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.frame-camera-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.frame-camera-input {
  appearance: none;
  font: inherit;
  line-height: 1.45;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  resize: none;
  width: 100%;
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 14px;
  min-height: 38px;
}

.frame-camera-input:focus {
  outline: 0;
}

.frame-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.frame-hide {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s ease;
}

.frame-hide:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.frame-error {
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

/* ──────────── footer ──────────── */
.film-foot {
  margin-top: 56px;
  padding: 24px 32px 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* ──────────── lightbox ──────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 9, 8, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 48px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-stage {
  max-width: min(96vw, 1400px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#lightbox-img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-sans);
  font-size: 14px;
}

.lightbox-meta .mono {
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* ── VO above the image ── */
.lightbox-vo {
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.lightbox-vo[hidden] {
  display: none;
}

.lightbox-vo-line {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.4;
  margin: 0;
}

.lightbox-vo-direction {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

/* ── prev / next arrows ── */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  display: grid;
  place-items: center;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav:disabled {
  opacity: 0.25;
  cursor: default;
}
