/* Apna QR — apnaqr.in
   Tokens mirror the Android app theme. Light is the default; dark applies via
   prefers-color-scheme unless the visitor picked a theme ([data-theme]). */

/* Metric-matched fallbacks so the Google Fonts swap doesn't shift layout */
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Roboto"), local("Liberation Sans"), local("Helvetica"); ascent-override: 90.2%; descent-override: 22.48%; line-gap-override: 0%; size-adjust: 107.4%; }
@font-face { font-family: "Poppins Fallback"; src: local("Arial"), local("Roboto"), local("Liberation Sans"), local("Helvetica"); ascent-override: 92.33%; descent-override: 30.78%; line-gap-override: 8.79%; size-adjust: 113.73%; }

:root {
  /* Brand */
  --brand-blue: #2D67E8;
  --brand-blue-dark: #1E4ED8;
  --brand-indigo: #0A1F66;
  --violet: #4F46E5;
  --scan: #93C5FD;
  --hero-gradient: linear-gradient(135deg, #2D67E8 0%, #4F46E5 50%, #0A1F66 100%);
  --hero-glow:
    radial-gradient(60% 55% at 50% 0%, rgb(255 255 255 / 0.16), transparent 70%),
    radial-gradient(60% 55% at 50% 100%, rgb(96 165 250 / 0.28), transparent 70%);

  /* Content-type accents */
  --c-url: #2D67E8;
  --c-deeplink: #4F46E5;
  --c-upi: #0E9F6E;
  --c-whatsapp: #16A34A;
  --c-phone: #0D9488;
  --c-sms: #EA580C;
  --c-email: #DC2626;
  --c-wifi: #0284C7;
  --c-contact: #7C3AED;
  --c-location: #DB2777;
  --c-event: #CA8A04;
  --c-text: #64748B;

  /* Light theme */
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-container: #FFFFFF;
  --surface-variant: #F0F3FA;
  --primary: #2D67E8;
  --on-primary: #FFFFFF;
  --primary-container: #E8EFFF;
  --on-primary-container: #1E4ED8;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --outline: #D1D5DB;
  --outline-variant: #E5E7EB;
  --secondary: #6D28D9;
  --secondary-container: #EDE7FE;
  --tertiary: #059669;
  --tertiary-container: #D1FAE5;
  --error: #DC2626;
  --warn: #B45309;
  --shadow-sm: 0 1px 2px rgb(17 24 39 / 0.06), 0 2px 8px rgb(17 24 39 / 0.04);
  --shadow-md: 0 8px 30px -10px rgb(30 78 216 / 0.22), 0 2px 6px rgb(17 24 39 / 0.05);
  --nav-bg: rgb(246 247 251 / 0.72);

  /* Shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-hero: 28px;
  --r-glass: 34px;
  --r-chip: 14px;
  --r-pill: 999px;

  --font-head: "Poppins", "Poppins Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 64px;

  /* Spacing scale (use these for every margin, padding and gap) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 80px;
  /* Layout rhythm */
  --page-top: var(--space-2);       /* nav → first block */
  --section-gap: var(--space-9);    /* between top-level blocks in <main> (sections, ads) and before the footer */
  --block-gap: var(--space-4);      /* between sibling cards and panels */
  --card-pad: var(--space-5);

  color-scheme: light;
}
@media (min-width: 768px) {
  :root { --section-gap: var(--space-10); --block-gap: var(--space-6); --card-pad: var(--space-6); }
}
@media (min-width: 1100px) {
  :root { --section-gap: var(--space-11); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1219;
    --surface: #161B26;
    --surface-container: #1A1F2E;
    --surface-variant: #242B3D;
    --primary: #7DA2FF;
    --on-primary: #0A1F66;
    --primary-container: #1A2747;
    --on-primary-container: #C7D7FF;
    --text: #F3F4F6;
    --text-2: #9CA3AF;
    --text-3: #6B7280;
    --outline: #3D465C;
    --outline-variant: #2A3245;
    --secondary: #C4B5FD;
    --secondary-container: #2E2357;
    --tertiary: #6EE7B7;
    --tertiary-container: #0F3A2E;
    --error: #F87171;
    --warn: #FBBF24;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-md: 0 10px 30px -12px rgb(0 0 0 / 0.6);
    --nav-bg: rgb(15 18 25 / 0.72);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0F1219;
  --surface: #161B26;
  --surface-container: #1A1F2E;
  --surface-variant: #242B3D;
  --primary: #7DA2FF;
  --on-primary: #0A1F66;
  --primary-container: #1A2747;
  --on-primary-container: #C7D7FF;
  --text: #F3F4F6;
  --text-2: #9CA3AF;
  --text-3: #6B7280;
  --outline: #3D465C;
  --outline-variant: #2A3245;
  --secondary: #C4B5FD;
  --secondary-container: #2E2357;
  --tertiary: #6EE7B7;
  --tertiary-container: #0F3A2E;
  --error: #F87171;
  --warn: #FBBF24;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-md: 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --nav-bg: rgb(15 18 25 / 0.72);
  color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-weight: 800; }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); }
h3 { font-size: 1.125rem; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
.gen-hero__band :focus-visible, .app-promo :focus-visible, .cta :focus-visible, .notfound :focus-visible { outline-color: #FFFFFF; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 12px 16px; border-radius: var(--r-sm); background: var(--primary); color: var(--on-primary); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.container--narrow { max-width: 800px; }
@media (min-width: 768px) { .container { padding-inline: 24px; } }

.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 0; border-radius: var(--r-pill);
  font-weight: 600; font-size: 15px; line-height: 1; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .2s, color .2s;
}
.btn .i { width: 18px; height: 18px; }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn--grad { color: #FFFFFF; background: linear-gradient(135deg, var(--brand-blue), var(--violet)); box-shadow: 0 8px 20px -8px rgb(45 103 232 / 0.6); }
.btn--grad:hover { box-shadow: 0 12px 28px -8px rgb(79 70 229 / 0.7); }
.btn--glass {
  color: #FFFFFF;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.24), rgb(255 255 255 / 0.10));
  border: 1px solid rgb(255 255 255 / 0.35);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.btn--glass:hover { background: linear-gradient(180deg, rgb(255 255 255 / 0.32), rgb(255 255 255 / 0.16)); }
.btn--soft { background: var(--primary-container); color: var(--on-primary-container); }
.btn--soft:hover { box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn--ghost { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--outline); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid var(--outline-variant); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  transition: background-color .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-variant); }
.icon-btn .i { width: 20px; height: 20px; }

.play-badge { display: inline-block; border-radius: 10px; flex: none; }
.play-badge img { width: 188px; height: 56px; }
.play-badge--sm img { width: 161px; height: 48px; }

.chip-ic {
  --a: var(--primary);
  display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: var(--r-chip);
  color: var(--a);
  background: color-mix(in srgb, var(--a) 12%, transparent);
}
.chip-ic--sm { width: 32px; height: 32px; border-radius: 10px; }
.chip-ic--sm .i { width: 18px; height: 18px; }
:root[data-theme="dark"] .chip-ic { background: color-mix(in srgb, var(--a) 20%, transparent); color: color-mix(in srgb, var(--a) 60%, #FFFFFF); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip-ic { background: color-mix(in srgb, var(--a) 20%, transparent); color: color-mix(in srgb, var(--a) 60%, #FFFFFF); }
}

.card { background: var(--surface); border: 1px solid var(--outline-variant); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }

/* Gradient grain overlay */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  opacity: .14; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.is-scrolled { border-bottom-color: var(--outline-variant); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text); text-decoration: none; font: 700 18px/1 var(--font-head); letter-spacing: -0.02em; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav__actions { display: flex; align-items: center; gap: 6px; }
.nav__links { display: none; }
.nav__links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); color: var(--text); font-weight: 500; font-size: 15px; text-decoration: none; }
.nav__links a:hover { background: var(--surface-variant); }

.i-theme-moon { display: none; }
:root[data-theme="dark"] .i-theme-sun { display: none; }
:root[data-theme="dark"] .i-theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-theme-sun { display: none; }
  :root:not([data-theme="light"]) .i-theme-moon { display: block; }
}

@media (max-width: 859px) {
  .nav__links.is-open {
    display: grid; gap: 4px;
    position: absolute; top: calc(var(--nav-h) - 4px); left: 12px; right: 12px;
    padding: 10px; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--outline-variant); box-shadow: var(--shadow-md);
    animation: drop .2s var(--ease);
  }
  .nav__links.is-open a { padding: 0 16px; min-height: 48px; }
}
@media (max-width: 359px) { .brand span { display: none; } }
@media (min-width: 860px) {
  .nav__links { display: flex; gap: 2px; }
  .nav__menu { display: none; }
  .nav__actions { gap: 10px; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Shared hero bits ---------- */
.hero__cursor {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgb(147 197 253 / 0.30), transparent 60%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.3);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6EE7B7; box-shadow: 0 0 0 4px rgb(110 231 183 / 0.25); }
.grad-word {
  background: linear-gradient(90deg, #FFFFFF, #93C5FD, #C4B5FD, #FFFFFF);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 300% 0; } }
.hero__ctas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }

/* Scanner viewfinder (404 page) */
.viewfinder { position: relative; margin: auto 0; padding: 14px; }
.vf-corner { position: absolute; width: 28px; height: 28px; border: 3px solid var(--scan); }
.vf-corner--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.vf-corner--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.vf-corner--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.vf-corner--br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.scan-line {
  position: absolute; left: 4px; right: 4px; top: 12px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, #93C5FD, transparent);
  box-shadow: 0 0 18px 4px rgb(147 197 253 / 0.55);
  animation: scan 2.6s ease-in-out infinite alternate;
}
@keyframes scan { to { top: calc(100% - 15px); } }

/* ---------- Trust strip ---------- */
.trust__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
.trust__list li {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--outline-variant);
  font-weight: 600; font-size: 14px;
}
.trust__list .i { width: 18px; height: 18px; color: var(--primary); }

/* ---------- Sections ----------
   <main> owns the vertical rhythm: every top-level block (section, ad slot) is
   separated by one --section-gap, so padding never stacks between neighbours. */
main { padding-block: var(--page-top) var(--section-gap); }
main > * + * { margin-top: var(--section-gap); }
.section__head { max-width: 680px; margin-bottom: var(--space-7); }
.kicker { margin-bottom: var(--space-3); font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.section__sub { margin-top: var(--space-3); color: var(--text-2); font-size: 1.0625rem; }

/* ---------- Generator ---------- */
/* Order on phones: content → preview → style, so the QR shows up right under the input. */
.gen { display: grid; gap: var(--block-gap); align-items: start; grid-template-areas: "content" "preview" "style"; }
.gen__content, .gen__style {
  display: grid; gap: var(--space-4); min-width: 0; margin: 0;
  padding: var(--card-pad); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.gen__content { grid-area: content; }
.gen__style { grid-area: style; }
.gen__preview { grid-area: preview; }
.gen__legend { float: left; width: 100%; display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; font: 700 1.125rem/1.2 var(--font-head); letter-spacing: -0.02em; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--hero-gradient); color: #FFFFFF; font-size: 14px; }
.gen__label { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.gen__hint { font-size: 13px; color: var(--text-2); }

.type-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip {
  --a: var(--primary);
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 44px; padding: 5px 14px 5px 6px; border-radius: var(--r-pill);
  background: var(--surface-variant); border: 1.5px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .2s, background-color .2s;
}
.type-chip input { position: absolute; opacity: 0; pointer-events: none; }
.type-chip:has(input:checked) { border-color: var(--a); background: color-mix(in srgb, var(--a) 10%, var(--surface)); }
.type-chip:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.type-chip .chip-ic--sm { border-radius: 50%; }

.fields { display: grid; gap: 12px; }
@media (min-width: 560px) { .fields { grid-template-columns: 1fr 1fr; } .field--full { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: var(--r-sm); border: 1.5px solid var(--outline); background: var(--surface);
  font-weight: 400; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-2); opacity: .8; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

.templates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tpl {
  display: grid; justify-items: center; gap: 6px; min-height: 44px; padding: 10px 4px;
  border-radius: var(--r-md); border: 1.5px solid var(--outline-variant); background: var(--surface);
  font-size: 12px; font-weight: 600; transition: border-color .2s, transform .2s var(--ease);
}
.tpl::before { content: ""; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--s1), var(--s2)); }
.tpl:hover { transform: translateY(-2px); }
.tpl[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container); }
@media (min-width: 560px) { .templates { grid-template-columns: repeat(8, 1fr); } }

.seg-row { display: grid; gap: var(--space-4); }
@media (min-width: 560px) { .seg-row { grid-template-columns: 1.3fr 1fr; } }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: var(--r-pill); background: var(--surface-variant); }
.seg--fit { width: fit-content; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; cursor: pointer; color: color-mix(in srgb, var(--text) 75%, var(--surface-variant)); transition: background-color .2s, color .2s; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 1px; }

.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.color { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px 6px 6px; border-radius: var(--r-sm); border: 1.5px solid var(--outline-variant); font-size: 14px; font-weight: 600; cursor: pointer; }
.color input { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 1px solid var(--outline); border-radius: 10px; }
.color input::-moz-color-swatch { border: 1px solid var(--outline); border-radius: 10px; }

.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.logo-row .gen__hint { flex-basis: 100%; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }

.gen__preview { position: sticky; top: calc(var(--nav-h) + 16px); }
.preview { display: grid; gap: var(--space-4); padding: var(--card-pad); border-radius: var(--r-lg); }
.preview__qr {
  display: grid; place-items: center; aspect-ratio: 1; width: 100%; max-width: 340px; margin-inline: auto;
  padding: 12px; border-radius: var(--r-md);
  background: repeating-conic-gradient(var(--surface-variant) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px;
}
.preview__qr canvas, .preview__qr svg { width: 100% !important; height: auto !important; border-radius: 10px; box-shadow: var(--shadow-md); }
.preview__warn, .preview__error { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; }
.preview__warn { background: color-mix(in srgb, #F59E0B 16%, transparent); color: var(--text); }
.preview__warn .i { width: 18px; height: 18px; color: var(--warn); }
.preview__error { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--text); }
.preview__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.preview__actions .btn--grad { flex-basis: 100%; }
.payload { font-size: 13px; color: var(--text-2); }
.payload summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.payload code { display: block; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-variant); color: var(--text); white-space: pre-wrap; word-break: break-all; font-size: 12px; }

.preview__note { font-size: 13px; color: var(--text-2); text-align: center; text-wrap: balance; }
.preview__note .i { display: inline-block; vertical-align: -2px; width: 15px; height: 15px; margin-right: 4px; color: var(--tertiary); }


@media (min-width: 900px) {
  .gen { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); grid-template-areas: "content preview" "style preview"; }
}
@media (max-width: 899px) { .gen__preview { position: static; } }

/* ---------- Generator hero ---------- */
.gen-hero__band {
  overflow: hidden; text-align: center;
  padding: var(--space-6) var(--space-5) var(--space-11); border-radius: var(--r-hero);
  color: #FFFFFF; background: var(--hero-glow), var(--hero-gradient);
}
.gen-hero__band h1 { margin: var(--space-4) auto 0; max-width: 18ch; font-size: clamp(1.875rem, 1.2rem + 3.6vw, 3.75rem); line-height: 1.08; }
.gen-hero__sub { margin: var(--space-3) auto 0; max-width: 46ch; color: #E0E7FF; font-size: clamp(.975rem, .9rem + .4vw, 1.125rem); }
.gen-hero .eyebrow { font-size: 11px; letter-spacing: .1em; }
.gen-hero .gen { position: relative; margin-top: -64px; padding-inline: 6px; }
.gen-hero .nudge { margin-inline: 6px; }
.gen-hero .trust__list { margin-top: var(--block-gap); }
.gen-hero__band:hover .hero__cursor { opacity: 1; }
.gen-hero__band.is-pointer .hero__cursor { opacity: 1; }
@media (min-width: 768px) {
  .gen-hero__band { padding: var(--space-9) var(--space-7) 104px; }
  .gen-hero .gen { margin-top: -80px; padding-inline: 20px; }
  .gen-hero .nudge { margin-inline: 20px; }
}
@media (max-width: 420px) { .gen-hero .eyebrow::before { display: none; } }

/* ---------- Scanner app promo ---------- */
.app-promo {
  display: grid; gap: var(--space-7); overflow: hidden;
  padding: var(--space-7) var(--space-5) 0; border-radius: var(--r-hero);
  color: #FFFFFF; background: var(--hero-glow), var(--hero-gradient);
}
.app-promo__id { display: flex; align-items: center; gap: 14px; }
.app-promo__id img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 24px -8px rgb(10 31 102 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.25); }
.app-promo__name { font: 700 1.0625rem/1.25 var(--font-head); letter-spacing: -0.01em; }
.app-promo__meta { font-size: 13px; color: #C7D2FE; margin-top: 2px; }
.app-promo h2 { margin-top: var(--space-6); font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); }
.app-promo__sub { margin-top: var(--space-3); color: #E0E7FF; max-width: 52ch; }
.app-promo__points { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.app-promo__points li { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.app-promo__points .i { width: 20px; height: 20px; flex: none; margin-top: 2px; padding: 3px; border-radius: 50%; background: rgb(110 231 183 / 0.22); color: #6EE7B7; stroke-width: 3; }
.app-promo__shots { position: relative; display: flex; justify-content: center; align-items: flex-end; height: 300px; }
.app-promo__shots img {
  position: absolute; bottom: -40px; width: 150px; height: auto; border-radius: 20px;
  box-shadow: 0 24px 48px -16px rgb(10 31 102 / 0.7), 0 0 0 1px rgb(255 255 255 / 0.2);
}
.app-promo__shots img:nth-child(1) { translate: -62% 0; rotate: -8deg; bottom: -60px; }
.app-promo__shots img:nth-child(2) { z-index: 1; width: 170px; }
.app-promo__shots img:nth-child(3) { translate: 62% 0; rotate: 8deg; bottom: -60px; }
@media (min-width: 900px) {
  .app-promo { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 56px 0 0 56px; }
  .app-promo__copy { padding-bottom: 56px; }
  .app-promo__shots { height: 100%; min-height: 500px; }
  .app-promo__shots img { width: 200px; }
  .app-promo__shots img:nth-child(2) { width: 230px; }
}


.nudge {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-top: var(--block-gap); padding: var(--space-4) var(--space-5); border-radius: var(--r-lg);
  background: var(--primary-container); color: var(--on-primary-container);
}

/* ---------- Apps ---------- */
.apps { display: grid; gap: var(--block-gap); }
.app-card {
  position: relative; display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto 1fr; align-items: start; gap: 16px 14px; overflow: hidden;
  padding: var(--card-pad); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--outline-variant);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.app-card::before {
  content: ""; position: absolute; inset: auto -30% -70% auto; width: 70%; aspect-ratio: 1; z-index: 0; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent), transparent); opacity: 0; transition: opacity .35s;
}
.app-card > * { position: relative; z-index: 1; }
.app-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 18px 40px -18px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.app-card:hover::before { opacity: .35; }
.app-card img { width: 64px; height: 64px; border-radius: 18px; flex: none; box-shadow: var(--shadow-sm); }
.app-card__body { flex: 1; min-width: 0; }
.app-card h3 { font-size: 1.0625rem; }
.app-card p { color: var(--text-2); font-size: 14px; line-height: 1.45; margin-top: 2px; }
.app-card > .btn { grid-column: 1 / -1; align-self: end; }
.app-card__tag { display: inline-block; margin-bottom: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; color: var(--on-primary-container); background: var(--primary-container); }
.btn--app { width: 100%; background: var(--surface-variant); color: var(--text); box-shadow: inset 0 0 0 1px var(--outline-variant); }
.btn--app .i { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.app-card:hover .btn--app { background: var(--text); color: var(--bg); box-shadow: none; }
@media (min-width: 768px) { .apps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .apps { grid-template-columns: repeat(3, 1fr); } }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: var(--space-3); }
.faq details { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--outline-variant); transition: border-color .2s; }
.faq details[open] { border-color: color-mix(in srgb, var(--primary) 45%, var(--outline-variant)); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 14px 18px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 1.0625rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); font-size: 20px; font-weight: 500; transition: transform .25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 18px 18px; color: var(--text-2); }

/* ---------- CTA ---------- */
.cta {
  display: grid; justify-items: center; gap: var(--space-3); text-align: center; overflow: hidden;
  padding: var(--space-9) var(--space-5); border-radius: var(--r-hero);
  color: #FFFFFF; background: var(--hero-glow), var(--hero-gradient);
}
.cta h2 { max-width: 16ch; }
.cta p { color: #E0E7FF; }
.cta .hero__ctas { justify-content: center; margin-top: var(--space-3); }
@media (min-width: 768px) { .cta { padding: 72px 40px; } }

/* ---------- Footer ---------- */
.footer { padding: var(--space-8) 0; border-top: 1px solid var(--outline-variant); }
.footer__inner { display: grid; gap: var(--space-5); }
.footer__brand p { color: var(--text-2); font-size: 14px; margin-top: var(--space-2); }
.footer__links { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.footer__links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin-left: -10px; color: var(--text); text-decoration: none; font-weight: 500; }
.footer__links a:hover { color: var(--primary); text-decoration: underline; }
.footer__legal { color: var(--text-2); font-size: 14px; }
@media (min-width: 768px) { .footer__inner { grid-template-columns: minmax(240px, 1fr) minmax(0, auto); align-items: center; column-gap: var(--space-7); } .footer__links { justify-content: flex-end; } .footer__legal { grid-column: 1 / -1; } }

/* ---------- Legal / simple pages ---------- */
.page-head { padding-top: var(--space-7); }
.page-head h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }
.page-head p { margin-top: var(--space-3); color: var(--text-2); }
.prose { padding-top: var(--space-7); }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.375rem; margin: var(--space-8) 0 var(--space-3); }
.prose p, .prose li { color: var(--text); }
.prose p + p { margin-top: var(--space-3); }
.prose ul { list-style: disc; padding-left: 22px; margin-top: var(--space-3); display: grid; gap: var(--space-2); }
.prose a { font-weight: 500; }
.prose .callout { margin-top: var(--space-5); padding: var(--space-4) var(--space-5); border-radius: var(--r-md); background: var(--primary-container); color: var(--on-primary-container); }

.notfound { display: grid; justify-items: center; gap: var(--space-4); text-align: center; padding: var(--space-10) var(--space-6); border-radius: var(--r-hero); color: #FFFFFF; background: var(--hero-glow), var(--hero-gradient); overflow: hidden; }
.notfound h1 { font-size: clamp(4rem, 3rem + 6vw, 7rem); line-height: 1; }
.notfound p { max-width: 36ch; color: #E0E7FF; font-size: 1.125rem; }
.notfound .viewfinder { width: 180px; margin: var(--space-2) 0; }
.notfound__glitch { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; background: rgb(255 255 255 / 0.1); font: 800 3rem/1 var(--font-head); }

/* ---------- Reveal, confetti ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.confetti { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; pointer-events: none; }

.magnetic { transition: transform .3s var(--ease); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .scan-line { top: 50%; }
}


.prose code, .page-head code { color: var(--text); font-size: .9em; padding: 2px 6px; border-radius: 6px; background: var(--surface-variant); }
.gen__legend + * { clear: both; }
.gen-hero .grad-word, .app-promo .grad-word { white-space: nowrap; }
@media (min-width: 768px) { .gen-hero__band h1 { max-width: 22ch; } }
.tpl::before { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18), 0 0 0 1px var(--outline-variant); }

/* ---------- Ad slots (Google AdSense) ----------
   Neutral box with an "Advertisement" label so ads never look like generator controls.
   Space is reserved to limit layout shift; unfilled units collapse. */
.ad-slot__box {
  max-width: 970px; margin-inline: auto; padding: 10px 12px 12px;
  border-radius: var(--r-md); border: 1px solid var(--outline-variant); background: var(--surface);
}
.ad-slot__label { margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); text-align: center; }
/* Reserved heights match the horizontal units: 320×100 on phones, 728×90 from 768px. */
.ad-slot__unit { width: 100%; min-height: 100px; overflow: hidden; }
@media (min-width: 768px) { .ad-slot__unit { min-height: 90px; } }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }

/* Local demo placeholders (localhost only, see ads.js). Same footprint as the real units. */
.ad-demo {
  display: grid; place-content: center; justify-items: center; gap: 4px; margin-inline: auto;
  width: min(100%, 320px); height: 100px; padding: 8px; text-align: center;
  border: 1.5px dashed var(--outline); border-radius: 6px; color: var(--text-2); font-size: 12px; line-height: 1.3;
  background: repeating-linear-gradient(-45deg, var(--surface-variant) 0 10px, var(--surface) 10px 20px);
}
.ad-demo strong { color: var(--text); font-size: 13px; }
.ad-demo__size::before { content: attr(data-mobile) " px"; }
@media (min-width: 768px) {
  .ad-demo { width: min(100%, 728px); height: 90px; }
  .ad-demo__size::before { content: attr(data-desktop) " px"; }
}

/* ---------- Guides ---------- */
.guide-list { display: grid; gap: var(--space-4); padding-top: var(--space-7); }
.section .guide-list { padding-top: 0; }
.guide-card a { display: grid; gap: var(--space-2); padding: var(--space-5); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--outline-variant); color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s var(--ease); }
.guide-card a:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--outline-variant)); transform: translateY(-2px); }
.guide-card h2, .guide-card h3 { font-size: 1.25rem; line-height: 1.3; }
.guide-card p { color: var(--text-2); }
.guide-card__meta { font-size: 14px; font-weight: 600; color: var(--primary); }
.guide-more { margin-top: var(--space-5); text-align: center; font-weight: 600; }
.page-head .kicker a { color: inherit; text-decoration: none; }
.page-head .article-meta { font-size: 15px; }
