:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --surface: #14141b;
  --surface-2: #1c1c26;
  --surface-3: #262633;
  --text: #f5f5f7;
  --muted: #a3a3b2;
  --peach: #ff7a2f;
  --peach-soft: #ff9a5c;
  --peach-deep: #c65312;
  --line: rgba(255, 255, 255, 0.1);
  --line-peach: rgba(255, 122, 47, 0.45);
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --serif: Didot, "Bodoni MT", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: Inter, "Avenir Next", "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
  --page: min(1360px, calc(100% - 32px));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 520px at 80% -10%, rgba(255, 122, 47, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 28px;
  padding: 12px max(16px, calc((100% - 1360px) / 2));
  background: linear-gradient(180deg, rgba(11, 11, 16, 0.96), rgba(11, 11, 16, 0.78));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}

.brand span {
  background: linear-gradient(90deg, #fff, var(--peach-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
}

.site-nav {
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}

.site-nav.is-open {
  display: flex;
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 122, 47, 0.16);
  box-shadow: inset 0 0 0 1px var(--line-peach);
}

main {
  width: var(--page);
  margin: 0 auto;
  padding: 24px 0 80px;
}

.site-footer {
  width: var(--page);
  margin: 0 auto;
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.005em;
}

h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.1;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.45rem;
  margin: 0;
}

h3 {
  font-size: 1.02rem;
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--peach);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.card p,
.lede,
.description,
.meta,
.empty,
#progress-prompt,
#progress-note {
  margin: 0;
  color: var(--muted);
}

.lede {
  margin-bottom: 20px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

/* ---------- Buttons ---------- */

button,
.button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--peach);
  color: #17110d;
  border: 0;
  border-radius: 999px;
  padding: 11px 24px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

button:hover,
.button:hover {
  background: var(--peach-soft);
  box-shadow: 0 8px 24px rgba(255, 122, 47, 0.35);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.ghost,
.nav-toggle,
#like-button,
#dislike-button {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

button.ghost:hover,
.nav-toggle:hover,
#like-button:hover,
#dislike-button:hover {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.nav-toggle {
  padding: 8px 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.chip {
  display: inline-block;
  background: rgba(255, 122, 47, 0.14);
  color: var(--peach-soft);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.2s;
}

.chip:hover {
  background: rgba(255, 122, 47, 0.3);
}

/* ---------- Jumbotron ---------- */

.jumbotron {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.jumbotron-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  min-height: 300px;
  background: #000;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}

.jumbotron-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: auto;
}

.jumbotron-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 11, 16, 0.92) 0%, rgba(11, 11, 16, 0.55) 38%, transparent 72%),
    linear-gradient(0deg, rgba(11, 11, 16, 0.95) 0%, transparent 45%);
}

.jumbotron-stage .captions {
  top: 16%;
  bottom: auto;
  left: 46%;
  z-index: 2;
}

.jumbotron-stage .captions-toggle {
  z-index: 4;
}

.jumbotron-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 40rem;
  padding: 20px 18px 26px;
}

.jumbotron-info h2 {
  font-size: clamp(1.5rem, 4.6vw, 3rem);
  line-height: 1.08;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.jumbotron-info .eyebrow {
  margin: 0;
}

.jumbotron-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0;
  color: #d8d8e2;
  font-size: 0.86rem;
}

.jumbotron-blurb {
  display: none;
  margin: 0;
  color: #dcdce6;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}

.jumbotron-info .actions {
  margin-top: 4px;
}

.jumbotron-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
}

.jumbotron-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--peach);
}

.jumbotron-queue {
  min-width: 0;
}

.queue-heading {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.queue-heading span {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  letter-spacing: 0;
}

.jumbotron-queue ol {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 2px 2px 10px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 270px;
  padding: 8px;
  scroll-snap-align: start;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  font-weight: 400;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.queue-item:hover {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

.queue-item.is-active {
  background: rgba(255, 122, 47, 0.12);
  box-shadow: inset 0 0 0 2px var(--peach);
}

.queue-thumb {
  position: relative;
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-3);
}

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

.queue-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.queue-rank {
  color: var(--peach);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.queue-title {
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.queue-views {
  color: var(--muted);
  font-size: 0.76rem;
}

/* ---------- Home intro (compact brand strip) ---------- */

.intro {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 8px;
  padding: 14px 18px 14px 14px;
  background: linear-gradient(120deg, var(--surface), rgba(255, 122, 47, 0.09));
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.intro img {
  flex: none;
  width: 72px;
  height: 96px;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 10px;
  background: #000;
}

.intro-copy .eyebrow {
  margin-bottom: 4px;
}

.intro-copy h1 {
  margin: 0 0 4px;
  font-size: clamp(1.3rem, 3.4vw, 1.9rem);
}

.intro-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.intro-copy .button {
  margin-top: 12px;
  padding: 8px 20px;
  font-size: 0.85rem;
}

/* ---------- Shelves, rails, cards ---------- */

.shelf {
  margin-top: 36px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.row a {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}

.row a:hover {
  color: var(--peach);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px 16px;
}

.rail {
  display: flex;
  gap: 14px;
  margin: 0 -16px;
  padding: 6px 16px 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail .card {
  flex: none;
  width: min(72vw, 300px);
  scroll-snap-align: start;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.card h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}

.card-link:hover h3,
.card-link:focus-visible h3 {
  color: var(--peach-soft);
}

.card p:not(.views):not(.status) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 0.84rem;
  line-height: 1.45;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-link:hover .thumb,
.card-link:focus-visible .thumb {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--peach);
}

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

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.views {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.status {
  margin: 4px 0 0;
  color: var(--peach);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-failed,
.status-cancelled {
  color: #ff6b6b;
}

/* ---------- Video + watch page ---------- */

video {
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 1px var(--line);
}

.watch {
  display: grid;
  gap: 32px;
}

.watch-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.watch-main .player {
  box-shadow: var(--shadow);
}

.watch-main h1 {
  margin: 6px 0 0;
}

.watch-main h2,
.watch-side h2 {
  margin-top: 18px;
}

.watch-side h2 {
  margin: 0 0 14px;
}

.watch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.description {
  line-height: 1.7;
}

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

.scenes li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.scenes span {
  color: var(--peach);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 3.2em;
}

/* ---------- Forms and pages ---------- */

.auth-card {
  width: min(440px, 100%);
  margin: 24px auto 0;
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}

.auth-card .mark {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
}

.auth-card h1 {
  margin-top: 14px;
}

.auth-switch {
  color: var(--muted);
}

.auth-switch a {
  color: var(--peach);
  font-weight: 600;
}

.page-intro {
  display: grid;
  gap: 16px;
  margin-bottom: 12px;
}

.page-intro .mark {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 16px;
  background: #000;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
}

form.search,
form.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  font: inherit;
  transition: border-color 0.2s, background 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--peach);
  background: var(--surface-3);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.form-error {
  margin: 0;
  color: #ff8a80;
}

.progress,
.create-form {
  max-width: 760px;
  margin-top: 22px;
}

.create-form {
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.progress {
  padding-top: 8px;
}

.generation-live {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 16px 0 4px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120px 80px at 12% 50%, rgba(255, 122, 47, 0.18), transparent 70%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.generation-live[hidden] {
  display: none;
}

.orb {
  position: relative;
  width: 76px;
  height: 76px;
  flex: none;
}

.orb img {
  position: absolute;
  inset: 14px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  animation: stage-pulse 2.2s ease-in-out infinite;
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--peach);
  border-right-color: rgba(255, 122, 47, 0.4);
  animation: orb-spin 1.15s linear infinite;
}

.orb-ring-2 {
  inset: 8px;
  border-top-color: #fff;
  border-right-color: rgba(255, 255, 255, 0.25);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.generation-copy {
  flex: 1;
  min-width: 0;
}

#generation-queue {
  margin: 0;
  color: var(--muted);
}

#generation-eta {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.generation-meter {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.generation-meter span {
  position: relative;
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--peach), #ffd23f);
  transition: width 0.6s ease;
}

.generation-meter span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  background-size: 200% 100%;
  animation: stage-scan 1.4s linear infinite;
}

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

.artifact[aria-busy="true"] h2::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--peach);
  vertical-align: middle;
  animation: stage-pulse 1s ease-in-out infinite;
}

.stages {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 8px;
  list-style: none;
  padding: 16px 0 0;
  margin: 0 0 14px;
}

.stages li {
  position: relative;
  flex: 1 1 92px;
  border-top: 3px solid var(--surface-3);
  border-radius: 2px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.stages li.is-done {
  border-top-color: var(--peach);
  color: var(--text);
}

.stages li.is-current {
  border-top-color: var(--peach);
  color: var(--peach);
}

.stages li.is-current::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -3px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fff, var(--peach), transparent);
  background-size: 200% 100%;
  animation: stage-scan 1.2s linear infinite;
}

.stages li.is-current::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--peach);
  vertical-align: middle;
  animation: stage-pulse 1s ease-in-out infinite;
}

.stages li.is-failed {
  border-top-color: #ff6b6b;
  color: #ff8a80;
}

.stage-failed {
  display: block;
  margin-top: 4px;
  color: #ff8a80;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stage-failure {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 3px solid #ff6b6b;
  background: var(--surface);
}

.stage-failure p {
  margin: 0;
}

.stage-failure-title {
  font-weight: 600;
}

.stage-failure-detail {
  margin-top: 6px;
  color: var(--muted);
}

.stage-failure-inline {
  margin: 8px 0 0;
  color: #ff8a80;
}

.stage-failure details {
  margin-top: 12px;
}

.stage-failure summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
}

.stage-failure pre {
  margin: 8px 0 0;
  max-height: 9rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 0.75rem;
}

.artifact {
  margin-top: 28px;
}

.artifact h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.artifact h3 {
  margin: 18px 0 8px;
  color: var(--peach);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.script-cast,
.script-scenes,
.cast,
.scene-media {
  list-style: none;
  padding: 0;
  margin: 0;
}

.script-cast li,
.script-scenes li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.script-cast h4,
.script-scenes h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.script-cast p,
.script-scenes p {
  margin: 0;
  color: var(--muted);
}

.script-scenes span {
  display: inline-block;
  min-width: 6.5em;
  color: var(--peach);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cast,
.scene-media {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.cast {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.scene-media {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.cast img,
.cast .skeleton,
.scene-media img,
.scene-media video,
.scene-media .skeleton,
.frame-wrap img {
  width: 100%;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.cast img,
.cast .skeleton {
  aspect-ratio: 1;
}

.scene-media img,
.scene-media video,
.scene-media .skeleton,
.frame-wrap,
.frame-wrap img {
  aspect-ratio: 9 / 16;
}

.cast p,
.scene-media p {
  margin: 8px 0 0;
}

.frame-wrap {
  position: relative;
}

.frame-wrap.is-animating::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 122, 47, 0.45) 50%,
    transparent 80%
  );
  background-size: 200% 100%;
  animation: stage-scan 1.4s linear infinite;
}

.frame-status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.working-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
}

.working-line::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--peach);
  animation: stage-pulse 1s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-3) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: stage-scan 1.4s linear infinite;
}

.skeleton-text {
  height: 14px;
  margin-top: 10px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 62%;
}

@keyframes stage-scan {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@keyframes stage-pulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stages li.is-current::before,
  .stages li.is-current::after,
  .working-line::before,
  .skeleton,
  .frame-wrap.is-animating::after,
  .orb img,
  .orb-ring,
  .generation-meter span::after,
  .artifact[aria-busy="true"] h2::after {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }

  .thumb,
  .queue-item,
  button,
  .button {
    transition: none;
  }
}

#account-status {
  margin: 0 0 12px;
}

/* ---------- Breakpoints ---------- */

@media (max-width: 719px) {
  form.search button,
  .progress .actions button,
  #create-form button[type="submit"] {
    width: 100%;
    align-self: stretch;
  }
}

@media (min-width: 560px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rail {
    display: flex;
  }

  .jumbotron-info {
    padding: 28px 28px 34px;
  }

  .jumbotron-blurb {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

@media (min-width: 720px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: flex;
    flex-basis: auto;
    flex-direction: row;
    gap: 4px;
    padding-bottom: 0;
  }

  .page-intro {
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
  }

  .page-intro .mark {
    width: 72px;
    height: 72px;
  }

  form.search {
    flex-direction: row;
    align-items: end;
  }

  form.search label {
    flex: 1;
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rail {
    display: flex;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .jumbotron-info {
    padding: 44px 48px 52px;
    gap: 14px;
  }

  .watch {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }

  .watch-side .grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rail .card {
    width: 300px;
  }

  .watch-side .grid {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   Modern + dynamic layer: motion, navigation helpers, page-specific UI
   ===================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--peach);
  color: #17110d;
  font-weight: 600;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 10px;
}

kbd {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.15);
  color: var(--text);
  font: inherit;
  font-size: 0.8em;
}

/* ---------- Motion ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

main > * {
  animation: page-in 0.5s ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card {
  animation: card-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.site-header {
  transition: background 0.3s, box-shadow 0.3s;
}

.site-header.is-scrolled {
  background: rgba(11, 11, 16, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Pills, filters, topic bar ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.pill:hover {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.pill.is-active {
  background: var(--peach);
  color: #17110d;
  box-shadow: none;
}

.pill .count {
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.75rem;
}

.pill.is-active .count {
  background: rgba(0, 0, 0, 0.18);
}

.topic-bar,
.filter-bar {
  position: sticky;
  top: 61px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px -16px 0;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(180deg, rgba(11, 11, 16, 0.94) 70%, rgba(11, 11, 16, 0));
}

.topic-bar::-webkit-scrollbar,
.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar {
  position: static;
  margin: 8px 0 22px;
  padding: 0;
  background: none;
}

.search-landing .topic-bar {
  position: static;
  margin: 28px 0 0;
  padding: 0;
  flex-wrap: wrap;
  background: none;
}

.examples-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.shelf {
  scroll-margin-top: 130px;
}

/* ---------- Rails with arrows, ranked rail ---------- */

.rail-wrap {
  position: relative;
}

.rail-arrow {
  position: absolute;
  top: 38%;
  z-index: 3;
  display: none;
  width: 46px;
  height: 46px;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(11, 11, 16, 0.85);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: 1.9rem;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.rail-arrow:hover {
  background: var(--peach);
  color: #17110d;
  transform: translateY(-50%) scale(1.08);
}

.rail-prev {
  left: -12px;
}

.rail-next {
  right: -12px;
}

.rail-arrow[hidden] {
  display: none !important;
}

.rail-ranked {
  gap: 6px;
}

.ranked {
  position: relative;
  flex: none;
  width: min(62vw, 240px);
  scroll-snap-align: start;
}

.ranked-main {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding-left: 52px;
}

.rank-number {
  position: absolute;
  left: 0;
  bottom: -14px;
  z-index: 1;
  color: var(--bg);
  font-family: var(--serif);
  font-size: 7.4rem;
  font-weight: 700;
  line-height: 1;
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.45);
  transition: -webkit-text-stroke-color 0.25s;
}

.ranked:hover .rank-number {
  -webkit-text-stroke-color: var(--peach);
}

.ranked-thumb {
  position: relative;
  z-index: 2;
  display: block;
  flex: 1;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line), 0 14px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ranked:hover .ranked-thumb {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 0 0 2px var(--peach), 0 18px 40px rgba(0, 0, 0, 0.6);
}

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

.ranked-title {
  position: absolute;
  right: 8px;
  bottom: 10px;
  left: 60px;
  z-index: 3;
  overflow: hidden;
  padding: 18px 8px 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Topic hero ---------- */

.topic-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 240px;
  margin-bottom: 30px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--surface), rgba(255, 122, 47, 0.18));
  box-shadow: inset 0 0 0 1px var(--line);
}

.topic-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: blur(6px) saturate(1.2);
  transform: scale(1.1);
}

.topic-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(11, 11, 16, 0.95), rgba(11, 11, 16, 0.2) 70%);
}

.topic-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  padding: 28px 24px;
}

.topic-hero-copy h1 {
  margin-bottom: 8px;
}

.topic-hero-copy .lede {
  margin-bottom: 12px;
}

/* ---------- Search ---------- */

.search-landing {
  max-width: 820px;
  margin: 22px auto 0;
  padding: 8px 0 12px;
}

.search-landing.compact {
  max-width: none;
  margin: 0 0 22px;
  padding: 0;
}

.search-landing h1 {
  margin-bottom: 18px;
}

form.search.search-hero {
  position: relative;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  transition: box-shadow 0.25s;
}

form.search.search-hero:focus-within {
  box-shadow: inset 0 0 0 2px var(--peach), 0 0 0 6px rgba(255, 122, 47, 0.15), var(--shadow);
}

.search-icon {
  color: var(--peach);
  font-size: 1.5rem;
  line-height: 1;
  transform: rotate(-45deg);
}

form.search.search-hero input {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  background: none;
  border: 0;
  font-size: 1.05rem;
}

form.search.search-hero input:focus {
  background: none;
}

form.search.search-hero button {
  align-self: center;
}

.search-tip {
  margin-top: 12px;
}

/* ---------- Auth ---------- */

.auth-layout {
  display: grid;
  width: min(940px, 100%);
  margin: 18px auto 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}

.auth-layout .auth-card {
  width: 100%;
  margin: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  padding: 32px 28px 36px;
}

.auth-art {
  position: relative;
  display: none;
  min-height: 420px;
  overflow: hidden;
}

.auth-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(11, 11, 16, 0.92), rgba(11, 11, 16, 0.1) 65%);
}

.auth-art-copy {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  padding: 28px;
}

.auth-art-copy h2 {
  font-size: 2rem;
  line-height: 1.1;
}

.auth-art-copy p:last-child {
  margin: 8px 0 0;
  color: #d8d8e2;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 64px;
}

.link-button {
  background: none;
  color: var(--peach);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.link-button:hover {
  background: rgba(255, 122, 47, 0.14);
  box-shadow: none;
  transform: none;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.password-toggle:hover {
  transform: translateY(-50%);
}

/* ---------- Create ---------- */

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field-foot {
  display: flex;
  justify-content: flex-end;
}

.counter {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

textarea#prompt-input {
  min-height: 140px;
  overflow: hidden;
  transition: height 0.15s ease, border-color 0.2s, background 0.2s;
}

.create-form #generate-button {
  padding: 13px 34px;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--peach), #ff5a1f);
}

.stages li {
  border-top-width: 4px;
}

.stages li.is-current {
  text-shadow: 0 0 14px rgba(255, 122, 47, 0.7);
}

.artifact {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: page-in 0.5s ease both;
}

/* ---------- Watch ---------- */

#like-button.is-on,
#dislike-button.is-on {
  background: var(--peach);
  color: #17110d;
  box-shadow: none;
}

.description-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.description.is-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.watch-prompt,
.watch-cast {
  margin-top: 4px;
}

.watch-prompt h2,
.watch-cast h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.watch-prompt p {
  margin: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.watch-cast .cast img,
.watch-cast .cast .skeleton {
  aspect-ratio: 3 / 4;
}

.scenes {
  position: relative;
  padding-left: 26px;
}

.scenes::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--peach), rgba(255, 122, 47, 0.1));
}

.scenes li {
  position: relative;
  align-items: baseline;
  border-top: 0;
  padding: 10px 0;
}

.scenes li::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 3px var(--peach);
}

.scenes li p {
  margin: 0;
}

@media (min-width: 960px) {
  .watch-side {
    position: sticky;
    top: 84px;
  }
}

/* ---------- Cards ---------- */

.card.is-loading {
  animation: none;
}

.card.is-loading .thumb {
  box-shadow: none;
}

.card.is-loading .skeleton-text {
  margin-top: 4px;
}

/* ---------- Footer, toasts ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.05rem;
}

.footer-brand .logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.footer-status[data-state="up"] .status-dot {
  background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: dot-ping 2s ease-out infinite;
}

.footer-status[data-state="down"] .status-dot {
  background: #ff6b6b;
}

@keyframes dot-ping {
  70% {
    box-shadow: 0 0 0 8px rgba(61, 220, 132, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 132, 0);
  }
}

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-in 0.3s ease both;
}

.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.3s;
}

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

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  main > *,
  .card,
  .artifact,
  .toast,
  .footer-status[data-state="up"] .status-dot {
    animation: none;
  }
}

@media (min-width: 720px) {
  .auth-layout {
    grid-template-columns: 1fr 1fr;
  }

  .auth-art {
    display: block;
    order: 2;
  }

  .topic-bar {
    margin: 20px 0 0;
    padding-left: 0;
    padding-right: 0;
  }

  .topic-hero-copy {
    padding: 40px 44px;
  }

  .topic-hero {
    min-height: 280px;
  }

  .rail-arrow {
    display: block;
  }
}

@media (max-width: 719px) {
  form.search.search-hero {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
  }

  form.search.search-hero button {
    width: 100%;
  }

  .rank-number {
    font-size: 5.6rem;
  }

  .ranked-main {
    padding-left: 40px;
  }

  .ranked-title,
  .ranked-creator {
    left: 46px;
  }
}

/* Create page: one centred column */
body[data-page="create"] main > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

body[data-page="create"] .progress,
body[data-page="create"] .create-form {
  width: 100%;
}

main {
  min-height: 62vh;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* ---------- Player: 9:16 video, captions, watermark-safe layout ---------- */

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius-lg);
  container-type: inline-size;
}

.player video {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}

/* Desktop: a tall frame as high as the window allows, centred. */
.player.is-portrait {
  width: min(100%, calc(78vh * 9 / 16));
  max-height: 78vh;
  margin-inline: auto;
  aspect-ratio: 9 / 16;
}

.player.is-portrait video {
  object-fit: cover;
}

/* Phone: the video takes the whole width and the rest of the screen below the header. */
@media (max-width: 719px) {
  .player.is-portrait {
    width: 100vw;
    height: calc(100vh - 61px);
    height: calc(100dvh - 61px);
    max-height: none;
    margin-inline: calc(50% - 50vw);
    aspect-ratio: auto;
    border-radius: 0;
  }
}

.captions {
  position: absolute;
  right: 6%;
  bottom: 24%;
  left: 6%;
  z-index: 2;
  margin: 0;
  color: #fff;
  font-family: var(--sans);
  font-size: 1.5rem;
  font-size: clamp(1.1rem, 7cqw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.16em #000;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}

.captions .word {
  display: inline-block;
  margin: 0 0.1em;
  transition: color 0.08s, transform 0.08s;
}

.captions .word.is-active {
  color: #ffd23f;
  transform: scale(1.1);
}

.captions-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  align-self: auto;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  backdrop-filter: blur(6px);
}

.captions-toggle:hover {
  background: rgba(0, 0, 0, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transform: none;
}

.captions-toggle[aria-pressed="true"] {
  background: var(--peach);
  color: #17110d;
  box-shadow: none;
}

.captions-toggle[aria-pressed="false"] {
  text-decoration: line-through;
  opacity: 0.75;
}

/* Home hero on a phone: a tall stage, so the video fills it with little cropping. */
@media (max-width: 719px) {
  .jumbotron-stage {
    aspect-ratio: 9 / 15;
    max-height: 82vh;
    max-height: 82dvh;
  }

  .jumbotron-stage .captions {
    left: 8%;
  }
}

/* Home hero: the tall video sits on the right and the title keeps the left. */
@media (min-width: 720px) {
  .jumbotron-stage video {
    object-fit: contain;
    object-position: 82% center;
  }
}

/* Scene previews on the create page are tall too. */
.scene-media {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.scene-media img,
.scene-media video,
.scene-media .skeleton,
.frame-wrap img {
  aspect-ratio: 9 / 16;
}

/* Create page guide: prompt tips, stages, models */
body[data-page="create"] main > .guide,
body[data-page="create"] main > .guide-nav {
  max-width: 980px;
}

.guide-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
}

.guide-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
}

.guide-nav a:hover,
.guide-nav a:focus-visible {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-peach);
}

.guide {
  margin-top: 40px;
  scroll-margin-top: 90px;
}

.guide h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
}

.guide h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.guide p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.guide .guide-lead {
  max-width: 62ch;
  margin-bottom: 18px;
}

.tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tips li,
.model-card,
.prompt-compare figure {
  padding: 16px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
}

.prompt-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.prompt-compare figure {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.prompt-compare figcaption {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt-strong {
  box-shadow: inset 0 0 0 1px var(--line-peach);
}

.prompt-strong figcaption {
  color: var(--peach-soft);
}

.prompt-compare blockquote {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--line-peach);
  color: var(--text);
  line-height: 1.55;
}

.prompt-compare .pill {
  align-self: flex-start;
  margin-top: auto;
}

.stage-guide {
  position: relative;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-guide-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  transition: background 0.25s, box-shadow 0.25s;
}

.stage-guide-item.is-current {
  background: rgba(255, 122, 47, 0.1);
  box-shadow: inset 0 0 0 1px var(--line-peach);
}

.stage-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--peach-soft);
  font-weight: 700;
  font-size: 0.9rem;
}

.stage-guide-item.is-current .stage-number {
  background: var(--peach);
  color: #1a0d05;
}

.stage-guide h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.stage-time {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 122, 47, 0.14);
  color: var(--peach-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}

.model-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.model-card .model-role {
  color: var(--peach-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.model-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.model-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: auto 0 0;
  padding: 10px 0 0;
  list-style: none;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.model-links a {
  color: var(--peach-soft);
}

.guide .meta {
  margin-top: 14px;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .stage-guide-item {
    grid-template-columns: 28px 1fr;
    gap: 10px;
    padding: 12px 6px;
  }

  .stage-number {
    width: 28px;
    height: 28px;
  }
}

/* =====================================================================
   Profile corner, creators, comments, profile page, proof-of-work panel
   ===================================================================== */

/* ---------- Profile icon, always in the top-right corner of the screen ---------- */

.profile-corner {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 50;
}

.account-button {
  align-self: auto;
  gap: 8px;
  padding: 3px;
  background: rgba(20, 20, 27, 0.88);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-peach), 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.account-button:hover {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--peach), 0 8px 24px rgba(0, 0, 0, 0.55);
  transform: none;
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--peach), var(--peach-deep));
  color: #17110d;
  font-weight: 700;
  line-height: 1;
}

.avatar svg {
  display: block;
}

.avatar.is-guest {
  background: var(--surface-3);
  color: var(--peach-soft);
  box-shadow: inset 0 0 0 1.5px var(--line-peach);
}

.avatar-lg {
  width: 84px;
  height: 84px;
  font-size: 2.2rem;
}

.avatar-lg svg {
  width: 40px;
  height: 40px;
}

.profile-corner[data-state="loading"] .avatar {
  animation: avatar-pulse 1.4s ease-in-out infinite;
}

@keyframes avatar-pulse {
  50% {
    box-shadow: inset 0 0 0 1.5px var(--peach), 0 0 0 6px rgba(255, 122, 47, 0.18);
  }
}

.account-name {
  display: none;
  max-width: 150px;
  overflow: hidden;
  padding-right: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 28px));
  padding: 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}

.account-head {
  padding: 8px 12px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.account-title {
  margin: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.account-menu a,
.menu-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-self: stretch;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
}

.account-menu a:hover,
.menu-button:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  transform: none;
}

@media (min-width: 1100px) {
  .account-name {
    display: block;
  }
}

/* Keep the header's own content clear of the corner icon. */
.site-header {
  padding-right: max(64px, calc((100% - 1360px) / 2));
}

@media (min-width: 1100px) {
  .site-header {
    padding-right: max(236px, calc((100% - 1360px) / 2));
  }
}

/* ---------- Who made a video ---------- */

.creator {
  color: var(--peach-soft);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.creator:hover,
.creator:focus-visible {
  color: #fff;
  text-decoration-color: currentColor;
}

.creator.is-guest::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 0.05em;
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.byline {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-meta .by {
  color: var(--muted);
}

.jumbotron-meta .by {
  color: #b9b9c6;
}

.ranked-creator {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 68px;
  z-index: 4;
  overflow: hidden;
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranked-title {
  padding-bottom: 20px;
}

/* ---------- Profile page ---------- */

.profile-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 24px;
  margin-bottom: 28px;
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.profile-copy {
  min-width: 0;
}

.profile-copy h1 {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.profile-copy .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.profile-copy .meta + .meta {
  margin-top: 8px;
}

.profile-copy .meta a {
  color: var(--peach-soft);
  font-weight: 600;
}

/* ---------- Comments ---------- */

.comments {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.comments h2 {
  margin-top: 14px;
}

.comments h2 .count {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 1rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-form textarea {
  min-height: 74px;
  max-height: 240px;
  resize: vertical;
}

.comment-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.comment-foot button[type="submit"] {
  margin-left: auto;
}

.comment-foot .comment-as {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

button.emoji {
  align-self: auto;
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
  font-size: 1.1rem;
}

button.emoji:hover {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  transform: none;
}

.comment-list,
.reply-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment-list {
  gap: 18px;
}

.comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  font-size: 0.86rem;
}

.comment-time {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Comment text is plain text: keep the line breaks, never the markup. */
.comment-body {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.55;
}

.comment-actions {
  display: flex;
  gap: 14px;
}

.reply-list {
  gap: 14px;
  margin-top: 6px;
  padding-left: 18px;
  border-left: 2px solid var(--line);
}

.reply-list:empty {
  display: none;
}

.reply-slot:empty {
  display: none;
}

.reply-form {
  margin: 6px 0 4px 18px;
}

.reply-form textarea {
  min-height: 56px;
}

.more-replies {
  align-self: flex-start;
  margin-left: 18px;
}

/* ---------- Proof of work: what it is and why there is a wait ---------- */

.pow-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.pow-panel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 70;
  width: min(440px, calc(100vw - 24px));
  padding: 16px 18px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line-peach);
  transform: translateX(-50%);
  animation: pow-in 0.25s ease both;
}

.pow-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pow-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 122, 47, 0.18);
  border-radius: 50%;
}

.pow-text {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.pow-bar {
  height: 6px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.pow-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--peach), var(--peach-soft));
  border-radius: inherit;
  transition: width 0.2s linear;
}

.pow-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.pow-panel.is-done .pow-bar span {
  background: #3ddc84;
}

.pow-panel.is-done .pow-text {
  display: none;
}

@keyframes pow-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pow-panel,
  .profile-corner[data-state="loading"] .avatar {
    animation: none;
  }

  .pow-bar span {
    transition: none;
  }
}

/* ---------- For agents: MCP banner, guide page, footer links, pager ---------- */

.agent-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 20px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.agent-banner h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.agent-banner p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.agent-banner .actions {
  margin: 0;
}

.mcp-url,
.agent-doc code,
.agent-tools code {
  padding: 2px 8px;
  background: var(--surface-3);
  border-radius: 6px;
  color: var(--peach-soft);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.agent-doc {
  max-width: 860px;
  margin: 0 0 24px;
}

.agent-doc h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.agent-doc p,
.agent-doc li {
  color: var(--muted);
  line-height: 1.6;
}

.agent-doc a {
  color: var(--peach-soft);
  text-decoration: underline;
}

.agent-doc .code-block {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
}

.agent-doc .code-block code {
  padding: 0;
  background: none;
  white-space: pre;
}

.agent-doc.public-warning {
  padding: 16px 20px;
  background: rgba(255, 122, 47, 0.08);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line-peach);
}

.agent-doc.public-warning p {
  color: var(--text);
}

.agent-table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9rem;
}

.agent-table th,
.agent-table td {
  padding: 6px 18px 6px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}

.agent-tools {
  columns: 2 340px;
  padding-left: 18px;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .footer-links a:hover {
  color: var(--peach-soft);
}

.public-note {
  color: var(--text);
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
