/* ==========================================================================
   QR Open Studio v2.1 — International SaaS Dual Theme (Light + Dark)
   - Zero-FOUC Auto System Theme via prefers-color-scheme (explicit override via [data-theme])
   - Desktop Studio: Fixed 388px Right Sticky Preview (Zero Button Wrap/Overflow)
   - Mobile App (<=960px): 1-Row 54px Topbar + QR-First Top Preview + Fixed Bottom Tab Bar
   ========================================================================== */

:root {
  /* Clean SaaS Light Mode (Apple / Stripe / Canva Precision) */
  --bg: #f6f8fa;
  --bg-subtle: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #e2e8f0;
  --input-bg: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;

  /* Unified Signature Emerald Accent */
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --accent-border: rgba(5, 150, 105, 0.34);
  --accent-ink: #ffffff;

  /* Semantic Status (Only for status meters, warnings & errors) */
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.11);
  --amber-border: rgba(217, 119, 6, 0.32);
  --sky: #0284c7;
  --sky-soft: rgba(2, 132, 199, 0.1);
  --sky-border: rgba(2, 132, 199, 0.32);
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.1);
  --rose-border: rgba(225, 29, 72, 0.32);

  /* High-Contrast Standee Button */
  --standee-bg: #0f172a;
  --standee-bg-hover: #1e293b;
  --standee-border: #0f172a;
  --standee-text: #ffffff;
  --standee-ico: #34d399;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, 0.18);
  --checker-a: #f1f5f9;
  --checker-b: #e2e8f0;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --nav-bar-bg: rgba(255, 255, 255, 0.94);
  --toast-bg: #0f172a;
  --toast-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --bg-subtle: #111114;
    --surface: #111114;
    --surface-2: #18181b;
    --surface-hover: #27272a;
    --input-bg: #0c0c0f;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #fafafa;
    --text-2: #d4d4d8;
    --muted: #a1a1aa;

    --accent: #10b981;
    --accent-hover: #059669;
    --accent-soft: rgba(16, 185, 129, 0.14);
    --accent-border: rgba(16, 185, 129, 0.38);
    --accent-ink: #022c22;

    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.14);
    --amber-border: rgba(245, 158, 11, 0.36);
    --sky: #38bdf8;
    --sky-soft: rgba(56, 189, 248, 0.13);
    --sky-border: rgba(56, 189, 248, 0.34);
    --rose: #fb7185;
    --rose-soft: rgba(251, 113, 133, 0.14);
    --rose-border: rgba(251, 113, 133, 0.36);

    --standee-bg: #18181b;
    --standee-bg-hover: #27272a;
    --standee-border: rgba(16, 185, 129, 0.42);
    --standee-text: #fafafa;
    --standee-ico: #34d399;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 14px 38px -10px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.72);
    --checker-a: #18181b;
    --checker-b: #202026;
    --topbar-bg: rgba(17, 17, 20, 0.86);
    --nav-bar-bg: rgba(17, 17, 20, 0.94);
    --toast-bg: #27272a;
    --toast-text: #fafafa;
  }
}

html[data-theme="dark"] {
  --bg: #09090b;
  --bg-subtle: #111114;
  --surface: #111114;
  --surface-2: #18181b;
  --surface-hover: #27272a;
  --input-bg: #0c0c0f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-border: rgba(16, 185, 129, 0.38);
  --accent-ink: #022c22;

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-border: rgba(245, 158, 11, 0.36);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.13);
  --sky-border: rgba(56, 189, 248, 0.34);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --rose-border: rgba(251, 113, 133, 0.36);

  --standee-bg: #18181b;
  --standee-bg-hover: #27272a;
  --standee-border: rgba(16, 185, 129, 0.42);
  --standee-text: #fafafa;
  --standee-ico: #34d399;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 14px 38px -10px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.72);
  --checker-a: #18181b;
  --checker-b: #202026;
  --topbar-bg: rgba(17, 17, 20, 0.86);
  --nav-bar-bg: rgba(17, 17, 20, 0.94);
  --toast-bg: #27272a;
  --toast-text: #fafafa;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.hidden { display: none !important; }
.print-only { display: none; }

/* SHELL */
.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 56px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== HEADER (DESKTOP 60px · MOBILE 54px) ==================== */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 60px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--topbar-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  flex-shrink: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nav-tab.active svg { color: var(--accent); }

.header-utils {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Desktop Language Pill */
.lang-switch {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.lang-btn {
  height: 28px;
  min-width: 31px;
  padding: 0 7px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.14s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Mobile Compact Language Popover */
.lang-dd { position: relative; display: none; }
.lang-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.lang-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 146px;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 900;
}
.lang-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}
.lang-dd-item:hover { background: var(--surface-2); color: var(--text); }
.lang-dd-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 750; }

.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent-border); }

/* ==================== COMPACT HERO (ABOVE THE FOLD) ==================== */
.hero-strip {
  text-align: center;
  margin: 18px auto 18px;
  max-width: 720px;
}
.hero-strip h1 {
  margin: 0 0 6px;
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.22;
}
.hero-strip p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* ==================== MAIN WORKSPACE GRIDS ==================== */
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 388px;
  gap: 22px;
  align-items: start;
}
.scan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.view-pane { min-width: 0; max-width: 100%; }

/* ==================== STEP 1: QR TYPE SELECTOR (9 TYPES WITH SVG ICONS) ==================== */
.type-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}
.type-pill {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.14s;
}
.type-pill svg { flex-shrink: 0; opacity: 0.78; }
.type-pill:hover { border-color: var(--border-strong); color: var(--text); }
.type-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 750;
}
.type-pill.active svg { opacity: 1; }
.type-pill.accent-magic { border-color: var(--accent-border); color: var(--accent); }
.type-pill.accent-lock:not(.active) { border-color: var(--amber-border); }
.type-pill.accent-lock:not(.active) svg { color: var(--amber); opacity: 1; }

/* FORMS */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.inp, select.inp, textarea.inp {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.inp::placeholder { color: var(--muted); opacity: 0.8; }
.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mono-big { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.4px; }
.mono-sm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* ==================== STEP 2: 3 CLEAN CUSTOMIZATION TABS ==================== */
.cust-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.cust-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s;
}
.cust-tab:hover { color: var(--text); }
.cust-tab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.cust-tab.active svg { color: var(--accent); }
.cust-pane { display: flex; flex-direction: column; gap: 16px; }

/* Visual Style Cards (Dot / Eye / Frame with Mini SVG Previews) */
.vis-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.vis-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vis-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s;
}
.vis-card svg { color: var(--text-2); transition: color 0.14s; flex-shrink: 0; }
.vis-card:hover { border-color: var(--border-strong); color: var(--text); }
.vis-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 750;
}
.vis-card.active svg { color: var(--accent); }

/* Standard Chips (ECC, Standee Theme/Size) */
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.chip-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.preset-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 35px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s;
}
.preset-chip svg { flex-shrink: 0; opacity: 0.78; }
.preset-chip:hover { border-color: var(--border-strong); color: var(--text); }
.preset-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.preset-chip.active svg { opacity: 1; }

/* URL Purpose Quick Bar inside URL Tab (4 compact chips: Website / Google Maps / Fanpage / Menu) */
.url-mode-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.url-mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s;
}
.url-mode-chip svg { flex-shrink: 0; opacity: 0.78; }
.url-mode-chip:hover { border-color: var(--border-strong); color: var(--text); }
.url-mode-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 750;
}
.url-mode-chip.active svg { opacity: 1; }
.url-mode-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.chip {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 750;
}

/* Color Swatches & Custom Styled Color Pickers (ZERO ugly OS square box!) */
.palette-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}
.swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 40px;
  border-radius: 11px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.swatch:hover { transform: translateY(-1px); }
.swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: scale(1.05);
}

.color-pickers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.color-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  cursor: pointer;
  transition: border-color 0.14s;
}
.color-pill:hover { border-color: var(--accent); }
.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.color-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.color-lbl { font-size: 11px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 750;
  color: var(--text);
  text-transform: uppercase;
}
.color-pill input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: 0;
  padding: 0;
}

/* Center Badge 4x2 Balanced Grid (NO orphan vCard!) */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.badge-chip {
  height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s;
}
.badge-chip:hover { border-color: var(--border-strong); color: var(--text); }
.badge-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 750;
}

.logo-upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px dashed var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-mini:hover { filter: brightness(1.06); }
.btn-mini.ghost {
  border-style: solid;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--muted);
}
.btn-mini.ghost:hover { color: var(--rose); border-color: var(--rose-border); }

/* ==================== RIGHT STICKY PREVIEW PANEL (FIXED 388px ON PC) ==================== */
.preview-panel {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
}
.preview-mat {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-frame {
  width: 100%;
  max-width: 268px;
  border-radius: 16px;
  background: #ffffff;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
}
.preview-frame canvas { width: 100%; height: auto; border-radius: 8px; display: block; }

.meter-stack { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.meter-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  text-align: center;
  line-height: 1.3;
}
.meter-pill.ok { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.meter-pill.good { background: var(--sky-soft); border-color: var(--sky-border); color: var(--sky); }
.meter-pill.warn { background: var(--rose-soft); border-color: var(--rose-border); color: var(--rose); }
.meter-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ACTION BUTTONS — STRICTLY SINGLE-LINE, ZERO OVERFLOW */
.preview-actions { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.action-subrow-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, filter 0.15s;
}
.btn svg { flex-shrink: 0; }
.btn.sm { height: 40px; font-size: 12.5px; font-weight: 700; padding: 0 10px; gap: 5px; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-fit { width: auto; }

.btn-primary, .btn-emerald {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover, .btn-emerald:hover { background: var(--accent-hover); }

.btn-gold {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-gold:hover { background: var(--accent-hover); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-hover); }

.btn-standee {
  height: 46px;
  border-radius: 12px;
  background: var(--standee-bg);
  border: 1.5px solid var(--standee-border);
  color: var(--standee-text);
  font-size: 13.5px;
  font-weight: 750;
}
.btn-standee svg { color: var(--standee-ico); }
.btn-standee:hover { background: var(--standee-bg-hover); }

/* ENCRYPTED & REDESIGN SUB-BOXES */
.info-callout {
  padding: 10px 13px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--sky-soft);
  border: 1px solid var(--sky-border);
  color: var(--text-2);
}
.info-callout.emerald { background: var(--accent-soft); border-color: var(--accent-border); }
.strength-bar { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.strength-seg { flex: 1; height: 5px; border-radius: 99px; background: var(--border-strong); }
.strength-seg.s1 { background: var(--rose); }
.strength-seg.s2 { background: var(--amber); }
.strength-seg.s3 { background: var(--sky); }
.strength-seg.s4 { background: var(--accent); }

.rd-box {
  padding: 14px;
  border-radius: 13px;
  border: 1.5px dashed var(--accent-border);
  background: var(--accent-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rd-meta {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.mini-tag.warn { background: var(--rose-soft); color: var(--rose); border-color: var(--rose-border); }
.mini-tag.gold { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.toggle-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ==================== HISTORY, TRUST, FAQ ==================== */
.history-panel { margin-top: 18px; padding: 14px 18px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hist-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.hist-grid { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.hist-item {
  flex: 0 0 auto;
  max-width: 200px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  color: var(--text);
}
.hist-item:hover { border-color: var(--accent-border); }
.hist-item strong { font-size: 11px; color: var(--accent); }
.hist-item span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.trust-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.trust-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.trust-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.trust-card h3 { margin: 0; font-size: 13.5px; font-weight: 800; letter-spacing: -0.01em; }
.trust-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.faq-panel { margin-top: 18px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.faq-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.faq-item summary {
  padding: 13px 15px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 17px; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin: 0; padding: 0 15px 13px; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ==================== SCANNER & BATCH ==================== */
.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.sec-title svg { color: var(--accent); flex-shrink: 0; }
.muted { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.quick-code-row { display: flex; gap: 8px; }
.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.drop-sub { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.cam-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #09090b;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.cam-stage video { width: 100%; height: 100%; object-fit: cover; }
.cam-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #a1a1aa;
  font-size: 13px;
  text-align: center;
  padding: 16px;
}
.cam-actions { display: flex; gap: 8px; }
.scan-result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--accent-border);
  font-size: 13px;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.safety-banner {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.safety-banner.safe { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.safety-banner.caution { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.safety-banner.danger { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--rose-border); }
.decoded-pre {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--text);
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
}
.kv-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}
.kv-row span { color: var(--muted); }
.kv-row strong { color: var(--text); text-align: right; }
.res-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.batch-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.batch-card {
  background: #ffffff;
  color: #0f172a;
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow-sm);
}
.batch-card canvas { width: 138px; height: 138px; display: block; }
.batch-card strong { font-size: 12.5px; word-break: break-word; }

/* ==================== GATE /s/:code ==================== */
.gate-card {
  max-width: 440px;
  margin: 28px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}
.gate-icon.unlocked { box-shadow: 0 0 28px var(--accent-soft); }
.gate-card h1 { margin: 0 0 6px; font-size: 20px; font-weight: 850; letter-spacing: -0.02em; }
.gate-sub { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.code-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 16px;
}
.pin4-grid { display: flex; justify-content: center; gap: 11px; margin: 8px 0 14px; }
.pin4-box {
  width: 56px;
  height: 62px;
  border-radius: 14px;
  border: 1.5px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  outline: none;
}
.pin4-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.gate-nsfw-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.34);
  color: #e11d48;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  margin: 0 auto 12px;
}
[data-theme="dark"] .gate-nsfw-badge {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(251, 113, 133, 0.42);
  color: #fda4af;
}
.btn-nsfw-proceed {
  background: linear-gradient(135deg, #e11d48, #be123c) !important;
  color: #fff !important;
  border-color: rgba(251, 113, 133, 0.45) !important;
}
.gate-self-qr {
  margin-top: 18px;
  padding: 14px 12px 12px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.gate-self-qr-head {
  font-size: 11.5px;
  font-weight: 750;
  color: var(--muted);
  margin-bottom: 10px;
}
.gate-self-qr-frame {
  display: inline-flex;
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.gate-self-qr-frame canvas {
  display: block;
  width: 168px;
  height: 168px;
}
.gate-self-qr-url {
  margin-top: 9px;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--text);
  word-break: break-all;
  opacity: 0.85;
}
.gate-self-qr-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.gate-self-qr-actions .btn-sm {
  min-width: 0;
  min-height: 44px;
  font-size: 12px;
  padding: 8px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.err-msg { min-height: 18px; font-size: 12.5px; color: var(--rose); font-weight: 600; margin: 6px 0 8px; }
.btn-link {
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}
.btn-link.compact { margin-top: 0; font-size: 12px; color: var(--accent); }
.btn-link:hover { color: var(--text); }

/* ==================== MODALS (STANDEE & LEGAL) ==================== */
.modal-bd {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 840px;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.legal-modal { max-width: 620px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }

/* Standee Desktop 2-Column Inside Modal (Fields Left + Crisp Live Card Right!) */
.standee-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}
.standee-fields { display: flex; flex-direction: column; gap: 12px; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
}
.standee-preview-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.standee-preview-stage canvas {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}
.legal-body p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }

/* ==================== FOOTER ==================== */
.footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.footer-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.foot-link {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  padding: 2px 5px;
}
.foot-link:hover { color: var(--accent); text-decoration: underline; }
.foot-sep { color: var(--muted); opacity: 0.6; }
.footer-copy { font-size: 11.5px; color: var(--muted); }

/* ==================== MOBILE BOTTOM TAB BAR & SCROLL-BACK PILL ==================== */
.mobile-bottom-nav { display: none; }

.floating-preview-pill {
  display: none;
  position: fixed;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  z-index: 800;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 750;
  box-shadow: var(--shadow-lg);
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--toast-bg);
  border: 1px solid var(--accent-border);
  color: var(--toast-text);
  font-size: 13px;
  font-weight: 700;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  max-width: 92vw;
  text-align: center;
}

/* ==================== DEDICATED MOBILE APP LAYOUT (<= 960px) ==================== */
@media (max-width: 960px) {
  .app-shell {
    padding: 10px 14px calc(82px + env(safe-area-inset-bottom, 0px));
  }
  .topbar {
    top: 8px;
    height: 54px;
    padding: 0 12px;
    border-radius: 14px;
  }
  .nav-tabs { display: none; }
  .lang-switch { display: none; }
  .lang-dd { display: block; }

  .hero-strip { margin: 14px auto 12px; }
  .hero-strip h1 { font-size: 20px; }
  .hero-strip p { font-size: 12.5px; }

  /* Mobile Studio: QR PREVIEW FIRST ON TOP, Controls Right Below! */
  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .preview-panel {
    order: -1;
    position: static;
    padding: 14px;
    gap: 11px;
  }
  .preview-mat { padding: 12px; }
  .preview-frame { max-width: 210px; padding: 8px; }

  .scan-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .trust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Horizontal Swipe Type Rail on Mobile — strictly bounded to parent width */
  .type-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 6px;
    margin-bottom: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .type-rail::-webkit-scrollbar { display: none; }
  .type-pill { flex: 0 0 auto; height: 38px; }

  /* Fixed Native Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 850;
    background: var(--nav-bar-bg);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .m-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 46px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 10px;
    padding: 4px 2px;
    white-space: nowrap;
  }
  .m-nav-btn.active { color: var(--accent); background: var(--accent-soft); }

  .floating-preview-pill.visible { display: inline-flex; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 640px) {
  .brand-sub { display: none; }
  .panel { padding: 14px; border-radius: 16px; }
  .opt-grid { grid-template-columns: 1fr; gap: 10px; }
  .vis-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .palette-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .color-pickers { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .badge-chip { font-size: 11.5px; padding: 0 4px; }
  .trust-grid { grid-template-columns: 1fr; }
  .cust-tab { font-size: 12px; gap: 5px; padding: 0 6px; }

  /* Mobile Standee Bottom-Sheet Modal */
  .modal-bd { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
  }
  .standee-modal-body {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .url-mode-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .standee-preview-stage { order: -1; padding: 12px; }
  .standee-preview-stage canvas { max-width: 200px; }
  .modal-foot {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    justify-content: stretch;
  }
  .modal-foot .btn { flex: 1; }
  #btnCancelStandee { display: none; }
}

/* ==================== CLEAN PDF / STANDEE / BATCH A4 PRINT STYLESHEET ==================== */
@media print {
  @page { margin: 10mm; }
  html, body { background: #ffffff !important; color: #0f172a !important; }
  .app-shell, .modal-bd, .toast, .floating-preview-pill, .mobile-bottom-nav { display: none !important; }
  #printArea {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  #printArea .print-standee-img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
  }
  #printArea .print-standee-img.size-A6 { width: 105mm; }
  #printArea .print-standee-img.size-A5 { width: 148mm; }
  #printArea .print-standee-img.size-A4 { width: 185mm; }
  #printArea .print-batch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8mm;
    width: 100%;
  }
  #printArea .print-batch-item {
    border: 1px dashed #94a3b8;
    border-radius: 6px;
    padding: 5mm;
    text-align: center;
    break-inside: avoid;
  }
  #printArea .print-batch-item img { width: 42mm; height: 42mm; display: block; margin: 0 auto 3mm; }
  #printArea .print-batch-item strong { font-size: 10pt; color: #0f172a; word-break: break-word; }
}
