:root {
  --bg: #0a0e1a;
  --bg-2: #0f1426;
  --panel: #141a30;
  --panel-2: #1b2240;
  --line: #2a3358;
  --ink: #eef1ff;
  --muted: #9aa5d1;
  --accent: #6c8cff;
  --accent-2: #9db4ff;
  --pop: #ffd24a;
  --good: #2fbf5e;
  --bad: #ff5c5c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: "Mulish", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(75% 45% at 50% -10%, rgba(108, 140, 255, 0.18), transparent 60%),
    radial-gradient(55% 35% at 100% 100%, rgba(255, 210, 74, 0.08), transparent 60%);
  min-height: 100dvh;
}

.font-display { font-family: "Fredoka", system-ui, sans-serif; }

/* Layout */
.wrap { max-width: 768px; margin: 0 auto; padding: 32px 16px; }
@media (min-width: 640px) { .wrap { padding: 48px 16px; } }
.center { text-align: center; }
.muted { color: var(--muted); }
.grid2 { display: grid; gap: 20px; }
@media (min-width: 768px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.full { width: 100%; }
.small { font-size: .8rem; }
.text-bad { color: var(--bad); }

header h1 { font-size: 2.5rem; letter-spacing: -.02em; color: var(--accent-2); margin: 0; }
@media (min-width: 640px) { header h1 { font-size: 3rem; } }

/* Tabs */
.tabs { display: flex; gap: 20px; justify-content: center; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { background: transparent; color: var(--muted); border: none; border-bottom: 3px solid transparent; padding: 8px 4px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: .9rem; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Panels & controls */
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 20px; }
.panel.sticky { position: static; }
@media (min-width: 768px) { .panel.sticky { position: sticky; top: 24px; } }

/* Icônes inline (Lucide) */
.ico { display: inline-flex; align-items: center; justify-content: center; width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #07112e; font-weight: 800; border: none; border-radius: 14px; padding: 12px 16px; cursor: pointer; transition: transform .08s ease, filter .15s ease; font-family: inherit; font-size: 1rem; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--panel-2); color: var(--ink); font-weight: 700; border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; transition: transform .08s ease, border-color .15s ease; font-family: inherit; font-size: .9rem; text-decoration: none; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost:active { transform: translateY(1px) scale(.99); }

.field { background: #070b18; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); font-size: 1rem; padding: 10px 12px; width: 100%; outline: none; font-family: inherit; }
.field:focus { border-color: var(--accent); }
textarea.field { resize: vertical; min-height: 84px; }
input[type="color"].field { height: 44px; padding: 4px; }
input[type="range"] { width: 100%; }

.lbl { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 6px; font-weight: 700; }

.seg { display: inline-flex; flex-wrap: wrap; background: #070b18; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: none; padding: 8px 12px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #07112e; }

.code { background: #070b18; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; color: var(--accent-2); overflow-x: auto; white-space: pre; }

.divider { border: 0; height: 1px; background: var(--line); margin: 20px 0; }

.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }

.badge { margin-top: 8px; display: inline-block; font-size: .75rem; padding: 4px 12px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

/* Preview */
.preview-area { width: 100%; display: flex; align-items: center; justify-content: center; border-radius: 12px; padding: 16px 0; min-height: 240px; }
.qr-box canvas, .qr-box svg { display: block; width: min(100%, 260px); height: auto; border-radius: 6px; }
.frame-label { text-align: center; font-weight: 800; letter-spacing: .04em; margin-top: 8px; font-family: "Fredoka", system-ui, sans-serif; }
.logo-thumb { height: 36px; width: 36px; border-radius: 6px; object-fit: contain; background: var(--panel-2); border: 1px solid var(--line); }

/* API tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); padding: 4px 12px 4px 0; font-weight: 700; }
td { padding: 4px 12px 4px 0; border-top: 1px solid var(--line); }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.note { font-size: .8rem; border-radius: 10px; padding: 8px 12px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

/* FAQ */
.faq details { border-top: 1px solid var(--line); }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; list-style: none; padding: 12px 0; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; width: 16px; display: inline-block; }
.faq details[open] summary::before { content: "–"; }
.faq summary:hover { color: var(--accent-2); }
.faq details p { margin: 0 0 14px 24px; color: var(--muted); font-size: .9rem; line-height: 1.55; }

footer { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 40px; line-height: 1.6; }
footer a { color: var(--accent-2); }
footer .joke { font-style: italic; }

/* Accessibilité */
.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; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #07112e; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 800; z-index: 10; }
.skip:focus { left: 0; }

/* Barre du haut + sélecteur de langue */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 4px 10px 4px 12px; color: var(--muted); }
.lang-switch:hover { border-color: var(--accent); }
.lang-switch .ico { width: 1em; height: 1em; }
.lang-switch select { background: transparent; border: none; color: var(--ink); font-family: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; outline: none; padding: 4px 2px; }
.lang-switch select option { background: var(--panel); color: var(--ink); }

/* Fil d'Ariane */
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.crumbs a { color: var(--accent-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Contenu éditorial (intro) */
.prose p { margin: 0 0 12px; color: var(--ink); line-height: 1.6; font-size: .95rem; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--accent-2); font-weight: 800; }

/* Pourquoi nous */
.why-grid { display: grid; gap: 14px; }
@media (min-width: 560px) { .why-grid { grid-template-columns: 1fr 1fr; } }
.why-item { display: flex; flex-direction: column; gap: 2px; }
.why-item strong { color: var(--ink); font-weight: 800; }

/* Templates */
.tmpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tmpl-row button { background: var(--panel-2); color: var(--ink); border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: .82rem; }
.tmpl-row button:hover { border-color: var(--accent); color: var(--accent-2); }

/* Tailles rapides */
.size-quick { display: flex; gap: 6px; margin-top: 6px; }
.size-quick button { flex: 1; background: #070b18; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; cursor: pointer; font-weight: 700; font-family: inherit; font-size: .78rem; }
.size-quick button:hover { border-color: var(--accent); color: var(--accent-2); }

/* Boutons de téléchargement (PNG/SVG/PDF/WebP) */
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Bibliothèque d'icônes (logo central) */
.icon-lib { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.icon-btn { width: 40px; height: 40px; padding: 8px; background: var(--panel-2); color: var(--accent-2); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 100%; height: 100%; display: block; }

/* Génération par lot */
#bulk-data { min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* Scanner */
.scan-panel { display: flex; flex-direction: column; gap: 14px; }
.scan-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scan-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#scan-video { width: 100%; max-width: 420px; border-radius: 14px; border: 2px solid var(--line); background: #000; }
#scan-canvas { display: none; }
#scan-result-text { width: 100%; }

/* Historique local */
.hist { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.hist-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hist-clear { background: transparent; border: none; color: var(--muted); font-family: inherit; font-weight: 700; font-size: .78rem; cursor: pointer; }
.hist-clear:hover { color: var(--accent-2); }
.hist-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-item { padding: 0; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; line-height: 0; overflow: hidden; }
.hist-item:hover { border-color: var(--accent); }
.hist-item img { width: 48px; height: 48px; display: block; }

/* Maillage interne : autres types */
.type-links { display: flex; flex-wrap: wrap; gap: 8px; }
.type-link { display: inline-block; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: .85rem; font-weight: 700; text-decoration: none; }
.type-link:hover { border-color: var(--accent); color: var(--accent-2); }
