:root {
  --ink: #161712;
  --muted: #62645c;
  --paper: #f4f1e8;
  --card: rgba(255, 255, 252, 0.76);
  --line: rgba(22, 23, 18, 0.12);
  --acid: #d9ff57;
  --violet: #6b4eff;
  --shadow: 0 28px 80px rgba(41, 38, 27, 0.11);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(217, 255, 87, 0.34), transparent 28rem),
    radial-gradient(circle at 92% 72%, rgba(107, 78, 255, 0.15), transparent 34rem),
    var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow-x: hidden;
}

button, textarea, select, input { font: inherit; }
button, select { cursor: pointer; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}
.ambient-a { top: -14rem; right: 12%; background: var(--acid); }
.ambient-b { bottom: -12rem; left: -8rem; background: var(--violet); }

.site-header,
.layout,
footer {
  width: min(1420px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 50%;
  letter-spacing: 0;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.privacy-pill span {
  width: 7px;
  height: 7px;
  background: #47b86b;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(71, 184, 107, 0.12);
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { margin: 0; }
.logout-button {
  padding: 9px 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.logout-button:hover { color: var(--ink); border-color: rgba(22, 23, 18, 0.28); }

.layout { padding: 76px 0 48px; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 36px 64px;
  align-items: end;
  margin-bottom: 56px;
}

.eyebrow,
.step {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(42px, 6.5vw, 92px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h1 em { color: var(--violet); font-weight: 500; }

.intro-copy {
  max-width: 520px;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.feature-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-row span {
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4b4d46;
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(440px, 1.18fr);
  gap: 20px;
}

.panel {
  min-width: 0;
  padding: clamp(24px, 3vw, 42px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h2 { margin: 0; font-size: clamp(20px, 2.1vw, 29px); letter-spacing: -0.035em; }

.text-button,
.ghost-button {
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 700;
}
.text-button:hover, .ghost-button:hover { color: var(--violet); }

.prompt-field { position: relative; display: block; }

textarea {
  display: block;
  width: 100%;
  min-height: 196px;
  padding: 19px 19px 38px;
  resize: vertical;
  color: var(--ink);
  background: rgba(246, 244, 237, 0.86);
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  font-size: 14px;
  line-height: 1.75;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus, select:focus {
  border-color: rgba(107, 78, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(107, 78, 255, 0.08);
}

textarea::placeholder { color: #9b9c94; }

.count {
  position: absolute;
  right: 15px;
  bottom: 13px;
  color: #92948b;
  font-size: 10px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.options-grid label > span {
  display: block;
  margin: 0 0 7px 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

select {
  width: 100%;
  height: 46px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: rgba(246, 244, 237, 0.86);
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  font-size: 12px;
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 58px;
  margin-top: 20px;
  padding: 0 10px 0 22px;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.2s, opacity 0.2s;
}
.generate-button:hover { transform: translateY(-1px); }
.generate-button:disabled { cursor: wait; opacity: 0.55; transform: none; }
.button-arrow {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 12px;
  font-size: 20px;
}

.form-note { margin: 12px 2px 0; color: #93958d; font-size: 10px; line-height: 1.5; }

.result { display: flex; flex-direction: column; }
.result-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }

.result-stage {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 468px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(22, 23, 18, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(22, 23, 18, 0.025) 25%, transparent 25%),
    #f8f7f2;
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.result-stage:not(.empty) { background: #ecebe5; }
.result-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }

.empty-state,
.loading-state { color: var(--muted); text-align: center; }
.empty-state p,
.loading-state p { margin: 16px 0 5px; color: var(--ink); font-size: 14px; font-weight: 800; }
.empty-state small,
.loading-state small { color: #92948b; font-size: 11px; }

.empty-orbit {
  position: relative;
  width: 74px;
  height: 74px;
  margin: auto;
  border: 1px solid rgba(107, 78, 255, 0.28);
  border-radius: 50%;
}
.empty-orbit::before, .empty-orbit::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(107, 78, 255, 0.18);
  border-radius: 50%;
}
.empty-orbit::before { inset: 11px; }
.empty-orbit::after { inset: 23px; background: var(--violet); }
.empty-orbit span { position: absolute; top: 4px; left: 33px; width: 7px; height: 7px; background: var(--acid); border-radius: 50%; }

.loader { display: flex; justify-content: center; gap: 7px; }
.loader i {
  width: 10px;
  height: 34px;
  background: var(--violet);
  border-radius: 99px;
  animation: pulse 1s ease-in-out infinite;
}
.loader i:nth-child(2) { animation-delay: 0.14s; background: #957fff; }
.loader i:nth-child(3) { animation-delay: 0.28s; background: var(--acid); }
@keyframes pulse { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }

.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.secondary-button, .ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}
.secondary-button { color: white; background: var(--violet); border: 1px solid var(--violet); }
.result-actions .ghost-button { color: var(--ink); border: 1px solid var(--line); }

.status-message { min-height: 18px; margin: 12px 2px 0; color: #b04444; font-size: 11px; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 34px;
  color: #878980;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.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;
}

.login-body { display: grid; place-items: center; padding: 28px; }
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  width: min(1120px, 100%);
  min-height: min(690px, calc(100vh - 56px));
  overflow: hidden;
  background: rgba(255, 255, 252, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 5vw, 70px);
  background:
    linear-gradient(145deg, rgba(217, 255, 87, 0.32), transparent 55%),
    rgba(244, 241, 232, 0.66);
}
.login-brand { align-self: flex-start; }
.login-story h1 { font-size: clamp(48px, 6vw, 78px); }
.login-copy { max-width: 500px; margin: 28px 0 0; color: var(--muted); line-height: 1.8; }
.login-footnote { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.login-footnote span { width: 8px; height: 8px; background: #47b86b; border-radius: 50%; box-shadow: 0 0 0 5px rgba(71, 184, 107, 0.12); }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 5vw, 70px);
  background: rgba(255, 255, 255, 0.62);
}
.login-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 17px; margin-top: 34px; }
.login-form label > span { display: block; margin: 0 0 8px 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.login-form input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(246, 244, 237, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}
.login-form input:focus { border-color: rgba(107, 78, 255, 0.55); box-shadow: 0 0 0 4px rgba(107, 78, 255, 0.08); }
.login-error { display: none; margin: -3px 2px 0; color: #b04444; font-size: 11px; }
.login-error.visible { display: block; }
.login-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  margin-top: 5px;
  padding: 0 10px 0 20px;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
}
.login-security { margin: 16px 0 0; color: #93958d; font-size: 10px; text-align: center; }
.login-security a { color: inherit; text-underline-offset: 3px; }
.login-security a:hover { color: var(--violet); }

@media (max-width: 980px) {
  .intro { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .result-stage { min-height: 430px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 420px; }
}

@media (max-width: 620px) {
  .site-header, .layout, footer { width: min(100% - 28px, 1420px); }
  .site-header { padding: 18px 0; }
  .layout { padding-top: 46px; }
  .privacy-pill { padding: 8px 10px; }
  .intro { margin-bottom: 34px; }
  .panel { padding: 20px; border-radius: 22px; }
  .panel-heading { display: block; }
  .panel-heading .text-button { margin-top: 10px; }
  .options-grid { grid-template-columns: 1fr; }
  textarea { min-height: 170px; }
  .result-stage { min-height: 330px; }
  footer { gap: 12px; flex-direction: column; }
  .login-body { padding: 14px; }
  .login-shell { min-height: calc(100vh - 28px); border-radius: 24px; }
  .login-story { min-height: 380px; padding: 28px 24px; }
  .login-card { padding: 36px 24px; }
  .header-actions { gap: 6px; }
  .privacy-pill { display: none; }
}

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