/* =====================================================================
   QRVerse — Design System
   A handcrafted, tool-first UI. Light canvas, one dominant indigo,
   sharp accent chips. No gradient-soup, no glassmorphism.
   ===================================================================== */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* Brand palette (from brief) */
  --c-primary: #5b5cf0;
  --c-primary-600: #4a4bd6;
  --c-primary-700: #3e3fb8;
  --c-primary-tint: #ececfe;
  --c-primary-tint-2: #f5f5ff;

  --c-secondary: #ff6b6b;
  --c-secondary-tint: #ffecec;
  --c-accent: #00c896;
  --c-accent-tint: #e0f8f1;
  --c-highlight: #ffb800;
  --c-highlight-tint: #fff4d6;
  --c-info: #4da6ff;
  --c-info-tint: #e4f1ff;

  /* Neutrals — warm, not pure grey, so it reads "human" */
  --c-ink: #14151a;
  --c-ink-2: #3a3d47;
  --c-muted: #6b6f7b;
  --c-faint: #9ca0ac;
  --c-line: #e7e8ee;
  --c-line-2: #f0f1f5;
  --c-surface: #ffffff;
  --c-canvas: #f7f7fb;
  --c-canvas-2: #fbfbfd;

  /* Semantic */
  --c-success: #00a37a;
  --c-success-bg: #e0f8f1;
  --c-warning: #c98800;
  --c-warning-bg: #fff4d6;
  --c-danger: #e03e3e;
  --c-danger-bg: #ffecec;

  /* Typography */
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Type scale (1.2 minor third on a 16px base) */
  --t-xs: 0.75rem; /* 12 */
  --t-sm: 0.8125rem; /* 13 */
  --t-base: 0.9375rem; /* 15 */
  --t-md: 1.0625rem; /* 17 */
  --t-lg: 1.3125rem; /* 21 */
  --t-xl: 1.625rem; /* 26 */
  --t-2xl: 2.125rem; /* 34 */
  --t-3xl: 2.75rem; /* 44 */

  /* 8px spacing system */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Elevation — soft, layered, never harsh */
  --sh-1: 0 1px 2px rgba(20, 21, 26, 0.05), 0 1px 1px rgba(20, 21, 26, 0.04);
  --sh-2: 0 2px 4px rgba(20, 21, 26, 0.05), 0 4px 12px rgba(20, 21, 26, 0.06);
  --sh-3: 0 8px 24px rgba(20, 21, 26, 0.08), 0 2px 6px rgba(20, 21, 26, 0.05);
  --sh-pop: 0 16px 48px rgba(31, 32, 80, 0.16);
  --ring: 0 0 0 4px rgba(91, 92, 240, 0.16);

  --maxw: 1200px;
  --header-h: 64px;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 2. Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--c-ink);
  background: var(--c-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--c-ink);
}
p {
  margin: 0;
}
a {
  color: var(--c-primary-600);
  text-decoration: none;
}
a:hover {
  color: var(--c-primary-700);
}
img,
svg {
  vertical-align: middle;
}
button {
  font-family: inherit;
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

.container-x {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--s-4);
}
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -60px;
  z-index: 1100;
  background: var(--c-ink);
  color: #fff;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  transition: top var(--transition);
}
.skip-link:focus {
  top: var(--s-2);
  color: #fff;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--c-line);
}
.site-header .container-x {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--t-md);
  letter-spacing: -0.03em;
  color: var(--c-ink);
}
.brand:hover {
  color: var(--c-ink);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--c-primary);
  box-shadow:
    0 4px 10px rgba(91, 92, 240, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.brand-mark svg {
  width: 20px;
  height: 20px;
}
.brand b {
  color: var(--c-primary);
}
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}
.header-nav a.navlink {
  color: var(--c-ink-2);
  font-weight: 600;
  font-size: var(--t-sm);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
}
.header-nav a.navlink:hover {
  background: var(--c-line-2);
  color: var(--c-ink);
}
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--c-success);
  background: var(--c-success-bg);
  padding: 5px 10px;
  border-radius: var(--r-pill);
}
.header-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-success);
}

/* ---------- 4. Buttons ---------- */
.btn-x {
  --bg: var(--c-primary);
  --fg: #fff;
  --bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-weight: 650;
  font-size: var(--t-base);
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--bd);
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  box-shadow: var(--sh-1);
  white-space: nowrap;
  user-select: none;
}
.btn-x:hover {
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
  color: var(--fg);
}
.btn-x:active {
  transform: translateY(0);
  box-shadow: var(--sh-1);
}
.btn-x:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-x svg {
  width: 18px;
  height: 18px;
}
.btn-primary-x {
  --bg: var(--c-primary);
  --fg: #fff;
}
.btn-primary-x:hover {
  --bg: var(--c-primary-600);
}
.btn-ghost-x {
  --bg: transparent;
  --fg: var(--c-ink-2);
  --bd: var(--c-line);
  box-shadow: none;
}
.btn-ghost-x:hover {
  --bg: var(--c-line-2);
  --fg: var(--c-ink);
  box-shadow: none;
}
.btn-soft-x {
  --bg: var(--c-primary-tint);
  --fg: var(--c-primary-700);
  box-shadow: none;
}
.btn-soft-x:hover {
  --bg: #e0e0fe;
}
.btn-accent-x {
  --bg: var(--c-accent);
  --fg: #053d2f;
}
.btn-block-x {
  width: 100%;
}
.btn-sm-x {
  padding: 8px 12px;
  font-size: var(--t-sm);
  border-radius: var(--r-sm);
}
.btn-icon-x {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--c-surface);
  border: 1.5px solid var(--c-line);
  color: var(--c-ink-2);
  box-shadow: var(--sh-1);
}
.btn-icon-x:hover {
  background: var(--c-line-2);
  color: var(--c-ink);
}

/* ---------- 5. Cards & Surfaces ---------- */
.card-x {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
}
.panel-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-line-2);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.panel-head h2,
.panel-head h3 {
  font-size: var(--t-md);
}
.panel-head .eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-faint);
}
.panel-body {
  padding: var(--s-5);
}

/* ---------- 6. Forms ---------- */
.field {
  margin-bottom: var(--s-4);
}
.field:last-child {
  margin-bottom: 0;
}
.label-x {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--c-ink-2);
  margin-bottom: var(--s-2);
}
.label-x .hint {
  font-weight: 500;
  color: var(--c-faint);
  font-size: var(--t-xs);
}
.input-x,
.textarea-x,
.select-x {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--t-base);
  color: var(--c-ink);
  background: var(--c-canvas-2);
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 11px 14px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}
.input-x::placeholder,
.textarea-x::placeholder {
  color: var(--c-faint);
}
.input-x:focus,
.textarea-x:focus,
.select-x:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: var(--ring);
}
.textarea-x {
  resize: vertical;
  min-height: 92px;
  line-height: 1.5;
}
.select-x {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6F7B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
.input-group-x {
  display: flex;
}
.input-group-x .input-x {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group-x .addon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-muted);
  background: var(--c-line-2);
  border: 1.5px solid var(--c-line);
  border-left: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.field-error .input-x,
.field-error .textarea-x,
.field-error .select-x {
  border-color: var(--c-danger);
  background: var(--c-danger-bg);
}
.error-msg {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--c-danger);
  font-size: var(--t-xs);
  font-weight: 600;
  margin-top: 6px;
}
.field-error .error-msg {
  display: flex;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* Color input */
.color-field {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--c-canvas-2);
  border: 1.5px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 6px 10px 6px 6px;
}
.color-field input[type="color"] {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 0;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.color-field input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--c-line);
  border-radius: 7px;
}
.color-field .hexval {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--c-ink-2);
  text-transform: uppercase;
}

/* Range */
.range-x {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--c-line);
  outline: none;
}
.range-x::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: pointer;
  box-shadow: var(--sh-2);
  border: 3px solid #fff;
}
.range-x::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: var(--sh-2);
}

/* Toggle */
.toggle-x {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
  user-select: none;
}
.toggle-x input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--c-line);
  position: relative;
  transition: background var(--transition);
  flex: none;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--transition);
}
.toggle-x input:checked + .toggle-track {
  background: var(--c-primary);
}
.toggle-x input:checked + .toggle-track::after {
  transform: translateX(18px);
}
.toggle-x input:focus-visible + .toggle-track {
  box-shadow: var(--ring);
}

/* ---------- 7. Segmented / Choice chips ---------- */
.seg {
  display: inline-flex;
  background: var(--c-line-2);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
}
.seg button {
  border: none;
  background: transparent;
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--c-muted);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
}
.seg button[aria-selected="true"] {
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: var(--sh-1);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: var(--s-2);
}
.choice {
  border: 1.5px solid var(--c-line);
  background: var(--c-canvas-2);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-ink-2);
}
.choice:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-tint-2);
}
.choice[aria-pressed="true"] {
  border-color: var(--c-primary);
  background: var(--c-primary-tint);
  color: var(--c-primary-700);
  box-shadow: var(--ring);
}
.choice .swatch {
  width: 34px;
  height: 34px;
}

/* ---------- 8. QR type picker ---------- */
.typebar {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  padding-bottom: var(--s-2);
  padding-top: var(--s-2);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.typebar::-webkit-scrollbar {
  height: 6px;
}
.typebar::-webkit-scrollbar-thumb {
  background: var(--c-line);
  border-radius: var(--r-pill);
}
.type-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  border: 1.5px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink-2);
  border-radius: var(--r-pill);
  padding: 8px 14px 8px 8px;
  font-size: var(--t-sm);
  font-weight: 650;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.type-chip:hover {
  border-color: var(--c-faint);
  transform: translateY(-1px);
}
.type-chip .ic {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.type-chip .ic svg {
  width: 16px;
  height: 16px;
}
.type-chip[aria-pressed="true"] {
  border-color: var(--c-ink);
  color: var(--c-ink);
  background: var(--c-surface);
  box-shadow: var(--sh-2);
}

/* Category grid for landing */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s-3);
}
.cat-card {
  text-align: left;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
  border-color: transparent;
}
.cat-card .ic {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: #fff;
}
.cat-card .ic svg {
  width: 22px;
  height: 22px;
}
.cat-card .name {
  font-weight: 700;
  font-size: var(--t-base);
  color: var(--c-ink);
}
.cat-card .desc {
  font-size: var(--t-xs);
  color: var(--c-muted);
}

/* ---------- 9. The studio layout ---------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: var(--s-5);
  align-items: start;
}
@media (max-width: 920px) {
  .studio {
    grid-template-columns: 1fr;
  }
}

.preview-sticky {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}
.preview-stage {
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 1px 1px, var(--c-line) 1px, transparent 0) 0 0 /
      18px 18px,
    var(--c-canvas-2);
  border: 1px solid var(--c-line);
  padding: var(--s-6);
  display: grid;
  place-items: center;
  min-height: 300px;
}
.qr-frame {
  position: relative;
  display: inline-block;
  padding: 0;
  border-radius: var(--r-md);
}
.qr-mount {
  display: inline-block;
  line-height: 0;
}
.qr-mount canvas,
.qr-mount svg {
  display: block;
  border-radius: 4px;
  max-width: 100%;
  height: auto;
}

/* Frame decorations */
.frame-wrap {
  display: inline-block;
}
.frame-wrap.has-frame {
  padding: 14px 14px 0;
  border: 3px solid var(--c-ink);
  border-radius: var(--r-md);
  background: #fff;
}
.frame-wrap .frame-label {
  display: none;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  background: var(--c-ink);
  color: #fff;
  margin: 12px -14px 0;
  padding: 8px;
  border-radius: 0 0 9px 9px;
  font-size: var(--t-base);
  letter-spacing: 0.02em;
}
.frame-wrap.has-frame .frame-label {
  display: block;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-4);
  flex-wrap: wrap;
}
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-xs);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--r-pill);
}
.score-pill .gauge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.score-good {
  background: var(--c-success-bg);
  color: var(--c-success);
}
.score-good .gauge {
  background: var(--c-success);
}
.score-warn {
  background: var(--c-warning-bg);
  color: var(--c-warning);
}
.score-warn .gauge {
  background: var(--c-warning);
}
.score-bad {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}
.score-bad .gauge {
  background: var(--c-danger);
}

.tool-row {
  display: flex;
  gap: var(--s-2);
}

/* ---------- 10. Accordion (customization sections) ---------- */
.acc-item {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
  overflow: hidden;
  background: var(--c-surface);
}
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-base);
  color: var(--c-ink);
  text-align: left;
}
.acc-head:hover {
  background: var(--c-canvas-2);
}
.acc-head .chev {
  margin-left: auto;
  transition: transform var(--transition);
  color: var(--c-faint);
}

.chev {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}


/* Icon buttons */
.btn-icon-x {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG icon size */
.btn-icon-x svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

/* Optional: larger icons */
#btnCopy svg,
#btnShare svg,
#btnFullscreen svg {
    width: 20px;
    height: 20px;
}

.acc-head[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}
.acc-head .ic-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.acc-head .ic-dot svg {
  width: 16px;
  height: 16px;
}
.acc-panel {
  display: none;
  padding: var(--s-2) var(--s-4) var(--s-4);
  border-top: 1px solid var(--c-line-2);
}
.acc-item.open .acc-panel {
  display: block;
}

/* ---------- 11. Tabs (mode switch) ---------- */
.mode-tabs {
  display: inline-flex;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  padding: 5px;
  box-shadow: var(--sh-1);
  gap: 4px;
}
.mode-tabs button {
  border: none;
  background: transparent;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-weight: 650;
  font-size: var(--t-sm);
  color: var(--c-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.mode-tabs button svg {
  width: 17px;
  height: 17px;
}
.mode-tabs button[aria-selected="true"] {
  background: var(--c-ink);
  color: #fff;
}

/* ---------- 12. Toasts ---------- */
.toast-stack {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-4);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-width: calc(100vw - 32px);
}
.toast-x {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  background: var(--c-ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-pop);
  min-width: 240px;
  max-width: 360px;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  font-size: var(--t-sm);
  font-weight: 550;
}
.toast-x .tic {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.toast-x.success .tic {
  background: var(--c-accent);
  color: #053d2f;
}
.toast-x.error .tic {
  background: var(--c-secondary);
  color: #5a1010;
}
.toast-x.info .tic {
  background: var(--c-info);
  color: #0a2540;
}
.toast-x .tx {
  flex: 1;
  padding-top: 1px;
}
.toast-x.hide {
  animation: toastOut 0.25s forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ---------- 13. Modal ---------- */
.modal-x {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}
.modal-x.open {
  display: flex;
}
.modal-x .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 21, 26, 0.55);
  animation: fade 0.2s;
}
.modal-card {
  position: relative;
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-pop);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: pop 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.modal-card.lg {
  max-width: 760px;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-line-2);
  position: sticky;
  top: 0;
  background: var(--c-surface);
}
.modal-head h3 {
  font-size: var(--t-md);
}
.modal-body {
  padding: var(--s-5);
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Fullscreen preview */
.fs-stage {
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: var(--c-canvas);
  border-radius: var(--r-lg);
}

/* ---------- 14. Tooltip ---------- */
.tip {
  position: relative;
}
.tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--c-ink);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  box-shadow: var(--sh-2);
  z-index: 50;
}
.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 15. History list ---------- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.history-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--transition);
  background: var(--c-surface);
}
.history-item:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-tint-2);
}
.history-item .thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-line);
  background: #fff;
  flex: none;
  padding: 3px;
}
.history-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.history-item .meta {
  min-width: 0;
  flex: 1;
}
.history-item .meta .t {
  font-weight: 650;
  font-size: var(--t-sm);
  color: var(--c-ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.history-item .meta .d {
  font-size: var(--t-xs);
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-pill);
}

/* ---------- 16. Empty / loading states ---------- */
.empty {
  text-align: center;
  padding: var(--s-6) var(--s-4);
  color: var(--c-muted);
}
.empty .ico {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--s-3);
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: var(--c-line-2);
  color: var(--c-faint);
}
.empty h4 {
  font-size: var(--t-base);
  color: var(--c-ink-2);
  margin-bottom: 4px;
}
.empty p {
  font-size: var(--t-sm);
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--c-line);
  border-top-color: var(--c-primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--c-line-2) 25%,
    var(--c-line) 37%,
    var(--c-line-2) 63%
  );
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes sk {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* Drag/drop */
.dropzone {
  border: 2px dashed var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  text-align: center;
  color: var(--c-muted);
  transition: var(--transition);
  cursor: pointer;
  background: var(--c-canvas-2);
}
.dropzone:hover,
.dropzone.drag {
  border-color: var(--c-primary);
  background: var(--c-primary-tint-2);
  color: var(--c-primary-700);
}
.dropzone svg {
  width: 34px;
  height: 34px;
  margin-bottom: var(--s-2);
}

/* ---------- 17. Sections / landing ---------- */
.section {
  padding: var(--s-9) 0;
}
.section-tight {
  padding: var(--s-7) 0;
}
.eyebrow {
  display: inline-block;
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-primary);
  margin-bottom: var(--s-3);
}
.section-title {
  font-size: var(--t-2xl);
  max-width: 22ch;
}
.section-sub {
  color: var(--c-muted);
  font-size: var(--t-md);
  max-width: 56ch;
  margin-top: var(--s-3);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 800px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}
.feature {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: var(--transition);
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
}
.feature .ic {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-3);
  color: #fff;
}
.feature h3 {
  font-size: var(--t-md);
  margin-bottom: var(--s-2);
}
.feature p {
  color: var(--c-muted);
  font-size: var(--t-sm);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
  counter-reset: step;
}
@media (max-width: 800px) {
  .steps {
    grid-template-columns: 1fr;
  }
}
.step {
  position: relative;
  padding-left: 56px;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--c-primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: var(--t-md);
  box-shadow: 0 6px 14px rgba(91, 92, 240, 0.35);
}
.step h3 {
  font-size: var(--t-base);
  margin-bottom: 6px;
}
.step p {
  color: var(--c-muted);
  font-size: var(--t-sm);
}

/* Template gallery */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-4);
}
.tpl {
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  padding: var(--s-4);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.tpl:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-3);
}
.tpl .swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-3);
}
.tpl .name {
  font-weight: 700;
  font-size: var(--t-sm);
}
.tpl .desc {
  font-size: var(--t-xs);
  color: var(--c-muted);
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--c-line);
}
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: var(--s-4) 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-md);
  color: var(--c-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.faq-q .chev {
  margin-left: auto;
  color: var(--c-faint);
  transition: transform var(--transition);
}
.faq-q[aria-expanded="true"] .chev {
  transform: rotate(45deg);
  color: var(--c-primary);
}
.faq-a {
  display: none;
  padding: 0 0 var(--s-4);
  color: var(--c-muted);
  font-size: var(--t-base);
  max-width: 70ch;
}
.faq-item.open .faq-a {
  display: block;
}

/* Footer */
.site-footer {
  background: var(--c-ink);
  color: #c8cad2;
  padding: var(--s-8) 0 var(--s-6);
  margin-top: var(--s-8);
}
.site-footer a {
  color: #c8cad2;
}
.site-footer a:hover {
  color: #fff;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--s-6);
}
@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.footer-col h4 {
  color: #fff;
  font-size: var(--t-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--s-3);
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--t-sm);
}
.footer-bottom {
  border-top: 1px solid #2a2c34;
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: var(--t-sm);
  color: #9094a0;
}

/* ---------- 18. Scanner ---------- */
.scan-stage {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0b0c10;
  aspect-ratio: 4/3;
  display: grid;
  place-items: center;
}
.scan-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-reticle {
  position: absolute;
  inset: 16%;
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.35);
}
.scan-reticle::before,
.scan-reticle::after,
.scan-reticle .c1,
.scan-reticle .c2 {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid var(--c-accent);
}
.scan-reticle::before {
  top: -3px;
  left: -3px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 8px 0 0 0;
}
.scan-reticle::after {
  top: -3px;
  right: -3px;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 8px 0 0;
}
.scan-reticle .c1 {
  bottom: -3px;
  left: -3px;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 8px;
}
.scan-reticle .c2 {
  bottom: -3px;
  right: -3px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 8px 0;
}
.scan-result {
  margin-top: var(--s-4);
}
.result-box {
  background: var(--c-canvas-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--c-ink-2);
}

/* ---------- 19. Utilities ---------- */
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: var(--s-2);
}
.gap-3 {
  gap: var(--s-3);
}
.gap-4 {
  gap: var(--s-4);
}
.mt-2 {
  margin-top: var(--s-2);
}
.mt-3 {
  margin-top: var(--s-3);
}
.mt-4 {
  margin-top: var(--s-4);
}
.mt-5 {
  margin-top: var(--s-5);
}
.mt-6 {
  margin-top: var(--s-6);
}
.mb-2 {
  margin-bottom: var(--s-2);
}
.mb-3 {
  margin-bottom: var(--s-3);
}
.mb-4 {
  margin-bottom: var(--s-4);
}
.mb-5 {
  margin-bottom: var(--s-5);
}
.text-muted-x {
  color: var(--c-muted);
}
.text-sm {
  font-size: var(--t-sm);
}
.text-xs {
  font-size: var(--t-xs);
}
.fw-7 {
  font-weight: 700;
}
.wrap {
  flex-wrap: wrap;
}
.hide {
  display: none !important;
}
.grow {
  flex: 1;
}
.divider {
  height: 1px;
  background: var(--c-line);
  margin: var(--s-4) 0;
}

/* staggered entrance for above-the-fold */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.reveal.d1 {
  animation-delay: 0.05s;
}
.reveal.d2 {
  animation-delay: 0.12s;
}
.reveal.d3 {
  animation-delay: 0.2s;
}
@keyframes reveal {
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 20. Mobile bottom action bar ---------- */
.mobile-actions {
  display: none;
}
@media (max-width: 920px) {
  .preview-sticky {
    position: static;
  }
  .mobile-actions {
    display: flex;
    gap: var(--s-2);
    position: sticky;
    bottom: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--c-line);
    padding: var(--s-3) var(--s-4);
    margin: var(--s-5) calc(-1 * var(--s-4)) 0;
  }
  .mobile-actions .btn-x {
    flex: 1;
  }
  .section {
    padding: var(--s-7) 0;
  }
  .section-title {
    font-size: var(--t-xl);
  }
}
@media (max-width: 600px) {
  .header-nav .navlink.hide-sm {
    display: none;
  }
  .container-x {
    padding-inline: var(--s-3);
  }
  .panel-body {
    padding: var(--s-4);
  }
  .preview-stage {
    padding: var(--s-4);
  }
}
