/* ============================================================
   QR Code Generator — clean monochrome base with an emerald accent.
   ============================================================ */
:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --line: #e6e6e6;
  --line-strong: #d4d4d4;
  --fg: #0a0a0a;
  --fg-soft: #171717;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --hover: #f4f4f5;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --ring: rgba(16, 185, 129, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --grid: rgba(0, 0, 0, 0.035);
}
html[data-theme="dark"] {
  --bg: #050505;
  --bg-elev: #0a0a0a;
  --card: #0d0d0e;
  --line: #232326;
  --line-strong: #333336;
  --fg: #f5f5f5;
  --fg-soft: #ededed;
  --muted: #9aa0a6;
  --muted-2: #6b7280;
  --hover: #151517;
  --accent: #3ecf8e;
  --accent-strong: #4ade80;
  --accent-soft: rgba(62, 207, 142, 0.1);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.1);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.1);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --ring: rgba(62, 207, 142, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.45);
  --grid: rgba(255, 255, 255, 0.03);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
[id] { scroll-margin-top: 5rem; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.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: -9999px; top: 0; z-index: 100; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 0 0 8px 0; font-size: 13px; font-weight: 500; }
.skip:focus { left: 0; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; background: var(--fg); color: var(--bg); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }

main { display: block; padding: 52px 0 0; }
.hero { text-align: center; padding: 4px 0 30px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 500; box-shadow: var(--shadow-sm); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hero h1 { margin: 20px 0 12px; font-size: clamp(32px, 5.6vw, 48px); line-height: 1.06; font-weight: 700; letter-spacing: -0.03em; }
.hero h1 .grad { background: linear-gradient(100deg, var(--accent-strong), var(--accent) 55%, var(--info)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 16px; line-height: 1.6; }

/* ---------- Workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 20px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-head p { margin: 3px 0 0; color: var(--muted-2); font-size: 12px; }
.card-body { padding: 18px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted);
  cursor: pointer; font-size: 12.5px; font-weight: 500; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { border-color: var(--fg); color: var(--fg); }
.tab[aria-selected="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field .hint { margin: 5px 0 0; color: var(--muted-2); font-size: 11.5px; line-height: 1.5; }
.control {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg); font-size: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.control::placeholder { color: var(--muted-2); }
.control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--card); }
textarea.control { height: auto; min-height: 96px; padding: 11px 12px; resize: vertical; line-height: 1.55; }
select.control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; padding-right: 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch-row .sw-label { font-size: 13px; font-weight: 500; }
.switch-row .sw-sub { margin-top: 2px; color: var(--muted-2); font-size: 11.5px; }
.switch { position: relative; flex: none; width: 40px; height: 23px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { display: block; width: 40px; height: 23px; border-radius: 999px; background: var(--line-strong); transition: background 0.18s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.18s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked ~ .knob { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.adv { border-top: 1px solid var(--line); margin-top: 4px; }
.adv summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 12px; cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary .chev { color: var(--muted-2); transition: transform 0.2s; }
.adv summary .chev svg { width: 16px; height: 16px; display: block; }
.adv[open] summary .chev { transform: rotate(180deg); }

.color-field { display: flex; align-items: center; gap: 9px; }
.color-field input[type="color"] { flex: none; width: 42px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; }
.color-field .hex { flex: 1; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatch { width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.08); }
input[type="range"].control { height: auto; padding: 8px 0; border: 0; background: transparent; accent-color: var(--accent); }

/* ---------- Preview ---------- */
.preview { position: sticky; top: 76px; }
.qr-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 22px; border-bottom: 1px solid var(--line);
  min-height: 300px;
  background-image:
    linear-gradient(45deg, var(--hover) 25%, transparent 25%, transparent 75%, var(--hover) 75%),
    linear-gradient(45deg, var(--hover) 25%, transparent 25%, transparent 75%, var(--hover) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}
.qr-stage canvas { max-width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); }
.qr-empty { text-align: center; color: var(--muted-2); font-size: 13px; line-height: 1.6; }
.qr-empty svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: 0.5; }

.preview-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.pm { background: var(--card); padding: 12px 14px; }
.pm .k { color: var(--muted-2); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.pm .v { margin-top: 5px; font-size: 15px; font-weight: 600; font-family: "JetBrains Mono", monospace; letter-spacing: -0.02em; }
.pm .v.warn { color: var(--warn); }

.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; white-space: nowrap; font-size: 13.5px; font-weight: 600; transition: transform 0.08s, opacity 0.15s, border-color 0.15s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #04150d; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { border-color: var(--line-strong); background: var(--card); color: var(--fg-soft); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-block { width: 100%; }
.grow { flex: 1; }

.warnbox { display: flex; gap: 9px; margin: 0 16px 16px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 12px; line-height: 1.5; }
.warnbox svg { flex: none; width: 15px; height: 15px; margin-top: 1px; }

/* ---------- Recent ---------- */
.recent { margin-top: 24px; }
.section-eyebrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-eyebrow h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--muted-2); cursor: pointer; font-size: 12px; font-weight: 500; }
.link-btn:hover { color: var(--danger); }
.recent-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; box-shadow: var(--shadow-sm); }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 11px 15px; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; background: none; text-align: left; transition: background 0.12s; }
.recent-item:last-child { border-bottom: 0; }
.recent-item:hover { background: var(--hover); }
.recent-item .tag { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-2); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.recent-item .rtext { flex: 1; min-width: 0; font-family: "JetBrains Mono", monospace; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .rt { flex: none; color: var(--muted-2); font-size: 11px; }

/* ---------- Sections ---------- */
.section { margin-top: 56px; }
.section > h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.section > p.lead { margin: 0 0 22px; color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 600px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.step .num { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 500; color: var(--accent-strong); }
.step h3 { margin: 9px 0 5px; font-size: 14px; font-weight: 600; }
.step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.tips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tip { display: flex; gap: 11px; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.tip .ico { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); }
.tip .ico svg { width: 16px; height: 16px; }
.tip h3 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.tip p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.faq-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; box-shadow: var(--shadow-sm); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { flex: none; color: var(--muted-2); transition: transform 0.2s ease; }
.faq-item summary .chev svg { width: 16px; height: 16px; display: block; }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item .ans { padding: 0 18px 17px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.faq-note { margin-top: 14px; font-size: 12px; color: var(--muted-2); line-height: 1.6; }

footer { margin-top: 66px; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; padding: 34px 0; }
.footer-brand { max-width: 320px; }
.footer-brand p { margin: 12px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.footer-cols { display: flex; gap: 48px; }
.footer-col h3 { margin: 0 0 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-col a { color: var(--muted); font-size: 13px; transition: color 0.15s; }
.footer-col a:hover { color: var(--fg); }
.footer-base { border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted-2); font-size: 12px; line-height: 1.6; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 640px) {
  main { padding-top: 36px; }
  .steps, .tips, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-cols { gap: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
