:root {
  --bg: #0b0d17;
  --bg2: #131627;
  --bg3: #1a1e33;
  --ink: #eef0f8;
  --muted: #9aa1bd;
  --rule: rgba(124, 140, 255, 0.14);
  --accent: #6c7bff;
  --accent2: #a855f7;
  --ok: #34d399;
  --radius: 14px;
  --maxw: 1120px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; background: var(--bg3); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 760px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 24px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: all .18s ease; white-space: nowrap;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; box-shadow: 0 8px 26px rgba(108, 123, 255, 0.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(108, 123, 255, 0.45); }
.btn-ghost { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn-ghost:hover { background: var(--bg3); border-color: var(--accent); }
.btn-sm { padding: 9px 18px; font-size: 0.88rem; }
.btn-block { width: 100%; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 23, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 6px; }
.brand-mark { color: var(--accent); }
.brand-accent { color: var(--accent2); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--muted); font-size: 0.93rem; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--ink); }

/* Hero */
.hero { position: relative; padding: 96px 0 80px; text-align: center; overflow: hidden; }
.hero-glow {
  position: absolute; inset: -20% 0 auto 0; height: 620px; z-index: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(108, 123, 255, 0.28), transparent 55%),
    radial-gradient(circle at 72% 10%, rgba(168, 85, 247, 0.22), transparent 50%);
  filter: blur(20px); pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.pill {
  display: inline-block; padding: 7px 18px; border: 1px solid var(--rule);
  border-radius: 999px; font-size: 0.82rem; color: var(--accent); font-weight: 600;
  background: rgba(108, 123, 255, 0.08); letter-spacing: 0.02em;
}
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.1; font-weight: 800;
  letter-spacing: -0.03em; margin: 26px 0 22px;
  background: linear-gradient(135deg, #fff 20%, #b9c0ff 60%, var(--accent2) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: clamp(1rem, 2.2vw, 1.18rem); color: var(--muted); max-width: 640px; margin: 0 auto 34px; }
.hero-sub strong { color: var(--ink); }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 60px; }
.hero-stats { display: flex; gap: 56px; justify-content: center; flex-wrap: wrap; }
.hero-stats > div { display: flex; flex-direction: column; }
.stat-num { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-lbl { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

/* Sections */
.section { padding: 88px 0; }
.section-alt { background: var(--bg2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section-head { text-align: center; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.35rem); font-weight: 800; letter-spacing: -0.02em; }
.section-head p { color: var(--muted); margin-top: 10px; font-size: 1.02rem; }

/* Tool panel */
.tool-tabs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 26px; }
.tab {
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--rule);
  background: var(--bg2); color: var(--muted); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.tab:hover { color: var(--ink); border-color: var(--accent); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }

.tool-panel {
  background: var(--bg2); border: 1px solid var(--rule); border-radius: 20px;
  padding: 30px; max-width: 860px; margin: 0 auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.tool-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.tool-header h3 { font-size: 1.15rem; font-weight: 700; }
.model-badge { font-size: 0.76rem; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; }
.tool-desc { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }

textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--rule); border-radius: 12px;
  color: var(--ink); padding: 16px; font-size: 0.97rem; font-family: inherit;
  resize: vertical; line-height: 1.6; transition: border-color .15s;
}
textarea:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: #5a6080; }

.tool-controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.78rem; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
select, input[type="text"], input[type="password"] {
  background: var(--bg); border: 1px solid var(--rule); border-radius: 9px;
  color: var(--ink); padding: 11px 13px; font-size: 0.9rem; font-family: inherit; min-width: 150px;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }

.output { margin-top: 22px; border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
.output-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--bg3); font-size: 0.82rem; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.copy-btn { background: transparent; border: 1px solid var(--rule); border-radius: 7px; color: var(--ink);
  padding: 5px 12px; font-size: 0.78rem; cursor: pointer; transition: all .15s; font-family: inherit; }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.output-body { padding: 20px; white-space: pre-wrap; line-height: 1.75; font-size: 0.97rem; color: var(--ink); min-height: 60px; }
.cursor-blink::after { content: '▋'; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.api-hint { margin-top: 16px; font-size: 0.85rem; color: var(--muted); text-align: center; }
.api-hint a { color: var(--accent); text-decoration: underline; }
.api-hint.live { color: var(--ok); }

/* Features grid */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.feature { background: var(--bg3); border: 1px solid var(--rule); border-radius: var(--radius); padding: 26px; transition: transform .18s, border-color .18s; }
.feature:hover { transform: translateY(-3px); border-color: var(--accent); }
.f-icon { font-size: 1.6rem; margin-bottom: 12px; }
.feature h4 { font-size: 1.05rem; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 0.92rem; }

/* Pricing */
.price-card {
  background: var(--bg2); border: 1px solid var(--rule); border-radius: 18px;
  padding: 32px 28px; display: flex; flex-direction: column; position: relative;
}
.price-card.featured { border-color: var(--accent); box-shadow: 0 20px 56px rgba(108, 123, 255, 0.22); transform: scale(1.03); }
.ribbon {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  font-size: 0.74rem; font-weight: 700; padding: 5px 16px; border-radius: 999px; white-space: nowrap;
}
.price-card h3 { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.price { display: flex; align-items: baseline; gap: 4px; margin: 14px 0 20px; }
.price .amt { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; }
.price .per { color: var(--muted); font-size: 0.95rem; }
.price-card ul { list-style: none; margin-bottom: 26px; flex: 1; }
.price-card li { padding: 7px 0 7px 26px; position: relative; color: var(--muted); font-size: 0.92rem; }
.price-card li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--rule); padding: 6px 0; }
.faq-item summary { padding: 16px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent); font-size: 1.3rem; font-weight: 400; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { color: var(--muted); padding: 0 0 18px; font-size: 0.94rem; }

/* Setup */
.setup-grid { display: flex; flex-direction: column; gap: 16px; max-width: 620px; margin: 0 auto; }
.field-block { width: 100%; }
.field-block input { width: 100%; min-width: 0; }
.setup-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.setup-status { font-size: 0.85rem; color: var(--ok); }
.setup-note { font-size: 0.85rem; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 12px; }

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 44px 0 36px; background: var(--bg2); }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { color: #5a6080; font-size: 0.84rem; }
.footer-contact { font-size: 0.92rem; margin-bottom: 8px; color: var(--muted); }
.footer-contact a { color: var(--accent); }
.footer-contact a:hover { text-decoration: underline; }

/* Legal pages (privacy / terms) */
.legal { padding-top: 24px; }
.legal h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.legal h2 { font-size: 1.15rem; font-weight: 700; margin: 34px 0 10px; }
.legal p, .legal li { color: var(--muted); font-size: 0.95rem; line-height: 1.75; }
.legal p { margin-bottom: 12px; }
.legal ul { margin: 0 0 16px 22px; }
.legal li { margin-bottom: 7px; }
.legal .legal-updated { color: #5a6080; font-size: 0.85rem; margin-bottom: 26px; }
.legal strong { color: var(--ink); }
.legal a { color: var(--accent); text-decoration: underline; }

/* Free-plan quota */
.quota { margin-top: 14px; font-size: 0.85rem; color: var(--muted); text-align: center; }
.quota strong { color: var(--ink); }
.quota a { color: var(--accent); text-decoration: underline; font-weight: 600; }
.quota.quota-empty { color: #fbbf24; }
.quota.quota-pro { color: var(--ok); }
.upgrade-card input[type="text"] { width: 100%; margin-bottom: 14px; text-align: center; }

/* Upgrade modal */
.upgrade-modal {
  position: fixed; inset: 0; z-index: 100; padding: 24px;
  background: rgba(6, 8, 18, 0.74); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.upgrade-modal[hidden] { display: none; }
.upgrade-card {
  position: relative; width: 100%; max-width: 440px;
  background: var(--bg2); border: 1px solid var(--accent); border-radius: 20px;
  padding: 36px 30px 26px; text-align: center;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
  animation: upgrade-in .22s ease;
}
@keyframes upgrade-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.upgrade-card h3 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin: 16px 0 10px; }
.upgrade-card p { color: var(--muted); font-size: 0.94rem; margin-bottom: 22px; }
.upgrade-card p strong { color: var(--ink); }
.upgrade-card .btn + .btn { margin-top: 10px; }
.upgrade-card p.upgrade-note { font-size: 0.8rem; color: #5a6080; margin: 16px 0 0; }
.upgrade-close {
  position: absolute; top: 10px; right: 12px; padding: 4px 8px;
  background: transparent; border: 0; color: var(--muted); font-size: 1.5rem; line-height: 1;
  cursor: pointer; font-family: inherit;
}
.upgrade-close:hover { color: var(--ink); }

/* Responsive */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .price-card.featured { transform: none; }
}
@media (max-width: 600px) {
  .nav-links { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .hero-stats { gap: 32px; }
  .tool-controls { flex-direction: column; align-items: stretch; }
  .field select, .field input { width: 100%; }
  .section { padding: 60px 0; }
}
