:root {
  --site-bg: #f0f2f5;
  --site-surface: rgba(255, 255, 255, .72);
  --site-surface-solid: #ffffff;
  --site-text: #202238;
  --site-muted: #5f6478;
  --site-border: rgba(99, 87, 190, .18);
  --site-primary: #5b36f2;
  --site-primary-strong: #4724cf;
  --site-primary-soft: rgba(91, 54, 242, .1);
  --site-focus: #c4b5fd;
  --site-shadow: 0 16px 42px rgba(69, 48, 145, .12);
}
[data-theme="dark"] {
  --site-bg: #111522;
  --site-surface: rgba(25, 30, 48, .76);
  --site-surface-solid: #1b2030;
  --site-text: #f4f5fb;
  --site-muted: #b9c0d0;
  --site-border: rgba(167, 139, 250, .24);
  --site-primary: #9b87ff;
  --site-primary-strong: #c1b5ff;
  --site-primary-soft: rgba(155, 135, 255, .14);
  --site-focus: #a997ff;
  --site-shadow: 0 18px 48px rgba(0, 0, 0, .32);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
.app { background: transparent !important; }
.site-shell-ready :is(.topbar, header.bulk-header, nav.decoder-nav, header.format-page-header) { display: none !important; }
.site-shell-ready .animated-header > :is(.lang-switch, .theme-toggle) { display: none !important; }

/* Shared controls float inside the original colourful canvas. */
.site-header {
  position: relative;
  z-index: 200;
  width: min(1160px, calc(100% - 32px));
  margin: 18px auto 0;
  border: 1px solid var(--site-border);
  border-radius: 18px;
  background: var(--site-surface);
  box-shadow: var(--site-shadow), inset 0 1px 0 rgba(255, 255, 255, .7);
  backdrop-filter: saturate(150%) blur(18px);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  padding: 0;
  text-align: left;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(79, 70, 229, .24), rgba(124, 58, 237, .1) 48%, rgba(236, 72, 153, .2));
  opacity: .55;
  pointer-events: none;
}
.site-header__inner {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  padding: 8px 10px 8px 12px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--site-text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}
.site-brand img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 7px 18px rgba(79, 70, 229, .2);
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--site-muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.site-nav__link:hover {
  color: var(--site-primary-strong);
  border-color: var(--site-border);
  background: var(--site-primary-soft);
  transform: translateY(-1px);
}
.site-nav__link.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #4f46e5, #7c3aed 55%, #d946ef);
  box-shadow: 0 6px 16px rgba(91, 54, 242, .25);
}
[data-theme="dark"] .site-nav__link.is-active { color: #fff; }
[data-contrast="high"] .site-nav__link.is-active { color: #fff; background: #000091; }
.site-nav__link:focus-visible,
.site-brand:focus-visible,
.site-header button:focus-visible,
.site-header a:focus-visible { outline: 3px solid var(--site-focus); outline-offset: 2px; }
.site-header__actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: max-content; }
.site-header .lang-switch { position: relative; inset: auto; z-index: 3; }
.site-header .lang-current,
.site-header .theme-toggle {
  position: relative;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--site-surface-solid) 68%, transparent);
  color: var(--site-text);
  box-shadow: none;
}
.site-header .lang-current { min-width: 68px; padding: 8px 10px; font: inherit; font-size: 13px; font-weight: 750; }
.site-header .theme-toggle { width: 42px; padding: 9px; cursor: pointer; }
.site-header .theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.site-header .flag-img { display: none; }
.site-header .lang-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  left: auto;
  display: none;
  width: 220px;
  max-height: min(440px, calc(100vh - 90px));
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--site-border);
  border-radius: 12px;
  background: var(--site-surface-solid);
  box-shadow: 0 20px 50px rgba(25, 31, 50, .2);
}
.site-header .lang-dropdown.open { display: grid; }
.site-header .lang-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--site-text);
  font-size: 13px;
  text-decoration: none;
}
.site-header .lang-option .flag-img { display: block; }
.site-header .lang-option:hover,
.site-header .lang-option.active { color: var(--site-primary-strong); background: var(--site-primary-soft); }
.site-header .auth-controls { position: relative; inset: auto; }
.site-header .auth-anon { display: flex; align-items: center; }
.site-header .auth-anon .auth-link-secondary { display: none; }

/* Specialist and account screens share the same ambient identity. */
.bulk-page,
.task-page,
.guide-page {
  background: linear-gradient(135deg, #f0f2f5 0%, #e0e7ff 50%, #fce7f3 100%);
  background-attachment: fixed;
  color: var(--site-text);
}
.bulk-page::before,
.task-page::before,
.guide-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 18% 42%, rgba(79, 70, 229, .08), transparent 46%), radial-gradient(circle at 82% 18%, rgba(236, 72, 153, .07), transparent 38%);
  pointer-events: none;
}
[data-theme="dark"] :is(.bulk-page, .task-page, .guide-page) { background: linear-gradient(135deg, #111522, #17142a 55%, #241526); }
.bulk-page :is(.bulk-shell, .task-shell, .guide-shell, .gs1-shell, .two-d-shell) { color: var(--site-text); }
.bulk-page .bulk-shell { width: min(1160px, calc(100% - 32px)); }
.bulk-page :is(.bulk-title p, .task-lead, .gs1-heading p, .two-d-heading p, .gs1-reference p, .two-d-reference p) { color: var(--site-muted); }
.bulk-page :is(.bulk-toolbar, .bulk-output, .bulk-table-wrap, .gs1-workspace, .two-d-workspace, .task-steps li, details, .footer) {
  border-color: var(--site-border);
  background-color: var(--site-surface);
  box-shadow: 0 12px 34px rgba(69, 48, 145, .08);
  backdrop-filter: blur(14px);
}
.bulk-page :is(.btn-primary, .btn-secondary, .btn-link, button, input, select, textarea) { border-radius: 8px; }
.bulk-page .btn-primary { border-color: var(--site-primary); background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
.bulk-page .btn-primary:hover { border-color: var(--site-primary-strong); background: linear-gradient(135deg, #4338ca, #6d28d9); }
.bulk-page .btn-secondary { border-color: var(--site-primary); background: var(--site-surface-solid); color: var(--site-primary-strong); }
.bulk-page :is(.task-kicker, .two-d-advanced summary, .gs1-reference a, .task-links a) { color: var(--site-primary-strong); }
.bulk-page :is(.two-d-heading h1, .gs1-heading h1, .task-shell h1) { color: var(--site-text); letter-spacing: 0; }

/* Keep the original hero and barcode animation as the main identity. */
.animated-header {
  position: relative;
  padding: 42px 0 28px;
  color: var(--site-text);
  text-align: center;
}
.animated-header .subtitle { color: var(--site-muted); }
.animated-header :is(h1, .brand-heading) { letter-spacing: 0; }
.generator-panel :is(.controls, .preview),
.decoder-main :is(.camera-btn, .drop-area),
main.container > .card { border-radius: 14px; }
.decoder-main .camera-btn { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.decoder-main .camera-row { justify-content: center; }
.decoder-main .camera-btn { flex-direction: row; width: auto; min-height: 48px; padding: 11px 18px; gap: 9px; }
.decoder-main .camera-btn svg { width: 22px; height: 22px; padding: 0; border-radius: 0; background: transparent; box-shadow: none; animation: none; }
.decoder-main .camera-btn span { font-size: 14px; }
.decoder-main .decoder-intro { color: var(--site-muted); }
.decoder-main .decoder-feature { border-color: var(--site-border); background: var(--site-surface); color: var(--site-text); }
[data-theme="dark"] .decoder-main .decoder-feature { border-color: var(--site-border); background: var(--site-surface); color: var(--site-text); }
body[data-page] .animated-header .logo { display: block; }
body[data-page] .animated-header .logo .subtitle { margin-top: 6px; }
body[data-page] .app-nav[data-signed-in="false"] a:not(:first-child):not(.app-nav__cta) { display: none; }
.popular-gallery { align-items: stretch; }
.popular-card-wrap { height: 100%; }
.popular-card-wrap > .popular-card,
.popular-gallery > .popular-card { min-height: 116px; height: 116px; }
.popular-card__preview[data-preview="QR"] { height: 72px; padding: 6px 8px; }
.format-advanced-link {
  display: block;
  margin-top: 8px;
  color: var(--site-primary-strong);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}
.format-advanced-link[hidden] { display: none; }
#qr-preview.bwip-preview {
  width: min(100%, 680px);
  max-width: 100%;
  min-height: 170px;
  aspect-ratio: auto;
}
#qr-preview.bwip-preview svg {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 320px;
  margin: auto;
}
#qr-preview.bwip-preview::before { display: none; padding: 0; }
#qr-preview.bwip-preview.active svg { position: static; inset: auto; }

@media (max-width: 900px) {
  .site-header__inner { gap: 10px; }
  .site-brand > span { display: none; }
  .site-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-header .auth-controls { display: none; }
}
@media (max-width: 620px) {
  .site-header { width: calc(100% - 16px); margin-top: 8px; border-radius: 16px; }
  .site-header__inner { grid-template-columns: minmax(0, 1fr) max-content; min-height: 56px; padding: 6px 7px; }
  .site-brand { display: none; }
  .site-nav { justify-content: center; gap: 2px; }
  .site-nav__link { min-height: 40px; padding: 7px 6px; font-size: 11px; }
  .site-header .lang-current { min-width: 48px; padding-inline: 8px; }
  .site-header .lang-current > span:last-child { display: none; }
  .site-header .theme-toggle { display: none; }
  .animated-header { padding: 26px 0 22px; }
  .popular-card-wrap > .popular-card,
  .popular-gallery > .popular-card { min-height: 100px; height: 100px; }
  .popular-card__preview[data-preview="QR"] { height: 60px; }
}
@media (max-width: 380px) {
  .site-nav__link { padding-inline: 6px; font-size: 11px; }
}

[data-theme="dark"] .bulk-page :is(.two-d-preview-panel, .gs1-preview-panel, .two-d-form, .gs1-form, .bulk-table td, .bulk-table input, .bulk-table select, .bulk-output input, .bulk-output select, .two-d-field textarea, .two-d-field select, .two-d-field input, .gs1-field input, .gs1-field select) {
  border-color: var(--site-border);
  background: var(--site-surface-solid);
  color: var(--site-text);
}
[data-theme="dark"] .bulk-page :is(.two-d-format-options, .two-d-modes, .gs1-modes, .gs1-output code) { border-color: var(--site-border); background: #242a3a; color: var(--site-text); }
[data-theme="dark"] .bulk-page :is(.two-d-note, .bulk-mode, .column-mapping) { border-color: var(--site-primary); background: var(--site-primary-soft); color: var(--site-text); }
[data-theme="dark"] .bulk-page :is(.two-d-preview-wrap, .gs1-preview-wrap) { background: #fff; }
[data-theme="dark"] .decoder-main .camera-btn,
[data-theme="dark"] .bulk-page .btn-primary { border-color: #5b36f2; background: #5b36f2; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .site-header *, .site-header *::before, .site-header *::after { scroll-behavior: auto !important; transition: none !important; }
  .site-nav__link:hover { transform: none; }
}
