:root {
  --bg-outer: #090b12;
  --bg-window: #10131e;
  --bg-card: #161a28;
  --bg-card-elevated: #1b2032;
  --bg-input: #111522;
  --border-subtle: #252c42;
  --border-strong: #343d5b;
  --accent-primary: #6d5dfc;
  --accent-secondary: #8367ff;
  --accent-glow: rgba(109, 93, 252, 0.36);
  --success-green: #22c55e;
  --text-main: #f3f5fb;
  --text-secondary: #a2acc7;
  --text-muted: #6c7693;
  --radius-card: 14px;
  --radius-control: 9px;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #171c2e 0%, var(--bg-outer) 65%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14px;
}

.app-shell {
  width: 100%;
  max-width: 1460px;
  min-height: calc(100vh - 28px);
  background: var(--bg-window);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==================== WINDOW TITLEBAR ==================== */
.window-titlebar {
  height: 46px;
  padding: 0 18px;
  background: linear-gradient(180deg, #171b2a 0%, #121623 100%);
  border-bottom: 1px solid #1e2437;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.window-left, .window-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.traffic-lights {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.history-nav {
  display: flex;
  gap: 4px;
}

.icon-chrome-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-chrome-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5f57;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #dbe2f5;
  letter-spacing: 0.01em;
}

.project-pill {
  font-size: 11px;
  font-weight: 500;
  color: #b4bcf5;
  background: rgba(109, 93, 252, 0.15);
  border: 1px solid rgba(109, 93, 252, 0.34);
  padding: 2px 9px;
  border-radius: 999px;
}

.phosor-conn-pill {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #2e3650;
  padding: 2px 9px;
  border-radius: 999px;
}
.phosor-conn-pill.connected {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.38);
}

.inline-link-btn {
  background: transparent;
  border: none;
  color: #a495ff;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px;
}
.inline-link-btn:hover {
  color: #d3cbff;
  text-decoration: underline;
}

#nleShotVideoEl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid #3c4669;
  background: #252c44;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  position: relative;
}
.avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

/* ==================== TOP 4-STEP STEPPER BAR ==================== */
.stepper-bar {
  margin: 14px 20px 10px;
  padding: 5px;
  background: #141826;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 4px;
}

.step-chevron {
  color: #4b5575;
  font-size: 18px;
  padding: 0 4px;
  user-select: none;
}

.step-item {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.step-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.step-item.active {
  background: linear-gradient(90deg, rgba(61, 51, 148, 0.72) 0%, rgba(100, 82, 226, 0.78) 100%);
  border-color: #8373ff;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 20px rgba(109, 93, 252, 0.28);
}

.step-item.completed {
  color: #d6def2;
}

.step-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.step-item.active .step-indicator {
  background: radial-gradient(circle, #e0dafe 25%, #8f7dff 70%);
  box-shadow: 0 0 10px #a495ff;
}

.step-item.completed .step-indicator {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
  color: #4ade80;
}
.step-item.completed .step-indicator::before {
  content: '✓';
  font-weight: 700;
}

/* ==================== WORKSPACE & STUDIO CARDS ==================== */
.workspace-main {
  flex: 1;
  padding: 6px 20px 20px;
  display: flex;
  flex-direction: column;
}

.screen-panel {
  display: none;
  flex: 1;
  animation: fadeIn 0.2s ease;
}
.screen-panel.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-header.compact {
  margin-bottom: 11px;
}
.card-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #f5f7ff;
}

.subtle-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== CONTROLS, BUTTONS & DROPDOWNS ==================== */
.segmented-control {
  background: #101420;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
  display: inline-flex;
  gap: 2px;
}
.segmented-control.full-seg {
  width: 100%;
  border-radius: var(--radius-control);
}
.segmented-control.full-seg .seg-btn {
  flex: 1;
  border-radius: 6px;
  padding: 8px 8px;
  font-size: 12px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.16s ease;
}
.seg-btn.active {
  background: #2b334e;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
}
.field-group.tight {
  margin-bottom: 11px;
  gap: 5px;
}
.field-label {
  font-size: 12.5px;
  color: #b7c0d8;
  font-weight: 500;
}

.select-wrap {
  position: relative;
}
.select-wrap select,
.studio-card textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.select-wrap select {
  appearance: none;
  padding: 10px 34px 10px 12px;
  cursor: pointer;
}
.select-wrap::after {
  content: '⌄';
  position: absolute;
  right: 12px;
  top: 46%;
  transform: translateY(-55%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 14px;
}
.select-wrap select:focus,
.studio-card textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.2);
}

.primary-cta-btn {
  width: 100%;
  border: 1px solid rgba(168, 152, 255, 0.45);
  border-radius: 11px;
  padding: 13px 18px;
  background: linear-gradient(135deg, #6157ff 0%, #8257fb 100%);
  color: #fff;
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 22px var(--accent-glow);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.primary-cta-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.primary-cta-btn:active {
  transform: translateY(0);
}
.primary-cta-btn.inline-cta {
  width: auto;
  padding: 10px 20px;
  font-size: 13.5px;
}
.cta-arrow {
  font-size: 18px;
  line-height: 1;
}

.ghost-mini-btn {
  background: rgba(109, 93, 252, 0.12);
  border: 1px solid rgba(109, 93, 252, 0.35);
  color: #ccc6ff;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.ghost-mini-btn:hover {
  background: rgba(109, 93, 252, 0.24);
  color: #fff;
}

/* ==================== SCREEN 1 LAYOUT ==================== */
.screen1-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
}

.screen1-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-editor-card {
  flex: 1;
}

.editor-box {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid #27304a;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-toolbar {
  padding: 8px 12px;
  background: #171c2c;
  border-bottom: 1px solid #242b42;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.tool-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.tool-sep {
  width: 1px;
  height: 16px;
  background: #2b334d;
  margin: 0 3px;
}

.preset-chips {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.chip-btn {
  background: #20273d;
  border: 1px solid #2f3959;
  color: #b8c2df;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.chip-btn:hover {
  border-color: var(--accent-primary);
  color: #fff;
}

#storyPromptInput {
  flex: 1;
  min-height: 190px;
  border: none;
  border-radius: 0;
  padding: 16px 18px;
  font-size: 15.5px;
  line-height: 1.62;
  color: #eef1fa;
  resize: none;
  box-shadow: none;
}

.editor-footer {
  padding: 8px 16px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.style-cards-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
}

.style-card {
  position: relative;
  background: #111522;
  border: 1.5px solid #262e46;
  border-radius: 11px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: var(--text-main);
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.style-card:hover {
  transform: translateY(-2px);
  border-color: #4c5882;
}
.style-card.active {
  border-color: #7c6df6;
  box-shadow: 0 0 0 2px rgba(124, 109, 246, 0.28), 0 8px 20px rgba(0, 0, 0, 0.4);
}
.style-card img {
  width: 100%;
  height: 104px;
  object-fit: cover;
  display: block;
}
.style-card .style-name {
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 560;
}
.style-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.style-card.active .style-check {
  display: inline-flex;
}

.models-sidebar-card {
  justify-content: space-between;
}
.models-top h2 {
  margin: 0 0 18px;
  font-size: 17px;
}

/* ==================== SCREEN 2 LAYOUT ==================== */
.screen2-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.badge-chip {
  font-size: 11.5px;
  color: #c2cbeb;
  background: #20263b;
  border: 1px solid #303957;
  padding: 3px 10px;
  border-radius: 999px;
}

.underline-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid #262e46;
  margin-bottom: 12px;
}

.u-tab {
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  padding: 8px 2px 10px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
}
.u-tab.active {
  color: #fff;
  border-bottom-color: var(--accent-primary);
}

.script-tab-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.script-tab-body[hidden] {
  display: none !important;
}

.script-editor-area {
  flex: 1;
  min-height: 440px;
  padding: 16px;
  line-height: 1.65;
  font-size: 14px;
  resize: none;
}
.mono-script {
  font-family: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, Menlo, monospace;
  font-size: 13.2px;
}

.scene-text-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 455px;
  overflow-y: auto;
  padding-right: 4px;
}
.scene-text-item {
  background: #111522;
  border: 1px solid #28314c;
  border-radius: 10px;
  padding: 12px 14px;
}
.scene-text-item header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 650;
  color: #9da8ff;
  margin-bottom: 6px;
}
.scene-text-item textarea {
  min-height: 58px;
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
}

.screen2-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-with-sub {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.style-tag-inline {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.char-card {
  position: relative;
  background: #111522;
  border: 1px solid #2a324d;
  border-radius: 11px;
  overflow: hidden;
}
.char-card.locked {
  border-color: rgba(109, 93, 252, 0.55);
}
.char-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: filter 0.25s ease, transform 0.25s ease;
}
.char-actions-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 5px;
}
.circle-overlay-btn {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 19, 30, 0.76);
  backdrop-filter: blur(6px);
  color: #f3f5fb;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.circle-overlay-btn:hover {
  background: var(--accent-primary);
}
.circle-overlay-btn.active-lock {
  background: rgba(109, 93, 252, 0.88);
  border-color: #b1a7ff;
}

.char-caption {
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 560;
}
.char-role-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.backgrounds-card {
  flex: 1;
  justify-content: space-between;
}
.backgrounds-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.bg-card {
  position: relative;
  background: #111522;
  border: 1px solid #29314b;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}
.bg-card.approved {
  border-color: rgba(34, 197, 94, 0.45);
}
.bg-card img {
  width: 100%;
  height: 98px;
  object-fit: cover;
  display: block;
}
.bg-card-footer {
  padding: 7px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}
.card-footer-right {
  display: flex;
  justify-content: flex-end;
}

/* ==================== SCREEN 3 LAYOUT ==================== */
.screen3-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.screen3-top-row {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 310px;
  gap: 14px;
}

.storyboard-shots-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shot-card {
  position: relative;
  background: #111522;
  border: 1.5px solid #28304a;
  border-radius: 10px;
  padding: 6px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.shot-card.active {
  border-color: #7d6ef8;
  box-shadow: 0 0 0 2px rgba(125, 110, 248, 0.25);
}
.shot-thumb-wrap {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
}
.shot-thumb-wrap img {
  width: 100%;
  height: 86px;
  object-fit: cover;
  display: block;
}
.shot-dur-pill {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(10, 12, 20, 0.82);
  color: #e9ecf8;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
}
.shot-active-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
}
.shot-card.active .shot-active-badge {
  display: inline-flex;
}
.shot-meta-row {
  padding: 6px 3px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 560;
}
.shot-move-btns {
  display: flex;
  gap: 3px;
}
.shot-move-btns button {
  background: #1d2336;
  border: 1px solid #2d3653;
  color: #a9b3cf;
  border-radius: 4px;
  font-size: 10px;
  padding: 1px 5px;
  cursor: pointer;
}
.shot-move-btns button:hover {
  color: #fff;
  border-color: var(--accent-primary);
}

/* Monitor */
.monitor-card {
  justify-content: space-between;
  padding: 14px 16px;
}
.monitor-viewport-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #06080d;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #252c43;
}
#nlePreviewCanvas {
  width: 100%;
  height: 100%;
  display: block;
}
.monitor-caption-overlay {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: 86%;
  background: rgba(9, 11, 18, 0.78);
  color: #f8fafc;
  padding: 5px 13px;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.monitor-controls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scrubber-range, .purple-slider {
  width: 100%;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.transport-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.transport-center {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-transport-btn {
  background: transparent;
  border: none;
  color: #cfd6ec;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
}
.icon-transport-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.play-transport-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #414b6e;
  background: #232a42;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.play-transport-btn:hover {
  background: var(--accent-primary);
  border-color: #9386ff;
}

.timecode-readout {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: #e6ebf8;
}
.timecode-readout span {
  color: var(--text-muted);
}

.inspector-card {
  justify-content: space-between;
  padding: 15px 17px;
}
.label-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slider-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Multi-Track NLE Timeline */
.timeline-card {
  padding: 12px 16px 14px;
}
.timeline-grid {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.timeline-labels {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ruler-spacer {
  height: 22px;
}
.track-label {
  height: 38px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #b5bfd9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-lanes-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.timeline-ruler {
  height: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid #252c42;
  padding: 0 2px;
}
.timeline-track {
  height: 38px;
  background: #111522;
  border-radius: 7px;
  display: flex;
  gap: 4px;
  padding: 3px;
  overflow: hidden;
}

.tl-shot-clip {
  height: 100%;
  border-radius: 5px;
  border: 1.5px solid #303956;
  position: relative;
  overflow: hidden;
  background-size: auto 100%;
  background-repeat: repeat-x;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 4px #000;
}
.tl-shot-clip.active {
  border-color: #8f80ff;
  box-shadow: inset 0 0 0 1px #8f80ff;
}

.tl-wave-clip {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 550;
  overflow: hidden;
  white-space: nowrap;
}
.tl-wave-clip.dialogue {
  background: linear-gradient(90deg, #43327d 0%, #523d99 100%);
  border: 1px solid #765ee0;
  color: #ede9fe;
  width: 100%;
}
.tl-wave-clip.music {
  background: linear-gradient(90deg, #274878 0%, #2f5994 100%);
  border: 1px solid #4d85d6;
  color: #dbeafe;
  width: 100%;
}
.waveform-bars {
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.waveform-bars i {
  display: inline-block;
  width: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.72;
}

.tl-caption-clip {
  height: 100%;
  background: #1a2033;
  border: 1px solid #2d3654;
  border-radius: 5px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  color: #d2daf0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-playhead {
  position: absolute;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 5;
}
.playhead-cap {
  position: absolute;
  top: -7px;
  left: -5px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #ffffff;
}

/* ==================== SCREEN 4 LAYOUT ==================== */
.screen4-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.screen4-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-ready-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-green);
  box-shadow: 0 0 8px var(--success-green);
}

.cinema-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 440px;
  background: #05070c url('assets/backgrounds/scene2-parchment-shot.jpg') center / cover no-repeat;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #262e46;
}
.cinema-stage.vertical-preview {
  aspect-ratio: 9 / 16;
  width: auto;
  height: 430px;
  margin: 0 auto;
}
#finalVideoEl, #cinemaFallbackCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vol-glyph {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
}
.cinema-subtitle-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 10, 16, 0.8);
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  max-width: 85%;
  text-align: center;
}

.cinema-scrubber-wrap {
  position: relative;
  margin-top: 10px;
}
.chapter-ticks {
  position: relative;
  height: 6px;
  margin-top: 2px;
}
.chapter-tick {
  position: absolute;
  top: 0;
  width: 2px;
  height: 6px;
  background: #6c779b;
}

.cinema-transport-bar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cinema-time-left, .cinema-right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-vol {
  width: 80px;
}
.cc-toggle-btn {
  background: #222942;
  border: 1px solid #3c466b;
  color: #a8b3d1;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
}
.cc-toggle-btn.active {
  background: var(--accent-primary);
  border-color: #9c8fff;
  color: #fff;
}

.chapters-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chapters-strip {
  display: grid;
  grid-template-columns: repeat(4, 112px);
  gap: 10px;
}
.chapter-card {
  background: #111522;
  border: 1.5px solid #28304a;
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--text-main);
  text-align: left;
}
.chapter-card.active {
  border-color: var(--accent-primary);
}
.chapter-card img {
  width: 100%;
  height: 54px;
  object-fit: cover;
  display: block;
}
.chapter-card span {
  display: block;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 560;
}

.tech-badges-row {
  display: flex;
  gap: 9px;
}
.tech-badge {
  min-width: 68px;
  padding: 9px 12px;
  background: #121625;
  border: 1px solid #2b334f;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tech-badge.highlight {
  border-color: #7c6df6;
  background: rgba(109, 93, 252, 0.12);
}
.tech-badge strong {
  font-size: 15px;
  color: #f3f6ff;
}
.tech-badge span {
  font-size: 11px;
  color: var(--text-muted);
}

.export-sidebar-card {
  justify-content: space-between;
}
.export-top h2 {
  margin: 0 0 16px;
}

.switch-row, .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 6px;
  font-size: 13px;
}
.switch-row input, .check-row input {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.est-size-line {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #242b42;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.export-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.secondary-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.secondary-studio-btn {
  background: #1b2135;
  border: 1px solid #303958;
  color: #dce3f9;
  padding: 10px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
}
.secondary-studio-btn:hover {
  border-color: var(--accent-primary);
  color: #fff;
}

[hidden] {
  display: none !important;
}

/* ==================== REA VIDEO REVERSE-ENGINEER WORKSPACE ==================== */
.rea-quick-pill {
  background: rgba(124, 109, 246, 0.16);
  border: 1px solid rgba(139, 124, 255, 0.45);
  color: #dcd6ff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.rea-quick-pill:hover {
  background: var(--accent-primary);
  border-color: #9e92ff;
  color: #fff;
}

.s1-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.s1-mode-switch .seg-btn {
  padding: 6px 14px;
  font-size: 12.5px;
}

.rea-left-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.rea-upload-card {
  padding: 14px 18px;
}
.rea-upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  margin-top: 8px;
}
.rea-dropzone {
  border: 1.5px dashed #39456b;
  background: rgba(14, 18, 30, 0.72);
  border-radius: 11px;
  padding: 18px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 112px;
}
.rea-dropzone:hover,
.rea-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(124, 109, 246, 0.1);
}
.rea-drop-icon {
  font-size: 24px;
  line-height: 1;
}
.rea-drop-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #eef2ff;
}
.rea-drop-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 560px;
}
.rea-preview-box {
  width: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2b3554;
  background: #05070c;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rea-preview-box video {
  width: 100%;
  height: 124px;
  object-fit: cover;
  display: block;
}

.rea-results-card {
  flex: 1;
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 310px;
}
.rea-report-links {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.primary-mini-btn {
  background: linear-gradient(135deg, #7c6df6, #6153e0);
  border: 1px solid #9689ff;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.primary-mini-btn:hover {
  filter: brightness(1.08);
}

.rea-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 28px 24px;
  border: 1px dashed #252e49;
  border-radius: 10px;
}
.rea-empty-state p {
  max-width: 560px;
  line-height: 1.55;
  margin: 0;
}

.rea-summary-box {
  background: #0f1320;
  border: 1px solid #26304d;
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.rea-verdict-headline {
  color: #f1f5f9;
  font-weight: 600;
  line-height: 1.45;
}
.rea-mix-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rea-pill {
  background: #1a2136;
  border: 1px solid #2f3a5c;
  color: #cbd5f5;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.rea-pill.highlight {
  background: rgba(124, 109, 246, 0.18);
  border-color: rgba(139, 124, 255, 0.5);
  color: #e4dfff;
}
.rea-plan-line {
  color: #93c5fd;
  font-size: 12px;
}

.rea-shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.rea-shot-card {
  background: #101523;
  border: 1px solid #27314e;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rea-shot-card img {
  width: 100%;
  height: 98px;
  object-fit: cover;
  background: #070910;
  display: block;
}
.rea-shot-body {
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
}
.rea-shot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 600;
  color: #eef2ff;
}
.rea-label-tag {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}
.rea-shot-prompt {
  color: #cbd5e1;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rea-shot-ev {
  color: var(--text-muted);
  font-size: 10.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rea-dual-row {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 8px;
}
.rea-checks-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}
.compact-check {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}
.rea-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.full-w {
  width: 100%;
}

.export-download-Tray {
  margin-top: 4px;
  padding: 9px 11px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 9px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.export-download-Tray a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
}
.export-download-Tray a:hover {
  text-decoration: underline;
}

/* Toast */
.studio-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #1e253b;
  border: 1px solid #7c6df6;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 100;
}

/* Responsive support */
@media (max-width: 1180px) {
  .screen1-grid, .screen2-grid, .screen3-top-row, .screen4-grid {
    grid-template-columns: 1fr;
  }
  .style-cards-row {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .stepper-bar {
    display: flex;
    overflow-x: auto;
    border-radius: 14px;
  }
  .chapters-strip {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}
