/* ==========================================================================
   QR Code Studio — base tokens
   ========================================================================== */

:root {
  --bg-app: #f2f3f6;
  --bg-panel: #ffffff;
  --bg-panel-alt: #f7f8fa;
  --bg-hover: #eef0f4;
  --border: #e4e6eb;
  --border-strong: #d4d7de;
  --text: #14151a;
  --text-muted: #676c78;
  --text-faint: #9aa0ab;
  --accent: #4a55f1;
  --accent-hover: #3c46e0;
  --accent-soft: #eceeff;
  --accent-contrast: #ffffff;
  --danger: #d93a3a;
  --danger-soft: #fdeceb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 17, 25, .05);
  --shadow-md: 0 10px 30px rgba(15, 17, 25, .08);
  --shadow-lg: 0 20px 50px rgba(15, 17, 25, .14);
  --focus-ring: 0 0 0 3px rgba(74, 85, 241, .32);
  --checker-a: #f3f4f7;
  --checker-b: #e1e3ea;
  --header-h: 60px;
  --footer-h: auto;
  --transition-fast: 180ms cubic-bezier(.4, 0, .2, 1);
  --transition-med: 300ms cubic-bezier(.4, 0, .2, 1);
}

:root[data-theme="dark"] {
  --bg-app: #0f1014;
  --bg-panel: #16171e;
  --bg-panel-alt: #1b1d25;
  --bg-hover: #21232c;
  --border: #2a2c36;
  --border-strong: #383b48;
  --text: #f1f2f6;
  --text-muted: #a3a8b7;
  --text-faint: #6d7280;
  --accent: #7480ff;
  --accent-hover: #8a94ff;
  --accent-soft: #262a4a;
  --accent-contrast: #0f1014;
  --danger: #ff6b6b;
  --danger-soft: #3a1f22;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .38);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

/* Themed scrollbars (document + any internally-scrolling panel), light/dark aware via the CSS vars they reference */
html { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg-app); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 999px; border: 3px solid var(--bg-app);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}
body.static-page .app { height: auto; min-height: 100dvh; }

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 14px; height: 14px; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.reduce-motion * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 900px) { .app { height: auto; min-height: 100dvh; } }

/* ---------------- Header ---------------- */

.topbar {
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: relative;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; flex: none; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-accent { color: var(--accent); }

.topbar-nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
@media (max-width: 560px) { .topbar-nav { display: none; } }
.topbar-nav-link {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  border: none; background: transparent; color: var(--text-muted); font-size: 13.5px; font-weight: 600;
  text-decoration: none; transition: all var(--transition-fast);
}
.topbar-nav-link:hover { background: var(--bg-hover); color: var(--text); transform: translateY(-1px); }
.topbar-nav-link:active { transform: translateY(0); }
.topbar-nav-link .icon { width: 16px; height: 16px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.icon-btn:hover { background: var(--bg-hover); transform: translateY(-2px) scale(1.05); }
.icon-btn:active { transform: translateY(0) scale(.97); }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn--ghost:hover { background: var(--bg-hover); }

.overlay {
  position: fixed; inset: 0; background: rgba(10, 11, 15, .32);
  z-index: 45; backdrop-filter: blur(0px);
  opacity: 0; transition: opacity var(--transition-med), backdrop-filter var(--transition-med);
}
.overlay.is-open { opacity: 1; backdrop-filter: blur(1px); }

.settings-panel {
  position: absolute; top: calc(var(--header-h) + 8px); right: 16px; width: min(320px, calc(100vw - 32px));
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 16px; z-index: 50;
  opacity: 0; transform: translateY(-8px) scale(.98);
  transition: opacity var(--transition-med), transform var(--transition-med);
}
.settings-panel.is-open { opacity: 1; transform: translateY(0) scale(1); }
.settings-nav-links { display: none; flex-direction: column; gap: 2px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
@media (max-width: 560px) { .settings-nav-links { display: flex; } }
.settings-nav-links .topbar-nav-link { padding: 10px 8px; }
.settings-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.settings-panel-head h2 { font-size: 15px; margin: 0; }
.settings-field { margin-bottom: 14px; }
.settings-field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-muted); }
.settings-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; font-size: 14px; border-top: 1px solid var(--border);
}
.settings-hint { font-size: 12px; color: var(--text-faint); margin: 10px 0 0; line-height: 1.5; }

/* ---------------- About page ---------------- */

.about-main { flex: 1; overflow-y: auto; padding: 36px 20px 56px; }
.about-content { max-width: 640px; margin: 0 auto; }
.about-back {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); text-decoration: none; margin-bottom: 22px; transition: color var(--transition-fast);
}
.about-back .icon { width: 15px; height: 15px; }
.about-back:hover { color: var(--accent); }
.about-content h1 { font-size: 27px; margin: 0 0 8px; letter-spacing: -0.02em; }
.about-lead { color: var(--text-muted); font-size: 14.5px; line-height: 1.6; margin: 0 0 28px; }
.about-section {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 16px;
}
.about-section h2 { font-size: 15px; margin: 0 0 10px; letter-spacing: -.01em; }
.about-section p, .about-section li { font-size: 13.5px; line-height: 1.7; color: var(--text-muted); }
.about-section p + p { margin-top: 10px; }
.about-section ul { margin: 8px 0 0; padding-left: 20px; }
.about-section li + li { margin-top: 4px; }
@media (max-width: 560px) { .about-main { padding: 24px 16px 40px; } }

.blog-main { flex: 1; overflow-y: auto; padding: 36px 20px 56px; }
.blog-main-inner { max-width: 900px; margin: 0 auto; }
.blog-main-inner h1 { font-size: 27px; margin: 0 0 8px; letter-spacing: -0.02em; }
.blog-main-inner .about-lead { margin-bottom: 32px; }
@media (max-width: 560px) { .blog-main { padding: 24px 16px 40px; } }

.article-main { flex: 1; overflow-y: auto; padding: 36px 20px 56px; }
.article-inner { max-width: 700px; margin: 0 auto; }
.article-tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 14px;
}
.article-inner h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -0.02em; }
.article-meta { font-size: 12.5px; color: var(--text-faint); margin: 0 0 24px; }
.article-answer {
  background: var(--accent-soft); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius-md); padding: 16px 18px; margin: 0 0 32px;
}
.article-answer p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--text); }
.article-answer p + p { margin-top: 10px; }
.article-answer .btn { margin-top: 12px; width: auto; display: inline-flex; }
.article-body h2 { font-size: 19px; margin: 34px 0 12px; letter-spacing: -0.01em; }
.article-body h3 { font-size: 15.5px; margin: 22px 0 10px; }
.article-body p { font-size: 14.5px; line-height: 1.8; color: var(--text-muted); margin: 0 0 15px; }
.article-body ul, .article-body ol { margin: 0 0 15px; padding-left: 22px; color: var(--text-muted); font-size: 14.5px; line-height: 1.8; }
.article-body li { margin-bottom: 4px; }
.article-body strong { color: var(--text); }
.article-body a { font-weight: 600; }
.article-table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 13.5px; }
.article-table th, .article-table td { text-align: left; padding: 10px 12px; border: 1px solid var(--border); }
.article-table th { background: var(--bg-panel-alt); font-weight: 700; }
.article-table td { color: var(--text-muted); }
.article-callout {
  background: var(--bg-panel-alt); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 18px; margin: 0 0 20px; font-size: 13.5px; color: var(--text-muted); line-height: 1.7;
}
.article-callout strong { color: var(--text); }
.article-cta {
  margin-top: 40px; padding: 24px; text-align: center; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.article-cta h2 { margin-top: 0 !important; }
.article-cta p { color: var(--text-muted); font-size: 14px; margin: 0 0 16px; }
.article-cta .btn { width: auto; display: inline-flex; }
.article-related { margin-top: 40px; }
.article-related h2 { margin-bottom: 14px; }
@media (max-width: 560px) { .article-main { padding: 24px 16px 40px; } }

/* ==========================================================================
   Layout
   ========================================================================== */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 460px);
}
@media (max-width: 900px) {
  .layout { display: block; }
}

/* ---------------- Canvas pane ---------------- */

.canvas-pane {
  display: flex; flex-direction: column; min-height: 0;
  padding: 18px 22px 20px;
  border-right: 1px solid var(--border);
}
@media (max-width: 900px) {
  .canvas-pane {
    border-right: none; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20; background: var(--bg-app);
    padding: 12px 14px 14px;
  }
}

.canvas-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex: none; }
.zoom-controls { display: flex; align-items: center; gap: 4px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.zoom-label {
  min-width: 56px; text-align: center; font-size: 13px; font-weight: 600; border: none; background: transparent;
  padding: 6px 4px; border-radius: 8px; color: var(--text-muted);
}
.zoom-label:hover { background: var(--bg-hover); color: var(--text); }
.canvas-hint { font-size: 12px; color: var(--text-faint); }
@media (max-width: 560px) { .canvas-hint { display: none; } }

.canvas-viewport {
  flex: 1; min-height: 220px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
@media (max-width: 900px) {
  .canvas-viewport { flex: none; min-height: 0; height: 40vh; max-height: 420px; transition: height var(--transition-med); }
  .canvas-pane.is-compact .canvas-viewport { height: 26vh; max-height: 273px; }
}
@media (max-width: 900px) and (max-height: 700px) {
  .canvas-viewport { height: 34vh; }
  .canvas-pane.is-compact .canvas-viewport { height: 22.1vh; }
}

.canvas-surface {
  /* width/height are set inline by JS (ResizeObserver-driven) to guarantee
     a true square that always fits the viewport, on any screen — percentage
     + aspect-ratio alone can't react to a height-constrained container. */
  width: 260px;
  height: 260px;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  background-color: var(--checker-b);
  border-radius: 14px;
  box-shadow: 0 2px 5px rgba(15,17,25,.06), 0 18px 40px rgba(15,17,25,.10);
  transition: transform var(--transition-fast), width var(--transition-med), height var(--transition-med);
  will-change: transform;
}
.qr-preview { width: 100%; height: 100%; }
.qr-preview svg { display: block; width: 100%; height: 100%; }

/* ---------------- Controls pane ---------------- */

.controls-pane { min-height: 0; display: flex; flex-direction: column; }

.tabs {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  margin: 16px 20px 0; padding: 4px; background: var(--bg-panel-alt);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
@media (max-width: 900px) { .tabs { margin: 12px 14px 0; } }
.tab-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px;
  border: none; border-radius: 9px; background: transparent; color: var(--text-muted);
  font-size: 11.5px; font-weight: 700; transition: all var(--transition-fast);
}
.tab-btn .icon { width: 18px; height: 18px; }
.tab-btn:hover { color: var(--text); transform: translateY(-1px); }
.tab-btn:active { transform: translateY(0); }
.tab-btn.is-active { background: var(--bg-panel); color: var(--accent); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .tab-btn.is-active { background: var(--accent-soft); }

.controls-scroll {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 28px;
  display: flex; flex-direction: column;
}
@media (max-width: 900px) {
  .controls-scroll { overflow-y: visible; padding: 12px 14px 20px; }
}

.panel {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}

@keyframes fadeInUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.tab-panel { animation: fadeInUp 220ms ease; }
.accordion-panel:not([hidden]) { animation: fadeInUp 180ms ease; }
.panel-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; letter-spacing: -.01em; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.panel-title-row .panel-title { margin-bottom: 0; }

/* ==========================================================================
   Type grid
   ========================================================================== */

.type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 16px;
}
.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg-panel-alt); color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  transition: all var(--transition-fast);
}
.type-btn .icon { width: 20px; height: 20px; }
.type-btn:hover { background: var(--bg-hover); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.type-btn:active { transform: translateY(0); }
.type-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ==========================================================================
   Fields
   ========================================================================== */

.field-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field--filename { margin-bottom: 18px; }
.field label, .field-label-row { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field-label-row { display: flex; align-items: center; gap: 6px; }
.field--checkbox { flex-direction: row; }

.field input[type="text"], .field input[type="tel"], .field input[type="email"],
.field input[type="url"], .field input[type="number"], .field input[type="datetime-local"],
.field textarea, .field select,
#exportFilename {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg-panel); color: var(--text); font-size: 14px; transition: border-color var(--transition-fast);
}
.field textarea { resize: vertical; min-height: 64px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus,
#exportFilename:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--accent); }

.field-error {
  font-size: 12.5px; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm);
  padding: 8px 10px; margin: -4px 0 12px;
}
.field-hint { font-size: 12px; color: var(--text-faint); margin: 0 0 12px; line-height: 1.5; }

.info-tip { display: inline-flex; color: var(--text-faint); cursor: help; }
.info-tip:hover { color: var(--accent); }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.field-row label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field-row input[type="color"] { flex: none; }

input[type="color"] {
  width: 40px; height: 32px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-panel); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }

/* ==========================================================================
   Segmented controls
   ========================================================================== */

.segmented {
  display: grid; gap: 4px; background: var(--bg-panel-alt); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 4px;
}
.segmented--5 { grid-template-columns: repeat(5, 1fr); }
.segmented--3 { grid-template-columns: repeat(3, 1fr); }
.segmented--2 { grid-template-columns: repeat(2, 1fr); }
.segmented button {
  border: none; background: transparent; border-radius: 8px; padding: 8px 4px; font-size: 12px;
  font-weight: 600; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all var(--transition-fast); white-space: nowrap;
}
.segmented button:hover { color: var(--text); transform: translateY(-1px); }
.segmented button.is-active { background: var(--bg-panel); color: var(--accent); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .segmented button.is-active { background: var(--accent-soft); }
.segmented--5 button { font-size: 11px; padding: 8px 2px; }
@media (max-width: 380px) { .segmented--5 { grid-template-columns: repeat(3, 1fr); } }

/* ==========================================================================
   Accordion (Style section)
   ========================================================================== */

.accordion { display: flex; flex-direction: column; gap: 8px; }
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-panel-alt); }
.accordion-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: none; background: transparent; font-size: 13.5px; font-weight: 700; text-align: left;
}
.accordion-trigger-label { display: flex; align-items: center; gap: 8px; }
.accordion-current { font-weight: 500; color: var(--text-faint); font-size: 12.5px; }
.chevron { color: var(--text-faint); transition: transform var(--transition-fast); }
.accordion-item.is-open .chevron { transform: rotate(180deg); }
.accordion-item.is-open { background: var(--bg-panel); border-color: var(--border-strong); }
.accordion-panel { padding: 4px 14px 16px; }

/* ==========================================================================
   Option grid (style pickers)
   ========================================================================== */

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-bottom: 14px; }
.option-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-panel);
  color: var(--text-muted); font-size: 11px; font-weight: 600; transition: all var(--transition-fast);
}
.option-btn:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.option-btn:active { transform: translateY(0); }
.option-btn.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.option-preview { width: 32px; height: 32px; color: inherit; }

.option-grid--presets { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.option-grid--presets .option-btn { padding: 8px 6px 10px; font-size: 11.5px; }
.option-preview--preset {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.option-grid--plates .option-btn { padding: 12px 6px; }

.plate-swatch { width: 26px; height: 26px; display: block; background: var(--text-faint); opacity: .55; }
.plate-swatch--none { background: transparent; border: 1.5px dashed var(--border-strong); opacity: 1; }
.plate-swatch--square { border-radius: 3px; }
.plate-swatch--rounded { border-radius: 9px; }
.plate-swatch--circle { border-radius: 50%; }

/* ==========================================================================
   Range sliders
   ========================================================================== */

.range-row { margin-bottom: 16px; }
.range-row:last-child { margin-bottom: 4px; }
.range-row label, .range-row > .value { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.range-row label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.range-row .value { color: var(--text); font-variant-numeric: tabular-nums; }
.range-row.is-disabled { opacity: .45; pointer-events: none; }
#backgroundColorRow.is-disabled { opacity: .45; pointer-events: none; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 4px;
  background: var(--border-strong); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 3px solid var(--bg-panel); box-shadow: 0 1px 4px rgba(0,0,0,.25); margin-top: -6px; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg-panel);
  box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 4px; background: var(--border-strong); }
input[type="range"]:disabled { opacity: .5; cursor: not-allowed; }

.inline-number {
  width: 58px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--bg-panel); color: var(--text); font-size: 12.5px; text-align: right; margin-right: 2px;
}

/* ==========================================================================
   Color control
   ========================================================================== */

.color-control { margin-top: 4px; }
.color-mode { margin-bottom: 10px; }
.color-solid-row { display: flex; }
.color-gradient-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-gradient-row select {
  padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-panel);
  font-size: 12.5px; flex: none;
}
.color-gradient-row input[type="range"] { flex: 1 1 100%; margin-top: 6px; }

/* ==========================================================================
   Switch (toggle)
   ========================================================================== */

.switch { position: relative; display: inline-flex; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background var(--transition-fast);
}
.switch-track::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--transition-fast);
}
.switch input:checked ~ .switch-track { background: var(--accent); }
.switch input:checked ~ .switch-track::before { transform: translateX(16px); }
.switch input:focus-visible ~ .switch-track { box-shadow: var(--focus-ring); }

/* ==========================================================================
   Logo panel
   ========================================================================== */

.logo-body { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; transition: opacity var(--transition-fast); }
.logo-body.is-disabled { opacity: .45; pointer-events: none; }
.logo-pane { display: flex; flex-direction: column; gap: 12px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); padding: 22px 12px;
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
  transition: all var(--transition-fast);
}
.dropzone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.logo-image-preview { display: flex; align-items: center; gap: 12px; }
.logo-image-preview img {
  width: 52px; height: 52px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-panel-alt); padding: 4px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 700;
  border: 1px solid transparent; transition: all var(--transition-fast); width: 100%;
  text-decoration: none; color: inherit;
}
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn--ghost { background: var(--bg-panel-alt); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-hover); border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn--sm { padding: 7px 10px; font-size: 12.5px; width: auto; }

/* ==========================================================================
   Export section
   ========================================================================== */

.toggle-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
@media (max-width: 380px) { .toggle-pair { grid-template-columns: 1fr; } }
.toggle-card {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-panel-alt); font-size: 12.5px; font-weight: 700; cursor: pointer;
}

.export-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.export-grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 420px) { .export-grid { grid-template-columns: repeat(2, 1fr); } }
.export-grid .btn { flex-direction: column; padding: 12px 4px; }

.see-more { margin-top: 10px; }
.see-more summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--text-muted); list-style: none;
  display: flex; align-items: center; gap: 6px; padding: 4px 0;
}
.see-more summary::-webkit-details-marker { display: none; }
.see-more summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--transition-fast); margin-right: 2px;
}
.see-more[open] summary::before { transform: rotate(45deg); }
.see-more .export-grid { margin-top: 12px; }

/* ==========================================================================
   Homepage SEO content (below the fold, below the app shell)
   ========================================================================== */

.seo-content { background: var(--bg-app); padding: 56px 20px 24px; }
.seo-inner { max-width: 960px; margin: 0 auto; }
.seo-h1 { max-width: 760px; font-size: 28px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.02em; }
.seo-lead { max-width: 720px; font-size: 15.5px; line-height: 1.65; color: var(--text-muted); margin: 0 0 28px; }
.seo-inner h2 { font-size: 19px; margin: 36px 0 12px; letter-spacing: -0.01em; }
.seo-inner h2:first-of-type { margin-top: 8px; }
.seo-inner > p { max-width: 720px; font-size: 14px; line-height: 1.75; color: var(--text-muted); margin: 0 0 14px; }
.seo-inner a { font-weight: 600; }

.seo-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 8px; }
@media (max-width: 640px) { .seo-feature-grid { grid-template-columns: 1fr; } }
.seo-feature-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm);
}
.seo-feature-card .icon { width: 20px; height: 20px; color: var(--accent); margin-bottom: 10px; }
.seo-feature-card h3 { font-size: 14.5px; margin: 0 0 6px; }
.seo-feature-card p { font-size: 13px; margin: 0; line-height: 1.6; color: var(--text-muted); }

.type-explainer-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 0 0 8px;
}
.type-explainer-card {
  display: flex; align-items: flex-start; gap: 12px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
}
.type-explainer-card .icon { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.type-explainer-card h3 { font-size: 13.5px; margin: 0 0 3px; color: var(--text); }
.type-explainer-card p { font-size: 12.5px; margin: 0; line-height: 1.55; color: var(--text-muted); }

.faq-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.faq-item {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 4px 16px;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: 14px 24px 14px 0; position: relative;
  font-size: 14.5px; font-weight: 700; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: 2px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: translateY(-65%) rotate(45deg); transition: transform var(--transition-fast);
}
.faq-item[open] summary::after { transform: translateY(-35%) rotate(-135deg); }
.faq-item p { padding-bottom: 14px; margin: -4px 0 0; color: var(--text-muted); font-size: 14px; line-height: 1.7; }

.seo-blog-teaser { margin-top: 40px; }
.blog-teaser-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0 20px; }
@media (max-width: 700px) { .blog-teaser-grid { grid-template-columns: 1fr; } }

.blog-card {
  display: flex; flex-direction: column; gap: 8px; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.blog-card-tag {
  align-self: flex-start; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.blog-card h3 { font-size: 15px; margin: 0; line-height: 1.4; color: var(--text); }
.blog-card p { font-size: 13px; line-height: 1.6; color: var(--text-muted); margin: 0; flex: 1; }
.blog-card-meta { font-size: 11.5px; color: var(--text-faint); font-weight: 600; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  flex: none; padding: 16px 22px 18px; border-top: 1px solid var(--border); background: var(--bg-panel);
  text-align: center;
}
.site-footer p { margin: 0; font-size: 12px; color: var(--text-faint); }
@media (max-width: 900px) { .site-footer { padding: 14px 16px 18px; } }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--text); color: var(--bg-panel); padding: 11px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity var(--transition-med), transform var(--transition-med); z-index: 100; max-width: 90vw; text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--danger); color: #fff; }

/* Scrollbar styling lives globally near the top of this file, so every
   scroll container (document, controls panel, article pages) matches. */
