:root {
  --paper: #eee8dc;
  --paper-bright: #f8f3e9;
  --ink: #181714;
  --ink-soft: #4a4741;
  --signal: #ff4d24;
  --acid: #dfff00;
  --accent-2: #6d47ff;
  --line: rgba(24, 23, 20, 0.22);
  --grid-line: rgba(24, 23, 20, 0.045);
  --stage-glow: rgba(255, 255, 255, 0.9);
  --sans: "Helvetica Neue", "Arial Narrow", Arial, sans-serif;
  --serif: Iowan Old Style, "Times New Roman", Times, serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: color 350ms ease, background 350ms ease;
}

body[data-palette="cobalt"] {
  --signal: #2450ff;
  --acid: #ffdb1f;
  --accent-2: #ef4b8c;
}

body[data-palette="forest"] {
  --signal: #087f5b;
  --acid: #ffcf56;
  --accent-2: #8344ff;
}

body[data-palette="violet"] {
  --signal: #7857ff;
  --acid: #00cca8;
  --accent-2: #ff765f;
}

body[data-palette="rose"] {
  --signal: #e64278;
  --acid: #ffc800;
  --accent-2: #5948ff;
}

body.dark-mode {
  color-scheme: dark;
  --paper: #171716;
  --paper-bright: #0d0e0e;
  --ink: #f2ecdf;
  --ink-soft: #aaa398;
  --line: rgba(242, 236, 223, 0.2);
  --grid-line: rgba(242, 236, 223, 0.055);
  --stage-glow: rgba(112, 103, 255, 0.09);
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noise {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background:
    repeating-radial-gradient(circle at 13% 27%, transparent 0 2px, rgba(24, 23, 20, 0.22) 2.5px 3px, transparent 3.5px 7px),
    repeating-radial-gradient(circle at 78% 61%, transparent 0 3px, rgba(24, 23, 20, 0.18) 3.5px 4px, transparent 4.5px 9px);
  background-size: 43px 47px, 61px 59px;
  mix-blend-mode: multiply;
}

body.dark-mode .noise {
  opacity: 0.07;
  filter: invert(1);
  mix-blend-mode: screen;
}

.app-shell {
  min-height: 100vh;
}

.masthead {
  height: 104px;
  display: grid;
  grid-template-columns: minmax(260px, 31%) 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 28px;
  color: inherit;
  text-decoration: none;
  border-right: 1px solid var(--ink);
}

.wordmark__index {
  align-self: flex-start;
  margin-top: 24px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.wordmark__name {
  font-size: 21px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.masthead__note {
  margin: 0;
  padding-left: 28px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.15;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 28px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status__light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(255, 77, 36, 0.12);
}

body.is-performing .status__light {
  animation: status-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes status-pulse {
  to {
    background: var(--acid);
    box-shadow: 0 0 0 8px rgba(223, 255, 0, 0.13);
  }
}

.workspace {
  min-height: calc(100vh - 104px);
  display: grid;
  grid-template-columns: minmax(300px, 31%) 1fr;
}

.control-panel {
  min-height: calc(100vh - 104px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 28px 24px;
  border-right: 1px solid var(--ink);
}

.eyebrow {
  margin: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.control-panel h1 {
  max-width: 420px;
  margin: 45px 0 72px;
  font-size: clamp(40px, 4vw, 66px);
  font-weight: 600;
  letter-spacing: -0.075em;
  line-height: 0.82;
}

.control-panel h1 em {
  font-family: var(--serif);
  font-weight: 400;
}

.prompt-field {
  position: relative;
  display: block;
  padding-left: 30px;
}

.prompt-field__number {
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 9px;
  font-weight: 700;
}

.prompt-field input {
  width: 100%;
  padding: 0 0 12px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: clamp(18px, 1.7vw, 27px);
  font-style: italic;
}

.prompt-field__line {
  position: absolute;
  left: 30px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
  transform-origin: left;
  transition: transform 250ms ease, background 250ms ease;
}

.prompt-field:focus-within .prompt-field__line {
  height: 2px;
  background: var(--signal);
  transform: scaleX(1.03);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 18px 0 0 30px;
}

.suggestions button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: transparent;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease, border 180ms ease;
}

.suggestions button:hover {
  color: var(--paper-bright);
  border-color: var(--ink);
  background: var(--ink);
}

.generate-row {
  width: calc(100% - 30px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 8px;
  margin: 34px 0 0 30px;
}

.generate-button {
  width: 100%;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0 20px;
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
  transition: color 220ms ease, background 220ms ease;
}

.length-selector {
  position: relative;
  height: 68px;
  display: grid;
  grid-template-rows: 24px 1fr;
  border: 1px solid var(--ink);
  background: transparent;
  overflow: hidden;
}

.length-selector > span {
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.length-selector select {
  width: 100%;
  min-height: 0;
  padding: 0 18px 0 9px;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  outline: 0;
  appearance: none;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
  text-align: center;
  cursor: pointer;
}

.length-selector::after {
  content: "⌄";
  position: absolute;
  right: 7px;
  bottom: 12px;
  color: var(--signal);
  font-size: 11px;
  pointer-events: none;
}

.generate-button:hover {
  color: var(--ink);
  background: var(--signal);
}

.generate-button__mark {
  font-size: 24px;
  font-weight: 400;
  transition: transform 220ms ease;
}

.generate-button:hover .generate-button__mark {
  transform: translate(4px, -4px);
}

.font-picker {
  width: calc(100% - 30px);
  margin: 26px 0 0 30px;
}

.font-picker__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.font-picker__heading > span:last-child {
  color: var(--signal);
  font-family: var(--serif);
  font-size: 10px;
  font-style: italic;
}

.font-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.font-option {
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 2px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  overflow: hidden;
  transition: color 160ms ease, background 160ms ease;
}

.font-option:hover,
.font-option.is-active {
  color: var(--paper-bright);
  background: var(--ink);
}

.font-option.is-active {
  box-shadow: inset 0 -3px 0 var(--signal);
}

.font-option > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.font-option__sample {
  font-size: 18px;
  line-height: 1;
}

.font-option[data-font="duplex"] .font-option__sample {
  font-family: var(--sans);
  font-weight: 700;
}

.font-option[data-font="grotesk"] .font-option__sample {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
}

.font-option[data-font="didone"] .font-option__sample {
  font-family: Didot, "Bodoni 72", "Times New Roman", serif;
}

.font-option[data-font="oldstyle"] .font-option__sample {
  font-family: "Iowan Old Style", Baskerville, Georgia, serif;
}

.font-option[data-font="mono"] .font-option__sample {
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
}

.font-option[data-font="typewriter"] .font-option__sample {
  font-family: "Courier Prime", Courier, monospace;
}

.font-option[data-font="humanist"] .font-option__sample {
  font-family: Optima, "Trebuchet MS", sans-serif;
}

.font-option[data-font="condensed"] .font-option__sample {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
}

.font-option[data-font="rounded"] .font-option__sample {
  font-family: "Arial Rounded MT Bold", "Avenir Next", sans-serif;
}

.font-option[data-font="system"] .font-option__sample {
  font-family: system-ui, sans-serif;
}

.type-controls {
  width: calc(100% - 30px);
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 18px;
  margin: 22px 0 0 30px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.type-controls__heading {
  min-height: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.type-controls__heading > span:last-child {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 9px;
  font-style: italic;
}

.align-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.align-option {
  min-width: 0;
  min-height: 55px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 2px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: color 160ms ease, background 160ms ease;
}

.align-option:hover,
.align-option.is-active {
  color: var(--paper-bright);
  background: var(--ink);
}

.align-option.is-active {
  box-shadow: inset 0 -3px 0 var(--signal);
}

.align-option > span:last-child {
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.align-option__glyph {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1;
}

.spacing-controls {
  min-width: 0;
}

.compact-range {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 23px;
}

.compact-range > span {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compact-range output {
  color: var(--signal);
  font-family: var(--serif);
  font-size: 8px;
  font-style: italic;
}

.microcopy {
  width: 80%;
  margin: 70px 0 28px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
  line-height: 1.25;
}

.edition {
  display: flex;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.edition a {
  color: inherit;
  text-decoration: none;
  transition: color 180ms ease;
}

.edition a:hover {
  color: var(--signal);
}

.stage-wrap {
  min-width: 0;
  background: var(--paper-bright);
}

.stage-toolbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--ink);
}

.stage-toolbar > div {
  display: flex;
  align-items: center;
  gap: 18px;
}

.poem-count {
  padding-left: 18px;
  color: var(--ink-soft);
  border-left: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
}

.stage-toolbar__actions {
  height: 100%;
}

.text-action,
.icon-button {
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.text-action:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.icon-button {
  width: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-right: -24px;
  padding: 0 18px;
  color: var(--paper-bright);
  border-left: 1px solid var(--ink);
  background: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  transition: color 180ms ease, background 180ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--signal);
}

.stage-button__icon {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0;
}

.stage {
  --cursor-x: 50%;
  --cursor-y: 50%;
  --poem-shift-x: 0px;
  --poem-shift-y: 0px;
  --poem-rotate-x: 0deg;
  --poem-rotate-y: 0deg;
  position: relative;
  min-height: clamp(440px, 61vh, 720px);
  display: grid;
  place-items: center;
  padding: 70px clamp(32px, 6vw, 100px) 95px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), var(--stage-glow) 0, transparent 27%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper-bright);
  background-size: auto, 38px 38px, 38px 38px, auto;
  isolation: isolate;
  transition: background-color 300ms ease;
}

.background-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.68;
  mix-blend-mode: multiply;
  transition: opacity 300ms ease;
}

body.dark-mode .background-art {
  opacity: 0.56;
  mix-blend-mode: screen;
}

.bg-shape {
  --x: 50%;
  --y: 50%;
  --size: 180px;
  --rotation: 0deg;
  --delay: 0s;
  --duration: 12s;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  transform: translate(-50%, -50%) rotate(var(--rotation));
  animation-delay: var(--delay);
  animation-duration: var(--duration);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  will-change: transform, opacity;
}

.bg-shape--orb {
  border: 1px solid color-mix(in srgb, var(--signal) 70%, transparent);
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    color-mix(in srgb, var(--acid) 62%, transparent),
    color-mix(in srgb, var(--signal) 28%, transparent) 46%,
    transparent 70%
  );
  animation-name: background-orbit;
}

.bg-shape--halo {
  border: clamp(7px, 1.5vw, 22px) solid color-mix(in srgb, var(--accent-2) 42%, transparent);
  border-radius: 50%;
  filter: blur(1px);
  animation-name: background-breathe;
}

.bg-shape--ribbon {
  height: calc(var(--size) * 0.18);
  border-radius: 50%;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--signal) 78%, transparent),
    color-mix(in srgb, var(--acid) 54%, transparent),
    transparent
  );
  filter: blur(0.3px);
  animation-name: background-ribbon;
}

.bg-shape--block {
  height: calc(var(--size) * 0.55);
  border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent);
  background: color-mix(in srgb, var(--signal) 22%, transparent);
  animation-name: background-block;
}

.bg-shape--line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  transform-origin: left center;
  animation-name: background-line;
}

.bg-shape--dot {
  width: clamp(4px, calc(var(--size) * 0.08), 18px);
  height: clamp(4px, calc(var(--size) * 0.08), 18px);
  border-radius: 50%;
  background: var(--signal);
  box-shadow:
    calc(var(--size) * 0.35) calc(var(--size) * 0.18) 0 color-mix(in srgb, var(--acid) 72%, transparent),
    calc(var(--size) * -0.22) calc(var(--size) * 0.42) 0 color-mix(in srgb, var(--accent-2) 68%, transparent);
  animation-name: background-dots;
}

@keyframes background-orbit {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0.82);
  }
  100% {
    transform: translate(calc(-50% + 38px), calc(-50% - 22px)) rotate(calc(var(--rotation) + 32deg)) scale(1.16);
  }
}

@keyframes background-breathe {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0.72);
    opacity: 0.22;
  }
  100% {
    transform: translate(-50%, -50%) rotate(calc(var(--rotation) - 18deg)) scale(1.25);
    opacity: 0.82;
  }
}

@keyframes background-ribbon {
  0% {
    transform: translate(-60%, -50%) rotate(var(--rotation)) scaleX(0.76);
  }
  100% {
    transform: translate(-38%, -50%) rotate(calc(var(--rotation) + 9deg)) scaleX(1.38);
  }
}

@keyframes background-block {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) skewX(-3deg);
  }
  100% {
    transform: translate(calc(-50% + 26px), calc(-50% + 18px)) rotate(calc(var(--rotation) + 13deg)) skewX(8deg);
  }
}

@keyframes background-line {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(0.3);
    opacity: 0.18;
  }
  100% {
    transform: translate(-50%, -50%) rotate(calc(var(--rotation) + 24deg)) scaleX(1.6);
    opacity: 0.84;
  }
}

@keyframes background-dots {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0.5);
  }
  100% {
    transform: translate(calc(-50% + 44px), calc(-50% - 31px)) rotate(calc(var(--rotation) + 90deg)) scale(1.2);
  }
}

.stage__orbit {
  --orbit-size: 560px;
  --orbit-x: 66%;
  --orbit-y: 49%;
  --orbit-radius: 50%;
  --orbit-rotation: 0deg;
  --orbit-aspect: 1;
  --orbit-color: var(--signal);
  --orbit-style: solid;
  --orbit-width: 1px;
  position: absolute;
  z-index: 0;
  left: var(--orbit-x);
  top: var(--orbit-y);
  width: min(var(--orbit-size), 72vw);
  aspect-ratio: var(--orbit-aspect);
  border: var(--orbit-width) var(--orbit-style) color-mix(in srgb, var(--orbit-color) 72%, transparent);
  border-radius: var(--orbit-radius);
  background: color-mix(in srgb, var(--orbit-color) 5%, transparent);
  transform: translate(-50%, -50%) rotate(var(--orbit-rotation));
  transition:
    left 620ms cubic-bezier(.16, 1, .3, 1),
    top 620ms cubic-bezier(.16, 1, .3, 1),
    width 620ms cubic-bezier(.16, 1, .3, 1),
    border-radius 620ms cubic-bezier(.16, 1, .3, 1),
    transform 620ms cubic-bezier(.16, 1, .3, 1),
    border-color 350ms ease,
    background 350ms ease;
}

.stage__orbit::before,
.stage__orbit::after {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px dashed color-mix(in srgb, var(--orbit-color) 34%, transparent);
  border-radius: inherit;
}

.stage__orbit::after {
  inset: 49%;
  border-style: solid;
  background: var(--orbit-color);
}

.stage__axis {
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.stage__axis--x {
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed rgba(24, 23, 20, 0.1);
}

.stage__axis--y {
  top: 0;
  bottom: 0;
  left: 64%;
  border-left: 1px dashed rgba(24, 23, 20, 0.1);
}

.stage__coordinate {
  position: absolute;
  color: rgba(24, 23, 20, 0.48);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.stage__coordinate--top {
  top: 18px;
  right: 20px;
}

.stage__coordinate--bottom {
  left: 20px;
  bottom: 20px;
}

.stage-exit {
  position: absolute;
  z-index: 8;
  top: 22px;
  left: 24px;
  display: none;
  padding: 10px 14px;
  color: var(--paper-bright);
  border: 0;
  border-radius: 30px;
  background: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.poem {
  --poem-primary: var(--sans);
  --poem-secondary: var(--serif);
  --poem-primary-weight: 600;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.075em;
  --poem-secondary-spacing: -0.06em;
  --poem-secondary-style: italic;
  --user-letter-spacing: 0em;
  --user-word-spacing: 0.19em;
  --user-row-spacing: 0.85;
  position: relative;
  z-index: 2;
  width: min(100%, 860px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  perspective: 900px;
  transform: translate3d(var(--poem-shift-x), var(--poem-shift-y), 0)
    rotateX(var(--poem-rotate-x)) rotateY(var(--poem-rotate-y));
  transform-style: preserve-3d;
  transition: transform 220ms cubic-bezier(.22, .61, .36, 1);
}

.poem[data-font="grotesk"] {
  --poem-primary: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --poem-secondary: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 300;
  --poem-primary-spacing: -0.07em;
  --poem-secondary-spacing: -0.055em;
  --poem-secondary-style: normal;
}

.poem[data-font="didone"] {
  --poem-primary: Didot, "Bodoni 72", "Times New Roman", serif;
  --poem-secondary: Didot, "Bodoni 72", "Times New Roman", serif;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.055em;
  --poem-secondary-spacing: -0.045em;
}

.poem[data-font="oldstyle"] {
  --poem-primary: "Iowan Old Style", Baskerville, Georgia, serif;
  --poem-secondary: "Iowan Old Style", Baskerville, Georgia, serif;
  --poem-primary-weight: 600;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.045em;
  --poem-secondary-spacing: -0.035em;
}

.poem[data-font="mono"] {
  --poem-primary: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --poem-secondary: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.07em;
  --poem-secondary-spacing: -0.06em;
  --poem-secondary-style: normal;
}

.poem[data-font="typewriter"] {
  --poem-primary: "Courier Prime", "Courier New", Courier, monospace;
  --poem-secondary: "Courier Prime", "Courier New", Courier, monospace;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.075em;
  --poem-secondary-spacing: -0.065em;
}

.poem[data-font="humanist"] {
  --poem-primary: Optima, "Trebuchet MS", sans-serif;
  --poem-secondary: Optima, "Trebuchet MS", sans-serif;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.065em;
  --poem-secondary-spacing: -0.05em;
}

.poem[data-font="condensed"] {
  --poem-primary: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  --poem-secondary: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 400;
  --poem-primary-spacing: -0.055em;
  --poem-secondary-spacing: -0.04em;
  --poem-secondary-style: normal;
}

.poem[data-font="rounded"] {
  --poem-primary: "Arial Rounded MT Bold", "Avenir Next", Arial, sans-serif;
  --poem-secondary: "Arial Rounded MT Bold", "Avenir Next", Arial, sans-serif;
  --poem-primary-weight: 700;
  --poem-secondary-weight: 500;
  --poem-primary-spacing: -0.065em;
  --poem-secondary-spacing: -0.05em;
  --poem-secondary-style: normal;
}

.poem[data-font="system"] {
  --poem-primary: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --poem-secondary: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --poem-primary-weight: 750;
  --poem-secondary-weight: 350;
  --poem-primary-spacing: -0.075em;
  --poem-secondary-spacing: -0.055em;
  --poem-secondary-style: normal;
}

.poem-line {
  display: flex;
  max-width: 100%;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0 var(--user-word-spacing);
  margin: -0.02em 0;
  color: var(--ink);
  font-family: var(--poem-primary);
  font-size: clamp(33px, 4.7vw, 77px);
  font-weight: var(--poem-primary-weight);
  letter-spacing: calc(var(--poem-primary-spacing) + var(--user-letter-spacing));
  line-height: var(--user-row-spacing);
  transform-origin: left center;
  white-space: nowrap;
}

.poem-line:nth-child(even) {
  align-self: flex-end;
  font-family: var(--poem-secondary);
  font-style: var(--poem-secondary-style);
  font-weight: var(--poem-secondary-weight);
  letter-spacing: calc(var(--poem-secondary-spacing) + var(--user-letter-spacing));
}

.poem[data-align="center"] {
  align-items: center;
  text-align: center;
}

.poem[data-align="center"] .poem-line,
.poem[data-align="center"] .poem-line:nth-child(even) {
  align-self: center;
  justify-content: center;
}

.poem-line:nth-child(3n) {
  color: var(--signal);
}

.poem-word {
  display: inline-block;
  will-change: transform, opacity, filter;
  transform-origin: center center;
  cursor: crosshair;
}

.poem-word:hover {
  color: var(--signal);
  font-style: italic;
}

.play-button {
  position: absolute;
  z-index: 5;
  right: 24px;
  bottom: 20px;
  height: 48px;
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 0 9px 0 16px;
  color: var(--paper-bright);
  border: 0;
  border-radius: 28px;
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(24, 23, 20, 0.16);
  transition: transform 180ms ease, background 180ms ease;
}

.play-button:hover {
  background: var(--signal);
  transform: translateY(-2px);
}

.play-button__icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

body.is-performing .play-button__icon {
  width: 8px;
  height: 8px;
  border: 0;
  background: currentColor;
}

.play-button__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.play-button__key {
  padding: 7px 9px;
  color: var(--ink);
  border-radius: 20px;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 9px;
  font-style: italic;
}

.visual-console {
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(210px, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 16px 24px;
  border-top: 1px solid var(--ink);
}

.visual-console__heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.visual-console__caption,
.motion-presets__heading > span {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 10px;
  font-style: italic;
}

.palette-list {
  display: flex;
  align-items: center;
  gap: 9px;
}

.palette {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  transition: border 180ms ease, transform 180ms ease;
}

.palette:hover {
  transform: rotate(14deg);
}

.palette.is-active {
  border-color: var(--ink);
}

.palette span {
  display: block;
  background: var(--swatch);
}

.palette span:first-child {
  border-radius: 20px 0 0 20px;
}

.palette span:last-child {
  border-radius: 0 20px 20px 0;
}

.visual-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.theme-toggle,
.background-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--ink);
  background: transparent;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.theme-toggle {
  gap: 8px;
  padding: 0 12px;
}

.theme-toggle__track {
  width: 30px;
  height: 16px;
  display: block;
  padding: 2px;
  border-radius: 20px;
  background: var(--ink);
}

.theme-toggle__track span {
  width: 12px;
  height: 12px;
  display: block;
  border-radius: 50%;
  background: var(--paper-bright);
  transition: transform 250ms cubic-bezier(.16, 1, .3, 1), background 250ms ease;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__track span {
  background: var(--acid);
  transform: translateX(14px);
}

.background-button {
  gap: 10px;
  min-width: 174px;
  justify-content: space-between;
  padding: 0 10px 0 13px;
  color: var(--paper-bright);
  background: var(--ink);
  transition: color 180ms ease, background 180ms ease;
}

.background-button:hover {
  color: var(--ink);
  background: var(--signal);
}

.background-button__spark {
  color: var(--signal);
  font-size: 14px;
  transition: transform 400ms ease;
}

.background-button:hover .background-button__spark {
  color: currentColor;
  transform: rotate(90deg);
}

.background-button__count {
  padding-left: 8px;
  border-left: 1px solid currentColor;
  font-family: var(--serif);
  font-style: italic;
}

.motion-console {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 26%);
  border-top: 1px solid var(--ink);
}

.motion-presets {
  padding: 22px 24px 24px;
}

.motion-presets__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 17px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.preset {
  position: relative;
  min-height: 94px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: color 200ms ease, background 200ms ease;
}

.preset:nth-child(5n) {
  border-right: 0;
}

.preset:nth-child(n + 6) {
  border-top: 1px solid var(--line);
}

.preset:hover,
.preset.is-active {
  color: var(--paper-bright);
  background: var(--ink);
}

.preset.is-active::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
}

.preset__number {
  font-size: 7px;
  font-weight: 700;
}

.preset__name {
  align-self: end;
  font-family: var(--serif);
  font-size: clamp(13px, 1.3vw, 19px);
  font-style: italic;
}

.preset__glyph {
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: var(--signal);
  font-size: 16px;
}

.sliders {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border-left: 1px solid var(--ink);
}

.range-control {
  display: block;
}

.range-control__label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.range-control output {
  color: var(--signal);
}

input[type="range"] {
  width: 100%;
  height: 1px;
  display: block;
  appearance: none;
  border: 0;
  background: var(--ink);
}

input[type="range"]::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  appearance: none;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 1px var(--ink);
}

input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 1px var(--ink);
}

.randomize-button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  color: var(--ink);
  border: 1px solid var(--ink);
  background: var(--acid);
  box-shadow: 4px 4px 0 var(--signal);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.randomize-button:hover {
  color: var(--paper-bright);
  background: var(--signal);
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(3px, 3px);
}

.randomize-button span {
  font-size: 16px;
  transition: transform 300ms ease;
}

.randomize-button:hover span {
  transform: rotate(90deg) scale(1.15);
}

body.dark-mode .randomize-button {
  color: #000;
  border-color: #fff;
  background: #fff;
  box-shadow: none;
}

body.dark-mode .randomize-button:hover {
  color: #000;
  background: #fff;
  box-shadow: none;
  transform: none;
}

body.dark-mode .randomize-button:hover span {
  transform: none;
}

.editor {
  width: min(680px, calc(100% - 30px));
  padding: 0;
  border: 0;
  background: transparent;
}

.editor::backdrop {
  background: rgba(24, 23, 20, 0.8);
  backdrop-filter: blur(10px);
}

.editor__card {
  padding: 26px;
  color: var(--ink);
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  box-shadow: 12px 12px 0 var(--signal);
}

.editor__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.editor h2 {
  margin: 18px 0 34px;
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 68px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.editor__close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
}

.editor label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.editor textarea {
  width: 100%;
  resize: vertical;
  margin-top: 10px;
  padding: 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.15;
}

.editor__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.editor__save {
  min-width: 150px;
  padding: 14px 18px;
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  background: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.stage-mode .masthead,
body.stage-mode .control-panel,
body.stage-mode .stage-toolbar,
body.stage-mode .visual-console,
body.stage-mode .motion-console {
  display: none;
}

body.stage-mode .workspace {
  display: block;
}

body.stage-mode .stage {
  min-height: 100vh;
}

body.stage-mode .stage-exit {
  display: block;
}

body.stage-mode .poem-line {
  font-size: clamp(44px, 7vw, 112px);
}

@media (max-width: 1000px) {
  .masthead {
    grid-template-columns: 300px 1fr auto;
  }

  .workspace {
    grid-template-columns: 300px 1fr;
  }

  .control-panel {
    padding-left: 22px;
    padding-right: 22px;
  }

  .control-panel h1 {
    margin-bottom: 52px;
  }

  .motion-console {
    grid-template-columns: 1fr;
  }

  .visual-console {
    grid-template-columns: auto 1fr;
  }

  .visual-actions {
    grid-column: 1 / -1;
  }

  .sliders {
    display: grid;
    grid-template-columns: 1fr 1fr 140px;
    align-items: end;
    border-top: 1px solid var(--ink);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .masthead {
    height: 78px;
    grid-template-columns: 1fr auto;
  }

  .wordmark {
    border-right: 0;
  }

  .wordmark__index,
  .masthead__note {
    display: none;
  }

  .status {
    padding-right: 18px;
  }

  .status span:last-child {
    display: none;
  }

  .workspace {
    display: block;
  }

  .control-panel {
    min-height: auto;
    padding: 40px 20px 34px;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .control-panel h1 {
    max-width: 520px;
    margin: 32px 0 44px;
    font-size: clamp(44px, 13vw, 72px);
  }

  .control-panel__bottom {
    display: none;
  }

  .stage-toolbar {
    padding: 0 18px;
  }

  .icon-button {
    margin-right: -18px;
  }

  .stage {
    min-height: 520px;
    padding: 60px 24px 94px;
  }

  .stage__orbit {
    max-width: 72vw;
  }

  .poem-line {
    font-size: clamp(34px, 10.5vw, 62px);
  }

  .motion-presets {
    padding: 20px 16px 22px;
    overflow: hidden;
  }

  .preset-list {
    grid-template-columns: repeat(15, minmax(92px, 1fr));
    overflow-x: auto;
  }

  .preset:nth-child(n + 6) {
    border-top: 0;
  }

  .preset:nth-child(5n) {
    border-right: 1px solid var(--line);
  }

  .preset:last-child {
    border-right: 0;
  }

  .preset {
    min-height: 82px;
  }

  .sliders {
    grid-template-columns: 1fr 1fr;
    padding: 22px 16px;
  }

  .randomize-button {
    grid-column: 1 / -1;
  }

  .visual-console {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 16px;
  }

  .visual-actions {
    grid-column: auto;
  }

  .background-button {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .wordmark {
    padding-left: 18px;
  }

  .wordmark__name {
    font-size: 18px;
  }

  .stage-toolbar .poem-count {
    display: none;
  }

  .play-button__key {
    display: none;
  }

  .play-button {
    grid-template-columns: auto auto;
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .poem {
    transform: none !important;
  }
}
