:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f3f6;
  --text: #1d2433;
  --muted: #687386;
  --line: #d9e0e8;
  --accent: #0f7b6c;
  --accent-strong: #0a5c51;
  --danger: #b42318;
  --panel: var(--surface);
  --panel-raised: #f9fbfd;
  --ink: var(--text);
  --accent-hot: #b42318;
  --success: #137a4b;
  --warn: #b7791f;
  --shadow: rgba(22, 30, 46, 0.14);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: contain;
}

.tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 64px;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

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

.tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto 48px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.inline-form {
  display: flex;
  flex: 1 1 320px;
  gap: 10px;
}

.toolbar input[type="text"],
.clip-fields input,
.clip-fields textarea,
.row-label input[type="text"],
.tier-item select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.toolbar input[type="text"],
.clip-fields input,
.row-label input[type="text"] {
  padding: 0 10px;
}

.inline-form input,
#videoUploadForm input[type="text"] {
  min-width: min(260px, 100%);
  flex: 1 1 220px;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}


@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    padding: 14px 16px 0;
  }

  .brand {
    padding-bottom: 12px;
  }

  .tabs {
    width: 100%;
    height: auto;
    overflow-x: auto;
  }

  .tab {
    min-height: 48px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .page {
    margin: 24px auto;
  }

  .workspace-head {
    align-items: start;
    flex-direction: column;
  }
}


:root {
  --topbar-height: 64px;
  --sticky-gap: 16px;
  --bottom-action-safe-space: 112px;
  --timeline-max-height: calc(100vh - var(--topbar-height) - 48px);
}

html {
  scroll-padding-top: calc(var(--topbar-height) + var(--sticky-gap));
  scroll-padding-bottom: var(--bottom-action-safe-space);
}

.topbar {
  min-height: var(--topbar-height);
}

.tabs {
  height: var(--topbar-height);
}

.tab.active,
.tab[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
}

.tab:focus-visible {
  outline: 3px solid rgba(15, 123, 108, 0.28);
  outline-offset: 3px;
}

.page:has(.generate-bar),
.page.has-generate-bar {
  padding-bottom: var(--bottom-action-safe-space);
}

.block-card,
.upload-form,
.editor,
.control-grid,
.form-field,
.form-fields,
.video-clip,
.toolbar {
  scroll-margin-bottom: var(--bottom-action-safe-space);
}

.generate-bar {
  position: sticky;
  bottom: 0;
  z-index: 8;
  justify-content: flex-end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(22, 30, 46, 0.14);
  backdrop-filter: blur(10px);
}

.timeline-panel {
  position: sticky;
  top: calc(var(--topbar-height) + var(--sticky-gap));
  z-index: 7;
  max-height: var(--timeline-max-height);
  overflow: hidden;
}

@media (max-width: 760px) {
  .page:has(.generate-bar),
  .page.has-generate-bar {
    padding-bottom: 0;
  }

  .timeline-panel,
  .generate-bar {
    position: static;
    max-height: none;
    overflow: visible;
  }
}


/* Stitch tier-list redesign */
:root {
  --stitch-bg: #f7f9fb;
  --stitch-surface: #ffffff;
  --stitch-surface-low: #f2f4f6;
  --stitch-surface-high: #e0e3e5;
  --stitch-text: #191c1e;
  --stitch-muted: #3c4a42;
  --stitch-outline: #6c7a71;
  --stitch-outline-variant: #bbcabf;
  --stitch-border: #e0e3e5;
  --stitch-primary: #006c49;
  --stitch-primary-bright: #10b981;
  --stitch-danger: #ba1a1a;
  --topbar-height: 80px;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--stitch-bg);
  color: var(--stitch-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-size: 20px;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  width: 100%;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid rgb(187 202 191 / 0.3);
  background: rgb(255 255 255 / 0.7);
  font-size: 14px;
  line-height: 20px;
  backdrop-filter: blur(12px);
}

.topbar-brand,
.topbar-actions,
.tabs {
  display: flex;
  align-items: center;
}

.topbar-brand {
  flex: 1 1 0;
  min-width: 0;
  justify-content: flex-start;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--stitch-text);
  font-family: Geist, Inter, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  text-decoration: none;
}

.tabs {
  height: 80px;
  justify-content: center;
  gap: 32px;
}

.tab {
  display: inline-flex;
  height: 100%;
  align-items: center;
  padding: 0;
  border-bottom: 2px solid transparent;
  color: var(--stitch-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
}

.tab:hover {
  color: var(--stitch-primary);
}

.tab.active,
.tab[aria-current="page"] {
  border-bottom-color: var(--stitch-primary);
  color: var(--stitch-primary);
}

.topbar-actions {
  flex: 1 1 0;
  justify-content: flex-end;
  gap: 24px;
}

.mobile-menu-button,
.mobile-menu {
  display: none;
}

.mobile-menu-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--stitch-muted);
}

.mobile-menu-button:hover,
.mobile-menu-button:focus-visible {
  background: var(--stitch-surface-low);
  color: var(--stitch-primary);
}

.mobile-menu[hidden] {
  display: none !important;
}

.utility-button,
.utility-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.utility-form,
.mobile-menu-form {
  display: contents;
}

.account-dropdown {
  position: relative;
  display: inline-flex;
}

.account-trigger {
  max-width: 240px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--stitch-muted);
  cursor: pointer;
}

.account-trigger:hover,
.account-trigger:focus-visible,
.account-trigger[aria-expanded="true"] {
  background: var(--stitch-surface-low);
  color: var(--stitch-primary);
  outline: 0;
}

.account-trigger[aria-expanded="true"] .account-caret {
  transform: rotate(180deg);
}

.utility-user {
  max-width: 220px;
}

.utility-user .account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-caret {
  margin-left: -2px;
  font-size: 18px;
  transition: transform 140ms ease;
}

.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 164px;
  overflow: hidden;
  padding: 4px;
  border: 1px solid var(--stitch-outline);
  border-radius: 6px;
  background: var(--stitch-surface);
  box-shadow: 0 12px 28px rgb(22 30 46 / 0.14);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-form {
  display: contents;
}

.account-menu-item {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--stitch-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  background: var(--stitch-surface-low);
  color: var(--stitch-primary);
  outline: 0;
}

.utility-button-primary {
  padding: 0 24px;
  border: 1px solid var(--stitch-primary);
  background: var(--stitch-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgb(22 30 46 / 0.08);
}

.utility-button-primary:hover {
  background: #00583c;
}

.utility-link {
  color: var(--stitch-muted);
}

.utility-link:hover {
  color: var(--stitch-primary);
}

.utility-button-secondary {
  padding: 0 24px;
  border: 1px solid var(--stitch-outline);
  background: var(--stitch-surface);
  color: var(--stitch-text);
  box-shadow: 0 1px 2px rgb(22 30 46 / 0.04);
}

.utility-button-secondary:hover {
  background: var(--stitch-surface-low);
}

.page {
  flex: 1 0 auto;
}

body.tier-route .tier-page {
  width: 100%;
  max-width: none;
  margin: 0;
}


.site-footer {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 48px 32px;
  border-top: 1px solid var(--stitch-outline-variant);
  background: var(--stitch-surface);
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

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

.social-links a {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  color: var(--stitch-muted);
}

.social-links a:hover {
  color: var(--stitch-primary);
}

.social-links svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.copy-link-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 999px;
  background: var(--stitch-surface-low);
  color: var(--stitch-text);
  font-size: 13px;
  font-weight: 500;
}

.copy-link-button:hover {
  background: var(--stitch-surface-high);
}

.copy-link-button .material-symbols-outlined {
  font-size: 18px;
}

.footer-bottom {
  display: flex;
  width: min(100%, 1200px);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid rgb(187 202 191 / 0.3);
  color: rgb(60 74 66 / 0.8);
  font-size: 12px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--stitch-text);
  font-weight: 700;
}

.footer-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: rgb(60 74 66 / 0.82);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--stitch-primary);
  text-decoration: underline;
}

.api-docs {
  display: grid;
  gap: 24px;
  max-width: 920px;
  margin: 0 auto;
}

.api-docs-head,
.api-docs-section {
  display: grid;
  gap: 12px;
}

.api-docs-head p,
.api-docs-section p,
.api-docs-section li,
.api-field-list dd {
  color: var(--stitch-muted);
  line-height: 1.65;
}

.api-docs code {
  border-radius: 4px;
  background: var(--stitch-surface-low);
  color: var(--stitch-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.api-docs :not(pre) > code {
  padding: 2px 5px;
}

.api-docs pre {
  margin: 0;
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 8px;
  background: #101418;
}

.api-docs pre code {
  padding: 0;
  background: transparent;
  color: #edf8f4;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.api-field-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.api-field-list div {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--stitch-outline-variant);
}

.api-field-list dt {
  font-weight: 700;
}

.api-field-list dd {
  margin: 0;
}


@media (max-width: 900px) {
  :root {
    --topbar-height: 80px;
  }

  .topbar {
    min-height: var(--topbar-height);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: 0 16px;
    flex-wrap: wrap;
  }

  .topbar-brand {
    height: var(--topbar-height);
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .brand {
    padding-bottom: 0;
  }

  .tabs,
  .topbar-actions {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .mobile-menu {
    flex: 0 0 100%;
    width: 100%;
    padding: 0 0 12px;
    border-top: 1px solid rgb(187 202 191 / 0.3);
  }

  .mobile-menu:not([hidden]) {
    display: block;
  }

  .mobile-menu-nav {
    display: grid;
    gap: 4px;
    padding-top: 8px;
  }

  .mobile-menu-nav .tab,
  .mobile-menu-link {
    display: flex;
    width: 100%;
    height: auto;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    color: var(--stitch-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
  }

  button.mobile-menu-link {
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
  }

  .mobile-menu-nav .tab.active,
  .mobile-menu-nav .tab[aria-current="page"] {
    background: #edf8f4;
    color: var(--stitch-primary);
  }

  .mobile-menu-nav .tab:hover,
  .mobile-menu-link:hover {
    background: var(--stitch-surface-low);
    color: var(--stitch-primary);
  }

  .mobile-menu-primary {
    background: var(--stitch-primary);
    color: #ffffff;
  }

  .mobile-menu-primary:hover {
    background: #00583c;
    color: #ffffff;
  }

  .site-footer {
    gap: 24px;
    padding: 32px 16px;
  }

  .footer-actions {
    flex-direction: column;
    gap: 20px;
  }

  .footer-bottom {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .api-field-list div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
