/* ============================================================
   LinkVerse — design system
   Display: Space Grotesk · Body: Inter · Data: JetBrains Mono
   ============================================================ 
*/

:root {
  --paper: #F5F6F8;
  --void: #0E0F13;
  --signal: #3654FF;
  --signal-soft: rgba(54, 84, 255, .12);
  --amber: #FFB020;
  --slate: #8A8F98;

  --bg: var(--paper);
  --bg-elev: #FFFFFF;
  --bg-sunken: #EDEFF3;
  --ink: #14161C;
  --ink-muted: #5C626C;
  --line: rgba(138, 143, 152, .28);
  --line-strong: rgba(138, 143, 152, .45);
  --shadow-sm: 0 1px 2px rgba(20, 22, 28, .06), 0 2px 8px rgba(20, 22, 28, .04);
  --shadow-md: 0 10px 30px rgba(20, 22, 28, .10);
  --shadow-lift: 0 12px 26px rgba(54, 84, 255, .22);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --nav-h: 68px;
  --maxw: 1180px;
}

[data-theme="dark"] {
  --bg: var(--void);
  --bg-elev: #16181F;
  --bg-sunken: #101218;
  --ink: #F2F3F5;
  --ink-muted: #9AA0AA;
  --line: rgba(138, 143, 152, .24);
  --line-strong: rgba(138, 143, 152, .38);
  --signal-soft: rgba(54, 84, 255, .20);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .55);
  --shadow-lift: 0 12px 26px rgba(54, 84, 255, .3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 18px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.mono { font-family: var(--font-mono); font-variant-ligatures: none; }
.muted { color: var(--ink-muted); font-weight: 400; }

.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-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--signal); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* Focus visibility everywhere */
:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
  border-radius: 4px;
}
[data-theme="dark"] :focus-visible { outline-color: #7C90FF; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: .95rem;
  padding: 12px 20px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line-strong);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--signal); color: var(--signal); background: var(--signal-soft); }
.btn-lg { padding: 15px 26px; font-size: 1rem; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; font-size: 1rem;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.icon-btn:hover { color: var(--signal); border-color: var(--signal); background: var(--signal-soft); text-decoration: none; transform: translateY(-1px); }

/* ---------------- Fields ---------------- */
.field {
  width: 100%; font-family: var(--font-body); font-size: .95rem;
  color: var(--ink); background: var(--bg-elev);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 12px 14px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .3s ease;
}
.field.mono { font-family: var(--font-mono); font-size: .9rem; }
.field::placeholder { color: var(--slate); }
.field:focus { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); outline: none; }
select.field { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--slate) 50%), linear-gradient(135deg, var(--slate) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 13px) 52%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
textarea.field { resize: vertical; line-height: 1.6; }

.color {
  width: 100%; height: 42px; padding: 3px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: var(--r-md);
}
.range { width: 100%; accent-color: var(--signal); height: 26px; cursor: pointer; }

/* ---------------- Navbar ---------------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .3s ease;
}
.navbar.is-stuck { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; gap: 20px; height: var(--nav-h); position: relative; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: 1.22rem; letter-spacing: -.03em; }
.brand-word-accent { color: var(--signal); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  box-shadow: 0 4px 12px rgba(54, 84, 255, .28);
  transition: transform .22s ease, box-shadow .22s ease;
}
.brand-mark svg { display: block; border-radius: 10px; }
.brand:hover .brand-mark { transform: translateY(-2px) rotate(-3deg); box-shadow: 0 8px 20px rgba(54, 84, 255, .38); }
.lv-amber-eye, .lv-amber-dot { transition: stroke .25s ease, fill .25s ease; }

/* Nav links sit dead-centre in the bar, independent of the brand/action widths */
.nav-links {
  display: flex; align-items: center; gap: 6px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav-links > a {
  color: var(--ink); font-weight: 500; font-size: .93rem;
  padding: 8px 12px; border-radius: var(--r-sm); position: relative;
}
.nav-links > a:hover { text-decoration: none; color: var(--signal); background: var(--signal-soft); }
.nav-mobile-actions { display: none; }

.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.hamburger { display: none; }

/* ---------------- Hero ---------------- */
.hero { position: relative; padding: 74px 0 66px; overflow: hidden; }

/* Layered backdrop: soft colour blooms + a QR-module grid that fades outward */
.hero-bg {
  position: absolute; inset: -10% -5% 0; pointer-events: none;
  background-image:
    radial-gradient(ellipse 46% 40% at 22% 8%, rgba(54, 84, 255, .20), transparent 70%),
    radial-gradient(ellipse 40% 36% at 82% 4%, rgba(255, 176, 32, .16), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 42%, rgba(54, 84, 255, .10), transparent 72%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 34px 34px, 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 76% 80% at 50% 34%, #000 26%, transparent 100%);
  mask-image: radial-gradient(ellipse 76% 80% at 50% 34%, #000 26%, transparent 100%);
}
[data-theme="dark"] .hero-bg {
  background-image:
    radial-gradient(ellipse 46% 40% at 22% 8%, rgba(54, 84, 255, .34), transparent 70%),
    radial-gradient(ellipse 40% 36% at 82% 4%, rgba(255, 176, 32, .13), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 42%, rgba(54, 84, 255, .16), transparent 72%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 34px 34px, 34px 34px;
}

/* Floating QR-module accents, drifting very slowly */
.hero-bg::before, .hero-bg::after {
  content: ""; position: absolute; border-radius: 22%;
  background-image: radial-gradient(circle, var(--signal) 1.6px, transparent 1.8px);
  background-size: 14px 14px; opacity: .22;
}
.hero-bg::before { width: 150px; height: 150px; top: 16%; left: 4%; animation: drift 17s ease-in-out infinite; }
.hero-bg::after {
  width: 120px; height: 120px; top: 26%; right: 5%;
  background-image: radial-gradient(circle, var(--amber) 1.6px, transparent 1.8px);
  opacity: .3; animation: drift 21s ease-in-out infinite reverse;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14px, -18px); }
}

/* Page-wide ambient wash so sections below the hero aren't flat */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 34% at 88% 68%, rgba(54, 84, 255, .07), transparent 70%),
    radial-gradient(ellipse 44% 30% at 6% 88%, rgba(255, 176, 32, .06), transparent 70%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 50% 34% at 88% 68%, rgba(54, 84, 255, .13), transparent 70%),
    radial-gradient(ellipse 44% 30% at 6% 88%, rgba(255, 176, 32, .07), transparent 70%);
}

.hero-inner { position: relative; text-align: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  box-shadow: var(--shadow-sm);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }

.hero-title {
  font-size: clamp(2.15rem, 6vw, 4rem); font-weight: 700;
  margin: 22px auto 16px; max-width: 15ch;
}
.hero-title em { font-style: normal; color: var(--signal); }
.hero-sub { color: var(--ink-muted); font-size: clamp(1rem, 2vw, 1.16rem); max-width: 56ch; margin: 0 auto; }

.hero-form {
  display: flex; gap: 10px; max-width: 680px; margin: 32px auto 12px;
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 8px; box-shadow: var(--shadow-md);
}
.field-wrap { position: relative; flex: 1; display: flex; }
.field-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--slate); pointer-events: none; }
.hero-form .field { border: none; background: transparent; padding-left: 42px; font-size: .95rem; }
.hero-form .field:focus { box-shadow: none; }
.field-wrap:focus-within { border-radius: var(--r-md); box-shadow: 0 0 0 3px var(--signal-soft); }
.hero-note { font-size: .85rem; color: var(--ink-muted); min-height: 22px; }
.hero-note.is-error { color: #D93B3B; font-weight: 500; }
.hero-note.is-ok { color: var(--signal); font-weight: 500; }

/* ---------------- Unfold animation ---------------- */
.unfold { position: relative; margin: 46px auto 0; max-width: 940px; padding: 8px 0; }
.unfold-track {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: nowrap;
}
.uf-stage {
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: .28; transform: translateY(6px) scale(.97);
  transition: opacity .5s ease, transform .5s ease;
}
.uf-stage.is-live { opacity: 1; transform: translateY(0) scale(1); }
.uf-stage figcaption {
  font-family: var(--font-body); font-size: .74rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted);
}
.uf-stage.is-live figcaption { color: var(--signal); }
.uf-box {
  display: flex; align-items: center; justify-content: center;
  min-height: 92px; padding: 14px 16px;
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: border-color .4s ease, box-shadow .4s ease;
}
.uf-stage.is-live .uf-box { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
.uf-long { max-width: 250px; }
.uf-longtext { font-size: .68rem; color: var(--ink-muted); word-break: break-all; line-height: 1.5; }
.uf-short .mono { font-size: 1rem; font-weight: 700; color: var(--ink); }
.uf-arrow { color: var(--slate); font-size: 1.1rem; margin-bottom: 26px; }

.qr-mini { display: grid; grid-template-columns: repeat(11, 5px); gap: 1px; }
.qr-mini i { width: 5px; height: 5px; background: transparent; border-radius: 1px; display: block; }
.qr-mini i.on { background: var(--ink); }
.qr-mini i.eye { background: var(--amber); }
.uf-stage.is-live .qr-mini i.on { animation: qrpop .5s ease both; }
@keyframes qrpop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.bars-mini { display: flex; align-items: flex-end; gap: 2px; height: 58px; }
.bars-mini span { display: block; background: var(--ink); border-radius: 1px; height: 100%; }
.uf-stage.is-live .bars-mini span { animation: bargrow .45s cubic-bezier(.2,.9,.3,1) both; }
@keyframes bargrow { from { transform: scaleY(.1); } to { transform: scaleY(1); } }

.scanline {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--signal), var(--amber), transparent);
  opacity: 0; border-radius: 2px;
}
.unfold.is-scanning .scanline { animation: scan 3.2s ease-in-out infinite; }
@keyframes scan {
  0% { opacity: 0; transform: translateY(0); }
  10% { opacity: .9; }
  90% { opacity: .9; }
  100% { opacity: 0; transform: translateY(150px); }
}

/* ---------------- Section chrome ---------------- */
.divider {
  height: 12px; margin: 0 auto; max-width: var(--maxw);
  background-image: radial-gradient(circle, var(--line-strong) 1.2px, transparent 1.3px);
  background-size: 12px 12px; opacity: .8;
}
section { padding: 72px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-title { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 700; }
.section-sub { color: var(--ink-muted); margin-top: 10px; }

/* ---------------- Tabs & panels ---------------- */
.tabs {
  display: flex; gap: 6px; padding: 6px; margin: 0 auto 22px; max-width: 560px;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: .92rem;
  padding: 11px 12px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--signal); color: #fff; box-shadow: var(--shadow-sm); }

.panel { animation: fadein .3s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.panel-grid-short { grid-template-columns: 1fr 1fr; }

.pane {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm);
}
.pane-title { font-size: 1.05rem; margin-bottom: 18px; }
.control { margin-bottom: 16px; }
.control > label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 7px; color: var(--ink); }
.control-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.control-check { display: flex; align-items: center; gap: 10px; }
.control-check input { width: 18px; height: 18px; accent-color: var(--signal); cursor: pointer; }
.control-check label { margin: 0; font-weight: 500; font-size: .88rem; cursor: pointer; }
.hint { font-size: .78rem; color: var(--ink-muted); margin-top: 6px; }

.alias-row { display: flex; align-items: stretch; }
.alias-row .field { min-width: 0; }
.alias-prefix {
  display: flex; align-items: center; flex: 0 0 auto; white-space: nowrap;
  padding: 0 12px; font-size: .85rem; color: var(--ink-muted);
  background: var(--bg-sunken); border: 1px solid var(--line-strong); border-right: none;
  border-radius: var(--r-md) 0 0 var(--r-md);
}
.alias-row .field { border-radius: 0 var(--r-md) var(--r-md) 0; }

.tool-msg { font-size: .84rem; margin-top: 10px; min-height: 20px; color: var(--ink-muted); }
.tool-msg.is-error { color: #D93B3B; font-weight: 500; }
.tool-msg.is-ok { color: var(--signal); font-weight: 500; }

.result-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 220px; color: var(--slate); text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
}
.result-empty i { font-size: 1.7rem; }
.result-box { animation: popin .35s ease both; }
@keyframes popin { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.result-label {
  font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 8px;
}
.result-label + .result-label { margin-top: 18px; }
.badge {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 176, 32, .18); color: #9A6100; border: 1px solid rgba(255, 176, 32, .5);
  font-size: .68rem; letter-spacing: .04em;
}
[data-theme="dark"] .badge { color: var(--amber); }
.result-link {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 12px 12px 14px;
}
.result-link a { font-size: .95rem; font-weight: 500; word-break: break-all; }
.result-dest { font-size: .8rem; color: var(--ink-muted); word-break: break-all; }
.quick-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.quick-actions .btn { flex: 1; min-width: 150px; }

.preview-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; padding: 20px; overflow: auto;
  background:
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(-45deg, var(--bg-sunken) 25%, transparent 25%) 0 9px/18px 18px,
    linear-gradient(45deg, transparent 75%, var(--bg-sunken) 75%) 9px -9px/18px 18px,
    linear-gradient(-45deg, transparent 75%, var(--bg-sunken) 75%) -9px 0/18px 18px,
    var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.qr-canvas-holder, .bar-holder { display: flex; align-items: center; justify-content: center; max-width: 100%; animation: popin .4s ease both; }
.qr-canvas-holder canvas, .qr-canvas-holder svg { max-width: 100%; height: auto !important; display: block; border-radius: 6px; }
.bar-holder svg { max-width: 100%; height: auto; display: block; }
.export-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.export-row .btn { flex: 1; min-width: 96px; }

/* Presets, share link, decode block */
.preset-block { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line-strong); }
.preset-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.preset-row .field { flex: 1; }
.preset-row .icon-btn { width: 42px; flex: 0 0 auto; }

.decode-block { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line-strong); }
.decode-title { font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.decode-title i { color: var(--signal); }
.decode-block .file-row { margin-top: 12px; }
.decode-result { margin-top: 14px; animation: popin .35s ease both; }
.decode-result .result-link { margin-bottom: 10px; }
.decode-result .mono { font-size: .85rem; word-break: break-all; }

/* Frame preview wrapper — mirrors the exported frame so what you see matches */
.qr-framed { display: inline-block; background: #fff; }
.qr-framed.frame-border { padding: 14px; border: 4px solid var(--frame-color, #3654FF); border-radius: 14px; }
.qr-framed.frame-brackets {
  padding: 18px; position: relative; border-radius: 6px;
  background-image:
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF)),
    linear-gradient(var(--frame-color, #3654FF), var(--frame-color, #3654FF));
  background-repeat: no-repeat;
  background-size: 26px 5px, 5px 26px, 26px 5px, 5px 26px, 26px 5px, 5px 26px, 26px 5px, 5px 26px;
  background-position:
    left top, left top, right top, right top,
    left bottom, left bottom, right bottom, right bottom;
}
.qr-framed.frame-label {
  padding: 16px 16px 0; border: 4px solid var(--frame-color, #3654FF);
  border-radius: 16px; overflow: hidden;
}
.qr-frame-caption {
  display: block; margin: 14px -16px 0; padding: 10px 16px;
  background: var(--frame-color, #3654FF); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  letter-spacing: .14em; text-align: center; text-transform: uppercase;
}

.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-row { display: flex; gap: 10px; align-items: center; position: relative; }
.file-row .btn { cursor: pointer; }

/* ---------------- History & batch ---------------- */
.history {
  margin-top: 26px; padding: 22px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.history-head h3 { font-size: .95rem; display: inline-flex; align-items: center; gap: 8px; }
.history-head h3 i { color: var(--signal); }
.history-tools { display: flex; gap: 8px; }
#batch-toggle.is-on { background: var(--signal); color: #fff; border-color: var(--signal); }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.history-empty { color: var(--ink-muted); font-size: .86rem; }
.history-item {
  flex: 0 0 auto; max-width: 300px;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 8px 7px 14px;
  transition: border-color .18s ease, transform .18s ease;
}
.history-item:hover { border-color: var(--signal); transform: translateY(-1px); }
.history-item .hi-type {
  font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--signal); flex: 0 0 auto;
}
.history-item .hi-type.bar { color: var(--amber); }
.history-item .hi-text {
  font-family: var(--font-mono); font-size: .78rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px;
}
.history-item button { width: 30px; height: 30px; font-size: .8rem; border-radius: 50%; }

.batch { margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--line-strong); animation: fadein .25s ease both; }
.batch h4 { font-size: .95rem; margin-bottom: 6px; }
.batch textarea { margin-top: 10px; }
.batch-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.batch-controls .control { margin-bottom: 0; min-width: 200px; }
.batch-results { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; max-height: 340px; overflow: auto; }
.batch-results li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: .82rem;
}
.batch-results .br-src { font-family: var(--font-mono); color: var(--ink-muted); flex: 1; min-width: 160px; word-break: break-all; }
.batch-results .br-out { font-family: var(--font-mono); color: var(--signal); font-weight: 500; word-break: break-all; }
.batch-results .br-fail { color: #D93B3B; }
.batch-results img { width: 46px; height: 46px; border-radius: 4px; background: #fff; padding: 2px; }

/* ---------------- How it works ---------------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: none; }
.step {
  position: relative; padding: 28px 24px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: transform .2s ease, border-color .2s ease;
}
.step:hover { transform: translateY(-3px); border-color: var(--signal); }
.step-num {
  display: inline-block; font-size: 1.6rem; font-weight: 700; color: var(--signal);
  letter-spacing: -.04em; margin-bottom: 10px;
}
.step h3 { font-size: 1.08rem; margin-bottom: 8px; }
.step p { color: var(--ink-muted); font-size: .92rem; }

/* ---------------- Features ---------------- */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature-card {
  padding: 26px 22px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--signal); }
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: var(--signal-soft); color: var(--signal); font-size: 1.1rem; margin-bottom: 14px;
}
.feature-card:hover .feature-icon { background: rgba(255, 176, 32, .18); color: var(--amber); }
.feature-card h3 { font-size: 1.02rem; margin-bottom: 8px; }
.feature-card p { color: var(--ink-muted); font-size: .9rem; }
.feature-card code { font-size: .84rem; color: var(--ink); }

/* ---------------- FAQ ---------------- */
.accordion { display: grid; gap: 10px; }
.acc-item { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; transition: border-color .2s ease; }
.acc-item.is-open { border-color: var(--signal); }
.acc-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; background: transparent; border: none; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--ink);
}
.acc-btn:hover { color: var(--signal); }
.acc-icon { flex: 0 0 auto; color: var(--signal); transition: transform .28s ease; }
.acc-item.is-open .acc-icon { transform: rotate(45deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.acc-body-inner { padding: 0 20px 18px; color: var(--ink-muted); font-size: .94rem; }

/* ---------------- Footer ---------------- */
.footer { position: relative; padding: 56px 0 0; border-top: 1px solid var(--line); overflow: hidden; }
.footer-texture {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px;
  -webkit-mask-image: linear-gradient(to top, #000, transparent 85%);
  mask-image: linear-gradient(to top, #000, transparent 85%);
}
.footer-inner { position: relative; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-col h4 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--ink); font-size: .92rem; }
.footer-col a:hover { color: var(--signal); }
.footer-brand .brand { margin-bottom: 10px; }
.footer-tag { color: var(--ink-muted); font-size: .92rem; margin-bottom: 14px; }
.footer-bottom {
  position: relative; margin-top: 44px; padding: 20px 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: .85rem; color: var(--ink-muted);
}
.footer-mono { font-size: .78rem; color: var(--slate); letter-spacing: .04em; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-md); z-index: 300;
  opacity: 0; transition: opacity .22s ease, transform .22s ease; pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1000px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .uf-long { max-width: 190px; }
}

@media (max-width: 900px) {
  .panel-grid, .panel-grid-short { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  .nav-cta { display: none; }
  /* Theme + GitHub move inside the menu; only the hamburger stays on the right */
  .nav-actions > #gh-nav, .nav-actions > #theme-toggle { display: none; }
  .hamburger { display: inline-flex; }
  /* Menu stays in the DOM and animates open, so the tap feels smooth rather
     than snapping. Collapsed state is inert: no height, no focus, no taps. */
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0; transform: none;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--bg-elev); border-bottom: 1px solid transparent;
    box-shadow: var(--shadow-md);
    max-height: 0; opacity: 0; visibility: hidden; pointer-events: none;
    overflow: hidden; padding: 0 20px;
    transition: max-height .34s cubic-bezier(.4, 0, .2, 1),
                opacity .24s ease,
                padding .34s cubic-bezier(.4, 0, .2, 1),
                visibility 0s linear .34s,
                border-color .34s ease;
  }
  .nav-links.is-open {
    max-height: 460px; opacity: 1; visibility: visible; pointer-events: auto;
    padding: 12px 20px 18px; border-bottom-color: var(--line);
    transition: max-height .38s cubic-bezier(.16, 1, .3, 1),
                opacity .22s ease,
                padding .38s cubic-bezier(.16, 1, .3, 1),
                visibility 0s linear 0s,
                border-color .2s ease;
  }

  /* Each row eases in just behind the panel for a staggered reveal */
  .nav-links > a, .nav-mobile-actions {
    opacity: 0; transform: translateY(-8px);
    transition: opacity .26s ease, transform .26s ease;
  }
  .nav-links.is-open > a, .nav-links.is-open .nav-mobile-actions {
    opacity: 1; transform: translateY(0);
  }
  .nav-links.is-open > a:nth-of-type(1) { transition-delay: .06s; }
  .nav-links.is-open > a:nth-of-type(2) { transition-delay: .10s; }
  .nav-links.is-open > a:nth-of-type(3) { transition-delay: .14s; }
  .nav-links.is-open > a:nth-of-type(4) { transition-delay: .18s; }
  .nav-links.is-open .nav-mobile-actions { transition-delay: .22s; }

  .nav-links > a { padding: 12px 10px; font-size: 1rem; }

  /* Hamburger glyph swap animates instead of jumping */
  .hamburger i { transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
  .hamburger[aria-expanded="true"] i { transform: rotate(90deg); }
  .nav-mobile-actions {
    display: flex; align-items: center; gap: 10px; margin-top: 12px;
    padding-top: 14px; border-top: 1px solid var(--line);
  }
  .nav-mobile-icons { display: flex; gap: 8px; }
  .nav-mobile-icons .icon-btn { width: 44px; height: 44px; }
  .nav-mobile-actions .btn { flex: 1; }

  section { padding: 56px 0; }
  .hero { padding: 48px 0 52px; }
  .hero-form { flex-direction: column; border-radius: var(--r-md); }
  .hero-form .btn { width: 100%; }
  .hero-form .field { padding: 14px 14px 14px 42px; }

  .unfold-track { flex-wrap: wrap; gap: 10px; }
  .uf-arrow { transform: rotate(90deg); margin: 0; }
  .uf-stage { flex: 1 1 100%; }
  .uf-long { max-width: 100%; }
  .uf-box { width: 100%; }

  .tabs { flex-direction: column; max-width: 100%; }
  .tab { justify-content: flex-start; }
  .container { padding: 0 18px; }
  .pane { padding: 18px; }
  .quick-actions .btn { min-width: 100%; }
  .batch-controls .control { min-width: 100%; }
  .batch-controls .btn { flex: 1; }

  /* Logo reads a little small on a phone — bump the wordmark and mark */
  .brand-word { font-size: 1.6rem; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark svg { width: 36px; height: 36px; }

  /* Recent: keep every child inside the card instead of spilling past its edge.
     The pills become full-width rows so long links can't force a wider box. */
  .history { padding: 18px 16px; overflow: hidden; }
  .history-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .history-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .history-tools .btn { width: 100%; justify-content: center; }

  .history-list {
    display: flex; flex-direction: column; gap: 8px;
    overflow-x: hidden; max-width: 100%;
  }
  .history-item {
    width: 100%; max-width: 100%; flex: 0 0 auto;
    border-radius: var(--r-md); padding: 10px 10px 10px 14px;
    gap: 8px; box-sizing: border-box;
  }
  /* min-width:0 lets the ellipsis actually engage inside a flex row */
  .history-item .hi-text { flex: 1 1 auto; min-width: 0; max-width: none; }
  .history-item .hi-type { flex: 0 0 auto; }
  .history-item button { flex: 0 0 auto; }

  .batch-results { max-width: 100%; }
  .batch-results li { flex-direction: column; align-items: flex-start; }
  .batch-results .br-src, .batch-results .br-out { max-width: 100%; min-width: 0; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .brand-word { font-size: 1.28rem; }
  .export-row .btn { min-width: calc(50% - 5px); }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  /* Menu must still open/close instantly, without the staggered reveal */
  .nav-links > a, .nav-mobile-actions { opacity: 1; transform: none; }
  .uf-stage { opacity: 1; transform: none; }
  .scanline { display: none; }
  .btn:hover, .feature-card:hover, .step:hover, .icon-btn:hover, .history-item:hover { transform: none; }
}
