/* ============ self-hosted fonts (latin; CJK falls back to system fonts) ============ */
/* Instrument Serif */
@font-face {
  font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}
/* DM Sans 300-700 */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("fonts/dm-sans-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }
/* JetBrains Mono 400/500 */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

/* ============ tokens ============ */
:root {
  --bg-1: #fff6f0;
  --bg-2: #ffe5f2;
  --bg-3: #e3f1ff;
  --bg-4: #fff2d6;

  --ink-1: #1a1326;
  --ink-2: #4a3f5a;
  --ink-3: #8a7d99;
  --ink-4: #c4bccf;

  --hot: oklch(72% 0.18 25);     /* coral */
  --warm: oklch(82% 0.14 70);    /* peach */
  --cool: oklch(78% 0.13 220);   /* sky */
  --violet: oklch(70% 0.17 305); /* magenta */
  --mint: oklch(82% 0.10 165);

  --glass-bg: rgba(255, 255, 255, 0.42);
  --glass-bg-strong: rgba(255, 255, 255, 0.62);
  --glass-bd: rgba(255, 255, 255, 0.85);
  --glass-bd-inner: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 30px 60px -25px rgba(60, 20, 90, 0.25),
                  0 8px 24px -8px rgba(60, 20, 90, 0.15),
                  inset 0 1px 0 rgba(255,255,255,0.9),
                  inset 0 -1px 0 rgba(120, 80, 160, 0.08);

  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 34px;
  --radius-xl: 48px;

  --serif: "Instrument Serif", "Times New Roman", "Songti SC", serif;
  --sans: "DM Sans", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "PingFang SC", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink-1);
  background: #fff6f0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}

/* ============ mesh gradient background ============ */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -2;
  background:
    radial-gradient(45% 35% at 8% 12%, oklch(85% 0.13 25 / 0.9), transparent 65%),
    radial-gradient(40% 40% at 88% 8%, oklch(85% 0.12 305 / 0.85), transparent 65%),
    radial-gradient(55% 50% at 92% 88%, oklch(86% 0.11 220 / 0.85), transparent 65%),
    radial-gradient(45% 40% at 12% 92%, oklch(88% 0.12 70 / 0.85), transparent 65%),
    radial-gradient(35% 35% at 50% 50%, oklch(92% 0.06 100 / 0.7), transparent 70%),
    #fdf6ef;
  filter: saturate(1.05);
  animation: meshDrift 30s ease-in-out infinite alternate;
}
@keyframes meshDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 2%) scale(1.05); }
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ============ floating glass orbs ============ */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite alternate;
}
@keyframes float {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(40px, -30px, 0) scale(1.08); }
}

/* ============ layout shell ============ */
.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 32px clamp(20px, 4vw, 56px) 120px;
  position: relative;
  z-index: 1;
}

/* ============ nav ============ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 22px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-bd-inner);
  box-shadow: var(--glass-shadow);
  position: sticky;
  top: 12px;
  z-index: 50;
  flex-wrap: wrap;
}
.nav__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav__menu {
  display: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.6);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-1);
}
.nav__mobile-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 8px;
  width: 100%;
  flex-direction: column;
  background: rgba(255,255,255,0.55);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.8);
  gap: 2px;
}
.nav__mobile-menu a {
  display: block;
  padding: 12px 16px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink-1);
  font-size: 15px;
}
.nav__mobile-menu a:active { background: rgba(255,255,255,0.7); }
.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 28px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink-1);
  text-decoration: none;
  cursor: pointer;
}
.nav__brand:hover { color: var(--ink-1); }
.nav__brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fff, transparent 50%),
    conic-gradient(from 200deg, oklch(85% 0.14 25), oklch(82% 0.15 305), oklch(82% 0.14 220), oklch(86% 0.15 70), oklch(85% 0.14 25));
  box-shadow: inset 0 -3px 6px rgba(255, 100, 150, 0.2), 0 4px 16px rgba(200, 100, 200, 0.25);
}
.nav__links {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}
.nav__links a {
  text-decoration: none;
  color: inherit;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.nav__links a:hover { background: rgba(255,255,255,0.7); color: var(--ink-1); }
.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: linear-gradient(135deg, oklch(72% 0.18 25), oklch(68% 0.18 305));
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 18px -6px oklch(72% 0.18 25 / 0.5);
  cursor: pointer;
  transition: transform 0.15s;
  white-space: nowrap;
}
.nav__cta:hover { transform: translateY(-1px); }
.nav__cta-text { display: inline; }

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  padding: 3px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.lang-toggle button {
  border: none;
  background: transparent;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  padding: 6px 12px;
  cursor: pointer;
  min-width: 32px;
  transition: all 0.18s;
  line-height: 1;
}
.lang-toggle button.is-on {
  background: var(--ink-1);
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.lang-toggle button:hover:not(.is-on) { color: var(--ink-1); }

/* ============ hero ============ */
.hero {
  position: relative;
  padding: 110px 0 80px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--glass-bd-inner);
  backdrop-filter: blur(12px);
  width: max-content;
}
.hero__eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: oklch(72% 0.18 145);
  box-shadow: 0 0 12px oklch(72% 0.18 145);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin: 22px 0 26px;
  color: var(--ink-1);
}
.hero h1 .it { font-style: italic; color: oklch(45% 0.18 320); }
.hero h1 .underline {
  position: relative;
  display: inline-block;
}
.hero h1 .underline::after {
  content: "";
  position: absolute;
  left: 4%; right: 4%; bottom: 4%;
  height: 14%;
  background: linear-gradient(90deg, oklch(82% 0.16 25 / 0.5), oklch(80% 0.16 305 / 0.5));
  border-radius: 999px;
  z-index: -1;
}
.hero p.lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 480px;
  margin: 0 0 36px;
}
.hero__row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.hero__terminal {
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  backdrop-filter: blur(12px);
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  max-width: 100%;
  min-width: 0;
}
.hero__terminal-text {
  max-width: 320px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  animation: termIn 0.5s ease;
}
@keyframes termIn {
  from { opacity: 0; transform: translateX(4px); }
  to   { opacity: 1; transform: translateX(0); }
}
.hero__caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--ink-2);
  animation: caretBlink 1s steps(2) infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes caretBlink {
  50% { opacity: 0; }
}
.hero__stats {
  display: flex;
  gap: 28px;
  margin-top: 56px;
  flex-wrap: wrap;
}
.hero__stat .v {
  font-family: var(--serif);
  font-size: 38px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hero__stat .l {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-top: 6px;
}

/* hero crystal */
.crystal {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 560px;
  justify-self: center;
}
.crystal__sphere {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.2) 18%, transparent 35%),
    radial-gradient(circle at 70% 70%, oklch(80% 0.18 25 / 0.6), transparent 50%),
    radial-gradient(circle at 30% 80%, oklch(75% 0.18 220 / 0.55), transparent 55%),
    radial-gradient(circle at 75% 30%, oklch(78% 0.18 305 / 0.55), transparent 55%),
    radial-gradient(circle at 50% 50%, oklch(88% 0.10 80 / 0.4), transparent 60%);
  box-shadow:
    inset 0 0 80px rgba(255,255,255,0.4),
    inset -20px -30px 60px rgba(180, 80, 180, 0.2),
    0 60px 100px -40px rgba(180, 80, 180, 0.45),
    0 30px 50px -20px rgba(255, 150, 100, 0.3);
  animation: spin 24s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.crystal__sphere::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: inset 0 -8px 24px rgba(120, 60, 160, 0.15);
}
.crystal__highlight {
  position: absolute;
  top: 14%;
  left: 22%;
  width: 28%;
  height: 18%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0.95), transparent 70%);
  filter: blur(2px);
  border-radius: 50%;
  pointer-events: none;
}
.crystal__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.6);
  animation: spin 60s linear infinite reverse;
}
.crystal__ring--2 {
  inset: -4%;
  border-color: rgba(255,255,255,0.35);
  animation-duration: 90s;
}
.crystal__chip {
  position: absolute;
  padding: 8px 14px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  border: 1px solid var(--glass-bd-inner);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(60,20,90,0.18);
  animation: floatChip 6s ease-in-out infinite alternate;
}
.crystal__chip--1 { top: 6%; right: -4%; }
.crystal__chip--2 { top: 38%; left: -10%; animation-delay: -2s; }
.crystal__chip--3 { bottom: 8%; right: 2%; animation-delay: -4s; }
.crystal__chip--4 { bottom: 28%; left: -2%; animation-delay: -1s; }
@keyframes floatChip {
  to { transform: translate(8px, -10px); }
}

/* ============ section heading ============ */
.section {
  margin-top: 120px;
  position: relative;
}
.section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.section__head-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}
.section__kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.section h2 {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 76px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 720px;
}
.section h2 em { font-style: italic; color: oklch(50% 0.15 320); }
.section__sub {
  max-width: 380px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

/* ============ generator (the centerpiece) ============ */
.gen {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr;
  gap: 28px;
  align-items: stretch;
}
@media (max-width: 1080px) {
  .gen { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--glass-bd-inner);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}
.glass::before {
  /* edge highlight */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,0.95), rgba(255,255,255,0.1) 40%, rgba(255,255,255,0.4));
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.gen__compose {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gen__compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gen__compose-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
}
.dots { display: flex; gap: 6px; }
.dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(120,80,160,0.15);
}
.dots span:nth-child(1) { background: oklch(85% 0.16 25); }
.dots span:nth-child(2) { background: oklch(85% 0.16 80); }
.dots span:nth-child(3) { background: oklch(85% 0.13 165); }

.prompt-input {
  background: rgba(255,255,255,0.65);
  border-radius: var(--radius-md);
  padding: 18px 18px 14px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 0 rgba(120,80,160,0.05);
  min-height: 140px;
  position: relative;
}
.prompt-input__field {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-1);
  resize: none;
  min-height: 90px;
}
.prompt-input__field::placeholder { color: var(--ink-3); }
.prompt-input__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(120,80,160,0.15);
  margin-top: 8px;
  min-height: 38px;
  align-items: center;
}
.prompt-input__chips-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.ingredient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.7));
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: 0 2px 6px rgba(120,80,160,0.12);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-1);
  cursor: pointer;
  transition: transform 0.15s;
  animation: chipIn 0.3s cubic-bezier(.2,.9,.3,1.2);
}
.ingredient-chip:hover { transform: translateY(-1px); }
.ingredient-chip .swatch {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}
.ingredient-chip .x {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--ink-2);
  margin-left: 2px;
}
@keyframes chipIn {
  from { transform: scale(0.6) translateY(8px); opacity: 0; }
}

/* settings row */
.gen__settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.gen__setting {
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.gen__setting label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.aspect-options {
  display: flex;
  gap: 6px;
}
.aspect-options button {
  flex: 1;
  border: 1px solid rgba(120,80,160,0.15);
  background: rgba(255,255,255,0.8);
  border-radius: 10px;
  padding: 6px 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.aspect-options button.is-on {
  background: var(--ink-1);
  color: white;
  border-color: var(--ink-1);
}
.aspect-vis {
  display: flex; align-items: center; justify-content: center;
  height: 28px;
}
.aspect-vis i {
  background: currentColor;
  border-radius: 2px;
  display: block;
}
.aspect-label {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.04em;
  opacity: 0.8;
}
.model-select {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
}
.model-select .badge {
  padding: 2px 6px;
  background: oklch(72% 0.18 145 / 0.2);
  color: oklch(40% 0.15 145);
  border-radius: 6px;
  font-size: 10px;
}
.steps-slider {
  position: relative;
  height: 6px;
  background: rgba(120,80,160,0.12);
  border-radius: 999px;
  margin-top: 8px;
}
.steps-slider .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, oklch(72% 0.18 25), oklch(68% 0.18 305));
  border-radius: inherit;
}
.steps-slider input {
  position: absolute;
  inset: -8px 0;
  width: 100%; opacity: 0; cursor: pointer;
}
.steps-row {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 12px;
}

.gen__go {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.gen__go-main {
  flex: 1;
  padding: 16px 22px;
  border-radius: 999px;
  border: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  color: white;
  background:
    linear-gradient(135deg, oklch(72% 0.20 25) 0%, oklch(70% 0.20 340) 50%, oklch(70% 0.20 280) 100%);
  background-size: 200% 200%;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 12px 28px -8px oklch(70% 0.20 305 / 0.5),
    0 4px 10px -4px oklch(70% 0.20 25 / 0.4);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 0.15s, background-position 0.6s;
  position: relative;
  overflow: hidden;
}
.gen__go-main:hover { background-position: 100% 0; transform: translateY(-1px); }
.gen__go-main:disabled { opacity: 0.55; cursor: wait; transform: none; }
.gen__go-main .kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(0,0,0,0.18);
  margin-left: 4px;
}
.gen__go-icon {
  width: 56px;
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.6);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.gen__go-icon:hover { background: white; color: var(--ink-1); transform: translateY(-1px); }
.gen__go-icon.is-on {
  background: var(--ink-1);
  color: white;
  border-color: var(--ink-1);
}

/* Refine popover */
.refine-wrap {
  position: relative;
  display: inline-flex;
}
.refine-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: rgba(255, 250, 245, 0.96);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 18px;
  padding: 10px;
  box-shadow:
    0 20px 50px -20px rgba(60, 20, 90, 0.45),
    0 6px 20px -8px rgba(60, 20, 90, 0.2),
    inset 0 1px 0 rgba(255,255,255,0.95);
  z-index: 20;
  animation: refineMenuIn 0.18s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes refineMenuIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.refine-menu::after {
  /* arrow */
  content: "";
  position: absolute;
  top: 100%;
  right: 22px;
  border: 6px solid transparent;
  border-top-color: rgba(255, 250, 245, 0.96);
}
.refine-menu__title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 8px 8px;
}
.refine-menu__list {
  display: grid;
  gap: 2px;
}
.refine-menu__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-1);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.refine-menu__btn:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.6));
  box-shadow: 0 2px 6px rgba(120,80,160,0.1);
}
.refine-menu__icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, oklch(86% 0.13 25 / 0.5), oklch(82% 0.14 305 / 0.5));
  color: var(--ink-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.refine-menu__plus {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink-3);
  line-height: 1;
}

/* Prompt input flash highlight when Surprise me fires */
.prompt-input.is-flash {
  animation: promptFlash 0.7s ease-out;
}
@keyframes promptFlash {
  0%   { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 0 0 0px oklch(80% 0.18 305 / 0.5); }
  25%  { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 0 0 6px oklch(80% 0.18 305 / 0.35); background: rgba(255, 245, 250, 0.85); }
  100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 0 0 0px oklch(80% 0.18 305 / 0); }
}

/* canvas / output panel */
.gen__canvas {
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.gen__canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.gen__canvas-head .left {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.gen__canvas-head .left .blip {
  width: 8px; height: 8px; border-radius: 50%;
  background: oklch(72% 0.20 25);
  box-shadow: 0 0 8px oklch(72% 0.20 25);
}
.gen__canvas-head .left .blip.is-idle { background: var(--ink-4); box-shadow: none; }
.gen__canvas-head .right { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.6);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.15s;
}
.icon-btn:hover { background: white; color: var(--ink-1); }

.gen__result-actions {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 14px;
}

.gen__send-edit {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.86);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--hot), oklch(70% 0.20 305));
  color: white;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 16px 34px -18px oklch(65% 0.20 305 / 0.55);
  transition: transform 0.15s, box-shadow 0.15s;
}

.gen__send-edit:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px -18px oklch(65% 0.20 305 / 0.7);
}

.canvas-stage {
  position: relative;
  flex: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background:
    repeating-conic-gradient(rgba(120,80,160,0.04) 0% 25%, transparent 0% 50%) 50% 50% / 22px 22px,
    rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.7);
  min-height: 460px;
  display: flex; align-items: center; justify-content: center;
}

.canvas-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.6s, transform 0.6s;
  opacity: 0;
}
.canvas-image.is-on { opacity: 1; }

.diffusion {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.diffusion.is-on { opacity: 1; }
.diffusion__noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 100% 100%;
  mix-blend-mode: overlay;
  animation: shift 0.3s steps(6) infinite;
}
@keyframes shift {
  0% { transform: translate(0,0); }
  20% { transform: translate(-4%,3%); }
  40% { transform: translate(3%,-5%); }
  60% { transform: translate(-2%,-2%); }
  80% { transform: translate(5%,4%); }
  100% { transform: translate(0,0); }
}
.diffusion__color {
  position: absolute; inset: 0;
  background:
    radial-gradient(40% 40% at 30% 30%, oklch(75% 0.20 25 / 0.9), transparent 60%),
    radial-gradient(40% 40% at 70% 70%, oklch(72% 0.20 305 / 0.9), transparent 60%),
    radial-gradient(50% 50% at 50% 50%, oklch(80% 0.18 220 / 0.7), transparent 70%);
  filter: blur(0px);
  animation: deblur 4s linear forwards;
  mix-blend-mode: normal;
}
@keyframes deblur {
  0% { filter: blur(60px); }
  100% { filter: blur(0px); }
}
.diffusion__progress {
  position: absolute;
  left: 18px; right: 18px; bottom: 18px;
  height: 4px;
  background: rgba(255,255,255,0.4);
  border-radius: 999px;
  overflow: hidden;
}
.diffusion__progress .bar {
  height: 100%;
  background: linear-gradient(90deg, oklch(72% 0.20 25), oklch(70% 0.20 280));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px oklch(72% 0.20 305);
}
.diffusion__caption {
  position: absolute;
  left: 18px; bottom: 32px;
  font-family: var(--mono);
  font-size: 11px;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.canvas-empty {
  text-align: center;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  z-index: 2;
}
.canvas-empty .big {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.gen__canvas-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.gen__canvas-foot-meta {
  min-width: 0;
  flex: 1;
  word-break: break-word;
}
.gen__canvas-foot strong { color: var(--ink-1); font-weight: 500; }
.gen__variations {
  display: flex; gap: 8px;
}
.gen__variations .v {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.8);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.gen__variations .v.is-on { outline: 2px solid var(--ink-1); outline-offset: 2px; }

/* ============ templates ============ */
.tpl-panes {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
}
@media (max-width: 1080px) {
  .tpl-panes { grid-template-columns: 1fr; }
}
.tpl-cats {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--glass-bd-inner);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--glass-shadow);
  height: max-content;
}
.tpl-cats__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tpl-cats__head {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  padding: 8px 12px;
}
.tpl-cats__btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.15s, color 0.15s;
}
.tpl-cats__btn:hover { background: rgba(255,255,255,0.5); color: var(--ink-1); }
.tpl-cats__btn.is-on {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.55));
  color: var(--ink-1);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(120,80,160,0.1);
}
.tpl-cats__btn .swatch {
  width: 22px; height: 22px; border-radius: 7px;
}
.tpl-cats__btn .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 880px) {
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
}
.tpl-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-bd-inner);
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 28px -16px rgba(60,20,90,0.25);
  transition: transform 0.25s cubic-bezier(.2,.9,.3,1.1), box-shadow 0.25s;
  aspect-ratio: 4/5;
  display: flex;
  flex-direction: column;
}
.tpl-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px -20px rgba(60,20,90,0.35);
}
.tpl-card__preview {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.tpl-card__preview-gradient {
  position: absolute; inset: 0;
}
.tpl-card__preview-grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.6;
}
.tpl-card__preview-label {
  position: absolute;
  inset: auto 12px 12px 12px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tpl-card__body {
  padding: 12px 14px 14px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
}
.tpl-card__title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.tpl-card__title em { font-style: italic; color: oklch(50% 0.15 320); }
.tpl-card__desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tpl-card__use {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-1);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.tpl-card:hover .tpl-card__use { opacity: 1; transform: translateY(0); }

/* ============ ingredient drawer (novel) ============ */
.ingredients {
  margin-top: 18px;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.ingredients__title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.ingredients__rows { display: grid; gap: 8px; }
.ingredients__row {
  display: flex; align-items: flex-start; gap: 8px;
}
.ingredients__chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.ingredients__row-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  width: 70px;
}
.ingredients__chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.9);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.ingredients__chip:hover { background: white; color: var(--ink-1); transform: translateY(-1px); }
.ingredients__chip.is-on {
  background: var(--ink-1);
  color: white;
  border-color: var(--ink-1);
}
.ingredients__chip .swatch {
  width: 10px; height: 10px; border-radius: 50%;
}

.gal-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.gal-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.gal-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.92);
  box-shadow: 0 14px 34px -26px rgba(60,20,90,0.35);
  backdrop-filter: blur(18px);
}

.gal-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink-1);
  font-size: 14px;
  font-family: var(--sans);
}

.gal-search__input::placeholder {
  color: var(--ink-3);
}

.gal-search__clear {
  border: none;
  background: rgba(20, 8, 40, 0.08);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.gal-search__clear:hover {
  background: rgba(20, 8, 40, 0.14);
  color: var(--ink-1);
}

.gal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gal-tab {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.9);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 20px -18px rgba(60,20,90,0.25);
}

.gal-tab:hover {
  background: white;
  color: var(--ink-1);
  transform: translateY(-1px);
}

.gal-tab.is-active {
  background: var(--ink-1);
  color: white;
  border-color: var(--ink-1);
}

.gal-tab__count {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  opacity: 0.8;
}

/* ============ gallery ============ */
/* Taobao-style lazy masonry: JS renders only the current batch, then
   distributes those visible cards into shortest columns so vertical gaps close. */
.gallery {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.gallery__col {
  flex: 1 1 0;
  min-width: 0;
}
.gallery__sentinel {
  min-height: 90px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.gal-card {
  break-inside: avoid;
  margin-bottom: 18px;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 40px -24px rgba(60,20,90,0.4);
  cursor: pointer;
  /* scroll-reveal: hidden until .is-visible is added by IntersectionObserver */
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(.2,.9,.3,1);
}
.gal-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
@media (prefers-reduced-motion: reduce) {
  .gal-card { opacity: 1; transform: none; transition: none; }
}
.gal-card__img {
  width: 100%;
  height: auto;
  display: block;
  background-size: cover;
  background-position: center;
  transition: transform 0.6s cubic-bezier(.2,.9,.3,1);
}
.gal-card:hover .gal-card__img { transform: scale(1.05); }
.gal-card__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20,8,40,0.85) 100%);
  opacity: 0;
  transition: opacity 0.25s;
}
.gal-card:hover .gal-card__veil { opacity: 1; }
.gal-card__info {
  position: absolute;
  left: 14px; right: 14px; bottom: 14px;
  color: white;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.gal-card:hover .gal-card__info { opacity: 1; transform: translateY(0); }
.gal-card__title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.9);
  margin-bottom: 8px;
}
.gal-card__prompt {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gal-card__meta {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.gal-card__meta .tag {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
}
.gal-card__badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  color: var(--ink-1);
}
.gal-card__actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.gal-card:hover .gal-card__actions { opacity: 1; }
.gal-card__action {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.95);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-1);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.gal-card__action:hover { background: white; transform: translateY(-1px); }

/* gallery filters */
.gal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd-inner);
  border-radius: 999px;
  backdrop-filter: blur(24px);
  box-shadow: var(--glass-shadow);
  width: max-content;
  max-width: 100%;
}
.gal-filters button {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.gal-filters button:hover { color: var(--ink-1); }
.gal-filters button.is-on {
  background: var(--ink-1);
  color: white;
  font-weight: 500;
}

.gal-error {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
}

/* ============ footer ============ */
.foot {
  margin-top: 120px;
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd-inner);
  backdrop-filter: blur(24px);
  box-shadow: var(--glass-shadow);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  font-size: 14px;
}
.foot h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
  font-weight: 500;
}
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink-1); }
.foot__brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 36px;
  letter-spacing: -0.02em;
}
.foot__brand-sub {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13px;
}
@media (max-width: 880px) {
  .foot { grid-template-columns: 1fr 1fr; }
}

/* sparkle */
.sparkle {
  position: absolute;
  width: 6px; height: 6px;
  background: white;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
  box-shadow: 0 0 10px white;
}

/* toast */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 12px 18px;
  background: var(--ink-1);
  color: white;
  border-radius: 999px;
  font-size: 13px;
  font-family: var(--sans);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: oklch(82% 0.16 145); }

/* ============ Modals ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 14, 50, 0.45);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 28px;
  animation: modalFadeIn 0.22s ease-out;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  background:
    radial-gradient(50% 50% at 0% 0%, oklch(95% 0.06 25 / 0.5), transparent 70%),
    radial-gradient(50% 50% at 100% 100%, oklch(94% 0.07 305 / 0.45), transparent 70%),
    rgba(255, 250, 245, 0.96);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 28px;
  box-shadow:
    0 40px 100px -20px rgba(60, 20, 90, 0.45),
    0 12px 40px -10px rgba(60, 20, 90, 0.25),
    inset 0 1px 0 rgba(255,255,255,0.95);
  max-height: calc(100vh - 56px);
  overflow: auto;
  width: 100%;
  animation: modalSlideIn 0.28s cubic-bezier(.2,.9,.3,1.05);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal--narrow { max-width: 460px; }
.modal--wide   { max-width: 980px; }
.modal--fullscreen {
  max-width: 95vw;
  max-height: 95vh;
  background: transparent;
  box-shadow: none;
  border: none;
  overflow: visible;
}
.modal__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.95);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-1);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 4px 12px rgba(60,20,90,0.18);
}
.modal__close:hover { background: white; transform: rotate(90deg); }
.modal__pad { padding: 40px 44px 36px; }
.modal__head { margin-bottom: 28px; }
.modal__head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 6px 0 14px;
}
.modal__head h2 em { font-style: italic; color: oklch(50% 0.15 320); }
html[data-lang="zh"] .modal__head h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 32px;
}
html[data-lang="zh"] .modal__head h2 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}
.modal__head--center { text-align: center; }
.modal__sub {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  max-width: 560px;
}

/* ---- Pricing ---- */
.cycle-toggle {
  display: inline-flex;
  margin-top: 18px;
  padding: 4px;
  background: rgba(0,0,0,0.05);
  border-radius: 999px;
}
.cycle-toggle button {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.cycle-toggle button.is-on {
  background: var(--ink-1);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.plan-card {
  position: relative;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 22px;
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 24px -16px rgba(60,20,90,0.18);
}
.plan-card.is-featured {
  background:
    radial-gradient(60% 60% at 0% 0%, oklch(82% 0.16 25 / 0.7), transparent 70%),
    radial-gradient(60% 60% at 100% 100%, oklch(76% 0.18 305 / 0.7), transparent 70%),
    rgba(255,255,255,0.85);
  border: 1px solid oklch(78% 0.16 305 / 0.5);
  box-shadow: 0 24px 50px -22px oklch(70% 0.20 305 / 0.55);
  transform: translateY(-8px);
}
.plan-card__ribbon {
  position: absolute;
  top: -10px; left: 22px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ink-1);
  color: white;
}
.plan-card__name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  letter-spacing: -0.01em;
}
html[data-lang="zh"] .plan-card__name {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 22px;
}
.plan-card__tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 6px;
}
.plan-card__price {
  margin-top: 14px;
  display: flex; align-items: baseline; gap: 4px;
}
.plan-card__price .num {
  font-family: var(--serif);
  font-size: 48px;
  letter-spacing: -0.02em;
  line-height: 1;
}
html[data-lang="zh"] .plan-card__price .num { font-family: var(--sans); font-weight: 700; font-size: 40px; }
.plan-card__price .unit { color: var(--ink-3); font-family: var(--mono); font-size: 12px; }
.plan-card__features {
  list-style: none;
  padding: 0;
  margin: 22px 0 22px;
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
  flex: 1;
}
.plan-card__features li {
  display: flex; align-items: flex-start; gap: 8px;
  line-height: 1.45;
}
.plan-card__check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: oklch(82% 0.13 145 / 0.4);
  color: oklch(40% 0.15 145);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.plan-card__cta {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-1);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.plan-card__cta:hover { background: white; transform: translateY(-1px); }
.plan-card__cta.is-primary {
  background: linear-gradient(135deg, oklch(72% 0.20 25), oklch(70% 0.20 305));
  color: white;
  border: none;
  box-shadow: 0 8px 22px -8px oklch(70% 0.20 305 / 0.55);
}

/* ---- Docs ---- */
.docs__tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
  width: max-content;
  max-width: 100%;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.docs__tabs::-webkit-scrollbar { display: none; }
.docs__tabs button {
  border: none; background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.docs__tabs button.is-on {
  background: var(--ink-1);
  color: white;
}
.docs__body { min-height: 280px; }
.docs__guide { display: grid; gap: 18px; }
.docs__guide-row {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 18px;
  padding: 18px 20px;
}
.docs__guide-row h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
html[data-lang="zh"] .docs__guide-row h3 {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 17px;
}
.docs__guide-row p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.docs__lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink-1);
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
html[data-lang="zh"] .docs__lead {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 16px;
}
.docs__ingredients .docs__ing-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(120,80,160,0.15);
}
.docs__ingredients .docs__ing-row:last-child { border-bottom: none; }
.docs__ing-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  width: 70px;
  flex-shrink: 0;
  padding-top: 6px;
}
.docs__ing-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.docs__code {
  background: oklch(20% 0.04 280);
  color: oklch(92% 0.04 80);
  padding: 18px 20px;
  border-radius: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0 0 12px;
  white-space: pre;
}
.docs__api-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.docs__changelog {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.docs__changelog li {
  display: grid;
  grid-template-columns: 100px 60px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed rgba(120,80,160,0.15);
  align-items: baseline;
  font-size: 14px;
}
.docs__changelog li:last-child { border-bottom: none; }
.docs__changelog-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.docs__changelog-ver {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: oklch(72% 0.20 305 / 0.18);
  color: oklch(40% 0.20 305);
  width: max-content;
}
.docs__changelog-note { color: var(--ink-1); }

/* ---- Signup ---- */
.signup__mark {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fff, transparent 50%),
    conic-gradient(from 200deg, oklch(85% 0.14 25), oklch(82% 0.15 305), oklch(82% 0.14 220), oklch(86% 0.15 70), oklch(85% 0.14 25));
  box-shadow: 0 10px 24px -6px oklch(70% 0.18 305 / 0.45);
}
.signup__form { display: grid; gap: 12px; }
.signup__field {
  display: grid; gap: 4px;
}
.signup__field > span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.signup__field input {
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.85);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-1);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.signup__field input:focus {
  border-color: oklch(70% 0.18 305);
  box-shadow: 0 0 0 3px oklch(70% 0.18 305 / 0.18);
}
.signup__agree {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.4;
  padding: 4px 0;
}
.signup__agree input { margin-top: 3px; accent-color: var(--ink-1); }
.signup__cta {
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  color: white;
  background: linear-gradient(135deg, oklch(72% 0.20 25), oklch(70% 0.20 305));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 10px 24px -8px oklch(70% 0.20 305 / 0.45);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  transition: transform 0.15s;
}
.signup__cta:hover { transform: translateY(-1px); }
.signup__or {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  position: relative;
  margin: 14px 0 8px;
}
.signup__or::before, .signup__or::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: rgba(120,80,160,0.18);
}
.signup__or::before { left: 0; }
.signup__or::after { right: 0; }
.signup__oauth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.signup__oauth button {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-1);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
}
.signup__oauth button:hover { background: white; }
.signup__bottom {
  text-align: center;
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 12px;
}
.signup__bottom button {
  background: none;
  border: none;
  color: oklch(45% 0.18 305);
  font-weight: 500;
  cursor: pointer;
  font-size: inherit;
  padding: 0 0 0 4px;
  text-decoration: underline;
  text-decoration-color: oklch(45% 0.18 305 / 0.3);
  text-underline-offset: 3px;
}
.signup__success {
  text-align: center;
  padding: 20px 0;
}
.signup__check {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: oklch(80% 0.16 145 / 0.25);
  color: oklch(40% 0.18 145);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  animation: checkPop 0.5s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes checkPop {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ---- Fullscreen image viewer ---- */
.fullscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-height: 95vh;
}
.fullscreen img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
}
.fullscreen__caption {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 14px 22px;
  text-align: center;
  max-width: 720px;
  border: 1px solid rgba(255,255,255,0.95);
}
.fullscreen__caption-prompt {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink-1);
  display: block;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
html[data-lang="zh"] .fullscreen__caption-prompt {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 16px;
}
.fullscreen__caption-meta {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.fullscreen__use {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: var(--ink-1);
  color: white;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.fullscreen__use:hover { transform: translateY(-1px); opacity: 0.9; }

/* ============ pre-generation quiz ============ */
.quiz h3 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 18px;
  color: var(--ink-1);
}
.quiz form { display: flex; flex-direction: column; gap: 8px; }
.quiz label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  margin-top: 8px;
}
.quiz input {
  border: 1px solid rgba(120,80,160,0.2);
  background: rgba(255,255,255,0.85);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-1);
  outline: none;
}
.quiz input:focus { border-color: var(--ink-1); }
.quiz__err {
  color: oklch(55% 0.2 25);
  font-size: 13px;
  margin-top: 6px;
}
.quiz__go {
  margin-top: 14px;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  background: var(--ink-1);
  color: white;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.quiz__go:hover { transform: translateY(-1px); opacity: 0.9; }

/* ---- Foot CTA ---- */
.foot__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.95);
  background: linear-gradient(135deg, oklch(72% 0.20 25), oklch(70% 0.20 305));
  color: white;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s;
}
.foot__cta:hover { transform: translateY(-1px); }

/* Modal mobile */
@media (max-width: 760px) {
  .modal-backdrop { padding: 16px; align-items: flex-end; }
  .modal { border-radius: 24px; max-height: 92vh; }
  .modal--narrow, .modal--wide { max-width: 100%; }
  .modal__pad { padding: 28px 22px 24px; }
  .modal__head h2 { font-size: 30px; }
  html[data-lang="zh"] .modal__head h2 { font-size: 24px; }
  .modal__close { width: 32px; height: 32px; top: 10px; right: 10px; }
  .plan-grid { grid-template-columns: 1fr; gap: 12px; }
  .plan-card.is-featured { transform: none; }
  .signup__oauth { grid-template-columns: 1fr; }
  .docs__changelog li { grid-template-columns: 80px 50px 1fr; gap: 10px; font-size: 13px; }
  .docs__changelog-date { font-size: 10px; }
  .docs__changelog-note { font-size: 13px; }
  .docs__code { font-size: 11px; padding: 14px 16px; }
  .fullscreen img { max-height: 65vh; border-radius: 16px; }
  .fullscreen__caption-prompt { font-size: 15px; }
}

::selection { background: oklch(78% 0.16 305 / 0.35); }

/* ============ Chinese type tuning ============
   Slightly heavier weights & tighter letter-spacing read better in 中文.
*/
html[data-lang="zh"] body { letter-spacing: 0; }
html[data-lang="zh"] .hero h1 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(48px, 8vw, 116px);
  line-height: 1.02;
}
html[data-lang="zh"] .hero h1 .it {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}
html[data-lang="zh"] .hero h1 .underline { font-weight: 700; }
html[data-lang="zh"] .section h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 60px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
html[data-lang="zh"] .section h2 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}
html[data-lang="zh"] .gen__compose-title {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 18px;
}
html[data-lang="zh"] .tpl-card__title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
}
html[data-lang="zh"] .tpl-card__title em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}
html[data-lang="zh"] .canvas-empty .big {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 22px;
}
html[data-lang="zh"] .gal-card__prompt {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
}
html[data-lang="zh"] .foot__brand-sub,
html[data-lang="zh"] .hero p.lede,
html[data-lang="zh"] .section__sub {
  letter-spacing: 0.01em;
  line-height: 1.7;
}
html[data-lang="zh"] .hero__stat .v {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 30px;
}

/* ============ MOBILE + TABLET RESPONSIVE ============ */

/* iPad landscape and under */
@media (max-width: 1100px) {
  .app { padding: 24px 28px 100px; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 60px 0 40px; }
  .hero h1 { font-size: clamp(56px, 12vw, 108px); }
  .crystal { max-width: 420px; margin: 0 auto; }
  .gen { grid-template-columns: 1fr; }
  .tpl-panes { grid-template-columns: 200px 1fr; }
  .section { margin-top: 88px; }
  .nav__links li:nth-child(4),
  .nav__links li:nth-child(5) { display: none; }
}

/* iPad portrait + small tablet */
@media (max-width: 880px) {
  .nav { padding: 10px 12px 10px 18px; }
  .nav__links { display: none; }
  .nav__menu { display: inline-flex; }
  .nav__mobile-menu { display: flex; }
  .nav__brand { font-size: 24px; }
  .nav__brand-mark { width: 28px; height: 28px; }
  .nav__cta { padding: 10px 16px; font-size: 13px; }

  .section__head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .section__head-right { text-align: left; align-items: flex-start; width: 100%; }
  .section__sub { max-width: 100%; }

  .tpl-panes { grid-template-columns: 1fr; gap: 16px; }
  .tpl-cats__head { padding: 4px 8px; }
  .tpl-cats__list {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tpl-cats__list::-webkit-scrollbar { display: none; }
  .tpl-cats__btn {
    flex-shrink: 0;
    padding: 8px 12px;
    background: rgba(255,255,255,0.6);
    border-radius: 999px;
  }
  .tpl-cats__btn .count { display: none; }
  .tpl-cats__btn.is-on { background: var(--ink-1); color: white; }
  .tpl-cats__btn.is-on .swatch { box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }

  .gal-filters {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .gal-filters::-webkit-scrollbar { display: none; }
  .gal-filters button { flex-shrink: 0; }

  .hero__terminal-text { max-width: 180px; }
  .hero__stats { gap: 20px; margin-top: 36px; }
  .hero__stat .v { font-size: 30px; }

  .crystal__chip { font-size: 10px; padding: 6px 10px; }
}

/* iPhone landscape and under (≤ 720) */
@media (max-width: 720px) {
  .app { padding: 18px 18px 80px; }
  .nav {
    top: 8px;
    padding: 8px 10px 8px 16px;
    border-radius: 28px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .nav__brand { font-size: 22px; gap: 8px; }
  .nav__brand-mark { width: 24px; height: 24px; }
  .nav__cta-text { display: none; }
  .nav__cta { padding: 9px 11px; gap: 0; }
  .lang-toggle button { padding: 5px 9px; font-size: 11px; min-width: 28px; }

  .hero { padding: 32px 0 16px; gap: 24px; }
  .hero__eyebrow { font-size: 10px; padding: 6px 12px; }
  .hero h1 {
    font-size: clamp(52px, 14vw, 84px);
    line-height: 0.95;
    margin: 16px 0 18px;
  }
  html[data-lang="zh"] .hero h1 {
    font-size: clamp(44px, 11vw, 72px);
    line-height: 1.05;
  }
  .hero p.lede { font-size: 16px; margin-bottom: 24px; }
  .hero__row { gap: 12px; }
  .hero__terminal {
    padding: 9px 14px;
    font-size: 12px;
  }
  .hero__terminal-text { max-width: 200px; }
  .hero__stats { gap: 16px 22px; margin-top: 32px; }
  .hero__stat .v { font-size: 24px; }
  .hero__stat .l { font-size: 10px; }
  html[data-lang="zh"] .hero__stat .v { font-size: 22px; }

  .crystal { max-width: 320px; }
  .crystal__chip { font-size: 9px; padding: 5px 9px; }
  .crystal__chip--1 { right: 0; }
  .crystal__chip--2 { left: -4%; }
  .crystal__chip--3 { right: 0; }
  .crystal__chip--4 { left: 0; }

  .section { margin-top: 68px; }
  .section h2 { font-size: clamp(34px, 9vw, 56px); }
  html[data-lang="zh"] .section h2 { font-size: clamp(28px, 7vw, 44px); }
  .section__kicker { font-size: 10px; }

  /* GENERATOR mobile */
  .gen { gap: 18px; }
  .glass { border-radius: 26px; }
  .gen__compose { padding: 20px; gap: 14px; }
  .gen__compose-title { font-size: 20px; }
  .prompt-input { padding: 14px; min-height: 120px; }
  .prompt-input__field { font-size: 15px; min-height: 78px; }
  .gen__settings { grid-template-columns: 1fr; gap: 8px; }
  .gen__setting { padding: 10px 12px; }
  .aspect-options button { padding: 8px 4px; }

  .ingredients { padding: 12px 14px; }
  .ingredients__row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .ingredients__row-label { width: auto; }
  .ingredients__chip { padding: 7px 12px; font-size: 12px; }

  .gen__go-main {
    padding: 14px 16px;
    font-size: 14px;
    min-height: 48px;
  }
  .gen__go-main .kbd { display: none; }
  .gen__go-icon { width: 48px; min-height: 48px; }

  .gen__canvas { padding: 16px; }
  .canvas-stage { min-height: 320px; }
  .gen__canvas-foot { flex-direction: column; align-items: flex-start; gap: 10px; }
  .gen__variations .v { width: 52px; height: 52px; }
  .icon-btn { width: 36px; height: 36px; }

  /* TEMPLATES mobile */
  .tpl-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tpl-card__title { font-size: 16px; }
  html[data-lang="zh"] .tpl-card__title { font-size: 15px; }
  .tpl-card__desc { font-size: 11px; }

  /* GALLERY mobile */
  .gallery { column-count: 2; column-gap: 12px; }
  .gal-card { margin-bottom: 12px; border-radius: 18px; }
  .gal-card__prompt { font-size: 14px; }
  html[data-lang="zh"] .gal-card__prompt { font-size: 13px; }
  .gal-card__info { left: 10px; right: 10px; bottom: 10px; }
  .gal-card__badge { font-size: 8px; padding: 3px 6px; }
  /* Touch devices: show info without hover */
  .gal-card__veil { opacity: 0.55; }
  .gal-card__info { opacity: 1; transform: none; }
  .gal-card__remix { opacity: 1; }

  /* FOOTER mobile */
  .foot {
    grid-template-columns: 1fr 1fr;
    padding: 28px 22px;
    gap: 22px;
    border-radius: 26px;
  }
  .foot__brand { font-size: 30px; }
  .foot > div:first-child { grid-column: 1 / -1; }

  /* TOAST mobile */
  .toast { bottom: 20px; font-size: 12px; padding: 10px 14px; max-width: 88vw; }

  /* hide orbs on tiny screens for perf + readability */
  .orb { display: none; }
}

/* Very small phones */
@media (max-width: 420px) {
  .app { padding: 14px 14px 70px; }
  .tpl-grid { grid-template-columns: 1fr; }
  .gallery { column-count: 1; }
  .nav__brand { font-size: 20px; }
  .nav__brand span:last-child { display: inline; }
  .crystal { max-width: 260px; }
  .crystal__chip--1, .crystal__chip--3 { right: -8%; }
  .crystal__chip--2, .crystal__chip--4 { left: -8%; }
}

/* iPhone-specific tweaks: safe-area for notch + reduce backdrop-filter cost */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .nav { top: max(12px, env(safe-area-inset-top)); }
}

/* Touch-device polish: enlarge taps, kill expensive hover-only effects */
@media (hover: none) and (pointer: coarse) {
  .tpl-card:hover { transform: none; box-shadow: 0 12px 28px -16px rgba(60,20,90,0.25); }
  .gal-card:hover .gal-card__img { transform: none; }
  .ingredient-chip:hover, .ingredients__chip:hover { transform: none; }
  /* min hit target 44px */
  .nav__cta, .nav__menu, .lang-toggle button { min-height: 40px; }
  .gen__go-main { min-height: 52px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
}

/* Respect motion preferences (also overridden by tweak panel) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
[data-motion="still"] .orb,
[data-motion="still"] .crystal__sphere,
[data-motion="still"] .crystal__ring,
[data-motion="still"] .crystal__chip,
[data-motion="still"] body::before,
[data-motion="still"] .hero__caret {
  animation: none !important;
}
[data-motion="subtle"] .crystal__sphere { animation-duration: 60s; }
[data-motion="subtle"] .orb { animation-duration: 32s; }

/* Density tweak */
[data-density="compact"] .section { margin-top: 76px; }
[data-density="compact"] .hero { padding-top: 70px; padding-bottom: 50px; }
[data-density="comfy"] .section { margin-top: 160px; }
[data-density="comfy"] .hero { padding-top: 140px; padding-bottom: 100px; }

/* ============ Image editor (改图) ============ */

/* Active nav link for the new edit entry */
.nav__links a.is-active {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-1);
  box-shadow: 0 4px 14px -8px rgba(60, 20, 90, 0.3);
}

/* Source-image dropzone — empty state and filled preview */
.edit-dropzone {
  border: 1.5px dashed rgba(120, 80, 160, 0.35);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  background: rgba(120, 80, 160, 0.04);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-dropzone.is-drag {
  border-color: var(--hot);
  background: rgba(120, 80, 160, 0.12);
}
.edit-dropzone.has-image {
  padding: 0;
  cursor: default;
  background: transparent;
  border-style: solid;
  border-color: var(--glass-bd);
  overflow: hidden;
}
.edit-dropzone__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
}
.edit-dropzone__empty svg { color: var(--ink-2); margin-bottom: 4px; }
.edit-dropzone__big {
  font-size: 15px;
  color: var(--ink-2);
  font-weight: 600;
}
.edit-dropzone__sub { font-size: 12px; }
.edit-dropzone__hint {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 6px;
  opacity: 0.7;
}

.edit-preview { width: 100%; position: relative; }
.edit-preview img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: rgba(26, 19, 38, 0.04);
}
.edit-preview__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--glass-bg-strong);
  border-top: 1px solid var(--glass-bd-inner);
}
.edit-preview__name {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edit-preview__btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-bd);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease;
}
.edit-preview__btn:hover { background: white; color: var(--ink-1); }

/* URL input row */
.edit-url-row { display: flex; gap: 8px; margin-top: 12px; }
.edit-url-input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-bd);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-1);
  outline: none;
}
.edit-url-input:focus { border-color: var(--hot); background: white; }
.edit-url-input::placeholder { color: var(--ink-3); }
.edit-url-go {
  width: 40px;
  border: 1px solid var(--glass-bd);
  border-radius: var(--radius-sm);
  background: var(--ink-1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-url-go:hover { opacity: 0.85; }

/* Interactive model selector */
.model-select.is-interactive {
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid var(--glass-bd);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.model-select.is-interactive:hover { background: white; }
.model-select.is-interactive.is-on { border-color: var(--hot); background: white; }
.model-select .badge--mask {
  background: oklch(72% 0.15 220 / 0.2);
  color: oklch(40% 0.15 220);
}
.refine-menu__desc { font-size: 11px; color: var(--ink-3); line-height: 1.4; margin-top: 2px; white-space: normal; }
.refine-menu__btn.is-on { background: rgba(120, 80, 160, 0.1); border-color: var(--hot); }

/* Mask canvas */
.edit-mask {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--glass-bd);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
}
.edit-mask__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.edit-mask__title { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-1); }
.edit-mask__hint { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.edit-mask__stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  background: rgba(26, 19, 38, 0.06);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.edit-mask__img,
.edit-mask__canvas {
  display: block;
  max-width: 100%;
  max-height: 420px;
  user-select: none;
  -webkit-user-select: none;
}
.edit-mask__canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  touch-action: none;
  cursor: crosshair;
  opacity: 0.6;
}
.edit-mask__tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.edit-mask__tool {
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-bd);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.edit-mask__tool.is-on { background: var(--ink-1); color: white; border-color: var(--ink-1); }
.edit-mask__tool:hover { background: white; color: var(--ink-1); }
.edit-mask__size { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.edit-mask__size input { width: 100px; cursor: pointer; }
.edit-mask__warn { margin-top: 8px; font-family: var(--mono); font-size: 10px; color: oklch(55% 0.18 60); }

/* Accent icon-btn for send-to-edit */
/* ============ scroll bar ============ */

/* ============ long-render wait hint ============ */
.diffusion__wait {
  position: absolute;
  left: 0; right: 0; bottom: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
  pointer-events: none;
}
.diffusion__wait button {
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
  color: white;
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.diffusion__wait button:hover { background: rgba(0,0,0,0.45); transform: translateY(-1px); }
