:root {
  color-scheme: dark;
  --bg: #100e18;
  --panel: #171521;
  --panel-soft: #1d1a29;
  --line: #2d293a;
  --text: #f2eff7;
  --muted: #a29cad;
  --dim: #706a7a;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
  --mono: "DM Mono", monospace;
  --violet: #c5a6ff;
  --mint: #b0d9c7;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.13;
}

.ambient-one {
  width: 460px;
  height: 460px;
  background: #8156af;
  top: -260px;
  left: 15%;
}

.ambient-two {
  width: 400px;
  height: 400px;
  background: #386d73;
  right: -260px;
  top: 38%;
}

.app-shell {
  max-width: 1120px;
  margin: auto;
  padding: 0 42px;
}

.topbar {
  height: 78px;
  border-bottom: 1px solid #ffffff12;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #eeeaf4;
  text-decoration: none;
  font: 500 10px var(--mono);
  letter-spacing: 0.17em;
}

.brand-mark {
  color: var(--violet);
  font-size: 20px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 10px var(--mono);
  letter-spacing: 0.08em;
  color: #aaa4b4;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px #b0d9c777;
}

.intro {
  padding: 60px 0 40px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--violet);
  font: 10px var(--mono);
  letter-spacing: 0.12em;
}

.eyebrow-line {
  width: 22px;
  height: 1px;
  background: var(--violet);
}

h1 {
  font: 500 clamp(44px, 6vw, 69px) / 1.08 var(--serif);
  letter-spacing: -0.04em;
  margin: 20px 0 13px;
}

h1 em {
  color: var(--violet);
  font-weight: 500;
}

.intro-copy {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 0.82fr) minmax(380px, 1.18fr);
  gap: 54px;
  align-items: start;
  padding-bottom: 68px;
}

.controls {
  padding-top: 4px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 27px;
}

.step-number {
  font: 10px var(--mono);
  color: var(--violet);
  border: 1px solid #c5a6ff55;
  border-radius: 4px;
  padding: 5px 7px;
}

.section-heading h2 {
  font: 500 17px var(--serif);
  margin: 0;
}

.field-label {
  display: block;
  color: #c4bfcd;
  font-size: 11px;
  margin: 19px 0 8px;
}

input:not([type="checkbox"]),
select {
  width: 100%;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #171521;
  color: var(--text);
  padding: 0 13px;
  font: 12px var(--sans);
  outline: none;
  transition: border-color 0.2s;
}

input:not([type="checkbox"]):focus,
select:focus {
  border-color: #a985d7;
}

input::placeholder {
  color: #706a7a;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  appearance: none;
  cursor: pointer;
}

.select-wrap > span {
  position: absolute;
  right: 14px;
  top: 10px;
  color: var(--muted);
  pointer-events: none;
}

.model-card {
  margin-top: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171521;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.model-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #c5a6ff18;
  color: var(--violet);
  font-size: 16px;
}

.model-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.model-copy strong {
  font-size: 11px;
  font-weight: 600;
}

.model-copy span {
  font-size: 9px;
  line-height: 1.4;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex: none;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #393444;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
}

.slider:before {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  left: 3px;
  top: 3px;
  background: #b7b0c1;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: #7b5ba6;
}

.switch input:checked + .slider:before {
  transform: translateX(15px);
  background: #fff;
}

.switch input:focus-visible + .slider {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.model-note {
  color: var(--dim);
  font-size: 9px;
  line-height: 1.55;
  margin: 8px 2px 0;
}

.generate-button {
  margin-top: 21px;
  width: 100%;
  height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 5px;
  background: #c7a8fc;
  color: #20162c;
  padding: 0 15px;
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.generate-button:hover {
  background: #d7c2ff;
  transform: translateY(-1px);
}

.generate-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.button-arrow {
  font-size: 17px;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 9px;
  margin: 10px 0 0;
}

.privacy-note span {
  font-size: 15px;
  color: var(--mint);
}

.story-panel {
  min-height: 410px;
  border: 1px solid #3a3546;
  border-radius: 7px;
  background: linear-gradient(145deg, #1a1825, #15131d 75%);
  box-shadow: 0 22px 70px #0003;
  display: flex;
  flex-direction: column;
  padding: 19px 22px 16px;
  position: relative;
  overflow: hidden;
}

.story-panel:before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c5a6ff55, transparent);
}

.story-topline,
.story-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.story-kicker {
  font: 9px var(--mono);
  letter-spacing: 0.1em;
  color: #898294;
}

.story-kicker span {
  color: var(--violet);
  margin-left: 4px;
}

.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 27px;
  border-radius: 4px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  border-color: #7b6c8f;
}

.story-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 12px;
}

.story-placeholder {
  text-align: center;
  color: #9a93a5;
}

.moon-mark {
  font-size: 29px;
  color: var(--violet);
  display: inline-block;
  margin-bottom: 10px;
}

.story-placeholder p {
  font: 500 18px / 1.5 var(--serif);
  margin: 0 0 15px;
}

.placeholder-caption {
  font: 8px var(--mono);
  letter-spacing: 0.1em;
  color: #686271;
}

.story-text {
  max-width: 490px;
  width: 100%;
  font: 16px / 1.9 var(--serif);
  color: #e4dfe9;
  white-space: pre-wrap;
  animation: fade-in 0.6s ease;
}

.story-text p {
  margin: 0 0 14px;
}

.story-footer {
  border-top: 1px solid #ffffff10;
  padding-top: 12px;
  color: #777180;
  font: 9px var(--mono);
}

.paper-mark {
  color: #b4d4c4;
  font-size: 13px;
}

.page-footer {
  height: 54px;
  border-top: 1px solid #ffffff12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #706a7a;
  font: 8px var(--mono);
  letter-spacing: 0.055em;
}

.page-footer a {
  color: #bba0eb;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

.footer-right {
  color: #9992a2;
}

.error-message {
  color: #e0adad;
  font: 12px / 1.6 var(--sans);
  text-align: center;
  max-width: 380px;
}

.progress-label {
  color: var(--violet);
  font: 11px var(--mono);
  text-align: center;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0 24px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .intro {
    padding: 48px 0 32px;
  }

  .story-panel {
    min-height: 350px;
  }

  .page-footer {
    height: auto;
    min-height: 58px;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .footer-right {
    margin-left: auto;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 0 17px;
  }

  .topbar {
    height: 65px;
  }

  .brand {
    font-size: 9px;
  }

  .status-pill {
    font-size: 8px;
  }

  .intro {
    padding-top: 39px;
  }

  .story-panel {
    padding: 17px 15px;
  }

  .story-content {
    padding: 24px 4px;
  }

  .story-text {
    font-size: 15px;
  }

  .page-footer {
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}