:root {
  --bg: #030303;
  --fg: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.52);
  --line: rgba(255, 255, 255, 0.2);
  --stage-a: 255, 70, 18;
  --stage-b: 255, 20, 14;
  --stage-c: 255, 183, 86;
  --stage-d: 46, 98, 214;
  --flow-x: 0px;
  --flow-y: 0px;
  --flow-x-soft: 0px;
  --flow-y-soft: 0px;
  --font: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font);
  cursor: crosshair;
}

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

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

.grain,
.lightfield {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.grain {
  z-index: 2;
  opacity: 0.82;
  mix-blend-mode: overlay;
  background-image: url("../grain-coarse.png");
  background-size: 120px 120px;
}

.lightfield {
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at calc(10% + var(--flow-x)) calc(40% + var(--flow-y)), rgba(var(--stage-a), 0.86), transparent 34%),
    radial-gradient(ellipse at calc(88% - var(--flow-x-soft)) calc(32% + var(--flow-y-soft)), rgba(var(--stage-b), 0.72), transparent 31%),
    radial-gradient(ellipse at calc(44% + var(--flow-x-soft)) calc(68% - var(--flow-y)), rgba(var(--stage-c), 0.56), transparent 44%),
    radial-gradient(ellipse at calc(52% - var(--flow-x)) calc(48% - var(--flow-y-soft)), rgba(var(--stage-d), 0.34), transparent 40%),
    #030303;
  transform: scale(1.08);
}

.wave {
  position: absolute;
  left: -20vw;
  width: 145vw;
  height: 46vh;
  border-radius: 48% 52% 44% 56% / 42% 58% 48% 52%;
  filter: blur(38px);
  opacity: 0.8;
  mix-blend-mode: screen;
  animation: drift 24s ease-in-out infinite alternate;
}

.wave-a {
  top: 10vh;
  background: linear-gradient(90deg, rgba(255, 61, 12, 0) 0%, rgba(255, 61, 12, 0.95) 28%, rgba(255, 225, 170, 0.7) 48%, rgba(38, 112, 255, 0.58) 68%, rgba(255, 61, 12, 0) 100%);
  transform: rotate(-18deg);
}

.wave-b {
  top: 45vh;
  opacity: 0.54;
  background: linear-gradient(90deg, rgba(36, 92, 220, 0) 0%, rgba(36, 92, 220, 0.68) 25%, rgba(255, 112, 26, 0.72) 54%, rgba(255, 240, 210, 0.46) 74%, rgba(36, 92, 220, 0) 100%);
  transform: rotate(13deg);
  animation-duration: 30s;
}

.wave-c {
  top: 72vh;
  opacity: 0.38;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.58) 42%, rgba(255, 58, 16, 0.42) 67%, rgba(255, 255, 255, 0) 100%);
  transform: rotate(-8deg);
  animation-duration: 36s;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 32px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: clamp(22px, 5vw, 58px);
}

.site-nav a::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  opacity: 0.82;
}

main {
  position: relative;
  z-index: 5;
}

.hero,
.live-tool,
.system,
.archive,
.install {
  min-height: 100vh;
  padding: 104px 6vw 72px;
}

.live-tool {
  padding-top: 118px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.74fr) minmax(0, 1fr);
  gap: 5vw;
  align-items: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  font-family: var(--display);
  font-size: clamp(68px, 12vw, 152px);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

h2 {
  max-width: 760px;
  font-size: clamp(36px, 6vw, 84px);
  font-weight: 500;
  line-height: 0.94;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.lede {
  max-width: 500px;
  margin-top: 28px;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 36px;
}

.text-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-action::after {
  content: "";
  width: 54px;
  height: 1px;
  margin-left: 12px;
  background: currentColor;
  transition: width 400ms ease, opacity 400ms ease;
}

.text-action:hover::after {
  width: 76px;
  opacity: 0.58;
}

.interface-frame {
  position: relative;
  min-width: 0;
  min-height: clamp(420px, 56vw, 620px);
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(4, 4, 4, 0.42);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.frame-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.frame-body {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 16px;
  height: calc(100% - 36px);
  margin-top: 18px;
}

.frame-body aside,
.frame-body section {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

.frame-body aside {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  color: rgba(255, 255, 255, 0.56);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
}

.frame-body aside strong {
  color: rgba(255, 255, 255, 0.88);
}

.frame-body section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 62px;
  gap: 14px;
  padding: 18px;
}

.field,
.output-lines {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(0, 0, 0, 0.18);
  background-size: 14px 14px;
}

.field.wide,
.output-lines {
  grid-column: 1 / -1;
}

.output-lines {
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 230px;
  padding: 24px;
}

.output-lines span {
  display: block;
  height: 9px;
  background: rgba(255, 255, 255, 0.42);
}

.output-lines span:nth-child(2) {
  width: 76%;
}

.output-lines span:nth-child(3) {
  width: 52%;
}

.output-lines span:nth-child(4) {
  width: 88%;
}

.strip {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.strip span {
  min-height: 72px;
  padding: 28px 32px;
  border-right: 1px solid var(--line);
}

.strip span:last-child {
  border-right: 0;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.84fr) minmax(420px, 1.16fr);
  gap: 1px;
  margin-top: 70px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.tool-form,
.tool-output {
  min-width: 0;
  background: rgba(0, 0, 0, 0.48);
}

.tool-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.tool-form label {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-row label {
  position: relative;
  display: block;
}

.mode-row input {
  position: absolute;
  opacity: 0;
}

.mode-row span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.06);
}

.mode-row input:checked + span {
  color: rgba(0, 0, 0, 0.92);
  background: rgba(255, 255, 255, 0.9);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  outline: 0;
  background: rgba(0, 0, 0, 0.32);
  font: 500 14px/1.45 var(--font);
  letter-spacing: 0;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.62);
}

.generate-button {
  min-height: 50px;
  color: rgba(0, 0, 0, 0.92);
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  font: 700 12px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.54;
}

.status-line {
  min-height: 18px;
  color: rgba(255, 255, 255, 0.56);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}

.tool-output {
  display: grid;
  grid-template-rows: minmax(360px, 1fr) minmax(220px, 0.54fr);
  gap: 1px;
}

.result-stage,
.prompt-box {
  background: rgba(0, 0, 0, 0.34);
}

.result-stage {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.46);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-stage.is-loading {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    rgba(0, 0, 0, 0.34);
  background-size: 18px 18px;
}

.result-stage img {
  width: min(100%, 760px);
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  width: 100%;
}

.prompt-box {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 220px;
}

.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.prompt-head button {
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

#promptOutput {
  min-height: 180px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 80px;
  background: var(--line);
}

.system-grid article {
  min-height: 260px;
  padding: 28px;
  background: rgba(0, 0, 0, 0.42);
}

.system-grid span {
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--mono);
  font-size: 12px;
}

.system-grid h3 {
  margin-top: 92px;
}

.system-grid p {
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.image-run {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 72px;
  overflow-x: auto;
  padding-bottom: 18px;
}

figure {
  margin: 0;
  min-width: 180px;
}

figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

figcaption {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.64);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.install-panel {
  max-width: 880px;
  margin-top: 70px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.install-panel p {
  color: var(--muted);
  font-size: 16px;
}

pre {
  overflow: auto;
  margin: 24px 0;
  padding: 22px;
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.36);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(8px);
  transition: opacity 900ms ease, transform 900ms ease, filter 900ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

@keyframes drift {
  from {
    transform: translate3d(-2vw, -1vh, 0) rotate(-18deg) scale(1);
  }
  to {
    transform: translate3d(4vw, 2vh, 0) rotate(-10deg) scale(1.08);
  }
}

@media (max-width: 860px) {
  .site-header {
    padding: 18px;
  }

  .site-nav {
    gap: 18px;
  }

  .hero,
  .live-tool,
  .system,
  .archive,
  .install {
    min-height: auto;
    padding: 96px 20px 64px;
  }

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

  .interface-frame {
    min-height: 420px;
  }

  .frame-body {
    grid-template-columns: 1fr;
  }

  .frame-body aside {
    display: none;
  }

  .strip,
  .tool-shell,
  .system-grid {
    grid-template-columns: 1fr;
  }

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

  .tool-output {
    grid-template-rows: auto auto;
  }

  .strip span {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .system-grid h3 {
    margin-top: 70px;
  }
}
