/* ==========================================================================
   CodeCraft — shared stylesheet
   Mobile-first. Breakpoints: 640px (phone→tablet), 900px (tablet→desktop)
   ========================================================================== */
:root{
  --paper:#FAF9F5;
  --paper-dim:#F0EEE7;
  --ink:#181B1D;
  --ink-soft:#5B615F;
  --line:#CDC8BB;
  --line-strong:#A39D8E;
  --line-soft:#E6E2D8;
  --laser:#D6361F;
  --laser-dim:#F6DAD3;
  --ok:#2E7D5B;
  --warn:#B4740B;
  --radius:6px;
  --radius-lg:12px;
  --shadow-sm:0 1px 2px rgba(24,27,29,.05);
  --shadow:0 4px 16px rgba(24,27,29,.07);
  --shadow-lg:0 18px 44px rgba(24,27,29,.13);
  --max:1100px;
  --ease:cubic-bezier(.22,.61,.36,1);
  --ring:0 0 0 3px rgba(24,27,29,.10);
}
*{box-sizing:border-box;}
html{scroll-behavior:smooth; -webkit-text-size-adjust:100%;}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:'Space Grotesk', system-ui, -apple-system, Segoe UI, sans-serif;
  line-height:1.55;
  font-size:16px;
  -webkit-font-smoothing:antialiased;
  overflow-x:clip;
}
.mono{ font-family:'JetBrains Mono', ui-monospace, monospace; }
a{ color:inherit; }
img,svg{ max-width:100%; }
h1,h2,h3,h4{ letter-spacing:-0.015em; }
::selection{ background:var(--laser-dim); }
:focus-visible{ outline:2px solid var(--laser); outline-offset:2px; border-radius:2px; }
.skip-link{ position:absolute; left:-9999px; top:0; background:var(--ink); color:var(--paper); padding:10px 16px; z-index:200; }
.skip-link:focus{ left:8px; top:8px; }

/* ---------- module grid backdrop (QR-module motif) ---------- */
.modules{
  position:absolute; inset:0;
  background-image: radial-gradient(var(--line) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 92%);
  mask-image: linear-gradient(to bottom, black, transparent 92%);
  opacity:.55;
  pointer-events:none;
}

header{ position:relative; }
.wrap{ max-width:var(--max); margin:0 auto; padding:0 18px; }

/* ==========================================================================
   TOP BAR + MOBILE NAV
   ========================================================================== */
.topbar{
  position:sticky; top:0; z-index:60;
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:13px 18px;
  background:rgba(250,249,245,.88);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--line);
}
.topbar-inner{ width:100%; max-width:var(--max); margin:0 auto; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.brand{ display:flex; align-items:center; gap:10px; font-weight:600; font-size:18px; text-decoration:none; flex:none; }
.brand img{ height:22px; width:auto; display:block; }

.nav-toggle{
  display:inline-flex; flex-direction:column; justify-content:center; gap:5px;
  width:42px; height:38px; padding:0 9px; cursor:pointer;
  background:transparent; border:1px solid var(--line-strong); border-radius:var(--radius);
  transition:border-color .16s, background-color .16s;
}
@media (hover:hover){ .nav-toggle:hover{ border-color:var(--ink); background:var(--paper-dim); } }
.nav-toggle span{ display:block; height:2px; width:100%; background:var(--ink); border-radius:2px; transition:transform .28s var(--ease), opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform:translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity:0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform:translateY(-7px) rotate(-45deg); }

nav#mainnav{
  position:absolute; top:100%; left:0; right:0; z-index:59;
  background:var(--paper); border-bottom:1px solid var(--line);
  padding:8px 18px 18px;
  display:none; flex-direction:column;
  box-shadow:var(--shadow);
  max-height:calc(100dvh - 64px); overflow-y:auto;
}
nav#mainnav.open{ display:flex; animation:navIn .22s var(--ease); }
@keyframes navIn{ from{ opacity:0; transform:translateY(-8px);} to{ opacity:1; transform:none;} }
nav#mainnav a{
  text-decoration:none; color:var(--ink-soft); font-size:16px;
  padding:12px 4px; border-bottom:1px solid var(--line-soft);
}
nav#mainnav a:last-child{ border-bottom:none; }
nav#mainnav a.active{ color:var(--ink); font-weight:600; }
nav#mainnav a.active::before{ content:"▸ "; color:var(--laser); }

@media (min-width:1040px){
  .nav-toggle{ display:none; }
  nav#mainnav{
    position:static; display:flex !important; flex-direction:row; align-items:center;
    background:transparent; border:none; box-shadow:none; padding:0; overflow:visible; max-height:none;
    animation:none;
  }
  nav#mainnav a{ font-size:14.5px; margin-left:clamp(14px,1.7vw,22px); padding:4px 0; border:none; position:relative; }
  nav#mainnav a::after{ content:""; position:absolute; left:0; right:0; bottom:-4px; height:2px; background:var(--line-strong); transform:scaleX(0); transform-origin:left; transition:transform .22s var(--ease); }
  nav#mainnav a:hover{ color:var(--ink); }
  nav#mainnav a:hover::after{ transform:scaleX(1); }
  nav#mainnav a.active{ color:var(--ink); }
  nav#mainnav a.active::before{ content:none; }
  nav#mainnav a.active::after{ background:var(--laser); transform:scaleX(1); }
}

/* ==========================================================================
   PAGE HEADERS
   ========================================================================== */
.page-header{ position:relative; padding:38px 18px 34px; border-bottom:1px solid var(--line); overflow:hidden; }
.page-header .wrap{ position:relative; padding:0; }
.eyebrow{ display:inline-block; width:56px; height:2px; background:var(--laser); margin-bottom:14px; }
.page-header h1{ font-size:clamp(25px,6vw,38px); line-height:1.12; margin:0 0 10px; max-width:22ch; }
.page-header p{ color:var(--ink-soft); font-size:15.5px; max-width:56ch; margin:0; }

.crumbs{ font-size:12.5px; color:var(--ink-soft); margin-bottom:14px; font-family:'JetBrains Mono',monospace; }
.crumbs a{ text-decoration:none; }
.crumbs a:hover{ color:var(--ink); }
.crumbs span{ opacity:.5; margin:0 6px; }

/* ==========================================================================
   HERO (home)
   ========================================================================== */
.hero{ position:relative; padding:40px 18px 52px; }
.hero-inner{ position:relative; max-width:var(--max); margin:0 auto; display:grid; grid-template-columns:1fr; gap:34px; align-items:center; }
.hero h1{ font-size:clamp(29px,7.4vw,46px); line-height:1.08; margin:0 0 14px; }
.lede{ color:var(--ink-soft); font-size:16.5px; max-width:46ch; margin:0 0 24px; }
.scan-line{ display:inline-block; width:56px; height:2px; background:var(--laser); margin-bottom:16px; }
.hero-cta{ display:flex; gap:10px; flex-wrap:wrap; }
.trust{ display:flex; gap:8px 20px; flex-wrap:wrap; margin-top:26px; font-size:13px; color:var(--ink-soft); font-family:'JetBrains Mono',monospace; }
.trust b{ color:var(--ink); font-weight:600; }
@media (min-width:900px){
  .hero{ padding:56px 18px 72px; }
  .hero-inner{ grid-template-columns:1.1fr .9fr; gap:52px; }
}

/* ---------- live demo card ---------- */
.demo{ background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius-lg); padding:20px; box-shadow:var(--shadow); }
.demo-label{ font-size:11.5px; color:var(--ink-soft); margin-bottom:8px; font-family:'JetBrains Mono',monospace; letter-spacing:.04em; }
.demo input[type=text]{
  width:100%; font-family:'JetBrains Mono', monospace; font-size:15px;
  padding:12px 13px; border:1px solid var(--line); border-radius:var(--radius);
  background:var(--paper-dim); color:var(--ink); outline:none; transition:border-color .16s, box-shadow .16s, background-color .16s;
}
.demo input[type=text]{ border-color:var(--line-strong); }
.demo input[type=text]:focus{ border-color:var(--ink); background:#fff; box-shadow:var(--ring); }
.qr-stage{ margin-top:18px; display:flex; justify-content:center; align-items:center; min-height:172px; position:relative; }
#qrPreview{ position:relative; }
#qrPreview canvas, #qrPreview img{ display:block; border:1px solid var(--line); border-radius:3px; }
.laser-sweep{ position:absolute; left:0; right:0; height:2px; background:var(--laser); box-shadow:0 0 10px 1px var(--laser); top:0; animation:sweep 1.5s ease-in-out 1; pointer-events:none; }
@keyframes sweep{ 0%{top:0; opacity:1;} 90%{opacity:1;} 100%{top:100%; opacity:0;} }
.demo-actions{ display:flex; gap:10px; margin-top:16px; justify-content:center; flex-wrap:wrap; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn{
  font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:14.5px; letter-spacing:.005em;
  padding:11px 20px; border-radius:var(--radius); border:1px solid var(--ink);
  background:var(--ink); color:var(--paper); cursor:pointer; text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; line-height:1.1;
  box-shadow:0 1px 0 rgba(24,27,29,.14), inset 0 1px 0 rgba(255,255,255,.07);
  transition:transform .16s var(--ease), background-color .18s, border-color .18s, color .18s, box-shadow .2s var(--ease);
  -webkit-tap-highlight-color:transparent;
}
.btn.ghost{ background:transparent; color:var(--ink); box-shadow:none; }
.btn.laser{ background:var(--laser); border-color:var(--laser); color:#fff; box-shadow:0 1px 0 rgba(120,20,8,.25), inset 0 1px 0 rgba(255,255,255,.14); }
.btn.sm{ font-size:13px; padding:8px 14px; min-height:38px; }
.btn.block{ width:100%; }

/* Hover: the border thickens (inset, so nothing shifts) and a laser
   "scan line" appears along the bottom edge — the site's own motif. */
@media (hover:hover){
  .btn:hover,
  .feature-card:hover .btn.ghost{
    transform:translateY(-1px);
    box-shadow:0 8px 18px -8px rgba(24,27,29,.45), inset 0 -3px 0 var(--laser);
  }
  .btn:not(.ghost):not(.laser):hover{ background:#0C0E0F; }
  .btn.ghost:hover,
  .feature-card:hover .btn.ghost{
    background:#fff; border-color:var(--ink);
    box-shadow:0 8px 18px -10px rgba(24,27,29,.35), inset 0 0 0 1px var(--ink), inset 0 -3px 0 var(--laser);
  }
  .btn.laser:hover{
    background:#B92C18; border-color:#B92C18;
    box-shadow:0 8px 18px -8px rgba(214,54,31,.6), inset 0 -3px 0 rgba(0,0,0,.28);
  }
}
.btn:active{ transform:translateY(0); box-shadow:inset 0 2px 4px rgba(0,0,0,.22); transition-duration:.05s; }
.btn.ghost:active{ background:var(--paper-dim); box-shadow:inset 0 0 0 1px var(--ink); }
.btn:focus-visible{ outline:2px solid var(--laser); outline-offset:3px; border-radius:var(--radius); }
.btn:disabled{ opacity:.4; cursor:not-allowed; transform:none !important; box-shadow:none !important; }
.btn-row{ display:flex; gap:9px; flex-wrap:wrap; }

/* ==========================================================================
   AD SLOTS  (AdSense-ready)
   ========================================================================== */
.ad-slot{ max-width:var(--max); margin:0 auto; padding:0 18px; }
.ad-slot .ad-label{ font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-soft); opacity:.7; text-align:center; margin-bottom:6px; font-family:'JetBrains Mono',monospace; }
.ad-box{
  border:1px dashed var(--line); border-radius:var(--radius); min-height:100px;
  display:flex; align-items:center; justify-content:center; text-align:center;
  color:var(--ink-soft); font-size:11.5px; font-family:'JetBrains Mono',monospace;
  background:var(--paper-dim); padding:12px; overflow:hidden;
}
.ad-unit{ margin:28px 0; }
.ad-unit ins.adsbygoogle{ display:block; }
/* sticky mobile anchor ad */
.ad-sticky{ position:fixed; left:0; right:0; bottom:0; z-index:70; background:var(--paper); border-top:1px solid var(--line); padding:6px 10px; display:none; }
.ad-sticky .ad-box{ min-height:50px; margin:0; }
.ad-sticky .close{ position:absolute; top:-24px; right:8px; background:var(--paper); border:1px solid var(--line); border-bottom:none; border-radius:4px 4px 0 0; font-size:11px; padding:2px 9px; cursor:pointer; color:var(--ink-soft); }
@media (max-width:899px){ .ad-sticky.on{ display:block; } body.has-sticky-ad{ padding-bottom:78px; } }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
section.tool{ padding:44px 18px; border-top:1px solid var(--line); }
.tool-inner{ max-width:var(--max); margin:0 auto; }
.tool-head{ margin-bottom:24px; }
.tool-head h2{ font-size:clamp(21px,4.6vw,27px); margin:0; }
.tool-head p{ color:var(--ink-soft); margin:7px 0 0; font-size:14.5px; max-width:60ch; }
@media (min-width:900px){ section.tool{ padding:62px 18px; } }

/* ==========================================================================
   TOOL WORKBENCH  (shared by all four tools)
   ========================================================================== */
.panel{ display:grid; grid-template-columns:minmax(0,1fr); gap:22px; }
@media (min-width:900px){ .panel{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:32px; align-items:start; } }
.panel.wide-preview{ grid-template-columns:minmax(0,1fr); }
@media (min-width:900px){ .panel.wide-preview{ grid-template-columns:minmax(0,420px) minmax(0,1fr); } }

.controls{ background:#fff; border:1px solid var(--line); border-radius:var(--radius-lg); padding:20px; box-shadow:var(--shadow-sm); transition:border-color .2s; }
@media (hover:hover){ .controls:hover{ border-color:var(--line-strong); } }
.controls-title{ font-size:12px; font-family:'JetBrains Mono',monospace; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-soft); margin:0 0 14px; }

.field{ margin-bottom:15px; }
.field:last-child{ margin-bottom:0; }
.field label{ display:block; font-size:12.5px; color:var(--ink-soft); margin-bottom:6px; font-weight:500; }
.field .hint{ font-size:11.5px; color:var(--ink-soft); opacity:.85; margin-top:5px; }
.field select, .field input[type=text], .field input[type=number], .field input[type=url], .field input[type=email], .field input[type=tel], .field textarea{
  width:100%; font-family:'JetBrains Mono',monospace; font-size:15px;
  padding:11px 12px; border:1px solid var(--line-strong); border-radius:var(--radius);
  background:#fff; color:var(--ink); outline:none; transition:border-color .16s, box-shadow .16s;
  -webkit-appearance:none; appearance:none;
}
.field select{
  background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg width='11' height='7' viewBox='0 0 11 7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%235B615F' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center; padding-right:34px;
}
@media (hover:hover){ .field input:hover, .field select:hover, .field textarea:hover{ border-color:var(--ink-soft); } }
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--ink); box-shadow:var(--ring); }
.field textarea{ resize:vertical; min-height:110px; line-height:1.6; }
.field input.invalid{ border-color:var(--laser); background:#fff7f5; }
.field input.invalid:focus{ box-shadow:0 0 0 3px rgba(214,54,31,.14); }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.row3{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (min-width:640px){ .row3{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:420px){ .row2{ grid-template-columns:1fr; } }

/* ---------- tabs (QR type selector) ---------- */
.tabs{ display:flex; gap:6px; overflow-x:auto; padding-bottom:6px; margin-bottom:16px; -webkit-overflow-scrolling:touch; scrollbar-width:thin; }
.tabs::-webkit-scrollbar{ height:4px; }
.tabs::-webkit-scrollbar-thumb{ background:var(--line); border-radius:4px; }
.tab{
  flex:none; font-family:'Space Grotesk',sans-serif; font-size:13.5px; font-weight:500;
  padding:9px 14px; border:1px solid var(--line-strong); border-radius:999px;
  background:#fff; color:var(--ink-soft); cursor:pointer; white-space:nowrap;
  display:inline-flex; align-items:center; gap:7px; transition:background-color .16s, border-color .16s, color .16s, box-shadow .16s;
}
@media (hover:hover){ .tab:hover{ border-color:var(--ink); color:var(--ink); background:var(--paper-dim); box-shadow:inset 0 0 0 1px var(--ink); } }
.tab.active{ background:var(--ink); border-color:var(--ink); color:var(--paper); box-shadow:none; }
@media (hover:hover){ .tab.active:hover{ background:#0C0E0F; color:var(--paper); box-shadow:inset 0 -3px 0 var(--laser); } }
.tab:focus-visible{ outline-offset:3px; }
.tab .ic{ font-size:14px; line-height:1; }
.tabpane{ display:none; }
.tabpane.active{ display:block; animation:fadeIn .2s var(--ease); }
@keyframes fadeIn{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;} }

/* ---------- color picker row ---------- */
.color-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.color-chip{ position:relative; width:44px; height:44px; border-radius:var(--radius); border:1px solid var(--line-strong); overflow:hidden; flex:none; cursor:pointer; padding:0; background:#fff; }
.color-chip input[type=color]{ position:absolute; inset:-6px; width:calc(100% + 12px); height:calc(100% + 12px); border:none; padding:0; cursor:pointer; background:transparent; }
.color-hex{ font-family:'JetBrains Mono',monospace; font-size:13px; color:var(--ink-soft); text-transform:uppercase; }
.swatches{ display:flex; gap:9px; flex-wrap:wrap; }
.swatch{ width:30px; height:30px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px var(--line); cursor:pointer; transition:transform .14s var(--ease); }
@media (hover:hover){ .swatch:hover{ transform:scale(1.12); } }
.swatch.active{ box-shadow:0 0 0 2px var(--ink); }

/* ---------- range slider ---------- */
.range-head{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:6px; }
.range-val{ font-family:'JetBrains Mono',monospace; font-size:12.5px; color:var(--ink); background:var(--paper-dim); border:1px solid var(--line-strong); border-radius:4px; padding:1px 7px; }
input[type=range]{ width:100%; -webkit-appearance:none; appearance:none; background:transparent; height:26px; cursor:pointer; margin:0; }
input[type=range]::-webkit-slider-runnable-track{ height:4px; background:var(--line); border-radius:4px; }
input[type=range]::-moz-range-track{ height:4px; background:var(--line); border-radius:4px; }
input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; width:20px; height:20px; border-radius:50%; background:var(--ink); border:3px solid var(--paper); box-shadow:0 0 0 1px var(--line); margin-top:-8px; }
input[type=range]::-moz-range-thumb{ width:20px; height:20px; border-radius:50%; background:var(--ink); border:3px solid var(--paper); box-shadow:0 0 0 1px var(--line); }

/* ---------- switch ---------- */
.switch-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid var(--line-soft); }
.switch-row:last-of-type{ border-bottom:none; }
.switch-row .lbl{ font-size:14px; }
.switch-row .lbl small{ display:block; font-size:11.5px; color:var(--ink-soft); }
.switch{ position:relative; flex:none; width:46px; height:27px; }
.switch input{ opacity:0; width:0; height:0; position:absolute; }
.switch .track{ position:absolute; inset:0; background:var(--line); border-radius:999px; transition:background .2s; cursor:pointer; }
.switch .track::after{ content:""; position:absolute; top:3px; left:3px; width:21px; height:21px; background:#fff; border-radius:50%; transition:transform .22s var(--ease); box-shadow:var(--shadow-sm); }
.switch input:checked + .track{ background:var(--ok); }
.switch input:checked + .track::after{ transform:translateX(19px); }
.switch input:focus-visible + .track{ outline:2px solid var(--laser); outline-offset:2px; }

/* ---------- file drop ---------- */
.dropzone{
  border:2px dashed var(--line-strong); border-radius:var(--radius-lg); background:var(--paper-dim);
  padding:28px 18px; text-align:center; cursor:pointer; transition:all .18s var(--ease);
}
.dropzone:hover, .dropzone.drag{ border-color:var(--laser); background:#fff; box-shadow:0 0 0 3px rgba(214,54,31,.10); }
.dropzone .dz-ic{ font-size:26px; display:block; margin-bottom:8px; }
.dropzone .dz-main{ font-size:14.5px; font-weight:600; }
.dropzone .dz-sub{ font-size:12.5px; color:var(--ink-soft); margin-top:4px; }
.file-pill{ display:inline-flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--line); border-radius:999px; padding:5px 6px 5px 12px; font-size:12.5px; font-family:'JetBrains Mono',monospace; margin-top:10px; }
.file-pill button{ border:none; background:var(--paper-dim); width:22px; height:22px; border-radius:50%; cursor:pointer; color:var(--ink-soft); font-size:13px; line-height:1; transition:background-color .16s, color .16s; }
@media (hover:hover){ .file-pill button:hover{ background:var(--laser); color:#fff; } }

/* ---------- preview ---------- */
.preview-card{
  background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius-lg); padding:20px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:280px; gap:14px; box-shadow:var(--shadow-sm); position:relative; overflow:hidden;
}
.preview-card.checker{
  background-image:linear-gradient(45deg,#F2F0EA 25%,transparent 25%),linear-gradient(-45deg,#F2F0EA 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#F2F0EA 75%),linear-gradient(-45deg,transparent 75%,#F2F0EA 75%);
  background-size:16px 16px; background-position:0 0,0 8px,8px -8px,-8px 0;
}
.preview-card svg, .preview-card canvas, .preview-card img{ max-width:100%; height:auto; }
.preview-stage{ display:flex; align-items:center; justify-content:center; width:100%; min-height:200px; }
.preview-meta{ font-family:'JetBrains Mono',monospace; font-size:11.5px; color:var(--ink-soft); text-align:center; }
.preview-toolbar{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; width:100%; }
.sticky-preview{ position:sticky; top:74px; }
@media (max-width:899px){ .sticky-preview{ position:static; } }

.status{ font-size:12.5px; font-family:'JetBrains Mono',monospace; color:var(--ok); min-height:18px; margin-top:10px; display:flex; align-items:center; gap:6px; }
.status.err{ color:var(--laser); }
.status.warn{ color:var(--warn); }

/* ---------- toast ---------- */
.toast{
  position:fixed; left:50%; bottom:24px; transform:translate(-50%,20px);
  background:var(--ink); color:var(--paper); padding:11px 18px; border-radius:999px;
  font-size:13.5px; z-index:120; opacity:0; pointer-events:none; transition:all .25s var(--ease);
  box-shadow:var(--shadow-lg); max-width:90vw; text-align:center;
}
.toast.show{ opacity:1; transform:translate(-50%,0); }

/* ---------- results grid (bulk tool) ---------- */
.result-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:14px; }
.result-item{ background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:12px; text-align:center; }
.result-item canvas, .result-item svg{ max-width:100%; height:auto; }
.result-item .cap{ font-family:'JetBrains Mono',monospace; font-size:10.5px; color:var(--ink-soft); margin-top:8px; word-break:break-all; line-height:1.35; }
.result-item .mini{ margin-top:8px; font-size:11.5px; background:none; border:1px solid var(--line-strong); border-radius:4px; padding:5px 10px; cursor:pointer; transition:background-color .16s, border-color .16s, color .16s; }
@media (hover:hover){ .result-item .mini:hover{ background:var(--ink); border-color:var(--ink); color:var(--paper); } }

/* ---------- scan result ---------- */
.scan-out{ width:100%; background:var(--paper-dim); border:1px solid var(--line); border-radius:var(--radius); padding:14px; }
.scan-out .k{ font-size:11px; font-family:'JetBrains Mono',monospace; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.08em; }
.scan-out .v{ font-family:'JetBrains Mono',monospace; font-size:14px; word-break:break-all; margin-top:6px; line-height:1.6; }
video#camFeed{ width:100%; border-radius:var(--radius); background:#000; display:block; }

/* ==========================================================================
   CONTENT / INFO BLOCKS (AdSense-friendly written content)
   ========================================================================== */
.prose{ max-width:72ch; }
.prose h2{ font-size:clamp(19px,4.2vw,23px); margin:34px 0 10px; }
.prose h3{ font-size:16.5px; margin:24px 0 8px; }
.prose h2:first-child, .prose h3:first-child{ margin-top:0; }
.prose p, .prose li{ color:var(--ink-soft); font-size:15.5px; line-height:1.75; }
.prose ul, .prose ol{ padding-left:20px; }
.prose li{ margin-bottom:7px; }
.prose strong{ color:var(--ink); font-weight:600; }
.prose a{ color:var(--ink); border-bottom:1px solid var(--line); text-decoration:none; }
.prose a{ transition:border-color .16s, color .16s; }
.prose a:hover{ border-color:var(--laser); }

.info-grid{ display:grid; grid-template-columns:1fr; gap:18px; }
@media (min-width:700px){ .info-grid{ grid-template-columns:1fr 1fr; } }
.info-card{ background:#fff; border:1px solid var(--line); border-radius:var(--radius-lg); padding:22px; transition:border-color .2s, box-shadow .2s; }
@media (hover:hover){ .info-card:hover{ border-color:var(--line-strong); box-shadow:var(--shadow-sm); } }
.info-card h3{ font-size:16.5px; margin:0 0 8px; display:flex; align-items:center; gap:9px; }
.info-card h3 .n{ font-family:'JetBrains Mono',monospace; font-size:12px; color:var(--laser); border:1px solid var(--laser-dim); background:var(--laser-dim); border-radius:3px; padding:1px 6px; }
.info-card p{ color:var(--ink-soft); font-size:14.5px; margin:0; line-height:1.7; }

.callout{ background:var(--paper-dim); border-left:3px solid var(--laser); border-radius:0 var(--radius) var(--radius) 0; padding:16px 18px; margin:22px 0; }
.callout p{ margin:0; font-size:14.5px; color:var(--ink-soft); }
.callout strong{ color:var(--ink); }

/* table */
.table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; margin:18px 0; border:1px solid var(--line-strong); border-radius:var(--radius); background:#fff; }
table.spec{ width:100%; border-collapse:collapse; min-width:520px; font-size:14px; }
table.spec th, table.spec td{ text-align:left; padding:11px 14px; border-bottom:1px solid var(--line-soft); }
table.spec th{ background:var(--paper-dim); font-size:12.5px; font-weight:600; white-space:nowrap; }
table.spec td{ color:var(--ink-soft); }
table.spec td:first-child{ color:var(--ink); font-family:'JetBrains Mono',monospace; font-size:13px; white-space:nowrap; }
table.spec tr:last-child td{ border-bottom:none; }

/* ---------- steps ---------- */
.steps{ display:grid; grid-template-columns:1fr; gap:20px; }
@media (min-width:700px){ .steps{ grid-template-columns:repeat(3,1fr); } }
.step{ border-top:2px solid var(--ink); padding-top:12px; }
.step h3{ font-size:15.5px; margin:0 0 6px; }
.step p{ font-size:14px; color:var(--ink-soft); margin:0; }

/* ---------- FAQ ---------- */
details{ border-bottom:1px solid var(--line); padding:15px 0; transition:border-color .18s; }
@media (hover:hover){ details:hover{ border-bottom-color:var(--line-strong); } }
details summary{ cursor:pointer; font-weight:500; font-size:15.5px; list-style:none; display:flex; justify-content:space-between; align-items:center; gap:14px; }
details summary::-webkit-details-marker{ display:none; }
details summary::after{ content:"+"; font-family:'JetBrains Mono',monospace; color:var(--laser); font-size:20px; flex:none; line-height:1; }
details[open] summary::after{ content:"–"; }
details p{ color:var(--ink-soft); font-size:14.5px; margin:10px 0 0; line-height:1.7; }
details ul{ color:var(--ink-soft); font-size:14.5px; margin:10px 0 0; padding-left:20px; }

/* ---------- tool cards (home) ---------- */
.feature-grid{ display:grid; grid-template-columns:1fr; gap:18px; }
@media (min-width:640px){ .feature-grid{ grid-template-columns:1fr 1fr; } }
.feature-card{
  background:#fff; border:1px solid var(--line); border-radius:var(--radius-lg); padding:24px;
  display:flex; flex-direction:column; transition:transform .22s var(--ease), box-shadow .22s, border-color .22s;
  text-decoration:none; color:inherit;
}
.feature-card:focus-visible{ outline-offset:4px; border-radius:var(--radius-lg); }
@media (hover:hover){ .feature-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); border-color:var(--ink); } }
.feature-card .btn, .feature-card .tag{ align-self:flex-start; }
.feature-card .mark{ width:32px; height:32px; margin-bottom:14px; }
.feature-card h3{ font-size:18px; margin:0 0 8px; }
.feature-card p{ color:var(--ink-soft); font-size:14.5px; margin:0 0 16px; flex:1; }
.tag{ display:inline-block; font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); border:1px solid var(--line); border-radius:999px; padding:2px 9px; margin-bottom:12px; }
.tag.new{ color:var(--laser); border-color:var(--laser-dim); background:var(--laser-dim); }

/* ---------- related tools strip ---------- */
.related{ display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:640px){ .related{ grid-template-columns:repeat(3,1fr); } }
@media (min-width:1000px){ .related{ grid-template-columns:repeat(5,1fr); } }
.related a{ display:block; background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:15px 16px; text-decoration:none; transition:border-color .18s, transform .2s var(--ease), box-shadow .2s; }
@media (hover:hover){ .related a:hover{ border-color:var(--ink); transform:translateY(-2px); box-shadow:inset 0 -3px 0 var(--laser), var(--shadow-sm); } }
.related a b{ display:block; font-size:14.5px; margin-bottom:3px; }
.related a span{ font-size:12.5px; color:var(--ink-soft); }

/* ---------- legal / content pages ---------- */
.content-page{ max-width:780px; margin:0 auto; padding:36px 18px 70px; }
.content-page h2{ font-size:19.5px; margin:32px 0 10px; }
.content-page h2:first-of-type{ margin-top:0; }
.content-page p, .content-page li{ color:var(--ink-soft); font-size:15.5px; line-height:1.75; }
.content-page ul{ padding-left:20px; }
.content-page li{ margin-bottom:6px; }
.content-page a{ color:var(--ink); border-bottom:1px solid var(--line); text-decoration:none; }
.content-page .updated{ font-size:12.5px; color:var(--ink-soft); font-family:'JetBrains Mono',monospace; margin-bottom:8px; }

/* ---------- contact ---------- */
.contact-grid{ display:grid; grid-template-columns:1fr; gap:28px; max-width:var(--max); margin:0 auto; padding:40px 18px 70px; }
@media (min-width:900px){ .contact-grid{ grid-template-columns:1fr 1fr; gap:44px; } }
.contact-info h2{ font-size:21px; margin:0 0 12px; }
.contact-info p{ color:var(--ink-soft); font-size:15px; margin:0 0 20px; }
.contact-detail{ display:flex; align-items:center; gap:10px; font-family:'JetBrains Mono',monospace; font-size:14px; margin-bottom:10px; word-break:break-all; }
.contact-detail a{ text-decoration:none; border-bottom:1px solid var(--line); }
.contact-form{ background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius-lg); padding:24px; box-shadow:var(--shadow-sm); }
.form-note{ font-size:12.5px; color:var(--ink-soft); margin-top:12px; }

/* ---------- footer ---------- */
footer{ border-top:1px solid var(--line); padding:34px 18px; background:var(--paper-dim); }
.footer-inner{ max-width:var(--max); margin:0 auto; display:grid; grid-template-columns:1fr 1fr; gap:26px; }
@media (min-width:900px){ .footer-inner{ grid-template-columns:1.4fr 1fr 1fr 1fr; } }
.footer-col{ min-width:0; }
.footer-col:first-child{ grid-column:1 / -1; max-width:300px; }
@media (min-width:900px){ .footer-col:first-child{ grid-column:auto; } }
.footer-col h4{ font-size:12px; color:var(--ink); margin:0 0 12px; font-family:'JetBrains Mono',monospace; letter-spacing:.06em; text-transform:uppercase; }
.footer-col a{ display:block; text-decoration:none; color:var(--ink-soft); font-size:14px; margin-bottom:9px; }
.footer-col a{ transition:color .15s, transform .18s var(--ease); }
.footer-col a:hover{ color:var(--ink); }
@media (hover:hover){ .footer-col a:hover{ transform:translateX(3px); } }
.footer-bottom{ max-width:var(--max); margin:26px auto 0; padding-top:18px; border-top:1px solid var(--line); display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; color:var(--ink-soft); font-size:12.5px; }

/* back to top */
.to-top{ position:fixed; right:14px; bottom:14px; z-index:65; width:44px; height:44px; border-radius:50%; background:var(--ink); color:var(--paper); border:1px solid var(--ink); cursor:pointer; display:none; align-items:center; justify-content:center; font-size:17px; box-shadow:var(--shadow); transition:transform .18s var(--ease), box-shadow .18s; }
@media (hover:hover){ .to-top:hover{ transform:translateY(-2px); box-shadow:var(--shadow), inset 0 -3px 0 var(--laser); } }
.to-top.on{ display:flex; }
body.has-sticky-ad .to-top{ bottom:86px; }

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; scroll-behavior:auto !important; }
}

/* ==========================================================================
   MOBILE REFINEMENTS
   ========================================================================== */

/* iOS zooms the page when a focused control is under 16px — pin them at 16 */
@media (max-width:640px){
  .field select, .field input[type=text], .field input[type=number],
  .field input[type=url], .field input[type=email], .field input[type=tel],
  .field textarea, .demo input[type=text]{ font-size:16px; }
}

/* On a phone the inputs come first and the live preview sits below them
   (same order as the markup, so nothing needs reordering here). */

/* Native dropdown groups inherit nothing from the styled select */
.field optgroup{ font-family:'Space Grotesk',sans-serif; font-size:13px; color:var(--ink-soft); }
.field optgroup option{ font-family:'JetBrains Mono',monospace; color:var(--ink); }

/* Nothing should ever be able to push the page sideways */
.tool-inner, .panel, .controls, .prose, .content-page{ min-width:0; }
.prose p, .prose li, .content-page p, .content-page li{ overflow-wrap:anywhere; }
.preview-meta, .scan-out .v{ overflow-wrap:anywhere; }

/* Comfortable tap targets on small screens */
@media (max-width:640px){
  .btn.sm{ min-height:42px; padding:10px 14px; }
  .tab{ padding:11px 15px; }
  .swatch{ width:34px; height:34px; }
  .preview-toolbar .btn{ flex:1 1 calc(50% - 4px); }
  .preview-toolbar .btn:first-child{ flex-basis:100%; }
  .result-grid{ grid-template-columns:repeat(auto-fill,minmax(112px,1fr)); gap:10px; }
  .footer-bottom{ flex-direction:column; gap:6px; }
}

/* Ad slots should never look like part of the tool */
.ad-unit{ position:relative; }
@media (max-width:640px){
  .ad-slot{ padding:0 14px; }
  .ad-unit{ margin:22px 0; }
}

/* Print: drop the site furniture, keep the code */
@media print{
  .topbar, nav#mainnav, .ad-slot, .ad-sticky, .to-top, footer, .crumbs,
  .controls, .preview-toolbar, details, .related{ display:none !important; }
  body{ background:#fff; }
  .preview-card{ border:none; box-shadow:none; background:#fff; }
}

/* ==========================================================================
   SMALL-SCREEN HARDENING
   Notched devices, 320px phones, and the landscape/keyboard edge cases.
   ========================================================================== */

/* Respect the notch and the home indicator on iPhone (viewport-fit=cover) */
.topbar{
  padding-left:max(18px, env(safe-area-inset-left));
  padding-right:max(18px, env(safe-area-inset-right));
}
.ad-sticky{
  padding-bottom:max(6px, env(safe-area-inset-bottom));
  padding-left:max(10px, env(safe-area-inset-left));
  padding-right:max(10px, env(safe-area-inset-right));
}
@media (max-width:899px){
  body.has-sticky-ad{ padding-bottom:calc(78px + env(safe-area-inset-bottom)); }
}
.to-top{
  right:max(14px, env(safe-area-inset-right));
  bottom:max(14px, env(safe-area-inset-bottom));
}
.wrap, .tool-inner, .ad-slot, .contact-grid, .content-page, footer, .hero{
  padding-left:max(18px, env(safe-area-inset-left));
  padding-right:max(18px, env(safe-area-inset-right));
}
section.tool{ padding-left:0; padding-right:0; }
/* content column = --max everywhere (was 1064px in sections vs 1100px in the hero) */
.tool-inner, .ad-slot, .contact-grid{ max-width:calc(var(--max) + 36px); }

/* 320–420px: stop the two-column blocks from crushing */
@media (max-width:430px){
  .footer-inner{ grid-template-columns:1fr; gap:22px; }
  .footer-col:first-child{ max-width:none; }
  .row3{ grid-template-columns:1fr; }
  .hero{ padding-top:30px; padding-bottom:40px; }
  .page-header{ padding:28px 18px 26px; }
  .controls{ padding:16px; }
  .feature-card{ padding:20px; }
  .info-card{ padding:18px; }
  .demo{ padding:16px; }
  .preview-card{ padding:14px; min-height:230px; }
  .switch-row .lbl{ font-size:13.5px; }
  .contact-detail{ font-size:13px; }
}

/* Landscape phone, or an open keyboard shrinking the viewport: let the tool
   preview scroll away instead of eating the whole screen. */
@media (max-height:520px) and (max-width:899px){
  .preview-card{ min-height:0; }
  .preview-stage{ min-height:120px; }
  nav#mainnav{ max-height:calc(100dvh - 64px); }
}

/* Reserve space before the code renders so nothing jumps (CLS) */
#qrCanvas, #bcSvg{ min-height:180px; }
.qr-stage{ min-height:172px; }
#scanOut:empty{ min-height:120px; }

/* The scanner's camera feed should never outgrow the viewport */
video#camFeed{ max-height:60vh; object-fit:cover; }

/* Wide tables and code values get their own scroll, never the page */
.table-scroll{ max-width:100%; }
.scan-out{ max-width:100%; overflow:hidden; }

/* Keep the sticky bar clear of the sticky preview at every height */
.sticky-preview{ top:calc(64px + 10px); }

/* ==========================================================================
   OPTIONAL "CUSTOMISE" DISCLOSURE — used inside the QR/barcode/bulk tools
   so the default view is just the one field that matters. Overrides the
   plain FAQ-style <details> rules above for this specific variant.
   ========================================================================== */
details.customize{
  border-bottom:1px solid var(--line);
  padding:16px 20px;
  margin-bottom:0;
}
details.customize summary{
  font-size:14px; font-family:'JetBrains Mono',monospace; letter-spacing:.03em;
  color:var(--ink-soft); font-weight:500; padding:2px 0;
}
details.customize summary small{
  font-family:'Space Grotesk',sans-serif; text-transform:none; letter-spacing:0;
  color:var(--ink-soft); opacity:.7; font-weight:400; margin-left:2px;
}
details.customize summary::after{ content:"⌄"; font-size:16px; color:var(--ink-soft); transition:transform .15s; }
details.customize[open] summary::after{ transform:rotate(180deg); }
details.customize[open] summary{ margin-bottom:4px; }

/* ==========================================================================
   CUSTOM-COLOUR SWATCH
   Sits inline with the preset swatches but is a real <input type=color>,
   styled as a swatch with a small conic-gradient ring so it reads as
   "pick your own" rather than looking like a broken preset.
   ========================================================================== */
.swatch-custom{
  position:relative; width:30px; height:30px; border-radius:50%;
  border:2px solid #fff; box-shadow:0 0 0 1px var(--line);
  background:conic-gradient(from 180deg,#D6361F,#B45309,#2E7D5B,#1D4ED8,#6D28D9,#D6361F);
  cursor:pointer; transition:transform .14s var(--ease); overflow:hidden;
}
.swatch-custom.active{ box-shadow:0 0 0 2px var(--ink); }
.swatch-custom input[type=color]{
  position:absolute; inset:-4px; width:calc(100% + 8px); height:calc(100% + 8px);
  border:none; padding:0; cursor:pointer; opacity:0;
}
@media (hover:hover){ .swatch-custom:hover{ transform:scale(1.12); } }
@media (max-width:640px){ .swatch-custom{ width:34px; height:34px; } }

/* ==========================================================================
   NEW SIMPLE TOOLS — UPI QR generator + check-digit calculator
   ========================================================================== */
.amount-wrap{ position:relative; }
.amount-wrap .cur{
  position:absolute; left:1px; top:1px; bottom:1px; width:38px;
  display:flex; align-items:center; justify-content:center;
  background:var(--paper-dim); border-right:1px solid var(--line-strong);
  border-radius:var(--radius) 0 0 var(--radius);
  font-family:'JetBrains Mono',monospace; font-size:15px; color:var(--ink-soft); pointer-events:none;
}
.amount-wrap input{ padding-left:52px !important; }

.upi-summary{ width:100%; text-align:center; }
.upi-summary .pn{ font-weight:600; font-size:16px; }
.upi-summary .pa{ font-family:'JetBrains Mono',monospace; font-size:12.5px; color:var(--ink-soft); overflow-wrap:anywhere; }
.upi-summary .am{ font-size:22px; font-weight:700; letter-spacing:-.01em; margin-top:2px; }
#upiCanvas{ min-height:180px; }

/* check-digit result */
.big-code{
  width:100%; text-align:center; padding:22px 14px 18px;
  background:var(--paper-dim); border:1px solid var(--line); border-radius:var(--radius);
}
.big-code .k{ font-size:11px; font-family:'JetBrains Mono',monospace; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.08em; }
.big-code .num{
  font-family:'JetBrains Mono',monospace; font-weight:600;
  font-size:clamp(20px,5.6vw,30px); letter-spacing:.06em; margin-top:8px; overflow-wrap:anywhere; line-height:1.3;
}
.big-code .num .chk{ color:#fff; background:var(--laser); border-radius:4px; padding:0 6px; margin-left:3px; }
.big-code.ok{ border-color:var(--ok); }
.big-code.bad{ border-color:var(--laser); }
.big-code .verdict{ margin-top:10px; font-size:14px; font-weight:600; }
.big-code.ok .verdict{ color:var(--ok); }
.big-code.bad .verdict{ color:var(--laser); }
.big-code.idle .num{ color:var(--line-strong); }

.work-table{ width:100%; border-collapse:collapse; font-family:'JetBrains Mono',monospace; font-size:12.5px; margin-top:6px; }
.work-table th, .work-table td{ padding:6px 4px; text-align:center; border-bottom:1px solid var(--line-soft); }
.work-table th{ font-weight:500; color:var(--ink-soft); text-align:left; padding-left:0; white-space:nowrap; }
.work-table td.w3{ background:var(--laser-dim); }
.work-wrap{ overflow-x:auto; max-width:100%; }
