:root {
  color-scheme: light;
  --bg: #fcfcfc;
  --ink: #09090b;
  --muted: #63636b;
  --line: #e6e6eb;
  --line-strong: #c9c9d3;
  --panel: rgb(255 255 255 / 0.76);
  --panel-solid: #ffffff;
  --soft: #f4f4f7;
  --field: #fafafa;
  --accent: #7c3aed;
  --accent-2: #18c7c1;
  --accent-3: #d8ff4f;
  --danger: #b42318;
  --radius: 18px;
  --shadow: 0 24px 90px rgb(22 22 35 / 0.12);
  --font:
    "Ubuntu",
    "Avenir Next",
    "Segoe UI",
    "Microsoft YaHei UI",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.88), rgb(255 255 255 / 0.96)),
    url("/template-assets/background/dots-dark.svg") center top / 1120px auto repeat;
  color: var(--ink);
  font-family: var(--font);
}

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

button {
  border: 0;
}

.page-shell {
  width: min(100% - 32px, 1240px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 16px;
  z-index: 10;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 16px 0 22px;
  padding: 10px 12px;
  border: 1px solid rgb(230 230 235 / 0.8);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.72);
  box-shadow: 0 16px 50px rgb(30 30 45 / 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-orbit {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, white 0 16%, transparent 17%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 6px rgb(124 58 237 / 0.1);
}

.brand-orbit::after {
  content: "";
  position: absolute;
  inset: 11px 6px;
  border: 2px solid rgb(255 255 255 / 0.88);
  border-radius: 50%;
  transform: rotate(-24deg);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a,
.status-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
}

.top-nav a {
  padding: 0 15px;
  text-decoration: none;
  transition:
    color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.top-nav a:hover {
  background: rgb(9 9 11 / 0.06);
  color: var(--ink);
  transform: translateY(-1px);
}

.status-pill {
  min-width: 112px;
  justify-content: center;
  padding: 0 14px;
  background: #101014;
  color: white;
}

.hero-section {
  position: relative;
  min-height: calc(100dvh - 112px);
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.28fr);
  align-items: center;
  gap: clamp(22px, 4vw, 58px);
  padding: 34px 0 70px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 7% auto auto 52%;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgb(124 58 237 / 0.32), transparent 62%),
    radial-gradient(circle at 30% 70%, rgb(24 199 193 / 0.32), transparent 44%);
  filter: blur(42px);
  opacity: 0.72;
  pointer-events: none;
  animation: floatGlow 8s ease-in-out infinite alternate;
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding-bottom: 42px;
}

.eyebrow,
.mini-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 7px rgb(124 58 237 / 0.12);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 650px;
  margin-top: 18px;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 560px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.72;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.quick-prompts button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.74);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(20 20 32 / 0.06);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.quick-prompts button:hover {
  border-color: var(--accent);
  box-shadow: 0 16px 42px rgb(124 58 237 / 0.16);
  transform: translateY(-2px);
}

.studio-card {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgb(230 230 235 / 0.9);
  border-radius: 26px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.96), rgb(255 255 255 / 0.84));
  box-shadow: var(--shadow);
  transform: perspective(1200px) rotateX(5deg) rotateY(-5deg);
  transition:
    transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 420ms ease;
}

.studio-card:hover,
.studio-card:focus-within {
  box-shadow: 0 36px 110px rgb(22 22 35 / 0.18);
  transform: perspective(1200px) rotateX(0deg) rotateY(0deg) translateY(-4px);
}

.studio-glow {
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(
    from 180deg,
    transparent,
    rgb(124 58 237 / 0.48),
    rgb(24 199 193 / 0.5),
    transparent 48%
  );
  filter: blur(18px);
  opacity: 0.56;
  animation: rotateGlow 8s linear infinite;
}

.studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 2px 6px 10px;
}

.window-dots {
  display: inline-flex;
  gap: 7px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d7d7df;
}

.window-dots span:nth-child(1) {
  background: #ff6b6b;
}

.window-dots span:nth-child(2) {
  background: #ffd166;
}

.window-dots span:nth-child(3) {
  background: #4ecdc4;
}

.model-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: #101014;
  color: white;
  font-size: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.mode-button {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.mode-button span {
  color: var(--accent);
  font-size: 12px;
}

.mode-button:hover {
  transform: translateY(-1px);
}

.mode-button.active {
  border-color: #101014;
  background: #101014;
  color: white;
}

.mode-button.active span {
  color: var(--accent-3);
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
}

.composer,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.78);
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label,
.field-stack span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: var(--ink);
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

select {
  max-width: 184px;
  min-height: 42px;
  padding: 0 12px;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 260px;
  resize: vertical;
  padding: 14px;
  line-height: 1.72;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(124 58 237 / 0.12);
  background: white;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-stack.compact {
  margin-top: auto;
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.84), rgb(246 246 250 / 0.9)),
    url("/template-assets/background/lines.svg") center / cover no-repeat;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.output-head h2,
.section-head h2,
.rules-card h2 {
  margin-top: 3px;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
}

.result-box {
  min-height: 238px;
  max-height: 420px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 0.88);
  white-space: pre-wrap;
  line-height: 1.76;
  box-shadow: inset 0 1px 0 white;
}

.result-box.empty {
  color: var(--muted);
}

.audit {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.62);
}

.audit summary {
  cursor: pointer;
  padding: 13px 14px;
  font-weight: 900;
}

.audit ul {
  margin: 0;
  padding: 0 16px 14px 34px;
  color: var(--muted);
  line-height: 1.62;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.primary,
.ghost-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary {
  min-width: 198px;
  padding: 0 18px;
  background: #101014;
  color: white;
  box-shadow: 0 14px 34px rgb(16 16 20 / 0.2);
}

.primary:hover {
  box-shadow: 0 18px 46px rgb(124 58 237 / 0.24);
  transform: translateY(-2px);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.arrow {
  display: inline-block;
  transition: transform 180ms ease;
}

.primary:hover .arrow {
  transform: translateX(4px);
}

.ghost-button {
  min-width: 82px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgb(22 22 35 / 0.1);
}

.ghost-button.small {
  min-width: 62px;
  min-height: 38px;
  border-radius: 12px;
}

.flow-section,
.rules-section {
  padding: 42px 0;
}

.section-head {
  max-width: 760px;
  margin-bottom: 18px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.flow-grid article,
.rules-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.78);
  box-shadow: 0 16px 60px rgb(22 22 35 / 0.08);
}

.flow-grid article {
  min-height: 190px;
  padding: 22px;
  transition:
    transform 180ms ease,
    border-color 180ms ease;
}

.flow-grid article:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.flow-grid article span {
  color: var(--accent);
  font-weight: 900;
}

.flow-grid h3 {
  margin-top: 22px;
  font-size: 22px;
}

.flow-grid p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.rules-card {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: center;
  gap: 20px;
  padding: 24px;
  overflow: hidden;
}

.rule-marquee {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.rule-marquee span {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #101014;
  color: white;
  font-size: 14px;
  box-shadow: 0 12px 28px rgb(16 16 20 / 0.12);
}

.is-loading .studio-card {
  cursor: progress;
}

.is-loading .studio-glow {
  opacity: 0.9;
  animation-duration: 2.8s;
}

@keyframes rotateGlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes floatGlow {
  from {
    transform: translate3d(-20px, -8px, 0) scale(0.94);
  }
  to {
    transform: translate3d(26px, 22px, 0) scale(1.08);
  }
}

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

@media (max-width: 1040px) {
  .hero-section {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 24px;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .studio-card {
    transform: none;
  }

  .studio-card:hover,
  .studio-card:focus-within {
    transform: translateY(-2px);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 22px, 1240px);
  }

  .site-header {
    align-items: stretch;
    flex-direction: column;
    border-radius: 24px;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  .status-pill {
    width: 100%;
  }

  h1 {
    font-size: clamp(44px, 16vw, 72px);
  }

  .studio-grid,
  .flow-grid,
  .rules-card {
    grid-template-columns: 1fr;
  }

  .rule-marquee {
    justify-content: flex-start;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary,
  .ghost-button {
    width: 100%;
  }

  select {
    max-width: none;
  }

  .field-row {
    align-items: stretch;
    flex-direction: column;
  }
}
