:root {
  --bg: #0b0e14;
  --bg-2: #131823;
  --bg-3: #1a2030;
  --bg-card: #161c2a;
  --fg: #eef2f7;
  --fg-dim: #a3afc2;
  --muted: #6b7791;
  --accent: #6cb2ff;
  --accent-2: #ffd166;
  --accent-dim: #2c5a8c;
  --border: #232a3c;
  --ok: #4ade80;
  --danger: #ff6b6b;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "New York", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* Force the [hidden] attribute to win over our component CSS — without
   this, elements styled `display: flex/grid` stay visible even when JS
   sets element.hidden = true. Bit me on .lock-overlay (false paywall
   showing in dev) and would silently break .account-chip / .account-menu
   too. One rule, fixes the whole class. */
[hidden] { display: none !important; }
a { color: var(--accent); }
a:hover { color: #82c0ff; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  min-height: 100dvh;
  line-height: 1.55;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
button, input, textarea, select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 9px 14px;
}
button:hover { background: #232a3c; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0e14;
  font-weight: 600;
}
button.primary:hover { background: #82c0ff; }
button.icon-btn { padding: 4px 10px; font-size: 18px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); font-size: 13px; }

/* ── Top nav ─────────────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 24, 35, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  font-size: 28px;
  color: var(--accent);
  display: inline-block;
  transform: translateY(-1px);
}
.brand-text h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.brand-text small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-actions { display: flex; gap: 14px; }
.nav-link {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}
.nav-link:hover { background: var(--bg-3); color: var(--fg); }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 88px 24px 72px;
  text-align: center;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  inset: -50% -10% auto -10%;
  height: 600px;
  background:
    radial-gradient(ellipse 40% 60% at 30% 50%, rgba(108, 178, 255, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 70% at 75% 40%, rgba(255, 209, 102, 0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}
.hero-inner { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  background: rgba(108, 178, 255, 0.10);
  border: 1px solid var(--accent-dim);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
}
.hero h2 {
  margin: 0 0 18px;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: var(--serif);
  line-height: 1.12;
}
.hero h2 .accent { color: var(--accent); }
.hero-sub {
  margin: 0 auto 28px;
  color: var(--fg-dim);
  font-size: 18px;
  line-height: 1.55;
  max-width: 640px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.big-cta {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 10px;
  text-decoration: none;
}
a.big-cta {
  background: var(--accent);
  color: #0b0e14;
  border: 1px solid var(--accent);
}
a.big-cta:hover { background: #82c0ff; color: #0b0e14; transform: translateY(-1px); transition: transform .15s; }
.secondary-cta {
  display: inline-flex;
  align-items: center;
  padding: 13px 22px;
  font-size: 15px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.secondary-cta:hover { color: var(--accent); border-color: var(--accent-dim); }
.hero-trust {
  display: flex;
  gap: 24px;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

/* ── Section helpers ────────────────────────────────────────────────── */
.section-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
  text-align: center;
}
.section-sub {
  color: var(--fg-dim);
  font-size: 16px;
  text-align: center;
  margin: 0 auto 40px;
  max-width: 560px;
  line-height: 1.55;
}

/* ── How it works ──────────────────────────────────────────────────── */
.how { padding: 72px 24px 56px; background: linear-gradient(180deg, transparent, rgba(19,24,35,0.6) 50%, transparent); }
.how-inner { max-width: 1100px; margin: 0 auto; }
.how-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}
.how-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  position: relative;
}
.how-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b0e14;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 16px;
}
.how-step h4 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.how-step p { margin: 0; color: var(--fg-dim); font-size: 14px; line-height: 1.6; }

/* ── Filters / library section header ─────────────────────────────── */
.filters {
  padding: 72px 28px 24px;
  max-width: 1280px;
  margin: 0 auto;
  display: block;
}
.filters-head { text-align: center; margin-bottom: 30px; }
.filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 0 20px;
}
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

/* ── Pricing ──────────────────────────────────────────────────────── */
.pricing { padding: 72px 24px; }
.pricing-inner { max-width: 540px; margin: 0 auto; }
.price-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  border-radius: 18px;
  padding: 36px 32px 32px;
  position: relative;
  box-shadow: 0 24px 60px rgba(108, 178, 255, 0.06);
  text-align: center;
}
.price-badge {
  display: inline-block;
  background: var(--accent);
  color: #0b0e14;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
}
.price-amount {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -2px;
  margin: 8px 0 4px;
  line-height: 1;
}
.price-amount .price-dollar { font-size: 32px; vertical-align: top; margin-right: 2px; color: var(--fg-dim); }
.price-amount .price-once { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 8px; vertical-align: middle; font-family: var(--sans); letter-spacing: 0; }
.price-feats {
  list-style: none;
  padding: 0;
  margin: 22px 0 26px;
  text-align: left;
  display: inline-block;
}
.price-feats li {
  color: var(--fg-dim);
  font-size: 14px;
  padding: 6px 0;
  line-height: 1.5;
}
.pricing-buy { width: 100%; }
.price-fine {
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0 0;
  line-height: 1.5;
}

/* ── FAQ ──────────────────────────────────────────────────────────── */
.faq { padding: 56px 24px 80px; }
.faq-inner { max-width: 720px; margin: 0 auto; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  color: var(--muted);
  font-size: 20px;
  font-weight: 300;
  transition: transform 0.15s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--accent); }
.faq-item p {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.6;
}
.faq-item a { color: var(--accent); }

/* ── Footer links ─────────────────────────────────────────────────── */
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--fg-dim); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-fine { color: var(--muted); font-size: 12px; margin-top: 14px; }
.footer-fine a { color: var(--muted); }
.footer-fine a:hover { color: var(--accent); }

/* ── Filter pills + search input ────────────────────────────────────── */
/* Layout for .filters and .filter-row lives in the "Filters / library
   section header" block above. Just the per-pill + search styling here. */
.filter {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 999px;
}
.filter:hover { border-color: var(--accent-dim); color: var(--fg); }
.filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0e14;
  font-weight: 600;
}
.search-wrap { display: flex; }
.search-wrap input { width: 220px; padding: 7px 12px; font-size: 13px; }

/* ── Gallery ─────────────────────────────────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  padding: 0 28px 80px;
  max-width: 1280px;
  margin: 0 auto;
}
.loading { color: var(--muted); padding: 40px; text-align: center; grid-column: 1 / -1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.card-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-3);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a2030 0%, #131823 100%);
}
.card-thumb-placeholder .placeholder-icon {
  display: block;
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.4;
}
.card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.card-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.card-purpose {
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
  flex: 1;
}
.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.tag {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.tag.cat { background: var(--accent-dim); border-color: var(--accent-dim); color: white; }

/* ── Detail dialog ───────────────────────────────────────────────────── */
.detail-dialog, .source-dialog {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: min(960px, 92vw);
  max-width: 960px;
  max-height: 90dvh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.detail-dialog::backdrop, .source-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }

.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 1;
}
.detail-head .icon-btn { background: transparent; border: 0; }
.detail-head h2 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; }

.detail-body { overflow-y: auto; max-height: calc(90dvh - 60px); padding: 0; }

.detail-preview {
  padding: 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.detail-preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  background: #0b0e14;
  display: block;
}
.detail-preview img:not([src]), .detail-preview img[src=""] { display: none; }
.detail-recommended {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
}
.rec-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}
.rec-pill .key { color: var(--muted); }
.rec-pill .val { color: var(--fg); font-weight: 500; }

.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--bg);
  position: sticky;
  top: 60px;
  z-index: 1;
}
.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--fg-dim);
  padding: 12px 16px;
  border-radius: 0;
  font-size: 14px;
}
.tab:hover { background: transparent; color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-pane { display: none; padding: 20px; }
.tab-pane.active { display: block; }
.tab-help { color: var(--fg-dim); font-size: 13px; margin: 0 0 12px; }

#craft-brief, #craft-brand, .copy-field-textarea {
  width: 100%;
  background: var(--bg-2);
  font-size: 14px;
  resize: vertical;
  font-family: var(--sans);
  margin-bottom: 10px;
}
.brand-toggle { margin-bottom: 14px; }
.brand-toggle summary { color: var(--fg-dim); font-size: 13px; cursor: pointer; padding: 4px 0; }
.brand-toggle summary:hover { color: var(--fg); }
.brand-toggle textarea { margin-top: 8px; }

#craft-status { font-size: 13px; margin: 12px 0; min-height: 18px; }

.output-pane { margin-top: 18px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.output-label { font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.copy-btn { padding: 5px 12px; font-size: 12px; }
pre {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
  max-height: 400px;
  overflow-y: auto;
  background: #0b0e14;
}
.output-settings {
  padding: 10px 14px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-dim);
}

.copy-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.copy-field-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: block; }
.copy-field-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.copy-field-input {
  width: 100%;
  background: var(--bg-2);
  font-size: 14px;
  padding: 8px 10px;
}

.markdown-body { color: var(--fg-dim); font-size: 14px; line-height: 1.6; }
.markdown-body code { font-family: var(--mono); font-size: 12px; background: var(--bg-3); padding: 1px 5px; border-radius: 3px; }

#about-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

/* ── Source dialog ──────────────────────────────────────────────────── */
.source-body { padding: 20px; }
.source-body pre { max-height: 60dvh; }

/* ── Saved prompts dialog ──────────────────────────────────────────── */
.prompts-dialog {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: min(820px, 92vw);
  max-height: 90dvh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.prompts-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.prompts-body { padding: 18px 22px 26px; overflow-y: auto; max-height: calc(90dvh - 60px); }
.prompts-help { color: var(--fg-dim); font-size: 13px; margin: 0 0 18px; line-height: 1.55; }
.prompts-list { display: flex; flex-direction: column; gap: 12px; }
.prompt-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.prompt-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.prompt-icon { font-size: 16px; }
.prompt-name { font-weight: 600; font-size: 14px; flex: 1; color: var(--fg); }
.prompt-date { color: var(--muted); font-size: 11px; }
.prompt-summary {
  color: var(--fg-dim);
  font-size: 12px;
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.45;
}
.prompt-text {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  background: #0b0e14;
  padding: 10px 12px;
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 0 0 10px;
  border: 1px solid var(--border);
  color: var(--fg);
}
.prompt-actions { display: flex; gap: 8px; }
.prompt-actions button { font-size: 12px; padding: 5px 12px; }
.prompt-delete {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
}
.prompt-delete:hover { color: var(--danger); border-color: var(--danger); background: rgba(255,107,107,0.05); }
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  z-index: 1000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  margin-top: 40px;
  padding: 36px 28px 48px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.6;
}
.footer-col strong { display: block; color: var(--fg); font-size: 14px; margin-bottom: 10px; letter-spacing: 0.2px; }
.footer-col p { margin: 0; }
.footer-col ul { margin: 0; padding-left: 18px; }
.footer-col em { color: var(--accent-2); font-style: normal; font-weight: 500; }

/* ── Wizard form ────────────────────────────────────────────────────── */
.wizard-fields { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.wiz-field { display: flex; flex-direction: column; }
.wiz-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}
.wiz-label .req { color: var(--danger); margin-left: 2px; font-weight: 400; }
.wiz-help { font-size: 12px; color: var(--muted); margin-bottom: 6px; line-height: 1.45; }
.wiz-input {
  width: 100%;
  background: var(--bg-2);
  padding: 8px 12px;
  font-size: 14px;
}
textarea.wiz-input { font-family: var(--sans); resize: vertical; min-height: 70px; }
select.wiz-input { cursor: pointer; }

.wiz-list-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wiz-list-row { display: flex; gap: 6px; align-items: stretch; }
.wiz-list-row .wiz-list-input { flex: 1; }
.wiz-list-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  width: 34px;
  flex-shrink: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--fg-dim);
}
.wiz-list-btn:hover { color: var(--danger); border-color: var(--danger); }
.wiz-list-add {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--fg-dim);
  font-size: 13px;
  padding: 7px 14px;
  align-self: flex-start;
}
.wiz-list-add:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-dim); }
.wiz-list-add:disabled { opacity: 0.4; cursor: not-allowed; }

/* Wizard-badge tag on gallery cards */
.tag.tag-wizard {
  background: rgba(108, 178, 255, 0.12);
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* ── Lock overlay (paywall) ─────────────────────────────────────────── */
/* .form-area is the positioning context — the lock overlay only covers
   the wizard/craft form (inputs + Generate button), NOT the output pane
   below. This way users still see + can copy their last generated prompt
   even after they've hit the free-tier wall. */
.form-area { position: relative; }
.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 14, 20, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 28px;
}
.lock-card {
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 26px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.lock-icon { font-size: 36px; margin-bottom: 10px; }
.lock-card h3 { margin: 0 0 8px; font-size: 18px; color: var(--fg); }
.lock-card p { margin: 0 0 18px; color: var(--fg-dim); font-size: 13px; line-height: 1.55; }
.unlock-btn { width: 100%; padding: 12px 20px; font-size: 15px; }
.unlock-btn strong { font-weight: 700; }
.lock-small { color: var(--muted); font-size: 11px; margin-top: 12px !important; }

/* ── Usage meter (free-tier counter under Generate buttons) ─────────── */
.usage-meter {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-dim);
  padding: 6px 10px;
  background: rgba(108, 178, 255, 0.06);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  display: inline-block;
}
.usage-meter.out {
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.4);
  color: var(--fg);
}
.usage-meter .usage-count { font-weight: 700; color: var(--accent); }
.usage-meter .link {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ── Auth: top-nav chips + login dialog ─────────────────────────────── */
.nav-link.nav-cta {
  background: var(--accent);
  color: #0b0e14;
  font-weight: 600;
  border: 0;
  padding: 7px 14px;
}
.nav-link.nav-cta:hover { background: #82c0ff; color: #0b0e14; }

.account-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 13px;
}
.account-email { color: var(--fg); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-btn {
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.account-menu-btn:hover { color: var(--fg); background: var(--bg-2); }
.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 6px;
  min-width: 160px;
  z-index: 30;
}
.account-menu-item {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--fg);
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.account-menu-item:hover { background: var(--bg-3); }

.login-dialog {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: min(440px, 92vw);
  max-height: 90dvh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.login-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.login-body { padding: 22px 24px 26px; }
.login-help { color: var(--fg-dim); font-size: 14px; margin: 0 0 16px; line-height: 1.55; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input { padding: 11px 14px; font-size: 15px; background: var(--bg-2); }
#login-form button.primary { padding: 11px 16px; font-size: 14px; }
.login-fine { color: var(--muted); font-size: 12px; margin: 14px 0 0; line-height: 1.55; }
.login-fine .link {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.login-success-icon { font-size: 40px; text-align: center; margin: 6px 0 8px; }
#login-step-sent h3 { margin: 0 0 8px; text-align: center; font-size: 18px; }
#login-step-sent p { text-align: center; color: var(--fg-dim); font-size: 14px; line-height: 1.55; margin: 0 0 12px; }
#login-step-sent strong { color: var(--fg); }

/* ── Roadmap page ─────────────────────────────────────────────────── */
.roadmap-main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 60px;
}
.roadmap-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 22px;
}
.col-shipped  { border-top: 3px solid var(--ok); }
.col-soon     { border-top: 3px solid var(--accent); }
.col-wishlist { border-top: 3px solid var(--accent-2); }
.roadmap-col-head { margin-bottom: 18px; }
.roadmap-col-head h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.roadmap-col-head p { margin: 0; color: var(--muted); font-size: 12px; }
.roadmap-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.roadmap-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.roadmap-item-meta {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  font-weight: 600;
}
.roadmap-item-eta { color: var(--accent); }
.roadmap-item-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.roadmap-item-note { color: var(--fg-dim); font-size: 12px; line-height: 1.55; }

.roadmap-cta { padding: 50px 24px 70px; text-align: center; }
.roadmap-cta-inner { max-width: 560px; margin: 0 auto; }
.roadmap-cta h3 { font-family: var(--serif); font-size: 26px; margin: 0 0 10px; }
.roadmap-cta p { color: var(--fg-dim); font-size: 15px; line-height: 1.6; margin: 0 0 22px; }
.roadmap-cta a.big-cta { display: inline-block; }

/* ── Legal pages (terms.html, privacy.html) ───────────────────────── */
.legal-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 28px 80px;
  color: var(--fg);
  font-size: 15px;
  line-height: 1.7;
}
.legal-main h2 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin: 0 0 8px;
}
.legal-effective { color: var(--muted); font-size: 13px; margin: 0 0 36px; }
.legal-main h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--fg);
}
.legal-main p { margin: 0 0 14px; color: var(--fg-dim); }
.legal-main p strong { color: var(--fg); }
.legal-main code { font-family: var(--mono); font-size: 13px; background: var(--bg-3); padding: 2px 6px; border-radius: 4px; }
.legal-main .legal-list { margin: 0 0 14px; padding-left: 22px; color: var(--fg-dim); }
.legal-main .legal-list li { margin-bottom: 8px; }
.legal-end {
  margin-top: 40px !important;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* ── Recommend dialog ─────────────────────────────────────────────── */
.recommend-dialog {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: min(820px, 92vw);
  max-height: 92dvh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.recommend-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.recommend-body { padding: 20px 24px 26px; overflow-y: auto; max-height: calc(92dvh - 60px); }
.recommend-help { color: var(--fg-dim); font-size: 14px; line-height: 1.55; margin: 0 0 14px; }
.recommend-starters {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.recommend-starters-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  font-weight: 500;
}
.starter-chip {
  display: inline-block;
  margin: 0 6px 6px 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.starter-chip:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(108, 178, 255, 0.06);
}
#recommend-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
#recommend-brief { background: var(--bg-2); padding: 12px 14px; font-size: 14px; font-family: var(--sans); resize: vertical; }
#recommend-form button { align-self: flex-start; padding: 10px 20px; }
#recommend-status { margin: 8px 0 14px; font-size: 13px; min-height: 18px; }
.recommend-results { display: flex; flex-direction: column; gap: 12px; }
.rec-card {
  display: grid;
  grid-template-columns: 30px 110px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.rec-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.rec-rank {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}
.rec-thumb {
  width: 110px;
  height: 80px;
  background: var(--bg-3);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.rec-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 24px; opacity: 0.5; }
.rec-body { min-width: 0; }
.rec-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; display: flex; gap: 8px; align-items: center; }
.rec-purpose { color: var(--fg-dim); font-size: 12px; margin-bottom: 6px; line-height: 1.45; }
.rec-reason { color: var(--fg); font-size: 13px; line-height: 1.5; font-style: italic; }
.rec-cta { white-space: nowrap; padding: 7px 14px; font-size: 13px; }

/* ── Admin page ────────────────────────────────────────────────────── */
.admin-main { max-width: 1200px; margin: 0 auto; padding: 40px 28px 80px; }
.admin-gate { padding: 60px 24px; text-align: center; color: var(--fg-dim); }
.admin-denied { max-width: 460px; margin: 0 auto; }
.admin-denied p { line-height: 1.55; }
.admin-denied .big-cta { display: inline-block; margin-top: 14px; padding: 11px 22px; background: var(--accent); color: #0b0e14; text-decoration: none; border-radius: 8px; font-weight: 600; }
.admin-section { margin-bottom: 40px; }
.admin-section h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 16px; letter-spacing: -0.3px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-value { font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { color: var(--fg-dim); font-size: 13px; margin-top: 4px; }
.stat-hint { color: var(--muted); font-size: 11px; margin-top: 4px; }

.comp-form { display: flex; gap: 8px; max-width: 480px; }
.comp-form input { flex: 1; background: var(--bg-2); padding: 10px 14px; font-size: 14px; }
.comp-form button { padding: 10px 18px; font-size: 14px; }

.users-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th, .users-table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.users-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-2);
}
.users-table tr:last-child td { border-bottom: 0; }
.users-table .cell-email { color: var(--fg); font-weight: 500; }

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.badge-free   { background: var(--bg-3); color: var(--muted); border: 1px solid var(--border); }
.badge-paid   { background: rgba(74, 222, 128, 0.10); color: var(--ok); border: 1px solid rgba(74, 222, 128, 0.4); }
.badge-comped { background: rgba(255, 209, 102, 0.10); color: var(--accent-2); border: 1px solid rgba(255, 209, 102, 0.4); }
.badge-admin  { background: rgba(108, 178, 255, 0.10); color: var(--accent); border: 1px solid var(--accent-dim); }

/* Toggle switch for comp on each user row */
.comp-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.comp-switch input { opacity: 0; width: 0; height: 0; }
.comp-track {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 999px; transition: 0.18s;
}
.comp-track::before {
  position: absolute; content: ""; height: 16px; width: 16px;
  left: 2px; bottom: 2px;
  background: var(--fg-dim); border-radius: 50%; transition: 0.18s;
}
.comp-switch input:checked + .comp-track { background: var(--accent-2); border-color: var(--accent-2); }
.comp-switch input:checked + .comp-track::before { transform: translateX(15px); background: #0b0e14; }
.comp-switch input:disabled + .comp-track { opacity: 0.5; cursor: wait; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .roadmap-main { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topnav { padding: 14px 16px; gap: 8px; flex-wrap: wrap; }
  .nav-link { font-size: 12px; padding: 4px 8px; }
  .nav-actions { gap: 6px; flex-wrap: wrap; }
  .account-email { max-width: 110px; }
  .brand-text h1 { font-size: 16px; }

  /* Hero on narrow viewports — stack CTAs, drop sizes, less padding */
  .hero { padding: 48px 18px 36px; }
  .hero h2 { font-size: 28px; letter-spacing: -0.6px; }
  .hero-sub { font-size: 15px; margin-bottom: 22px; }
  .hero-cta { flex-direction: column; gap: 10px; }
  .hero-cta a, .hero-cta button { width: 100%; text-align: center; }
  .hero-trust { gap: 14px; font-size: 12px; flex-direction: column; align-items: center; }
  .hero-eyebrow { font-size: 11px; padding: 5px 11px; margin-bottom: 18px; }

  /* Generic narrow-viewport section sizing */
  .section-title { font-size: 24px; letter-spacing: -0.3px; }
  .section-sub { font-size: 14px; margin-bottom: 28px; }
  .how, .pricing, .faq { padding: 48px 18px; }
  .how-step { padding: 22px 18px; }
  .price-card { padding: 30px 22px 26px; }
  .price-amount { font-size: 52px; }

  /* Library + gallery */
  .filters { padding: 48px 16px 16px; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .filter-row { justify-content: center; }
  .search-wrap input { width: 100%; }
  .gallery { padding: 0 16px 40px; gap: 14px; grid-template-columns: 1fr; }

  /* Dialogs — all the modals go full-screen on narrow */
  .detail-dialog, .source-dialog, .login-dialog,
  .prompts-dialog, .recommend-dialog {
    width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: 100dvh;
    border-radius: 0;
  }
  .detail-body { max-height: calc(100dvh - 60px); }
  .detail-preview img { max-height: 240px; }
  .detail-tabs { padding: 0 12px; gap: 0; overflow-x: auto; }
  .tab { font-size: 13px; padding: 10px 12px; white-space: nowrap; }
  .tab-pane { padding: 16px; }
  .output-head { padding: 10px 12px; }
  pre { padding: 12px; font-size: 12px; }

  /* Recommend cards — stack on narrow (the 4-col grid is too cramped) */
  .rec-card {
    grid-template-columns: 30px 1fr;
    grid-template-rows: auto auto auto;
  }
  .rec-thumb { grid-column: 1 / -1; width: 100%; height: 140px; }
  .rec-body { grid-column: 1 / -1; }
  .rec-cta { grid-column: 1 / -1; width: 100%; }

  /* Roadmap page — already 1-col below 900px */
  .roadmap-main { padding: 0 18px 50px; }
  .roadmap-cta h3 { font-size: 22px; }

  /* Legal pages — tighter margins */
  .legal-main { padding: 36px 18px 50px; }
  .legal-main h2 { font-size: 28px; }
  .legal-main h3 { font-size: 16px; }

  /* Admin page on phones — table scrolls horizontally; everything else stacks */
  .admin-main { padding: 28px 16px 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .comp-form { flex-direction: column; }
  .comp-form button { width: 100%; }
  .users-table { font-size: 12px; }
  .users-table th, .users-table td { padding: 8px 10px; }

  /* Footer columns drop to 2-col / 1-col via auto-fit; tighter padding */
  .footer { padding: 28px 18px 36px; }
  .footer-inner { gap: 22px; }
}
