:root {
  color-scheme: dark;
  --bg: #080912;
  --bg-soft: #101321;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f7f7fb;
  --muted: #a9afc3;
  --accent: #8b5cf6;
  --accent-2: #12d6df;
  --accent-3: #ff7a59;
  --success: #43e89f;
  --warning: #ffd166;
  --danger: #ff6b7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(139, 92, 246, 0.34), transparent 28rem),
    radial-gradient(circle at 82% 4%, rgba(18, 214, 223, 0.22), transparent 26rem),
    radial-gradient(circle at 74% 72%, rgba(255, 122, 89, 0.14), transparent 28rem),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(20px, 5vw, 72px);
  background: rgba(8, 9, 18, 0.74);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.nav {
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
}

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

.nav-cta {
  padding: 10px 16px;
  color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.menu-button {
  display: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 10px 14px;
}

.hero,
.studio-section,
.workflow-section,
.gallery-section {
  padding: clamp(64px, 10vw, 118px) clamp(20px, 5vw, 72px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.92fr);
  gap: clamp(36px, 6vw, 84px);
  align-items: center;
  min-height: calc(100vh - 80px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 24px;
  font-size: clamp(3.5rem, 8vw, 7.9rem);
  line-height: 0.87;
  letter-spacing: -0.08em;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 4.5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.16rem;
  letter-spacing: -0.03em;
}

.hero-text,
.section-heading p,
.workflow-grid p,
.gallery-card p,
.result-empty p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 680px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero-actions,
.hero-stats,
.form-grid,
.result-header {
  display: flex;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 14px;
  margin: 34px 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  color: var(--text);
  font-weight: 800;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #6d5dfc 45%, var(--accent-2));
  box-shadow: 0 14px 36px rgba(86, 98, 255, 0.35);
}

.button.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.button.full {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.hero-stats {
  gap: 18px;
  flex-wrap: wrap;
}

.hero-stats div {
  min-width: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.hero-stats strong,
.hero-stats span {
  display: block;
}

.hero-stats strong {
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.hero-stats span {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-board {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 38px;
  background:
    radial-gradient(circle at 20% 18%, rgba(18, 214, 223, 0.14), transparent 16rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
}

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.board-toolbar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-3);
}

.board-toolbar span:nth-child(2) {
  background: var(--warning);
}

.board-toolbar span:nth-child(3) {
  background: var(--success);
}

.board-toolbar p {
  margin: 0 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.node {
  position: absolute;
  z-index: 2;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(9, 12, 26, 0.82);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.node small {
  display: block;
  margin-bottom: 9px;
  color: var(--accent-2);
  font-weight: 800;
}

.node-script {
  top: 92px;
  left: 36px;
  width: 240px;
}

.node-frame {
  right: 44px;
  top: 150px;
  width: 180px;
}

.node-motion {
  left: 98px;
  bottom: 96px;
  width: 230px;
}

.node-output {
  right: 50px;
  bottom: 52px;
  width: 190px;
}

.mini-image {
  height: 116px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 36% 35%, #f7d489 0 10%, transparent 11%),
    linear-gradient(145deg, #42275a, #734b6d 45%, #1fddff);
}

.board-lines {
  position: absolute;
  inset: 72px 0 0;
  width: 100%;
  height: calc(100% - 72px);
}

.board-lines path {
  fill: none;
  stroke: rgba(18, 214, 223, 0.45);
  stroke-width: 3;
  stroke-dasharray: 8 10;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 36px;
}

.section-heading.narrow {
  max-width: 640px;
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.generator-card,
.result-card,
.workflow-grid article,
.gallery-card {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.generator-card,
.result-card {
  border-radius: 32px;
  padding: clamp(20px, 3vw, 32px);
}

label {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
  color: #dce1f2;
  font-size: 0.92rem;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  outline: none;
  background: rgba(0, 0, 0, 0.25);
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(18, 214, 223, 0.65);
  box-shadow: 0 0 0 4px rgba(18, 214, 223, 0.11);
}

textarea {
  min-height: 190px;
  resize: vertical;
  padding: 16px;
  line-height: 1.6;
}

input,
select {
  min-height: 48px;
  padding: 0 14px;
}

select option {
  color: #111827;
}

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

.optional {
  color: var(--muted);
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.result-card {
  position: sticky;
  top: 104px;
}

.result-header {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.result-header .eyebrow {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
}

.status-pill.idle {
  color: var(--muted);
}

.status-pill.running {
  color: var(--warning);
  background: rgba(255, 209, 102, 0.14);
}

.status-pill.done {
  color: var(--success);
  background: rgba(67, 232, 159, 0.14);
}

.status-pill.error {
  color: var(--danger);
  background: rgba(255, 107, 122, 0.14);
}

.result-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  text-align: center;
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.18);
}

.play-orb {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 44%, white 44% 56%, transparent 56%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  filter: drop-shadow(0 0 34px rgba(18, 214, 223, 0.42));
}

.result-output video {
  width: 100%;
  margin-bottom: 16px;
  border-radius: 24px;
  background: #000;
}

.hidden {
  display: none !important;
}

.debug-output {
  max-height: 260px;
  margin: 18px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #c9d3e9;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.28);
  padding: 14px;
}

.workflow-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.workflow-grid article {
  min-height: 220px;
  padding: 24px;
  border-radius: 28px;
}

.workflow-grid span {
  display: inline-grid;
  width: 44px;
  height: 44px;
  margin-bottom: 40px;
  place-items: center;
  color: var(--accent-2);
  border-radius: 15px;
  background: rgba(18, 214, 223, 0.12);
  font-weight: 900;
}

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

.gallery-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  border-radius: 34px;
  overflow: hidden;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.68), transparent 70%),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.32), transparent 18rem),
    linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(18, 214, 223, 0.18));
}

.card-b {
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.68), transparent 70%),
    radial-gradient(circle at 60% 20%, rgba(255, 122, 89, 0.38), transparent 16rem),
    linear-gradient(135deg, rgba(255, 122, 89, 0.5), rgba(139, 92, 246, 0.24));
}

.card-c {
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.68), transparent 70%),
    radial-gradient(circle at 50% 20%, rgba(67, 232, 159, 0.32), transparent 16rem),
    linear-gradient(135deg, rgba(18, 214, 223, 0.45), rgba(139, 92, 246, 0.22));
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 34px clamp(20px, 5vw, 72px);
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 980px) {
  .hero,
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-board,
  .result-card {
    position: relative;
    top: auto;
  }

  .workflow-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

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

  h1 {
    font-size: clamp(3.1rem, 15vw, 5rem);
  }

  .hero-board {
    min-height: 480px;
  }

  .node {
    transform: scale(0.88);
    transform-origin: top left;
  }

  .node-frame,
  .node-output {
    right: 16px;
  }

  .node-script {
    left: 16px;
  }

  .node-motion {
    left: 32px;
  }

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

  .site-footer {
    flex-direction: column;
  }
}
