
* {
  box-sizing: border-box;
}

:root {
  --bg: #090914;
  --panel: #11111f;
  --line: rgba(190,166,255,.16);
  --muted: #9692ad;
  --text: #f4f0ff;
  --purple: #a78bfa;
  --pink: #e6a6ff;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(
    ellipse at 50% 0%,
    #211638 0%,
    #0d0c19 42%,
    #080811 100%
  );
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .15;
  pointer-events: none;
  z-index: -1;
}

.ambient-one {
  background: #8056dc;
  top: 14%;
  left: -180px;
}

.ambient-two {
  background: #3e75c8;
  right: -190px;
  top: 48%;
}

/* HEADER */

.topbar {
  height: 76px;
  max-width: 1180px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand {
  font-size: 15px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.brand span:last-child {
  color: #b99aff;
}

.brand-mark {
  color: #c7a7ff;
  margin-right: 9px;
  font-size: 20px;
}

.top-note {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: #aaa5bd;
}

.live-dot,
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9be6ba;
  box-shadow: 0 0 10px #9be6ba;
  margin-right: 9px;
}

/* MAIN */

main {
  max-width: 1180px;
  margin: auto;
  padding: 0 28px;
}

/* HERO */

.hero {
  text-align: center;
  padding: 76px 15px 44px;
}

.eyebrow,
.section-kicker {
  font-size: 10px;
  letter-spacing: 2.8px;
  color: #b99aff;
  font-weight: 700;
}

.hero h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(46px, 7vw, 78px);
  line-height: 1.04;
  letter-spacing: -2px;
  margin: 20px 0 16px;
}

.hero h1 span {
  font-style: italic;
  color: #c6a9ff;
}

.hero-copy {
  max-width: 560px;
  margin: 0 auto;
  color: #aaa5bd;
  font-size: 14px;
  line-height: 1.8;
}

.hero-divider {
  margin: 30px auto 0;
  width: 180px;
  border-top: 1px solid var(--line);
  position: relative;
  color: #c4a3ff;
}

.hero-divider span {
  position: relative;
  top: -12px;
  background: #110e20;
  padding: 0 15px;
  font-size: 17px;
}

/* WORKSPACE */

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  background: linear-gradient(
    145deg,
    rgba(24,21,42,.96),
    rgba(14,14,27,.97)
  );
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 28px;
  min-height: 500px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
}

.panel-heading,
.story-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 27px;
}

.panel h2 {
  font-family: "Playfair Display", serif;
  font-size: 25px;
  font-weight: 500;
  margin: 8px 0 0;
}

.section-kicker {
  margin: 0;
  font-size: 9px;
}

.moon-icon {
  font-size: 32px;
  color: #c5a9ff;
}

/* INPUTS */

label {
  display: block;
  font-size: 9px;
  letter-spacing: 1.7px;
  color: #aaa4c1;
  font-weight: 700;
  margin: 0 0 10px;
}

textarea,
select {
  width: 100%;
  background: #0c0c18;
  border: 1px solid rgba(190,166,255,.2);
  border-radius: 8px;
  color: #f2edff;
  font: 13px "DM Sans", sans-serif;
  outline: none;
  transition: .2s;
}

textarea {
  padding: 15px;
  resize: vertical;
  min-height: 116px;
  line-height: 1.6;
}

textarea::placeholder {
  color: #69647e;
}

textarea:focus,
select:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167,139,250,.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 21px;
}

.field select {
  padding: 12px 10px;
  font-size: 12px;
}

/* GENERATE BUTTON */

.summon-btn {
  width: 100%;
  margin-top: 25px;
  border: 0;
  border-radius: 8px;
  padding: 16px 18px;
  background: linear-gradient(100deg,#8d68d8,#b17ee8);
  color: white;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 25px rgba(135,94,210,.2);
  transition: transform .2s, filter .2s;
}

.summon-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.summon-btn:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.btn-icon {
  font-size: 18px;
}

.btn-arrow {
  margin-left: auto;
  font-size: 17px;
}

.model-status {
  display: flex;
  align-items: center;
  margin-top: 16px;
  color: #a8a2bc;
  font-size: 10px;
  line-height: 1.5;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #b99aff;
  box-shadow: 0 0 8px #b99aff;
  flex: none;
}

.privacy-note {
  font-size: 10px;
  line-height: 1.6;
  color: #77728c;
  margin: 13px 0 0;
}

/* STORY PANEL */

.story-panel {
  position: relative;
  overflow: hidden;
}

.story-panel:after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -130px;
  bottom: -150px;
  border-radius: 50%;
  background: #8158d2;
  filter: blur(90px);
  opacity: .12;
  pointer-events: none;
}

.story-stamp {
  border: 1px solid rgba(208,179,255,.3);
  color: #bda4e9;
  font-size: 8px;
  letter-spacing: 1.4px;
  text-align: center;
  padding: 7px 9px;
  line-height: 1.6;
  transform: rotate(5deg);
}

.empty-state,
.loading-state {
  min-height: 355px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* BOOK DESIGN */

.book-art {
  height: 150px;
  width: 160px;
  position: relative;
  display: grid;
  place-items: center;
}

.book-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #9b6eff;
  filter: blur(42px);
  opacity: .28;
}

.book {
  position: relative;
  width: 88px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid #c6a7ff;
  border-radius: 5px 12px 12px 5px;
  background: linear-gradient(135deg,#49316c,#1b1830 70%);
  box-shadow:
    10px 8px 0 #100d1e,
    0 0 30px rgba(177,126,232,.22);
  font-size: 28px;
  color: #e0c8ff;
}

.empty-state h3,
.loading-state h3 {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  font-size: 22px;
  margin: 13px 0 7px;
}

.empty-state p,
.loading-state p {
  font-size: 12px;
  color: #89849f;
  line-height: 1.8;
  margin: 0;
}

/* LOADING */

.hidden {
  display: none !important;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(194,164,255,.2);
  border-top-color: #c5a2ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* GENERATED STORY */

.story-output {
  position: relative;
  z-index: 1;
}

.story-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 8px;
  letter-spacing: 1.3px;
  color: #b99aff;
  margin: 5px 0 20px;
}

.story-output h3 {
  font-family: "Playfair Display", serif;
  font-size: 29px;
  line-height: 1.2;
  font-weight: 500;
  margin: 0 0 18px;
  color: #f1eaff;
}

.story-output #storyText {
  font-family: "Playfair Display", serif;
  font-size: 14px;
  line-height: 1.95;
  color: #c6c0d5;
  white-space: pre-wrap;
  max-height: 280px;
  overflow: auto;
  padding-right: 7px;
}

/* STORY BUTTONS */

.story-actions {
  display: flex;
  gap: 9px;
  margin-top: 23px;
  flex-wrap: wrap;
}

.secondary-btn {
  border: 1px solid rgba(190,166,255,.25);
  background: rgba(167,139,250,.07);
  color: #d7c6ff;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn:hover {
  background: rgba(167,139,250,.16);
}

/* OPEN SOURCE SECTION */

.open-note {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 22px 0 55px;
  padding: 24px 27px;
  border: 1px solid rgba(190,166,255,.14);
  border-radius: 12px;
  background: rgba(17,16,31,.68);
}

.open-icon {
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(167,139,250,.13);
  color: #c8adff;
  font-size: 23px;
}

.open-note h3 {
  font-family: "Playfair Display", serif;
  font-size: 19px;
  font-weight: 500;
  margin: 6px 0 7px;
}

.open-note p:last-child {
  font-size: 11px;
  line-height: 1.8;
  color: #9690aa;
  margin: 0;
  max-width: 850px;
}

/* FOOTER */

footer {
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 23px;
  color: #6f6a82;
  font-size: 9px;
  letter-spacing: 1.8px;
}

footer span {
  color: #b99aff;
}

/* MOBILE RESPONSIVE */

@media(max-width:760px) {

  .topbar {
    padding: 0 18px;
  }

  .top-note {
    font-size: 8px;
  }

  main {
    padding: 0 16px;
  }

  .hero {
    padding: 60px 5px 35px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 22px;
    min-height: unset;
  }

  .story-panel {
    min-height: 440px;
  }

  .open-note {
    padding: 19px;
    gap: 13px;
  }

  .open-note h3 {
    font-size: 17px;
  }

  .form-row {
    gap: 9px;
  }
}
