@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --purple: #bd62ff;
  --violet: #813cff;
  --cyan: #50f4dc;
  --bg: #090514;
  --text: #f8f1ff;
  --muted: #b8a8ce;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 15%, #42146c55, transparent 35%),
    radial-gradient(ellipse at 85% 30%, #28106b55, transparent 40%),
    linear-gradient(140deg, #080411, #10091e 55%, #080411);
  color: var(--text);
  font-family: Inter, sans-serif;
  overflow-x: hidden;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 80% 20%, #c68aff, transparent),
    radial-gradient(2px 2px at 40% 80%, white, transparent),
    radial-gradient(2px 2px at 70% 65%, #b86cff, transparent);
  background-size: 250px 250px;
}

.navbar {
  min-height: 76px;
  padding: 15px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0b0619dd;
  backdrop-filter: blur(18px);
  border-bottom: 1px solid #b85aff35;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  color: white;
  white-space: nowrap;
}

.logo span {
  color: var(--purple);
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  color: #d9cde8;
  text-decoration: none;
  font-size: .9rem;
  transition: .3s;
}

nav a:hover {
  color: var(--purple);
}

.status {
  border: 1px solid #50f4dc55;
  padding: 9px 15px;
  border-radius: 30px;
  color: #baffef;
  font-size: .78rem;
  white-space: nowrap;
}

.status i {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--cyan);
  margin-right: 7px;
}

main {
  width: min(1250px, 92%);
  margin: auto;
}

.hero {
  min-height: 470px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 45px 0;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.eyebrow {
  color: var(--purple);
  letter-spacing: 4px;
  font-size: .78rem;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(3.3rem, 6vw, 5.8rem);
  line-height: 1;
  letter-spacing: -3px;
}

.hero h1 span {
  color: #c47aff;
  text-shadow: 0 0 30px #a13dff99;
}

.description {
  color: #d1c4e0;
  line-height: 1.8;
  max-width: 410px;
  margin: 22px 0;
  font-size: 1.05rem;
}

.hero-btn {
  display: inline-block;
  text-decoration: none;
  color: white;
  border: 1px solid var(--purple);
  padding: 13px 24px;
  border-radius: 40px;
  background: #a63cff18;
  box-shadow: 0 0 20px #9f3dff55;
  transition: .3s;
}

.hero-btn:hover {
  background: #a63cff55;
  transform: translateY(-4px);
  box-shadow: 0 0 35px #9f3dff99;
}

.stats {
  display: flex;
  gap: 40px;
  margin-top: 35px;
}

.stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stats strong {
  font-size: 1.4rem;
  color: #d39aff;
}

.stats small {
  color: #a99bbd;
}

.ghost-scene {
  height: 350px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle, #8e3dff25, transparent 65%);
}

.moon {
  position: absolute;
  top: 30px;
  left: 33%;
  height: 140px;
  width: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, white, #d9c4ff 55%, #7955c9);
  box-shadow: 0 0 65px #a68affaa;
}

.ghost {
  position: absolute;
  top: 95px;
  font-size: 140px;
  filter: drop-shadow(0 0 30px #b65aff);
  animation: float 4s ease-in-out infinite;
}

.spark {
  position: absolute;
  color: #e5b8ff;
  font-size: 30px;
  text-shadow: 0 0 20px var(--purple);
  animation: sparkle 3s infinite;
}

.spark1 { top: 55px; left: 15%; }
.spark2 { top: 170px; right: 10%; animation-delay: 1s; }
.spark3 { bottom: 50px; left: 28%; animation-delay: 2s; }

.scene-text {
  position: absolute;
  bottom: 18px;
  color: #c5a8e8;
  letter-spacing: 4px;
  font-size: .7rem;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes sparkle {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.glass {
  background: linear-gradient(145deg, #1b1030ed, #0d0819ed);
  border: 1px solid #b65aff77;
  border-radius: 22px;
  box-shadow: 0 0 30px #8b36ff20, inset 0 1px #ffffff10;
  backdrop-filter: blur(20px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
}

.console, .archive {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.section-heading h2 {
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  color: #d28cff;
}

.model-status {
  font-size: .7rem;
  color: #aef8e9;
  border: 1px solid #50f4dc55;
  padding: 7px 10px;
  border-radius: 30px;
}

.terminal {
  background: #05030d;
  border: 1px solid #873be4;
  border-radius: 12px;
  padding: 15px;
  font-family: monospace;
  line-height: 1.8;
  font-size: .85rem;
  margin-bottom: 22px;
}

.terminal p:first-child {
  color: #b8a8ca;
}

.ready {
  color: var(--cyan);
}

.cursor {
  display: inline-block;
  height: 15px;
  width: 8px;
  background: var(--cyan);
  animation: blink 1s infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.input-grid {
  display: grid;
  grid-template-columns: .85fr 1.4fr;
  gap: 18px;
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field label {
  font-size: .9rem;
  color: #eadcf7;
}

select, textarea {
  width: 100%;
  background: #090613;
  color: white;
  border: 1px solid #61437e;
  border-radius: 12px;
  padding: 14px;
  outline: none;
  font-family: inherit;
}

select {
  min-height: 52px;
}

textarea {
  height: 90px;
  resize: vertical;
}

select:focus, textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 12px #b34cff44;
}

textarea::placeholder {
  color: #8f819f;
}

.counter {
  text-align: right;
  color: #a99bbd;
  font-size: .7rem;
  margin-top: -7px;
}

.buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

button {
  cursor: pointer;
  font-family: inherit;
  transition: .25s;
}

.generate-btn {
  width: min(550px, 100%);
  padding: 15px;
  border: 1px solid white;
  border-radius: 40px;
  background: linear-gradient(100deg, #d65aff, #a9a5ff, #873cff);
  color: #190c2b;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: 0 0 25px #ad48ff88;
}

.generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 38px #ad48ffcc;
}

.generate-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.load-btn {
  padding: 12px 25px;
  border-radius: 35px;
  background: #0b2826;
  border: 1px solid var(--cyan);
  color: #baffef;
}

.load-btn:hover {
  background: #14534a;
}

.note {
  text-align: center;
  color: #9687a8;
  font-size: .7rem;
  margin-top: 15px;
}

.archive {
  display: flex;
  flex-direction: column;
}

.archive .section-heading {
  padding-bottom: 15px;
  border-bottom: 1px solid #ffffff20;
}

#savedCount {
  font-size: .72rem;
  color: #d3c3e5;
}

.archive-list {
  flex: 1;
}

.empty {
  text-align: center;
  padding: 35px 10px;
  color: #c9b6dc;
}

.empty div {
  font-size: 3.5rem;
  animation: float 4s infinite;
}

.empty h3 {
  margin: 15px 0 8px;
  font-size: 1rem;
}

.empty p {
  font-size: .8rem;
  line-height: 1.6;
}

.archive-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #ffffff08;
  border: 1px solid #ffffff15;
  color: white;
  padding: 13px;
  border-radius: 10px;
  margin-bottom: 9px;
}

.archive-item:hover {
  border-color: var(--purple);
  background: #a13cff20;
}

.archive-item strong, .archive-item small {
  display: block;
}

.archive-item small {
  color: #ae9bbf;
  margin-top: 6px;
}

.clear-btn {
  padding: 10px 20px;
  border: 1px solid var(--purple);
  border-radius: 30px;
  background: transparent;
  color: #d99dff;
  align-self: center;
  margin-top: 15px;
}

.clear-btn:hover {
  background: #a13cff30;
}

.story {
  padding: 28px;
  margin-top: 20px;
  animation: floatIn .4s ease;
}

.story[hidden] {
  display: none;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.story h2 {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  color: #d69aff;
  margin-bottom: 18px;
}

#storyText {
  color: #e4d9ef;
  line-height: 1.9;
  white-space: pre-wrap;
}

.story-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.story-actions button {
  border: 1px solid var(--purple);
  border-radius: 30px;
  padding: 10px 18px;
  background: #a13cff16;
  color: white;
}

.story-actions button:hover {
  background: #a13cff44;
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.feature {
  padding: 20px 15px;
  transition: .3s;
}

.feature:hover {
  transform: translateY(-5px);
  border-color: var(--purple);
}

.feature span {
  font-size: 1.8rem;
}

.feature h3 {
  font-size: .9rem;
  margin: 12px 0 7px;
}

.feature p {
  color: #ad9dbf;
  font-size: .75rem;
  line-height: 1.6;
}

footer {
  text-align: center;
  padding: 35px 10px;
  color: #b9a5d1;
  font-size: .8rem;
}

footer p:first-child {
  color: var(--purple);
  margin-bottom: 12px;
}

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #24113a;
  border: 1px solid var(--purple);
  color: white;
  padding: 13px 20px;
  border-radius: 30px;
  opacity: 0;
  pointer-events: none;
  transition: .3s;
  z-index: 20;
  text-align: center;
}

.toast.show {
  opacity: 1;
  bottom: 35px;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr 1fr;
  }

  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 650px) {
  .navbar {
    flex-wrap: wrap;
  }

  nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
  }

  nav a {
    font-size: .8rem;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 50px 0;
  }

  .ghost-scene {
    height: 260px;
  }

  .hero h1 {
    font-size: 3.5rem;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .features {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .features {
    grid-template-columns: 1fr;
  }

  .stats {
    gap: 20px;
  }

  .logo {
    font-size: 1.15rem;
  }
}