/* ==========================================================================
   course-gen design mockups — shared stylesheet
   Single source of truth for the static HTML mockup pages under html/.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color palette — white surfaces with a HeyGen-slide blue accent */
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f3f8;
  --color-text: #0f172a;
  --color-text-muted: #5b6677;
  --color-text-subtle: #8a94a4;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-soft: #e0ecff;
  --color-success: #047857;
  --color-success-soft: #d1fae5;
  --color-warn: #b45309;
  --color-warn-soft: #fef3c7;
  --color-danger: #b91c1c;
  --color-danger-soft: #fee2e2;
  --color-info: #0e7490;
  --color-info-soft: #cffafe;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.05), 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas,
    monospace;

  /* Layout */
  --content-max: 1200px;
  --nav-height: 64px;
}

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

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

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

h1, h2, h3, h4, h5 {
  margin: 0 0 var(--space-3);
  line-height: 1.25;
  color: var(--color-text);
}

h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 17px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.main {
  flex: 1;
  padding: var(--space-6) 0 var(--space-7);
}

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-5); }

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); font-size: 13px; }
.text-sm { font-size: 13px; }
.text-mono { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Top navigation
   -------------------------------------------------------------------------- */
.nav {
  height: var(--nav-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--space-5);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover { text-decoration: none; color: var(--color-text); }

.nav-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-accent) 0%, #1e40af 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.nav-spacer { flex: 1; }

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.nav-user:hover {
  border-color: var(--color-border-strong);
  text-decoration: none;
  color: var(--color-text);
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease,
    color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

/* Variants */
.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

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

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #991b1b;
  border-color: #991b1b;
  color: #fff;
}

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

.btn-ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-padded { padding: var(--space-5); }
.card-tight { padding: var(--space-4); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.card-body { padding: var(--space-5); }
.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --------------------------------------------------------------------------
   Badges, status pills, banners
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

/* All five contrast-checked against their soft backgrounds at ≥ 4.5:1 */
.status-idle      { background: #eef2f7; color: #475569; border-color: #d8dee7; }
.status-scripted  { background: var(--color-info-soft); color: var(--color-info); border-color: #a5f3fc; }
.status-submitted { background: var(--color-warn-soft); color: var(--color-warn); border-color: #fde68a; }
.status-rendered  { background: var(--color-success-soft); color: var(--color-success); border-color: #a7f3d0; }
.status-failed    { background: var(--color-danger-soft); color: var(--color-danger); border-color: #fecaca; }

.banner {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid;
  background: var(--color-surface);
}

.banner-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.banner-body { flex: 1; }
.banner-title { font-weight: 600; margin: 0 0 4px; }
.banner-msg { color: var(--color-text-muted); margin: 0; font-size: 14px; }

.banner-warn   { background: var(--color-warn-soft); border-color: #fcd34d; color: var(--color-warn); }
.banner-warn .banner-msg { color: #78350f; }
.banner-info   { background: var(--color-accent-soft); border-color: #bfdbfe; color: var(--color-accent); }
.banner-info .banner-msg { color: #1e3a8a; }
.banner-success{ background: var(--color-success-soft); border-color: #6ee7b7; color: var(--color-success); }
.banner-success .banner-msg { color: #065f46; }
.banner-danger { background: var(--color-danger-soft); border-color: #fca5a5; color: var(--color-danger); }
.banner-danger .banner-msg { color: #7f1d1d; }

.banner-close {
  background: transparent;
  border: 0;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  margin-left: var(--space-2);
  font-size: 18px;
  line-height: 1;
}
.banner-close:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

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

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:hover, select:hover, textarea:hover {
  border-color: var(--color-text-muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--color-accent);
}

.checkbox-row label { font-weight: 500; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%235b6677' d='M2 4l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: toast-in 160ms ease-out, toast-out 160ms ease-in 2.4s forwards;
}

.toast-icon {
  width: 16px;
  height: 16px;
  color: #93c5fd;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* --------------------------------------------------------------------------
   Login layout
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at -10% -20%, var(--color-accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #ede9fe, transparent 55%),
    var(--color-bg);
  padding: var(--space-5);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-7) var(--space-6) var(--space-6);
  text-align: center;
}

.login-card .nav-brand-mark {
  width: 44px;
  height: 44px;
  font-size: 18px;
  margin: 0 auto var(--space-4);
}

.login-card h1 { font-size: 22px; }
.login-card .form-row { text-align: left; }
.login-card .btn { width: 100%; }
.login-footer-note {
  margin-top: var(--space-5);
  font-size: 12px;
  color: var(--color-text-subtle);
}

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-header h1 { margin: 0; }
.page-header .muted { margin-top: 4px; font-size: 14px; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs .sep { color: var(--color-text-subtle); }

/* --------------------------------------------------------------------------
   Dashboard / project grid
   -------------------------------------------------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.project-card {
  display: block;
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.project-card:hover {
  text-decoration: none;
  color: inherit;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.project-card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 var(--space-1);
  color: var(--color-text);
}

.project-card-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.project-card-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.project-card-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent) 0%, #60a5fa 100%);
  border-radius: var(--radius-pill);
}

.project-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Upload page
   -------------------------------------------------------------------------- */
.upload-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.dropzone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dropzone-icon svg { width: 28px; height: 28px; }

.dropzone-title { font-weight: 600; margin: 0 0 var(--space-1); }
.dropzone-help { color: var(--color-text-muted); font-size: 13px; margin: 0; }

.upload-progress-wrap {
  margin-top: var(--space-4);
  display: none;
}

.upload-progress-wrap.is-visible { display: block; }

.upload-progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}

.upload-progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent), #60a5fa);
  transition: width 120ms linear;
}

.upload-success {
  display: none;
  margin-top: var(--space-4);
}

.upload-success.is-visible { display: flex; }

/* --------------------------------------------------------------------------
   Project page (transcript editor)
   -------------------------------------------------------------------------- */
.project-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-5);
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  padding: var(--space-4);
}

.toc h4 {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-text-subtle);
  margin: 0 0 var(--space-3);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 13px;
  text-decoration: none;
}

.toc-list a:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
  text-decoration: none;
}

.section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section + .section { margin-top: var(--space-4); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.section-title { font-weight: 600; font-size: 16px; margin: 0; }
.section-meta { font-size: 12px; color: var(--color-text-muted); }

.lesson {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.lesson:first-child { border-top: 0; }

.lesson-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-5);
}

.lesson-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: transform 160ms ease;
  padding: 0;
}

.lesson-toggle:hover { color: var(--color-text); }

.lesson.is-open .lesson-toggle {
  transform: rotate(90deg);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border-color: #bfdbfe;
}

.lesson-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-subtle);
  margin-top: 2px;
}

.lesson-title { font-weight: 600; }

.lesson-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lesson-body {
  display: none;
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px dashed var(--color-border);
  background: var(--color-surface-alt);
}

.lesson.is-open .lesson-body { display: block; }

.lesson-error {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-danger-soft);
  border: 1px solid #fecaca;
  color: #7f1d1d;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

/* Scene editor */
.scene-editor {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.scene-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.scene-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.scene-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}

.scene-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.scene-fields .form-row.full { grid-column: 1 / -1; }

.scene-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* --------------------------------------------------------------------------
   Builds page
   -------------------------------------------------------------------------- */
.build-card {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0;
  overflow: hidden;
}

.build-info { padding: var(--space-5); }
.build-info h3 { margin: 0 0 var(--space-1); }

.build-stage-list {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.build-stage-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--color-text-muted);
}

.build-stage-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border-strong);
  flex: 0 0 8px;
}

.build-stage-list .stage-done .dot { background: var(--color-success); }
.build-stage-list .stage-active .dot {
  background: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
  animation: pulse 1.4s ease-in-out infinite;
}

.build-stage-list .stage-done { color: var(--color-text); }
.build-stage-list .stage-active { color: var(--color-accent); font-weight: 600; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--color-accent-soft); }
  50%      { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.12); }
}

.build-log {
  background: #0f172a;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  padding: var(--space-4) var(--space-5);
  margin: 0;
  white-space: pre;
  overflow-x: auto;
  max-height: 300px;
}

.build-log .log-info  { color: #93c5fd; }
.build-log .log-ok    { color: #6ee7b7; }
.build-log .log-warn  { color: #fcd34d; }
.build-log .log-err   { color: #fca5a5; }
.build-log .log-time  { color: #64748b; }

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-5);
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.refresh-caption {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--color-text-muted);
}

.refresh-caption .spin {
  width: 14px;
  height: 14px;
  animation: spin 1.4s linear infinite;
  color: var(--color-accent);
}

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

/* --------------------------------------------------------------------------
   Lesson watch page
   -------------------------------------------------------------------------- */
.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-5);
  align-items: start;
}

.player-card {
  overflow: hidden;
  padding: 0;
}

.player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: block;
}

.player-meta { padding: var(--space-5); }

.scene-track {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.scene-track li {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.scene-track li.is-current {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.scene-track h4 { margin: 0 0 4px; font-size: 14px; }
.scene-track ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.lesson-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-5);
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  min-width: 220px;
  box-shadow: var(--shadow-sm);
}

.pager-btn:hover {
  text-decoration: none;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.pager-btn .label {
  font-size: 11px;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}

.pager-btn .title { font-size: 14px; font-weight: 600; }

.pager-btn.next { text-align: right; }

/* --------------------------------------------------------------------------
   Index / mockup gallery
   -------------------------------------------------------------------------- */
.hero {
  padding: var(--space-8) 0 var(--space-7);
  text-align: center;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 36px;
  margin: var(--space-4) 0 var(--space-3);
  letter-spacing: -0.02em;
}

.hero p { font-size: 16px; color: var(--color-text-muted); max-width: 640px; margin: 0 auto; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.gallery-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.gallery-card:hover {
  text-decoration: none;
  color: inherit;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.gallery-thumb {
  aspect-ratio: 16 / 9;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.gallery-thumb svg { width: 100%; height: 100%; }

.gallery-body { padding: var(--space-4); }

.gallery-body h3 { margin: 0 0 var(--space-1); font-size: 16px; }
.gallery-body p { margin: 0; font-size: 13px; color: var(--color-text-muted); }

/* Style guide block */
.styleguide {
  margin-top: var(--space-7);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.styleguide summary {
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.styleguide summary::-webkit-details-marker { display: none; }
.styleguide summary::after {
  content: "↓";
  color: var(--color-text-subtle);
  transition: transform 160ms ease;
}

.styleguide[open] summary::after { transform: rotate(180deg); }

.styleguide-body {
  padding: var(--space-5);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}

.swatch {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  font-size: 11px;
}

.swatch-color {
  aspect-ratio: 2 / 1;
  border-bottom: 1px solid var(--color-border);
}

.swatch-meta {
  padding: 6px 8px;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
}

.demo-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  padding: var(--space-5) 0 var(--space-6);
  text-align: center;
  font-size: 12px;
  color: var(--color-text-subtle);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

/* --------------------------------------------------------------------------
   Tablet breakpoint — collapse multi-column layouts
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .container { padding: 0 var(--space-4); }

  .nav-links { display: none; }
  .nav-inner { gap: var(--space-3); }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .upload-grid,
  .project-layout,
  .build-card,
  .watch-layout,
  .scene-fields,
  .styleguide-body {
    grid-template-columns: 1fr;
  }

  .toc { position: static; }

  .lesson-row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "toggle title"
      "meta   meta"
      "actions actions";
    row-gap: var(--space-2);
  }

  .lesson-toggle { grid-area: toggle; }
  .lesson-row > .lesson-main { grid-area: title; min-width: 0; }
  .lesson-meta { grid-area: meta; }
  .lesson-actions { grid-area: actions; flex-wrap: wrap; }

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

  .hero { padding: var(--space-6) 0 var(--space-5); }
  .hero h1 { font-size: 28px; }

  .lesson-pager { flex-direction: column; gap: var(--space-3); }
  .pager-btn { width: 100%; }
}
