/* ============================================================
   QR Barcode Maker — Design System v3.0
   Refined, premium, accessible. World-class polish.
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --primary: #2563EB;
  --primary-600: #1D4ED8;
  --primary-700: #1E40AF;
  --primary-50: #EFF6FF;
  --primary-100: #DBEAFE;

  --secondary: #1E40AF;
  --accent: #10B981;
  --accent-600: #059669;
  --accent-50: #ECFDF5;

  /* Neutrals — refined warm-cool grays */
  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #F1F5F9;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* Multi-layer shadows for premium depth */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 6px -1px rgba(15,23,42,.07), 0 2px 4px -2px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 15px -3px rgba(15,23,42,.08), 0 4px 6px -4px rgba(15,23,42,.05);
  --shadow-xl: 0 20px 25px -5px rgba(15,23,42,.10), 0 8px 10px -6px rgba(15,23,42,.06);
  --shadow-2xl: 0 25px 50px -12px rgba(15,23,42,.18);
  --shadow-glow: 0 0 0 4px rgba(37,99,235,.12);
  --shadow: var(--shadow-sm);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;
  --radius: var(--r);
  --radius-sm: var(--r-sm);

  /* Spacing scale (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 150ms;
  --t: 250ms;
  --t-slow: 400ms;

  /* Layout */
  --container: 1200px;
  --container-narrow: 880px;
  --container-prose: 760px;
  --header-h: 68px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img, svg, canvas, video { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--primary-600); }
button { font-family: inherit; }

::selection { background: var(--primary-100); color: var(--primary-700); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute; top: -100px; left: var(--s-4);
  background: var(--text); color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-sm);
  font-weight: 600; z-index: 100;
  text-decoration: none;
  transition: top var(--t) var(--ease);
}
.skip-link:focus { top: var(--s-2); color: #fff; outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.logo {
  font-weight: 700; font-size: 1.0625rem;
  color: var(--text);
  display: flex; align-items: center; gap: var(--s-2);
  letter-spacing: -.015em;
  transition: opacity var(--t-fast) var(--ease);
}
.logo:hover { opacity: .85; color: var(--text); }
.logo-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(37,99,235,.25), inset 0 1px 0 rgba(255,255,255,.2);
  position: relative;
}
.logo-mark::after {
  content: ''; position: absolute; inset: 6px;
  border: 2px solid #fff; border-radius: 3px;
  opacity: .9;
}
.nav-toggle {
  display: none; background: transparent; border: 0; cursor: pointer;
  padding: var(--s-2); color: var(--text); border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.nav-toggle:hover { background: var(--surface-3); }
.nav-toggle svg { width: 24px; height: 24px; }
.main-nav ul { display: flex; gap: var(--s-2); list-style: none; align-items: center; }
.main-nav a {
  color: var(--text-2); font-weight: 500; font-size: .9375rem;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  min-height: 40px;
  display: inline-flex; align-items: center;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.main-nav a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.main-nav a.cta {
  background: var(--text);
  color: #fff;
  padding: var(--s-2) var(--s-5);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,.15);
}
.main-nav a.cta:hover { background: var(--primary); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: inherit; font-weight: 600; font-size: .9375rem;
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-sm);
  border: 0; cursor: pointer;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease),
              box-shadow var(--t) var(--ease),
              color var(--t-fast) var(--ease);
  text-decoration: none;
  position: relative;
  isolation: isolate;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); transition-duration: 50ms; }
.btn:focus-visible { outline: 0; box-shadow: var(--shadow-glow); }

.btn-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37,99,235,.25), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--primary-600) 0%, var(--primary-700) 100%); color: #fff; box-shadow: 0 8px 16px -4px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.15); }

.btn-accent {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-600) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16,185,129,.25), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-accent:hover { background: linear-gradient(180deg, var(--accent-600) 0%, #047857 100%); color: #fff; box-shadow: 0 8px 16px -4px rgba(16,185,129,.35), inset 0 1px 0 rgba(255,255,255,.15); }

.btn-outline {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-strong); }

.btn-sm { padding: var(--s-2) var(--s-4); font-size: .875rem; min-height: 36px; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(2rem, 5vw, 4rem);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(16,185,129,.08), transparent 70%),
    linear-gradient(180deg, var(--primary-50) 0%, var(--bg) 90%);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15,23,42,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 100%);
  pointer-events: none;
}
.hero-inner { text-align: center; max-width: 880px; margin: 0 auto; position: relative; }
.hero h1 {
  font-size: clamp(2.25rem, 5.5vw, 4rem);
  line-height: 1.05; font-weight: 800;
  color: var(--text);
  margin-bottom: var(--s-5);
  letter-spacing: -.035em;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 50%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  display: inline;
}
.hero p {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  color: var(--text-2); margin-bottom: var(--s-8);
  max-width: 640px; margin-left: auto; margin-right: auto;
  line-height: 1.6;
}
.hero-cta { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { padding: var(--s-4) var(--s-8); font-size: 1rem; min-height: 52px; }

.hero-trust { margin-top: var(--s-5); font-size: .875rem; color: var(--muted); }
.hero-trust a { color: var(--primary); font-weight: 600; }

.hero-image { margin: var(--s-10) auto 0; max-width: var(--container-narrow); padding: 0 var(--s-3); }
.hero-image img {
  width: 100%; height: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2xl);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ---------- Sections ---------- */
section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section-title {
  text-align: center;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: var(--s-3);
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--text);
}
.section-sub {
  text-align: center; color: var(--muted);
  margin: 0 auto var(--s-12);
  max-width: 640px;
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* ---------- Feature Cards ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
}
.feature-card {
  background: var(--surface);
  padding: var(--s-6) var(--s-6);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t) var(--ease-out),
              box-shadow var(--t) var(--ease),
              border-color var(--t-fast) var(--ease);
  position: relative;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.feature-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  color: var(--primary);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-4);
  font-size: 1.5rem; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: var(--s-2);
  letter-spacing: -.01em;
  color: var(--text);
}
.feature-card p { color: var(--muted); font-size: .9375rem; line-height: 1.6; }

/* ---------- Steps ---------- */
.steps { background: var(--surface); }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-8);
}
.step { text-align: center; padding: var(--s-3); }
.step-num {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 700;
  margin: 0 auto var(--s-4);
  box-shadow: 0 8px 24px -8px rgba(37,99,235,.5), inset 0 1px 0 rgba(255,255,255,.2);
}
.step h3 { margin-bottom: var(--s-2); font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; }
.step p { color: var(--muted); font-size: .9375rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin: 0 auto; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: var(--s-3);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: var(--primary-100); box-shadow: var(--shadow-sm); }
.faq-item summary {
  padding: var(--s-5) var(--s-6);
  font-weight: 600; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  font-size: 1rem; color: var(--text);
  transition: background var(--t-fast) var(--ease);
  min-height: 56px;
}
.faq-item summary:hover { background: var(--surface-2); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ''; width: 20px; height: 20px;
  flex-shrink: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='%232563EB' stroke-width='2.5' stroke-linecap='round' d='M10 4v12M4 10h12'/></svg>") center/contain no-repeat;
  transition: transform var(--t) var(--ease-spring);
}
.faq-item[open] summary::after {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='%232563EB' stroke-width='2.5' stroke-linecap='round' d='M4 10h12'/></svg>") center/contain no-repeat;
  transform: rotate(180deg);
}
.faq-item p { padding: 0 var(--s-6) var(--s-5); color: var(--text-2); font-size: .9375rem; line-height: 1.7; }

/* ---------- Footer ---------- */
.site-footer {
  background: linear-gradient(180deg, #0F172A 0%, #020617 100%);
  color: #CBD5E1;
  padding: var(--s-16) 0 var(--s-6);
  margin-top: var(--s-16);
  position: relative;
}
.site-footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.4), transparent);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s-8);
  margin-bottom: var(--s-12);
}
.site-footer .logo { color: #fff; }
.site-footer .logo-mark { box-shadow: 0 4px 12px rgba(37,99,235,.4); }
.footer-col h4 { color: #fff; margin-bottom: var(--s-4); font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: var(--s-2); }
.footer-col a { color: #94A3B8; font-size: .9375rem; transition: color var(--t-fast) var(--ease); }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(148,163,184,.15); padding-top: var(--s-5); text-align: center; font-size: .8125rem; color: #64748B; }
.footer-desc { font-size: .9375rem; line-height: 1.7; margin-top: var(--s-3); color: #94A3B8; max-width: 380px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding: var(--s-4) 0; font-size: .8125rem; color: var(--muted); }
.breadcrumbs ol { list-style: none; display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.breadcrumbs li:not(:last-child)::after { content: '›'; margin-left: var(--s-2); color: var(--muted-2); font-size: 1.1em; }
.breadcrumbs a { color: var(--muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs li:last-child { color: var(--text-2); font-weight: 500; }

/* ---------- Tool Pages ---------- */
.tool-page { padding: var(--s-6) 0 var(--s-16); }
.tool-page h1 {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  margin-bottom: var(--s-3);
  letter-spacing: -.025em;
  font-weight: 800;
  line-height: 1.1;
}
.tool-page > .container > p.lead {
  color: var(--text-2);
  margin-bottom: var(--s-8);
  font-size: 1.125rem; max-width: 780px;
  line-height: 1.6;
}
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); align-items: start; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}
.panel h2 {
  font-size: 1.125rem;
  margin-bottom: var(--s-5);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex; flex-wrap: wrap; gap: var(--s-1);
  margin-bottom: var(--s-5);
  padding: var(--s-1);
  background: var(--surface-3);
  border-radius: var(--r);
}
.tab {
  background: transparent; border: 0;
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-4);
  font-family: inherit; font-size: .8125rem; font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--t-fast) var(--ease);
  min-height: 32px;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* ---------- Forms ---------- */
.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-size: .8125rem; font-weight: 600;
  margin-bottom: var(--s-2);
  color: var(--text-2);
  letter-spacing: -.005em;
}
.field input[type=text],
.field input[type=url],
.field input[type=email],
.field input[type=tel],
.field input[type=number],
.field textarea,
.field select {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .9375rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  min-height: 42px;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--border-strong); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 500px) { .field-row { grid-template-columns: 1fr; } }

.field input[type=color] {
  width: 100%; height: 44px; padding: 3px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease);
}
.field input[type=color]:hover { border-color: var(--border-strong); }
.field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 4px; }

.checkbox-field { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; font-size: .875rem; color: var(--text-2); user-select: none; }
.checkbox-field input { width: auto; cursor: pointer; accent-color: var(--primary); }

input[type=range] {
  width: 100%; accent-color: var(--primary);
  height: 6px;
}

/* ---------- Preview Box ---------- */
.preview-box {
  display: flex; align-items: center; justify-content: center;
  min-height: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.preview-box canvas, .preview-box svg, .preview-box img {
  max-width: 100%; max-height: 340px;
}
.download-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* Bulk grid */
.bulk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-3); margin-top: var(--s-5);
}
.bulk-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  text-align: center;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t) var(--ease);
}
.bulk-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bulk-item canvas { margin: 0 auto; border-radius: var(--r-xs); }
.bulk-item .label { font-size: .75rem; color: var(--muted); margin-top: var(--s-2); word-break: break-all; max-height: 32px; overflow: hidden; }

/* Spinner */
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: var(--r-full);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile Nav ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: rgba(255,255,255,.98);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: var(--s-4) var(--s-5);
    display: none;
    box-shadow: var(--shadow-xl);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: var(--s-1); align-items: stretch; }
  .main-nav a { padding: var(--s-3) var(--s-3); display: block; min-height: 48px; width: 100%; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Content Pages ---------- */
.content-page { padding: var(--s-12) 0 var(--s-16); max-width: var(--container-prose); margin: 0 auto; }
.content-page h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: var(--s-5); letter-spacing: -.025em; font-weight: 800; line-height: 1.15; }
.content-page h2 { font-size: 1.5rem; margin: var(--s-10) 0 var(--s-3); font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.content-page p { margin-bottom: var(--s-4); color: var(--text-2); font-size: 1.0625rem; line-height: 1.75; }
.content-page ul { margin: 0 0 var(--s-5) var(--s-6); }
.content-page li { margin-bottom: var(--s-2); color: var(--text-2); font-size: 1.0625rem; line-height: 1.7; }

/* ============================================================
   Advanced QR Generator Page
   ============================================================ */

/* Templates bar */
.templates-bar { margin-bottom: var(--s-6); }
.tb-title { font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: var(--s-3); text-transform: uppercase; letter-spacing: .08em; }
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-2); }
.tpl {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit; font-size: .875rem; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.tpl:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.tpl-swatch { width: 20px; height: 20px; border-radius: var(--r-xs); flex-shrink: 0; border: 1px solid rgba(0,0,0,.08); }

/* QR layout */
.qr-layout { display: grid; grid-template-columns: 1.2fr .9fr; gap: var(--s-6); align-items: start; }
@media (max-width: 960px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-options { display: flex; flex-direction: column; gap: var(--s-3); }

/* Accordion */
.acc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow var(--t) var(--ease), border-color var(--t-fast) var(--ease);
}
.acc[open] { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.acc summary {
  list-style: none;
  padding: var(--s-5) var(--s-6);
  cursor: pointer; font-weight: 600; font-size: 1rem;
  display: flex; align-items: center; gap: var(--s-3);
  user-select: none;
  transition: background var(--t-fast) var(--ease);
  letter-spacing: -.005em;
  color: var(--text);
}
.acc summary:hover { background: var(--surface-2); }
.acc summary::-webkit-details-marker { display: none; }
.acc-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  font-size: .8125rem; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37,99,235,.3);
}
.acc-icon {
  margin-left: auto; width: 20px; height: 20px;
  position: relative; flex-shrink: 0;
}
.acc-icon::before, .acc-icon::after {
  content: ''; position: absolute;
  background: var(--muted);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  transition: transform var(--t) var(--ease-spring);
  border-radius: 1px;
}
.acc-icon::before { width: 12px; height: 2px; }
.acc-icon::after { width: 2px; height: 12px; }
.acc[open] .acc-icon::after { transform: translate(-50%,-50%) scaleY(0); }
.acc-body {
  padding: 0 var(--s-6) var(--s-6);
  border-top: 1px solid var(--border);
}
.acc-body > :first-child { margin-top: var(--s-5); }

/* Sticky preview */
.qr-preview-wrap { position: sticky; top: calc(var(--header-h) + var(--s-3)); }
.preview-panel h2 { font-size: 1rem; margin-bottom: var(--s-4); }
.preview-frame {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  background: var(--surface);
  border-radius: var(--r);
  transition: all var(--t) var(--ease);
}
.preview-checker {
  background-image:
    linear-gradient(45deg, rgba(203,213,225,.5) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(203,213,225,.5) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(203,213,225,.5) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(203,213,225,.5) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  padding: var(--s-2);
  border-radius: var(--r-sm);
  display: inline-block;
}
#qr-canvas { display: flex; align-items: center; justify-content: center; }
#qr-canvas canvas, #qr-canvas svg { max-width: 100%; height: auto; display: block; border-radius: var(--r-xs); }
.preview-meta { text-align: center; color: var(--muted); font-size: .8125rem; margin: var(--s-3) 0 var(--s-4); font-variant-numeric: tabular-nums; }

/* Frame styles */
.preview-frame.frame-simple { border: 4px solid var(--frame-color); border-radius: 0; padding: var(--s-5); }
.preview-frame.frame-rounded { border: 4px solid var(--frame-color); border-radius: 18px; padding: var(--s-5); }
.preview-frame.frame-scanme, .preview-frame.frame-custom { border: 4px solid var(--frame-color); border-radius: 12px; padding: var(--s-5) var(--s-5) var(--s-12); }
.frame-label { position: absolute; left: var(--s-5); right: var(--s-5); bottom: var(--s-3); color: #fff; text-align: center; font-weight: 700; letter-spacing: .05em; padding: var(--s-2); border-radius: var(--r-sm); font-size: .9375rem; }

/* Visual thumb selectors */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--s-2); }
.thumb {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1);
  padding: var(--s-2);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit; font-size: .6875rem; font-weight: 600;
  color: var(--muted);
  transition: all var(--t-fast) var(--ease-out);
}
.thumb svg { display: block; border-radius: var(--r-xs); }
.thumb:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--primary); }
.thumb.active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--primary-50);
}

/* Swatches */
.swatches { display: flex; gap: var(--s-1); flex-wrap: wrap; margin-top: var(--s-2); }
.swatch {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  cursor: pointer; padding: 0;
  transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.swatch:hover { transform: scale(1.15); border-color: var(--primary); box-shadow: var(--shadow-sm); }

/* Color groups */
.color-group { padding: var(--s-4) 0; border-bottom: 1px solid var(--border); }
.color-group:last-child { border-bottom: 0; padding-bottom: 0; }
.color-group:first-child { padding-top: 0; }
.color-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-3); flex-wrap: wrap; gap: var(--s-2); }
.color-group-head strong { font-size: .875rem; font-weight: 600; color: var(--text); }
.gradient-controls { margin-top: var(--s-2); padding: var(--s-4); background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); }

/* Logo upload + gallery */
.upload-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.upload-name { font-size: .8125rem; color: var(--muted); }
.logo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.logo-tile {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
}
.logo-tile:hover { border-color: var(--primary); transform: scale(1.08); background: var(--primary-50); box-shadow: var(--shadow-sm); }
.logo-tile svg { width: 100%; height: 100%; display: block; }

.preview-panel .download-row { margin-top: var(--s-4); }
.preview-panel .download-row .btn { flex: 1; }

/* ============================================================
   i18n: language switcher + RTL
   ============================================================ */
.lang-switch-host { display: flex; align-items: center; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748B' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right .65rem center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-8) var(--s-2) var(--s-3);
  font-family: inherit; font-size: .8125rem; font-weight: 500;
  color: var(--text); cursor: pointer;
  max-width: 150px;
  min-height: 36px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.lang-select:hover { border-color: var(--border-strong); }
.lang-select:focus { outline: 0; border-color: var(--primary); box-shadow: var(--shadow-glow); }
@media (max-width: 768px) {
  .lang-switch-host { padding: var(--s-2) 0; }
  .lang-select { max-width: 100%; width: 100%; }
}

/* RTL */
html[dir=rtl] body { direction: rtl; text-align: right; }
html[dir=rtl] .main-nav ul { flex-direction: row-reverse; }
html[dir=rtl] .breadcrumbs ol { flex-direction: row-reverse; }
html[dir=rtl] .breadcrumbs li:not(:last-child)::after { margin-left: 0; margin-right: var(--s-2); }
html[dir=rtl] .acc summary { flex-direction: row-reverse; }
html[dir=rtl] .acc-icon { margin-left: 0; margin-right: auto; }
html[dir=rtl] .footer-col ul { padding: 0; }
html[dir=rtl] .feature-card { text-align: right; }
html[dir=rtl] .hero-inner, html[dir=rtl] .section-title, html[dir=rtl] .section-sub, html[dir=rtl] .step { text-align: center; }
html[dir=rtl] .lang-select { background-position: left .65rem center; padding: var(--s-2) var(--s-3) var(--s-2) var(--s-8); }
html[dir=rtl] .faq-item summary { flex-direction: row-reverse; }

/* ---------- Focus & A11y ---------- */
:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-glow);
  border-radius: var(--r-sm);
}
.feature-icon, .step-num { user-select: none; }

/* ============================================================
   Blog
   ============================================================ */
.blog-hero {
  padding: var(--s-12) 0 var(--s-8);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(37,99,235,.10), transparent 70%),
    linear-gradient(180deg, var(--primary-50) 0%, var(--bg) 100%);
  text-align: center;
  position: relative;
}
.blog-hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin-bottom: var(--s-3); letter-spacing: -.025em; font-weight: 800; line-height: 1.1; }
.blog-hero p { color: var(--text-2); font-size: 1.125rem; max-width: 640px; margin: 0 auto; line-height: 1.6; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-6);
  padding: var(--s-8) 0 var(--s-16);
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease), border-color var(--t-fast) var(--ease);
  display: flex; flex-direction: column;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); border-color: var(--border-strong); }
.blog-card a { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.blog-card a:hover { text-decoration: none; }
.blog-card-img {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  overflow: hidden;
}
.blog-card-img svg { width: 100%; height: 100%; display: block; }
.blog-card-body { padding: var(--s-5) var(--s-6) var(--s-6); flex: 1; display: flex; flex-direction: column; }
.blog-card .tag {
  display: inline-block;
  font-size: .6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary);
  background: var(--primary-50);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  margin-bottom: var(--s-3);
  align-self: flex-start;
}
.blog-card h2 {
  font-size: 1.1875rem; line-height: 1.35;
  margin-bottom: var(--s-2);
  color: var(--text);
  letter-spacing: -.015em;
  font-weight: 700;
}
.blog-card p { color: var(--muted); font-size: .9375rem; flex: 1; line-height: 1.6; }
.blog-card .read-more { margin-top: var(--s-4); color: var(--primary); font-weight: 600; font-size: .875rem; display: inline-flex; align-items: center; gap: var(--s-1); }
.blog-card:hover .read-more { gap: var(--s-2); }

/* Article page */
.blog-post { padding: 0 0 var(--s-16); }
.post-hero {
  width: calc(100% - var(--s-5));
  max-width: var(--container-narrow);
  margin: var(--s-8) auto 0;
  aspect-ratio: 21/9;
  max-height: 360px;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  display: block; overflow: hidden;
  position: relative;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
}
.post-hero svg { width: 100%; height: 100%; display: block; }
@media (max-width: 640px) { .post-hero { aspect-ratio: 16/9; border-radius: var(--r); margin-top: var(--s-5); } }

.post-container { max-width: var(--container-prose); margin: 0 auto; padding: 0 var(--s-5); }
.post-header { padding: var(--s-10) 0 var(--s-6); border-bottom: 1px solid var(--border); margin-bottom: var(--s-8); }
.post-meta { display: flex; gap: var(--s-3); align-items: center; font-size: .8125rem; color: var(--muted); margin-bottom: var(--s-5); flex-wrap: wrap; }
.post-meta .tag {
  background: var(--primary-50); color: var(--primary);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  font-weight: 700; text-transform: uppercase;
  font-size: .6875rem; letter-spacing: .08em;
}
.post-header h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.1; margin-bottom: var(--s-5);
  letter-spacing: -.03em; font-weight: 800;
  color: var(--text);
}
.post-lede { font-size: 1.25rem; color: var(--text-2); line-height: 1.55; font-weight: 400; }

.post-body { font-size: 1.0625rem; line-height: 1.75; color: var(--text-2); }
.post-body h2 {
  font-size: 1.625rem;
  margin: var(--s-12) 0 var(--s-4);
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -.02em;
  font-weight: 700;
}
.post-body h3 { font-size: 1.25rem; margin: var(--s-8) 0 var(--s-3); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.post-body p { margin-bottom: var(--s-4); }
.post-body ul, .post-body ol { margin: 0 0 var(--s-5) var(--s-6); }
.post-body li { margin-bottom: var(--s-2); }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body a {
  color: var(--primary); font-weight: 500;
  border-bottom: 1px solid rgba(37,99,235,.3);
  transition: border-color var(--t-fast) var(--ease);
}
.post-body a:hover { border-bottom-color: var(--primary); text-decoration: none; }
.post-body code { background: var(--surface-3); padding: 2px 6px; border-radius: var(--r-xs); font-size: .9em; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.post-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-50);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-6) 0;
  border-radius: 0 var(--r) var(--r) 0;
  font-style: italic;
  color: var(--text);
}
.post-callout {
  background: linear-gradient(135deg, var(--primary-50), #E0F2FE);
  border: 1px solid #BFDBFE;
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  margin: var(--s-8) 0;
  position: relative;
}
.post-callout strong {
  color: var(--primary-700);
  display: block; margin-bottom: var(--s-2);
  font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.post-cta {
  margin: var(--s-12) 0 var(--s-8);
  padding: var(--s-8);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  border-radius: var(--r-lg);
  color: #fff; text-align: center;
  position: relative; overflow: hidden;
  box-shadow: 0 16px 32px -12px rgba(37,99,235,.4);
}
.post-cta::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top right, rgba(255,255,255,.15), transparent 60%);
  pointer-events: none;
}
.post-cta h3 { color: #fff; font-size: 1.5rem; margin-bottom: var(--s-2); font-weight: 700; letter-spacing: -.015em; position: relative; }
.post-cta p { color: rgba(255,255,255,.92); margin-bottom: var(--s-5); font-size: 1rem; position: relative; }
.post-cta .btn { background: #fff; color: var(--primary); position: relative; }
.post-cta .btn:hover { background: var(--accent); color: #fff; }

.post-related { margin-top: var(--s-12); padding-top: var(--s-8); border-top: 1px solid var(--border); }
.post-related h3 { font-size: .8125rem; margin-bottom: var(--s-4); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.post-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); }
.post-related-grid a {
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text); font-weight: 500; font-size: .9375rem;
  transition: all var(--t-fast) var(--ease-out);
  line-height: 1.4;
}
.post-related-grid a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ============================================================
   Content sections
   ============================================================ */
.content-section { padding: clamp(3rem, 6vw, 5rem) 0; }
.content-section.content-alt { background: var(--surface); }
.content-figure { margin: var(--s-5) 0 var(--s-8); }
.content-figure img { width: 100%; height: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.content-figure figcaption { text-align: center; color: var(--muted); font-size: .875rem; margin-top: var(--s-3); font-style: italic; }
.content-section .feature-card h3 a { color: inherit; text-decoration: none; border-bottom: 0; transition: color var(--t-fast) var(--ease); }
.content-section .feature-card h3 a:hover { color: var(--primary); }

/* Comparison table */
.compare-table {
  overflow-x: auto;
  margin: var(--s-5) 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.compare-table table { width: 100%; border-collapse: collapse; min-width: 520px; }
.compare-table th, .compare-table td {
  padding: var(--s-4) var(--s-5);
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .9375rem;
}
.compare-table th { background: var(--surface-2); font-weight: 700; color: var(--text); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; }
.compare-table tr:last-child td { border-bottom: 0; }
.compare-table tr:hover td { background: var(--surface-2); }
.compare-table td:first-child { color: var(--text); }

/* Subtle entrance animation for above-fold content */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-inner > * { animation: fadeUp .6s var(--ease-out) backwards; }
.hero-inner h1 { animation-delay: .05s; }
.hero-inner p { animation-delay: .15s; }
.hero-inner .hero-cta { animation-delay: .25s; }
.hero-inner .hero-trust { animation-delay: .35s; }
.hero-image { animation: fadeUp .8s var(--ease-out) .4s backwards; }

/* ============================================================
   Quick Generator (homepage hero inline)
   ============================================================ */
.quick-gen {
  margin: var(--s-8) auto 0;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}
.quick-gen-form { display: flex; gap: var(--s-2); }
.quick-gen-form input {
  flex: 1; min-width: 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 1rem;
  background: var(--surface-2); color: var(--text);
  min-height: 48px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.quick-gen-form input:focus { outline: 0; border-color: var(--primary); box-shadow: var(--shadow-glow); background: var(--surface); }
.quick-gen-form .btn { min-height: 48px; padding-left: var(--s-6); padding-right: var(--s-6); }
.quick-gen-preview {
  display: flex; align-items: center; justify-content: center;
  margin-top: var(--s-5);
  min-height: 120px;
}
.quick-gen-preview canvas, .quick-gen-preview svg {
  border-radius: var(--r-sm);
  background: #fff;
  padding: var(--s-2);
  box-shadow: var(--shadow-sm);
}
.quick-gen-actions {
  display: flex; gap: var(--s-2); justify-content: center; flex-wrap: wrap;
  margin-top: var(--s-4);
}
@media (max-width: 480px) {
  .quick-gen-form { flex-direction: column; }
  .quick-gen-form input, .quick-gen-form .btn { width: 100%; }
}

/* ============================================================
   Scanner Page
   ============================================================ */
.scan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 900px) { .scan-grid { grid-template-columns: 1fr; } }

.scan-stage {
  position: relative;
  aspect-ratio: 4/3;
  background: var(--text);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-stage.flash::after {
  content: ''; position: absolute; inset: 0; background: rgba(16,185,129,.4);
  animation: scanflash .25s ease-out;
}
@keyframes scanflash {
  0% { opacity: 1; } 100% { opacity: 0; }
}
.scan-frame {
  position: absolute; inset: 18%;
  pointer-events: none;
}
.scan-frame span {
  position: absolute;
  width: 32px; height: 32px;
  border-color: rgba(255,255,255,.85);
  border-style: solid; border-width: 0;
}
.scan-frame span:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 6px; }
.scan-frame span:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 6px; }
.scan-frame span:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 6px; }
.scan-frame span:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 6px; }
.scan-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,23,42,.7);
  color: #fff; font-size: 1rem;
  text-align: center; padding: var(--s-5);
}
.scan-overlay p { color: #fff; }
.scan-hint { font-size: .8125rem; color: var(--muted); margin-top: var(--s-3); }

.scan-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-5);
  border: 2px dashed var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast) var(--ease);
}
.scan-drop:hover, .scan-drop.is-dragover {
  border-color: var(--primary);
  background: var(--primary-50);
  color: var(--primary);
}
.scan-drop strong { color: var(--text); }
.scan-drop small { font-size: .75rem; color: var(--muted); }

.scan-result { background: var(--surface-2); border-radius: var(--r); padding: var(--s-4); min-height: 120px; }
.scan-empty { color: var(--muted); font-size: .9375rem; text-align: center; padding: var(--s-5) 0; }

.scan-card { display: flex; flex-direction: column; gap: var(--s-3); }
.scan-card-row { display: flex; justify-content: space-between; gap: var(--s-3); align-items: baseline; font-size: .875rem; }
.scan-card-row.scan-card-row-block { flex-direction: column; align-items: stretch; }
.scan-label { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.scan-value { color: var(--text); font-weight: 600; font-family: ui-monospace, 'SF Mono', monospace; font-size: .8125rem; }
.scan-data {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: var(--s-3); margin-top: var(--s-2);
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: .8125rem; line-height: 1.5;
  color: var(--text); white-space: pre-wrap; word-break: break-all;
  max-height: 160px; overflow-y: auto;
}
.scan-validation {
  font-size: .8125rem; padding: var(--s-2) var(--s-3);
  background: var(--accent-50); color: var(--accent-600);
  border-radius: var(--r-sm);
  border: 1px solid rgba(16,185,129,.2);
}
.scan-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }

/* ============================================================
   History Panel
   ============================================================ */
.history-panel { margin-top: var(--s-5); }
.history-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin-bottom: var(--s-2); }
.history-head h2 { font-size: 1rem; margin: 0; }
.history-note { font-size: .75rem; color: var(--muted); margin-bottom: var(--s-3); line-height: 1.5; }
.history-empty { color: var(--muted); font-size: .8125rem; text-align: center; padding: var(--s-4) 0; font-style: italic; }
.history-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
  background: var(--surface-2);
  transition: border-color var(--t-fast) var(--ease);
}
.history-item:hover { border-color: var(--border-strong); }
.history-item img { width: 48px; height: 48px; border-radius: var(--r-xs); background: #fff; padding: 2px; flex-shrink: 0; }
.history-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.history-type { font-size: .65rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.history-data {
  font-size: .8125rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, 'SF Mono', monospace;
}

/* ============================================================
   Live Preview Mockup — Mobile Phone Frame
   ============================================================ */

/* View toggle */
.preview-head {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.preview-head h2 { margin: 0; }
.preview-modes {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--r-sm);
}
.pmode {
  background: transparent; border: 0;
  padding: 6px 14px;
  font-family: inherit; font-size: .8125rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-radius: 5px;
  transition: all var(--t-fast) var(--ease);
  min-height: 28px;
}
.pmode:hover { color: var(--text); }
.pmode.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.preview-stage[hidden] { display: none; }

/* Phone mockup frame */
.phone-mockup {
  display: flex;
  justify-content: center;
  padding: var(--s-3) 0;
  perspective: 1000px;
}
.phone-frame {
  position: relative;
  width: 280px;
  height: 560px;
  background: linear-gradient(145deg, #1a1d24 0%, #0a0c10 100%);
  border-radius: 38px;
  padding: 12px;
  box-shadow:
    0 0 0 2px #2c2f37,
    0 0 0 3px #3a3d44,
    0 25px 50px -12px rgba(15,23,42,.45),
    0 12px 24px -8px rgba(15,23,42,.3),
    inset 0 0 0 1px rgba(255,255,255,.04);
  transition: transform var(--t-slow) var(--ease-out);
}
.phone-mockup-bc .phone-frame {
  width: 320px;
  transform: rotate(90deg) translateY(-20px);
}
.phone-frame:hover { transform: translateY(-4px) scale(1.01); }
.phone-mockup-bc .phone-frame:hover { transform: rotate(90deg) translateY(-24px) scale(1.01); }

.phone-side {
  position: absolute;
  background: #1a1d24;
  border-radius: 2px;
}
.phone-side-power { right: -2px; top: 130px; width: 3px; height: 60px; }
.phone-side-vol1 { left: -2px; top: 110px; width: 3px; height: 32px; }
.phone-side-vol2 { left: -2px; top: 152px; width: 3px; height: 56px; }

.phone-screen {
  width: 100%; height: 100%;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  background: #fff;
  display: flex; flex-direction: column;
  transition: background var(--t) var(--ease);
}

/* Status bar */
.phone-statusbar {
  height: 38px;
  padding: 8px 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}
.phone-time { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.phone-dynisland {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  top: 8px;
  width: 92px; height: 26px;
  background: #000;
  border-radius: 14px;
}
.phone-icons {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text);
}

/* Phone content area (background + QR) */
.phone-content {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.phone-bg {
  position: absolute; inset: 0;
  z-index: 0;
  transition: opacity var(--t) var(--ease);
}
.phone-qr {
  position: relative; z-index: 1;
  width: 64%; max-width: 180px;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 24px -4px rgba(15,23,42,.18), 0 4px 8px -2px rgba(15,23,42,.08);
}
.phone-qr img, .phone-qr canvas, .phone-qr svg {
  width: 100%; height: auto; display: block;
}
.phone-mockup-bc .phone-qr {
  width: 80%; max-width: 240px;
  padding: 18px;
}
.phone-mockup-bc .phone-qr img,
.phone-mockup-bc .phone-qr svg {
  transform: rotate(-90deg);
  transform-origin: center;
}

/* Scan laser animation */
.scan-laser {
  position: absolute; inset: 0;
  z-index: 5;
  pointer-events: none;
  display: none;
}
.scan-laser.active { display: block; }
.scan-laser::before {
  content: '';
  position: absolute;
  left: 14%; right: 14%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #10B981 20%, #10B981 80%, transparent);
  box-shadow: 0 0 18px 6px rgba(16,185,129,.6), 0 0 4px 1px rgba(16,185,129,1);
  animation: scanSweep 1.6s var(--ease-out);
  border-radius: 2px;
}
.scan-laser::after {
  content: '';
  position: absolute;
  left: 18%; right: 18%; top: 18%; bottom: 18%;
  border: 2px solid rgba(16,185,129,.5);
  border-radius: 12px;
  animation: scanGlow 1.6s var(--ease-out);
  box-shadow: inset 0 0 30px rgba(16,185,129,.15);
  pointer-events: none;
}
@keyframes scanSweep {
  0%   { top: 18%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 82%; opacity: 0; }
}
@keyframes scanGlow {
  0%, 100% { opacity: 0; transform: scale(1.05); }
  20%, 80% { opacity: 1; transform: scale(1); }
}

/* Notification banner */
.phone-notification {
  position: absolute;
  top: 50px; left: 12px; right: 12px;
  z-index: 10;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px -4px rgba(15,23,42,.25);
  animation: notifIn .35s var(--ease-spring);
}
.phone-notification[hidden] { display: none; }
.phone-screen[data-bg="dark"] .phone-notification {
  background: rgba(40,40,40,.92);
  color: #fff;
}
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notif-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-icon svg { width: 18px; height: 18px; }
.notif-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.notif-title {
  font-size: 12px; font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.phone-screen[data-bg="dark"] .notif-title { color: #fff; }
.notif-data {
  font-size: 11px;
  color: var(--text-2);
  font-family: ui-monospace, 'SF Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.phone-screen[data-bg="dark"] .notif-data { color: rgba(255,255,255,.7); }

/* Home indicator */
.phone-home {
  position: absolute;
  bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 4px;
  background: var(--text);
  border-radius: 2px;
  z-index: 4;
  opacity: .55;
}
.phone-screen[data-bg="dark"] .phone-home { background: #fff; opacity: .7; }
.phone-screen[data-bg="payment"] .phone-home,
.phone-screen[data-bg="business"] .phone-home,
.phone-screen[data-bg="menu"] .phone-home { opacity: .35; }

/* Status bar color adapts to background */
.phone-screen[data-bg="dark"] .phone-statusbar,
.phone-screen[data-bg="dark"] .phone-icons { color: #fff; }
.phone-screen[data-bg="payment"] .phone-statusbar,
.phone-screen[data-bg="payment"] .phone-icons { color: #fff; }

/* === Background contexts === */

/* Light (default) */
.phone-bg[data-bg="light"], .phone-screen[data-bg="light"] .phone-bg {
  background: linear-gradient(180deg, #FAFBFC 0%, #F1F5F9 100%);
}

/* Dark */
.phone-screen[data-bg="dark"] .phone-bg {
  background: linear-gradient(180deg, #0F172A 0%, #020617 100%);
}
.phone-screen[data-bg="dark"] { background: #0F172A; }

/* Business card */
.phone-screen[data-bg="business"] .phone-bg {
  background:
    radial-gradient(ellipse at top, rgba(37,99,235,.08), transparent 60%),
    linear-gradient(160deg, #FAFBFC 0%, #E2E8F0 100%);
}
.phone-screen[data-bg="business"] .phone-bg::before {
  content: 'JOHN DOE';
  position: absolute;
  top: 16%; left: 0; right: 0;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 17px; font-weight: 800;
  letter-spacing: .04em;
  color: var(--text);
}
.phone-screen[data-bg="business"] .phone-bg::after {
  content: 'Senior Product Designer\Aacme @ Studio';
  white-space: pre;
  position: absolute;
  top: 22%; left: 0; right: 0;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

/* Menu */
.phone-screen[data-bg="menu"] .phone-bg {
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
}
.phone-screen[data-bg="menu"] .phone-bg::before {
  content: '✦ MENU ✦';
  position: absolute;
  top: 12%; left: 0; right: 0;
  text-align: center;
  font-family: 'Inter', serif;
  font-size: 16px; font-weight: 800;
  color: #78350F;
  letter-spacing: .15em;
}
.phone-screen[data-bg="menu"] .phone-bg::after {
  content: 'Scan to view our full menu';
  position: absolute;
  bottom: 14%; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  font-style: italic;
  color: #92400E;
}

/* Payment */
.phone-screen[data-bg="payment"] .phone-bg {
  background: linear-gradient(160deg, #1E40AF 0%, #6366F1 50%, #8B5CF6 100%);
}
.phone-screen[data-bg="payment"] .phone-bg::before {
  content: 'Pay with QR';
  position: absolute;
  top: 12%; left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-size: 18px; font-weight: 700;
  letter-spacing: -.02em;
}
.phone-screen[data-bg="payment"] .phone-bg::after {
  content: '$ 49.00';
  position: absolute;
  top: 20%; left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-size: 28px; font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.phone-screen[data-bg="payment"] .phone-qr {
  background: rgba(255,255,255,.98);
  box-shadow: 0 16px 40px -8px rgba(0,0,0,.4);
}

/* Background switcher */
.bg-switcher {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  margin-top: var(--s-3);
}
.bgs {
  background: transparent; border: 0;
  padding: 6px 8px;
  font-family: inherit; font-size: .7rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-radius: 5px;
  transition: all var(--t-fast) var(--ease);
  flex: 1 1 auto;
  min-width: 70px;
  white-space: nowrap;
  min-height: 28px;
}
.bgs:hover { color: var(--text); background: rgba(255,255,255,.6); }
.bgs.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* Mobile responsive — floating preview */
@media (max-width: 960px) {
  .qr-preview-wrap { position: relative; top: 0; }
  .phone-mockup { padding: var(--s-2) 0; }
  .phone-frame { width: 240px; height: 480px; }
  .phone-mockup-bc .phone-frame { width: 280px; }
}
@media (max-width: 480px) {
  .phone-frame { width: 220px; height: 440px; border-radius: 32px; padding: 10px; }
  .phone-screen { border-radius: 24px; }
}
