:root {
  --bg: #070711;
  --bg-soft: #0d0d1c;
  --panel: rgba(20, 20, 38, 0.72);
  --panel-strong: rgba(26, 26, 48, 0.92);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f3f4ff;
  --text-muted: #9aa0bd;
  --text-dim: #6b7192;
  --primary: #8b5cf6;
  --primary-2: #ec4899;
  --accent: #22d3ee;
  --gradient: linear-gradient(120deg, #8b5cf6 0%, #d946ef 45%, #22d3ee 100%);
  --gradient-soft: linear-gradient(120deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.12));
  --success: #34d399;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 60px -12px rgba(139, 92, 246, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: "Sora", "Inter", sans-serif; line-height: 1.15; margin: 0; }

a { color: inherit; text-decoration: none; }

.container { width: min(1160px, 92vw); margin: 0 auto; }

/* Background */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: float 18s ease-in-out infinite; }
.orb-1 { width: 520px; height: 520px; background: #7c3aed; top: -180px; left: -140px; }
.orb-2 { width: 460px; height: 460px; background: #db2777; top: 20%; right: -180px; animation-delay: -6s; }
.orb-3 { width: 500px; height: 500px; background: #0891b2; bottom: -220px; left: 30%; animation-delay: -12s; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.08); }
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(7, 7, 17, 0.65);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Sora", sans-serif; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--gradient); color: #fff; box-shadow: var(--shadow-glow);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.header-nav { display: flex; gap: 26px; font-size: 0.92rem; color: var(--text-muted); }
.header-nav a { transition: color 0.25s var(--ease); position: relative; }
.header-nav a:hover { color: var(--text); }
.header-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
  background: var(--gradient); transition: width 0.3s var(--ease); border-radius: 2px;
}
.header-nav a:hover::after { width: 100%; }

/* Hero */
.hero { text-align: center; padding: 90px 0 40px; }
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border-strong);
  font-size: 0.82rem; color: var(--text-muted);
  backdrop-filter: blur(10px);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-title { font-size: clamp(2.4rem, 6.5vw, 4.4rem); font-weight: 800; letter-spacing: -0.035em; margin: 24px auto 18px; max-width: 16ch; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-subtitle { max-width: 640px; margin: 0 auto; color: var(--text-muted); font-size: clamp(1rem, 2.2vw, 1.15rem); }
.hero-stats { display: flex; justify-content: center; gap: clamp(24px, 6vw, 70px); margin-top: 42px; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat strong { font-family: "Sora", sans-serif; font-size: 1.7rem; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 0.82rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.12em; }

/* Generator layout */
.generator-section { display: grid; gap: 30px; padding: 30px 0 60px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 40px);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,0.22), transparent 40%, transparent 60%, rgba(139,92,246,0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.panel-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.panel-head p { color: var(--text-muted); margin: 8px 0 28px; }

.generator-form { display: grid; gap: 26px; }
.field { border: none; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend {
  display: block; font-size: 0.86rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; padding: 0;
}
.textarea-wrap { position: relative; }
textarea {
  width: 100%; resize: vertical; min-height: 118px;
  background: rgba(8, 8, 20, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text); font: inherit; font-size: 1rem;
  padding: 16px 18px 34px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}
textarea::placeholder { color: var(--text-dim); }
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); background: rgba(12, 12, 26, 0.9); }
textarea.invalid { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.16); }
.textarea-meta { position: absolute; right: 14px; bottom: 10px; font-size: 0.76rem; color: var(--text-dim); pointer-events: none; }
.field-error { color: #f87171; font-size: 0.85rem; margin: 8px 0 0; min-height: 1.2em; }

/* Options */
.option-grid { display: grid; gap: 12px; }
.styles-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ratio-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.option {
  position: relative; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: rgba(12, 12, 26, 0.6);
  border: 1px solid var(--border);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
  user-select: none;
}
.option:hover { transform: translateY(-3px); border-color: var(--border-strong); background: rgba(22, 22, 44, 0.8); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .option-icon {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  font-size: 1.1rem; background: var(--gradient-soft); border: 1px solid var(--border);
  flex-shrink: 0; transition: transform 0.25s var(--ease);
}
.option .option-body { display: flex; flex-direction: column; min-width: 0; }
.option .option-body strong { font-size: 0.95rem; font-weight: 600; }
.option .option-body small { color: var(--text-dim); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.option.selected {
  border-color: transparent;
  background: linear-gradient(rgba(18, 18, 36, 0.95), rgba(18, 18, 36, 0.95)) padding-box,
              var(--gradient) border-box;
  border: 1px solid transparent;
  box-shadow: 0 12px 30px -14px rgba(139, 92, 246, 0.7);
}
.option.selected .option-icon { background: var(--gradient); color: #fff; transform: scale(1.05); }
.option.selected::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.ratio-visual { display: block; background: currentColor; border-radius: 3px; opacity: 0.85; }
.ratio-wrap { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--gradient-soft); border: 1px solid var(--border); flex-shrink: 0; }
.option.selected .ratio-wrap { background: var(--gradient); color: #fff; }

/* Advanced */
.advanced-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; color: var(--text-muted); font: inherit; font-size: 0.9rem;
  cursor: pointer; padding: 12px 0; transition: color 0.25s var(--ease);
}
.advanced-toggle:hover { color: var(--text); }
.advanced-toggle .chev { width: 18px; height: 18px; margin-left: auto; transition: transform 0.3s var(--ease); }
.advanced-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.advanced-panel { display: grid; gap: 12px; padding-top: 4px; animation: slideDown 0.35s var(--ease); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.switch-row {
  display: flex; align-items: center; gap: 16px; cursor: pointer;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: rgba(12, 12, 26, 0.6); border: 1px solid var(--border);
}
.switch-row span:first-child { display: flex; flex-direction: column; margin-right: auto; }
.switch-row strong { font-size: 0.95rem; font-weight: 600; }
.switch-row small { color: var(--text-dim); font-size: 0.78rem; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: rgba(255,255,255,0.14); position: relative; transition: background 0.3s var(--ease); flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.3s var(--ease); }
.switch-row input:checked ~ .switch { background: var(--gradient); }
.switch-row input:checked ~ .switch::after { transform: translateX(20px); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 13px 22px; transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), background 0.22s var(--ease), border-color 0.22s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 16px 40px -16px rgba(217, 70, 239, 0.8); background-size: 160% 160%; animation: shimmer 6s linear infinite; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 50px -16px rgba(217, 70, 239, 0.95); }
@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 160% 50%; } }
.btn-lg { width: 100%; padding: 17px 26px; font-size: 1.05rem; }
.btn-ghost { background: rgba(255,255,255,0.05); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,0.11); transform: translateY(-2px); border-color: var(--primary); }
.btn-ghost.copied { background: rgba(52, 211, 153, 0.16); border-color: var(--success); color: var(--success); }
.btn[disabled] { opacity: 0.7; cursor: progress; pointer-events: none; }
.spinner { width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; display: none; animation: spin 0.7s linear infinite; }
.btn.loading .spinner { display: inline-block; }
.btn.loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Output */
.output-panel {
  background: var(--panel-strong);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(20px, 3.5vw, 34px);
  backdrop-filter: blur(22px); box-shadow: var(--shadow-lg);
  animation: rise 0.5s var(--ease);
  position: relative; overflow: hidden;
}
.output-panel::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.output-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.output-title { display: flex; align-items: center; gap: 14px; }
.output-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--gradient); color: #fff; flex-shrink: 0; box-shadow: var(--shadow-glow); }
.output-icon svg { width: 22px; height: 22px; }
.output-title h2 { font-size: 1.2rem; }
.output-title p { margin: 2px 0 0; color: var(--text-dim); font-size: 0.83rem; }
.output-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.prompt-output { position: relative; }
.prompt-output pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  background: rgba(6, 6, 16, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px; font-family: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.95rem; line-height: 1.75; color: #e7e9ff;
  max-height: 460px; overflow: auto;
}
.prompt-output pre:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.prompt-output pre::selection { background: rgba(139, 92, 246, 0.5); }

.negative-wrap { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius-md); background: rgba(248, 113, 113, 0.07); border: 1px solid rgba(248, 113, 113, 0.2); }
.negative-wrap h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: #fca5a5; margin-bottom: 6px; }
.negative-wrap p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.output-footer { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-top: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 0.76rem; padding: 5px 12px; border-radius: 999px; background: var(--gradient-soft); border: 1px solid var(--border); color: var(--text-muted); }
.prompt-length { font-size: 0.8rem; color: var(--text-dim); }

/* Features */
.features { padding: 60px 0; }
.section-title { text-align: center; font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 44px; letter-spacing: -0.02em; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; backdrop-filter: blur(16px);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  position: relative; overflow: hidden;
}
.card::after { content: ""; position: absolute; inset: 0; background: var(--gradient-soft); opacity: 0; transition: opacity 0.3s var(--ease); }
.card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 26px 60px -30px rgba(139,92,246,0.7); }
.card:hover::after { opacity: 1; }
.card > * { position: relative; z-index: 1; }
.card-icon { font-family: "Sora", sans-serif; font-weight: 800; font-size: 1.1rem; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 14px; }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* Gallery */
.gallery { padding: 40px 0 90px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.gallery-card {
  border-radius: var(--radius-lg); padding: 24px; min-height: 170px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  cursor: default;
}
.gallery-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.9); }
.gallery-card .emoji { font-size: 2rem; margin-bottom: auto; }
.gallery-card h3 { font-size: 1.1rem; }
.gallery-card p { margin: 0; font-size: 0.85rem; color: rgba(255,255,255,0.78); }
.gallery-card::before { content: ""; position: absolute; inset: 0; opacity: 0.85; z-index: -1; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 34px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; color: var(--text-dim); font-size: 0.86rem; }
.footer-inner p { margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 24px);
  background: var(--panel-strong); border: 1px solid var(--border-strong);
  color: var(--text); padding: 13px 22px; border-radius: 999px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 100; font-size: 0.9rem; font-weight: 500;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: var(--success); }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 720px) {
  .header-nav { display: none; }
  .hero { padding: 60px 0 24px; }
  .output-head { flex-direction: column; }
  .output-actions { width: 100%; }
  .output-actions .btn { flex: 1; }
  .hero-stats { gap: 26px; }
  .stat strong { font-size: 1.4rem; }
}
@media (max-width: 420px) {
  .styles-grid { grid-template-columns: 1fr; }
  .ratio-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
