/* ============================================================
   HOMEPAGE REDESIGN — Prompt Helper
   Loaded AFTER site.css and shell.css, only on index.html.
   Pure restyle: no ids, hooks or behaviors are changed here.
   Direction: airy white page, soft warm glow, generator-as-hero,
   rounded composer, pill controls, bento features.
   Light and dark themes both supported through tokens.
   ============================================================ */

/* ===== TOKENS ===== */
:root {
  --bg: #FFFFFF;
  --bg-elevated: #FBF8F3;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-soft: #F6F1EA;
  --border: #EADFD4;
  --border-strong: #D9CBBB;
  --border-accent: #16140F;
  --text: #16140F;
  --text-secondary: #2E2A22;
  --muted: #5B554C;
  --muted-light: #8A8377;
  --accent: #16140F;
  --accent-light: #2E2A22;
  --accent-dark: #000000;
  --accent-glow: rgba(22, 20, 15, 0.1);
  --accent-2: #C2410C;
  --accent-2-dark: #9A3412;
  --accent-2-glow: rgba(194, 65, 12, 0.12);
  --wa: #FFF4EB;
  --wa-fg: #9A3412;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --bg-sidebar: #FBF8F3;
  --bg-shell: #FFFFFF;
  --accent-fg: #FFFFFF;

  /* new tokens used only by this file */
  --glow-1: #FFE6D4;
  --glow-2: #FFF4EB;
  --soft-panel: #FFF4EB;
  --pill-bg: #F6F1EA;
  --card-dark-bg: #16140F;
  --card-dark-fg: #F6F1EA;
  --card-dark-muted: #D8D1C2;
  --nav-active-bg: #FFE6D4;
  --nav-active-fg: #9A3412;
  --shadow-hero: 0 40px 80px -36px rgba(194, 65, 12, 0.35);
  --shadow-soft: 0 24px 48px -32px rgba(22, 20, 15, 0.25);
}

html[data-theme="dark"] {
  --glow-1: rgba(234, 88, 12, 0.2);
  --glow-2: rgba(234, 88, 12, 0.06);
  --soft-panel: #1D1D1B;
  --pill-bg: #2A2A27;
  --card-dark-bg: #262624;
  --card-dark-fg: #EDEBE6;
  --card-dark-muted: #9C9A93;
  --nav-active-bg: rgba(251, 146, 60, 0.16);
  --nav-active-fg: #FDBA74;
  --shadow-hero: 0 40px 80px -36px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 24px 48px -32px rgba(0, 0, 0, 0.5);
}

/* ===== PAGE GLOW ===== */
.app-main { position: relative; }
.app-main::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 720px;
  background: radial-gradient(ellipse 80% 90% at 50% 0%, var(--glow-1) 0%, var(--glow-2) 45%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}
.shell-content, .shell-footer { position: relative; z-index: 1; }
.topbar { position: relative; z-index: 30; }
.topbar { position: sticky; }

/* ===== SIDEBAR ===== */
.sidebar { background: var(--bg-sidebar); border-right-color: var(--border); }
.sb-brand { border-bottom-color: var(--border); }
.sb-logo { border-radius: 10px; background: var(--accent-2); color: #fff; width: 30px; height: 30px; }
.sb-brand-name { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.sb-link { border-radius: 12px; padding: 10px 12px; }
.sb-link:hover { background: var(--pill-bg); }
.sb-link.active { background: var(--nav-active-bg); color: var(--nav-active-fg); font-weight: 600; }
.sb-badge { background: var(--accent-2); }
.sb-foot { border-top-color: var(--border); }

/* ===== TOP BAR ===== */
.topbar { background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom: 1px solid var(--border); height: 64px; z-index: 30; }
.tb-search input { border-radius: 999px; height: 40px; background: var(--bg-input); border-color: var(--border); }
.tb-icon-btn { border-radius: 50%; width: 40px; height: 40px; }
.tb-cta { height: 40px; border-radius: 999px; padding: 0 20px; font-size: 0.875rem; background: var(--accent); border-color: var(--accent); }
.tb-link { font-weight: 600; color: var(--text); }

/* ===== HERO ===== */
.shell-content { padding-top: var(--space-10); }
.page-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
  margin: 0 auto var(--space-8);
  max-width: 860px;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  color: var(--accent-2);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.hero-pill:hover { color: var(--accent-2-dark); border-color: var(--accent-2); }
.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.page-head h1 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(2.4rem, 6.2vw, 4.25rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0;
  max-width: 820px;
}
.page-head h1 em {
  font-family: 'Fraunces', 'Libre Baskerville', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent-2);
}
.page-head > p { font-size: clamp(1.05rem, 1.8vw, 1.25rem); line-height: 1.5; max-width: 620px; margin: 0; }

/* ===== GENERATOR LAYOUT: centered composer, rail beneath ===== */
.gen-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 880px;
  margin: 0 auto var(--space-16);
}
.gen-main { width: 100%; }

.gen-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-hero);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.gen-panel:focus-within { border-color: var(--accent-2); }

/* Mode tabs: pill segmented control */
.gen-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  background: var(--pill-bg);
  border: 0;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  margin-bottom: var(--space-5);
}
.gen-tabs .mode-tab {
  border-radius: 999px;
  padding: 0 20px;
  min-height: 40px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}
.gen-tabs .mode-tab:hover { color: var(--text); }
.gen-tabs .mode-tab.active { background: var(--accent); color: var(--accent-fg); }

.gen-field-label { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.1em; }

/* Input: borderless inside the composer; the panel shows the focus ring */
.gen-input {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 160px;
  max-height: 420px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  border-radius: 0;
}
.gen-input:focus { outline: none; box-shadow: none; border: 0; }
.gen-panel:focus-within { box-shadow: var(--shadow-hero), 0 0 0 3px var(--accent-2-glow); }

/* Toolbar: pill selects and toggles */
.gen-toolbar { gap: 10px; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.gen-toolbar select {
  height: 44px;
  border-radius: 999px;
  padding: 0 36px 0 18px;
  background-color: var(--pill-bg);
  border-color: transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  background-position: right 16px center;
}
.gen-toolbar select:hover { border-color: var(--border-strong); }
.gen-toolbar .toggle {
  height: 44px;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--pill-bg);
  border-color: transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.gen-toolbar .toggle:hover { border-color: var(--border-strong); }
.gen-toolbar .toggle input { width: 16px; height: 16px; }

.gen-submit-row { margin-top: var(--space-5); gap: 10px; }
.gen-submit {
  height: 52px;
  padding: 0 32px;
  border-radius: 999px;
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 10px 24px -12px rgba(194, 65, 12, 0.7);
}
.gen-submit:hover { background: var(--accent-2-dark); border-color: var(--accent-2-dark); color: #fff; }
.gen-submit-row .btn { border-radius: 999px; min-height: 44px; padding: 0 20px; }

/* Output */
.gen-output {
  border-radius: 18px;
  background: var(--bg-elevated);
  border-color: var(--border);
  padding: 22px 24px;
  font-size: 1rem;
  line-height: 1.75;
}
.gen-output.has-content { border-color: var(--accent-2); }
#output-actions .btn, #output-meta .btn, .row .btn { border-radius: 999px; }
.variant { border-radius: 18px; background: var(--bg-card); border-color: var(--border); padding: var(--space-4); }

/* Buttons everywhere on the page */
.btn { border-radius: 999px; }
.btn-sm { min-height: 40px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; }
.error { border-radius: 14px; }

/* ===== RAIL: becomes a row of cards under the composer ===== */
.rail {
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}
.rail-card {
  border-radius: var(--radius-lg);
  border-color: var(--border);
  padding: var(--space-5);
  box-shadow: var(--shadow-soft);
  background: var(--bg-card);
}
.rail-card h3 { color: var(--muted); letter-spacing: 0.1em; }
/* Templates first and full width: they read as "try an example" chips */
#templates { grid-column: 1 / -1; order: -1; background: transparent; border: 0; box-shadow: none; padding: 0; }
#templates h3 { text-align: center; }
#templates-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.template-chip { border-radius: 999px; min-height: 44px; padding: 0 18px; font-size: 0.9375rem; font-weight: 500; background: var(--bg-card); border-color: var(--border-strong); }
.template-chip:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.memory-box, .search-input { border-radius: 14px; background: var(--bg-input); border-color: var(--border); }
.status-pill { border-radius: 999px; }
.usage-bar { height: 8px; border-radius: 999px; background: var(--bg-soft); }
.usage-bar > div { border-radius: 999px; }
.history-item { border-radius: 14px; }

/* ===== WORKS-WITH STRIP (new, static) ===== */
.works-strip {
  max-width: 1000px;
  margin: 0 auto var(--space-20);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.works-strip h2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-4);
}
.works-strip ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 36px; }
.works-strip li { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; color: var(--muted); }

/* ===== SECTIONS ===== */
.shell-section { margin-bottom: var(--space-20); }
.shell-section-head {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.shell-section-head h2 { font-size: clamp(1.75rem, 3.6vw, 2.6rem); letter-spacing: -0.03em; }
.shell-section-head p { font-size: 1.0625rem; margin: 0 auto; }
.shell-section-head a { color: var(--accent-2); }

/* Tool cards */
.tool-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-4); }
.tool-card { border-radius: var(--radius-lg); padding: 28px; border-color: var(--border); }
.tool-card h3 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: var(--space-2); }
.tool-card p { font-size: 0.9375rem; }
.tool-card .tool-go { font-size: 0.9375rem; }

/* Library */
.lib-tabs { display: flex; width: fit-content; margin-left: auto; margin-right: auto; border-radius: 999px; border: 0; background: var(--pill-bg); }
.lib-tab { border-radius: 999px; padding: 0 20px; min-height: 40px; font-size: 0.9375rem; }
.lib-tab.active { background: var(--accent); color: var(--accent-fg); }
.lib-card { border-radius: var(--radius-lg); padding: 24px; border-color: var(--border); }
.lib-card .lib-text { font-size: 0.9375rem; color: var(--text); font-weight: 500; }

/* How it works: soft panel with numbered circles */
#how {
  background: var(--soft-panel);
  border-radius: 36px;
  padding: 64px 48px;
}
#how .shell-section-head { align-items: flex-start; text-align: left; }
#how .shell-section-head p { margin-left: 0; }
#how .steps-row { padding: 0; gap: 32px; max-width: none; }
#how .step-card { background: transparent; border: 0; padding: 0; transform: none; }
#how .step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent-2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  margin-bottom: var(--space-4);
}
#how .step-card h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; }
#how .step-card p { font-size: 1rem; }

/* What is Prompt Helper: bento grid */
.feat-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-4); }
.feat {
  grid-column: span 3;
  flex-direction: column;
  gap: var(--space-4);
  border-radius: var(--radius-xl);
  padding: 36px;
  border-color: transparent;
  background: var(--pill-bg);
}
.feat:nth-child(1) { grid-column: span 4; background: var(--soft-panel); }
.feat:nth-child(2) { grid-column: span 2; }
.feat:nth-child(3) { grid-column: span 2; }
.feat:nth-child(4) { grid-column: span 4; background: var(--card-dark-bg); }
.feat-num {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
}
.feat h3 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: var(--space-2); }
.feat p { font-size: 1rem; }
.feat:nth-child(4) h3 { color: var(--card-dark-fg); }
.feat:nth-child(4) p { color: var(--card-dark-muted); }
.feat:nth-child(4) .feat-num { background: rgba(255, 255, 255, 0.12); color: #F4A27B; }

/* FAQ */
.faq-list { max-width: 820px; gap: 0; border-top: 1px solid var(--border); }
.faq-list details { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0; }
.faq-list summary { padding: 22px 4px; min-height: 64px; font-size: 1.125rem; display: flex; align-items: center; gap: 12px; }
.faq-list summary::before { font-size: 1.5rem; font-weight: 400; width: 20px; text-align: center; }
.faq-list details p { padding: 0 4px 24px 36px; margin: 0; font-size: 1rem; max-width: 720px; }

/* ===== FINAL CTA (new, static) ===== */
.final-cta {
  border: 1px solid var(--border-strong);
  border-radius: 40px;
  padding: 80px 32px;
  margin-bottom: var(--space-16);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  background: radial-gradient(ellipse 80% 120% at 50% 0%, var(--glow-1) 0%, var(--glow-2) 70%);
}
.final-cta h2 { font-size: clamp(2rem, 4.6vw, 3.25rem); letter-spacing: -0.03em; line-height: 1.05; max-width: 720px; }
.final-cta h2 em { font-family: 'Fraunces', 'Libre Baskerville', Georgia, serif; font-style: italic; font-weight: 500; color: var(--accent-2); }
.final-cta p { font-size: 1.125rem; max-width: 520px; }
.final-cta .cta-btn {
  display: inline-flex; align-items: center;
  min-height: 52px; padding: 0 32px;
  border-radius: 999px;
  background: var(--accent-2); color: #fff;
  font-weight: 600; font-size: 1.0625rem;
}
.final-cta .cta-btn:hover { background: var(--accent-2-dark); color: #fff; }

/* ===== FOOTER ===== */
.shell-footer { background: var(--bg-elevated); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1000px) {
  .feat-list { grid-template-columns: 1fr; }
  .feat, .feat:nth-child(n) { grid-column: auto; }
  #how { padding: 40px 24px; }
}
@media (max-width: 860px) {
  .shell-content { padding-top: var(--space-5); }
  .gen-panel { padding: 20px; border-radius: 24px; }
  .gen-tabs { overflow-x: auto; scrollbar-width: none; }
  .gen-tabs::-webkit-scrollbar { display: none; }
  .app-main::before { height: 520px; }
  .final-cta { padding: 56px 20px; border-radius: 28px; }
  .rail { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero-pill { font-size: 0.85rem; padding: 8px 16px; }
  .gen-submit { width: 100%; justify-content: center; }
}

/* ============================================================
   PRICING PAGE (top-nav layout, no app shell)
   ============================================================ */
body:has(.pricing-container) { background: var(--bg); }
body:has(.pricing-container)::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 560px; z-index: 0;
  background: radial-gradient(900px 420px at 50% -60px, var(--glow-1), transparent 70%);
  pointer-events: none;
}
.pricing-container { position: relative; z-index: 1; }
.nav { background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom-color: var(--border); }
.nav .brand { font-family: 'Inter', sans-serif; font-weight: 800; letter-spacing: -0.02em; }
.nav nav a { border-radius: 999px; padding: 8px 14px; }
.nav nav a.cta { border-radius: 999px; padding: 8px 18px; }
.pricing-container .page-title {
  font-family: 'Inter', sans-serif; font-weight: 800; letter-spacing: -0.045em; line-height: 1.04;
  font-size: clamp(2.4rem, 5.4vw, 3.75rem);
}
.pricing-container .page-title em {
  font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 500;
  color: var(--accent-2); letter-spacing: -0.02em;
}
.pricing-container .page-sub { font-size: 1.125rem; }
.plan-card { border-radius: 28px; box-shadow: var(--shadow-xs); background: var(--bg-card); }
.plan-card-pro {
  border: 1.5px solid var(--accent-2); box-shadow: var(--shadow-hero);
  background: var(--bg-card);
}
.plan-badge { background: var(--pill-bg); }
.plan-badge-recommended { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.plan-card .btn-primary, .plan-card .btn { border-radius: 999px; min-height: 48px; }
.plan-card-pro .btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.plan-card-pro .btn-primary:hover { background: var(--accent-2-dark); border-color: var(--accent-2-dark); }
.plan-meta { border-radius: 999px; }
.faq-eyebrow { background: var(--pill-bg); border-radius: 999px; }
.faq-item { border-radius: 16px; }
.faq-item[open] .faq-icon { background: var(--accent); }

/* ============================================================
   BLOG INDEX (own inline tokens: override after they load)
   ============================================================ */
:root {
  --surface: #FFFFFF; --surface-2: #F6F1EA; --line: #ECE6DD; --glow: #FFE6D4;
  --accent-soft: #F6F1EA;
}
html[data-theme="dark"] { --surface: #1D1D1B; --surface-2: #242422; --line: #2F2F2C; --glow: rgba(251,146,60,0.12); --accent-soft: rgba(237,235,230,0.08); }
.blog-hero { background: radial-gradient(900px 420px at 50% -80px, var(--glow), transparent 70%), var(--bg); border-bottom: 0; }
.blog-hero::after { display: none; }
.blog-hero h1 {
  background: none; -webkit-text-fill-color: currentColor; color: var(--text);
  font-weight: 800; letter-spacing: -0.045em;
}
.blog-eyebrow { background: var(--pill-bg, #F6F1EA); color: var(--accent-2-dark, #C2410C); border-color: transparent; }
.blog-stat { border-radius: 999px; box-shadow: none; background: var(--bg-card, #fff); }
.blog-controls-inner { border-radius: 28px; box-shadow: var(--shadow-hero); }
.blog-search, .blog-filter { border-radius: 999px; }
.blog-filter.active, .blog-filter[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg, #fff); border-color: var(--accent); }
.feat-card, .post-card { border-radius: 24px; box-shadow: none; }
.post-card:hover, .feat-card:hover { border-color: var(--accent-2); box-shadow: var(--shadow-md); }
.post-chip { background: var(--pill-bg, #F6F1EA); color: var(--accent-2-dark, #C2410C); border-radius: 999px; }
.post-arrow { color: var(--accent-2); }

/* wider pricing header so the title sits on one line on desktop */
.pricing-container .page-header { max-width: 860px !important; }
/* readable text on the light-orange dark-mode buttons */
html[data-theme="dark"] .plan-card-pro .btn-primary,
html[data-theme="dark"] .gen-submit,
html[data-theme="dark"] .final-cta .btn { color: #1A0E05; }

/* ============================================================
   MOBILE-FIRST FIXES (audit): first screen, tap targets, inputs
   ============================================================ */
.tb-pricing-m { display: none; }
.tb-icon-btn .tb-label { display: none; }
.tb-icon-btn svg { flex-shrink: 0; }

@media (max-width: 860px) {
  /* topbar: real labels instead of glyphs */
  #sb-signin-top { width: auto; padding: 0 12px; gap: 6px; border-color: var(--border); border-radius: 999px;
    font-size: 0.875rem; font-weight: 600; color: var(--text); font-family: inherit; }
  #sb-signin-top .tb-label { display: inline; }
  #tb-theme { border-radius: 999px; }
  .tb-pricing-m { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px;
    font-size: 0.875rem; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
  /* the extension is desktop-Chrome only, so phones get Pricing in the bar instead */
  .tb-cta { display: none; }
  /* search: icon button that opens to full width when focused */
  .tb-search { flex: 0 0 auto; }
  .tb-search input { width: 44px; padding: 0; cursor: pointer; transition: width var(--transition-base); }
  .tb-search input:focus { width: min(62vw, 260px); padding: 0 var(--space-3) 0 var(--space-8); cursor: text;
    position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 5; }
  .tb-search input::placeholder { color: transparent; }
  .tb-search input:focus::placeholder { color: var(--muted-light); }
  .tb-search::before { left: 14px; }
  .tb-search input { height: 44px; border-radius: 999px; }
}

@media (max-width: 700px) {
  /* 1. get the tool above the fold */
  .page-head { margin-bottom: 14px; }
  .hero-pill { display: none; }
  .hero-eyebrow { display: none; }
  .page-head h1 { font-size: clamp(1.9rem, 9vw, 2.35rem); line-height: 1.08; margin-bottom: 8px; }
  .page-head > p { font-size: 0.95rem; line-height: 1.45; }
  .shell-content { padding-top: 18px; }
  .app-main::before { height: 280px; }
  .gen-panel { border-radius: 22px; padding: 16px; }
  .gen-input { min-height: 120px; }
  /* keep Generate reachable: pinned to the bottom of the screen while the composer is in view */
  .gen-submit-row { position: sticky; bottom: 0; z-index: 20; margin: 12px -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--bg-card) 78%, transparent); border-radius: 0 0 22px 22px; }
  .gen-submit { flex: 1; justify-content: center; }
}

/* 3. no iOS zoom-on-focus: inputs must be 16px on phones */
@media (max-width: 860px) {
  input, select, textarea, .gen-input, .memory-box, .tb-search input, .blog-search, .search-input,
  .style-select, .target-select, #memory-input { font-size: 16px !important; }
}

/* 7. 44px minimum tap targets on touch screens */
@media (max-width: 860px) {
  .mode-tab, .lib-tab, .gen-toolbar select, .gen-toolbar .toggle, .btn, .btn-sm, #copy-btn, #share-btn,
  .blog-filter, .rail-card .btn, .faq-item > summary, .faq-list summary { min-height: 44px; }
  .btn-sm { padding-top: 10px; padding-bottom: 10px; }
  .gen-toolbar .toggle input[type="checkbox"] { width: 22px; height: 22px; }
  .gen-toolbar .toggle { gap: 10px; }
  #ab-help, #mem-help { position: relative; }
  #ab-help::after, #mem-help::after { content: ""; position: absolute; inset: -14px; }
  .shell-footer a, footer a { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 0; }
  .shell-section-head a, .works-strip a { display: inline-flex; align-items: center; min-height: 44px; }
  .tool-card .tool-go { min-height: 44px; display: inline-flex; align-items: center; }
}

/* post-result and A/B upsell cards */
.after-result {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: var(--space-3); padding: 12px 16px; border-radius: 16px;
  background: var(--pill-bg); border: 1px solid var(--border);
}
.after-result p { margin: 0; font-size: 0.875rem; color: var(--text-secondary); flex: 1 1 220px; }
.after-result .btn { border-radius: 999px; }
.after-result.hidden { display: none; }
#gen-error { position: relative; z-index: 21; margin-top: 12px; }

/* ============================================================
   LANDING PAGES (use-case pages)
   ============================================================ */
body.lp-body { background: var(--bg); }
body.lp-body::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 560px; z-index: 0; pointer-events: none;
  background: radial-gradient(900px 420px at 50% -60px, var(--glow-1), transparent 70%);
}
.lp-container { position: relative; z-index: 1; max-width: 980px; }
.lp-hero { text-align: center; max-width: 780px; margin: 0 auto var(--space-12); padding-top: var(--space-6); }
.lp-eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-2-dark); background: var(--pill-bg); border-radius: 999px; padding: 6px 14px; margin-bottom: var(--space-4); }
.lp-hero h1 { font-family: 'Inter', sans-serif; font-weight: 800; letter-spacing: -0.045em; line-height: 1.06;
  font-size: clamp(2rem, 6.2vw, 3.5rem); margin-bottom: var(--space-4); }
.lp-hero h1 em { font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 500; color: var(--accent-2); letter-spacing: -0.02em; }
.lp-lede { font-size: clamp(1rem, 2.4vw, 1.2rem); line-height: 1.6; max-width: 640px; margin: 0 auto var(--space-6); }
.lp-cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.lp-btn { border-radius: 999px; min-height: 52px; justify-content: center; text-decoration: none; }
.lp-btn-ghost { background: var(--bg-card); }
.lp-fine { font-size: 0.875rem; color: var(--muted); }
.lp-fine a { color: var(--accent-2-dark); text-decoration: underline; text-underline-offset: 3px; }
.lp-container section { margin-bottom: var(--space-16); }
.lp-h2 { text-align: center; font-size: clamp(1.5rem, 3.6vw, 2.1rem); letter-spacing: -0.03em; margin-bottom: var(--space-6); }
.lp-center { text-align: center; margin-top: var(--space-6); }
.lp-compare-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) auto minmax(0, 1.4fr); gap: var(--space-4); align-items: stretch; }
.lp-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px; padding: var(--space-5); }
.lp-card-out { border-color: var(--accent-2); box-shadow: var(--shadow-hero); }
.lp-tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-3); }
.lp-tag-accent { color: var(--accent-2-dark); }
.lp-rough { font-size: 1.25rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.02em; color: var(--text); }
.lp-out { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.9375rem; line-height: 1.65; color: var(--text-secondary); }
.lp-arrow { display: flex; align-items: center; font-size: 1.75rem; color: var(--accent-2); }
.lp-note { text-align: center; font-size: 0.8125rem; color: var(--muted); margin-top: var(--space-3); }
.lp-gets { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.lp-get { background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px; padding: var(--space-5); }
.lp-get h3 { font-size: 1.0625rem; margin-bottom: var(--space-2); }
.lp-get p { font-size: 0.9375rem; }
.lp-steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); counter-reset: none; }
.lp-steps li { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--pill-bg); border-radius: 24px; padding: var(--space-5); }
.lp-step-n { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.lp-steps h3 { font-size: 1.0625rem; margin-bottom: 4px; }
.lp-steps p { font-size: 0.9375rem; }
.lp-faq { max-width: 760px; margin: 0 auto; }
.lp-related { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.lp-rel { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--bg-card);
  border: 1px solid var(--border); font-size: 0.9375rem; font-weight: 600; color: var(--text); text-decoration: none; }
.lp-rel:hover { border-color: var(--accent-2); color: var(--accent-2-dark); }
body.lp-body footer { text-align: center; padding: var(--space-8) var(--space-4) var(--space-10); }
body.lp-body footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
@media (max-width: 860px) {
  .lp-compare-grid { grid-template-columns: 1fr; }
  .lp-arrow { justify-content: center; transform: rotate(90deg); height: 28px; }
  .lp-gets, .lp-steps { grid-template-columns: 1fr; }
  .lp-container { padding-top: 76px; }
  .lp-btn { width: 100%; }
}
.lp-faq, .lp-faq.faq-list { display: flex !important; flex-direction: column; column-count: 1 !important; columns: auto !important; grid-template-columns: 1fr !important; }
.lp-faq .faq-item { width: 100%; break-inside: avoid; }
.shell-footer-grid { grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .shell-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .shell-footer-grid { grid-template-columns: 1fr; } }

/* ============================================================
   UX POLISH
   ============================================================ */
/* placeholder + hint contrast (was ~2.4:1) */
:root { --muted-light: #77746C; }
html[data-theme="dark"] { --muted-light: #9A988F; }

/* brand mark in the sidebar */
.sb-logo svg { display: block; }

/* hint + example chips */
.gen-hint { margin: 8px 2px 0; font-size: 0.8125rem; color: var(--muted); }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.example-chips[hidden] { display: none; }
.example-chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast); }
.example-chip:hover, .example-chip:focus-visible { border-color: var(--accent-2); color: var(--accent-2-dark); background: var(--pill-bg); }
@media (max-width: 860px) { .example-chip { min-height: 44px; padding: 8px 16px; } }

/* options toggle: phones show the extra controls on demand */
.gen-options-toggle { display: none; }
@media (max-width: 700px) {
  .gen-options-toggle { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 0 16px;
    border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
  #gen-toolbar:not(.is-open) { display: none; }
}

/* loading skeleton while waiting for the first words */
.gen-output.is-loading { color: transparent; position: relative; overflow: hidden; min-height: 120px; }
.gen-output.is-loading::before {
  content: ""; position: absolute; left: 16px; right: 16px; top: 18px; height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%; animation: phg-shimmer 1.2s linear infinite;
  box-shadow: 0 26px 0 0 var(--bg-soft), 0 52px 0 0 var(--bg-soft);
}
@keyframes phg-shimmer { to { background-position: -200% 0; } }

/* output arrives gently */
.gen-output.has-content:not(.is-loading) { animation: phg-rise 220ms ease-out; }
@keyframes phg-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* toast */
.phg-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px);
  background: var(--accent); color: var(--accent-fg); padding: 10px 18px; border-radius: 999px; font-size: 0.875rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; z-index: 2000; }
.phg-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .gen-output.is-loading::before, .gen-output.has-content:not(.is-loading) { animation: none; }
  .phg-toast { transition: none; }
}

/* library footer (columns were not wrapped in a grid) */
.shell-footer:has(> .sf-col) {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6);
  padding: var(--space-10) max(var(--space-6), calc((100% - var(--shell-max)) / 2 + var(--space-6))) var(--space-8);
}
.shell-footer .sf-col h4 { letter-spacing: 0.08em; }
@media (max-width: 700px) { .shell-footer:has(> .sf-col) { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .example-chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .example-chips::-webkit-scrollbar { display: none; }
  .example-chip { flex: none; white-space: nowrap; }
  .gen-hint { margin-top: 6px; }
}
@media (max-width: 860px) {
  .nav nav a, .nav nav a.cta, .theme-toggle, .nav .brand { min-height: 44px; display: inline-flex; align-items: center; }
  .theme-toggle { min-width: 44px; justify-content: center; }
}

/* ===== Compact account area (one strip + one link; Memory lives in Options) ===== */
.rail.rail-compact { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 0 auto; }
.acct-strip { padding: 14px 16px; }
.acct-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.acct-who { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.acct-strip .usage-bar { margin-top: 6px; }
.acct-actions { margin-top: 10px; }
.acct-actions:not(:has(#portal-btn:not(.hidden))) #upgrade-btn { display: none; }
body.near-limit .acct-actions #upgrade-btn:not(.hidden) { display: inline-flex; }
.acct-actions:not(:has(*:not(.hidden):not(#upgrade-msg))) { display: none; }
body.near-limit .acct-actions { display: block; }
.rail-link { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); color: inherit; text-decoration: none; font-weight: 600; }
.rail-link:hover { border-color: var(--border-strong); }
.gen-memory { margin-top: 14px; width: 100%; }
.gen-memory .memory-box { width: 100%; }

.gen-memory > summary { cursor: pointer; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.gen-memory[open] > summary { margin-bottom: 6px; }
.gen-memory > summary { list-style: none; gap: 6px; }
.gen-memory > summary::-webkit-details-marker { display: none; }
.gen-memory > summary::after { content: "+"; font-size: 1rem; }
.gen-memory[open] > summary::after { content: "–"; }

/* ===== Blog index: consistent spacing ===== */
.blog-stats { display: none; }                       /* duplicated by the "174 guides" status under the search */
.blog-hero { padding-bottom: 56px; }
.blog-controls { margin-top: -28px; }
.blog-controls-inner { padding: 14px 16px; gap: 12px 16px; }
.blog-search-wrap { margin: 0; max-width: none; flex: 1 1 280px; }
.blog-search { height: 46px; padding-top: 0; padding-bottom: 0; }
.blog-filters { flex: 0 1 auto; }
.blog-search-status { text-align: center; margin: 14px 0 0; }
.blog-container { padding-top: 36px; }
.blog-section-label { margin-bottom: 16px; }
.feat-grid { gap: 16px; margin-bottom: 44px; }
.feat-card { justify-content: flex-start; min-height: 0; padding: 22px; }
.feat-inner { display: flex; flex-direction: column; flex: 1; }
.feat-title { margin: 12px 0 8px; font-size: 18px; }
.feat-desc { margin-bottom: 14px; }
.feat-foot { margin-top: auto; }
.post-grid { gap: 16px; }
.post-card { padding: 20px; }
.post-card-foot { padding-top: 12px; }
@media (max-width: 640px) {
  .blog-hero { padding-bottom: 44px; }
  .blog-controls { padding: 0 16px; }
  .blog-filters { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .blog-filters::-webkit-scrollbar { display: none; }
  .feat-card, .post-card { padding: 18px; }
}

.blog-home { position: absolute; top: 24px; left: 24px; z-index: 5; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--bg-card, #fff); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 0.875rem; text-decoration: none; }
@media (max-width: 640px) { .blog-home { top: 16px; left: 16px; } }
.feat-inner .post-chip { align-self: flex-start; }
@media (max-width: 640px) { .blog-hero { padding-top: 76px; } }

/* ===== Before / after + compact mode links ===== */
.ba-grid { display: grid; grid-template-columns: 1fr auto 1.6fr; gap: 16px; align-items: stretch; max-width: 980px; margin: 0 auto; }
.ba-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); padding: 20px; box-shadow: var(--shadow-soft); }
.ba-card p { margin: 0; line-height: 1.55; }
.ba-after { border-color: var(--accent-2); }
.ba-label { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.ba-arrow { align-self: center; font-size: 1.5rem; color: var(--accent-2); }
@media (max-width: 760px) { .ba-grid { grid-template-columns: 1fr; } .ba-arrow { transform: rotate(90deg); justify-self: center; } }
.mode-links { text-align: center; padding-top: 8px; }
.mode-links-label { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.mode-links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mode-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--border-strong, var(--border)); border-radius: 999px; background: var(--bg-card); color: inherit; text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.mode-links a:hover { border-color: var(--accent-2); }

/* Generate button while working: visible spinner + label, button stays at full strength */
.spinner.spinner-btn { width: 18px; height: 18px; margin-right: 8px; border: 2.5px solid currentColor; border-top-color: transparent; opacity: .95; }
#generate-btn:disabled[data-busy="1"] { opacity: 1; cursor: progress; }
#gen-status { font-size: 0.875rem; }
@media (prefers-reduced-motion: reduce) { .spinner.spinner-btn { animation-duration: 1.6s; } }

/* ===== Pricing: account line ===== */
.plan-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; max-width: 680px; margin: 32px auto; padding: 12px 14px 12px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-soft); }
.plan-meta #user-label { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; color: var(--text); }
.plan-meta .btn { margin: 0; }
.plan-meta #signout-btn { background: transparent; color: var(--muted); border-color: var(--border); }
.plan-meta #signout-btn:hover { color: var(--text); border-color: var(--border-strong); }
@media (max-width: 560px) { .plan-meta { margin: 24px 16px; } .plan-meta #user-label { flex-basis: 100%; } }

a.sb-brand-name { color: inherit; text-decoration: none; }
a.sb-brand-name:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Search dropdown ===== */
.tb-results { position: absolute; top: calc(100% + 8px); left: 0; width: min(520px, 92vw); max-height: min(70vh, 480px); overflow-y: auto; z-index: 60;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 6px; box-shadow: var(--shadow-hero); }
.tb-results[hidden] { display: none; }
.tb-res-head { font-size: 0.75rem; font-weight: 600; color: var(--muted); padding: 10px 10px 4px; }
.tb-res { display: flex; flex-direction: column; gap: 2px; padding: 10px; min-height: 44px; border-radius: 10px; color: var(--text); text-decoration: none; }
.tb-res:hover, .tb-res.on { background: var(--pill-bg); }
.tb-res-t { font-weight: 500; line-height: 1.3; }
.tb-res-t b { font-weight: 700; color: var(--accent-2-dark); }
html[data-theme="dark"] .tb-res-t b { color: var(--accent-2); }
.tb-res-d { font-size: 0.8125rem; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 860px) { .tb-results { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
