:root{
  font-family:Inter,system-ui,sans-serif;
  color:#111827;
  background:#f5f7f9;
  --ink:#111827;
  --soft:#344054;
  --muted:#667085;
  --line:#d9e0e7;
  --surface:#fff;
  --surface-soft:#f7f9fb;
  --primary:#111827;
  --primary-text:#fff;
  --success:#157f3b;
  --danger:#b42318;
  --shadow:0 18px 55px rgba(16,24,40,.08);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;min-width:320px;min-height:100svh;background:linear-gradient(180deg,#fff 0,#f5f7f9 58%,#eef2f5 100%);color:var(--ink)}
button,input,select{font:inherit}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{outline:3px solid rgba(17,24,39,.22);outline-offset:3px}

.site-header{position:sticky;top:0;z-index:20;border-bottom:1px solid rgba(217,224,231,.9);background:rgba(255,255,255,.94);backdrop-filter:blur(18px)}
.header-inner{display:flex;align-items:center;justify-content:space-between;gap:24px;width:min(1440px,100%);min-height:72px;margin:auto;padding:0 clamp(18px,3vw,34px)}
.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none;font-size:1.05rem;font-weight:800;letter-spacing:-.02em}
.brand span{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--primary);color:#fff;font:800 .92rem "Space Mono",monospace}
nav{display:flex;align-items:center;gap:clamp(14px,2vw,26px)}
nav a,footer a{color:#526078;text-decoration:none;font-size:.84rem;font-weight:700}
nav a:hover,footer a:hover{color:var(--ink)}

.scanner-main{width:min(1440px,100%);margin:auto;padding:clamp(38px,5vw,72px) clamp(18px,3vw,34px) calc(72px + env(safe-area-inset-bottom))}
.scanner-hero{display:grid;grid-template-columns:minmax(0,1.16fr) minmax(420px,.84fr);gap:clamp(28px,4vw,58px);align-items:center}
.hero-copy{min-width:0}
.eyebrow{margin:0 0 9px;color:var(--success);font-size:.7rem;font-weight:800;letter-spacing:.15em;text-transform:uppercase}
.hero-copy h1{max-width:830px;margin:0;font-size:clamp(2.8rem,6vw,5.3rem);line-height:.94;letter-spacing:-.065em}
.hero-copy>p:last-child{max-width:710px;margin:22px 0 0;color:var(--muted);font-size:clamp(1rem,1.35vw,1.16rem);line-height:1.68}

.scan-card{display:grid;gap:16px;padding:clamp(22px,3vw,30px);border:1px solid var(--line);border-radius:22px;background:var(--surface);box-shadow:var(--shadow)}
.scan-card-heading{display:grid;gap:5px}
.scan-card-heading h2{margin:0;font-size:clamp(1.45rem,2.4vw,2rem);line-height:1.05;letter-spacing:-.04em}
.scan-card-heading>p:last-child{margin:0;color:var(--muted);font-size:.82rem;line-height:1.5}
.scan-card-heading code{font-family:"Space Mono",monospace;font-size:.92em}
.url-field{display:grid;gap:8px}
.url-field>span{color:var(--soft);font-size:.72rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.url-field input{width:100%;min-width:0;height:52px;border:1px solid var(--line);border-radius:13px;padding:0 14px;background:var(--surface-soft);color:var(--ink);font:700 .92rem "Space Mono",monospace;transition:border-color .18s ease,box-shadow .18s ease,background .18s ease}
.url-field input:hover{border-color:#c3ccd6}
.url-field input:focus{border-color:#98a2b3;background:#fff;box-shadow:0 0 0 4px rgba(17,24,39,.06);outline:0}
.primary-button,.actions button,.secondary-button,.selection-actions button{min-height:48px;border:1px solid var(--primary);border-radius:12px;padding:0 18px;background:var(--primary);color:var(--primary-text);cursor:pointer;font-weight:800;transition:transform .16s ease,opacity .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease}
.primary-button:hover,.actions button:hover,.secondary-button:hover,.selection-actions button:hover{transform:translateY(-1px);box-shadow:0 8px 22px rgba(16,24,40,.14)}
.primary-button:disabled,.selection-actions button:disabled{cursor:not-allowed;opacity:.42;transform:none;box-shadow:none}
.status{min-height:22px;margin:0;color:var(--muted);font-size:.8rem;line-height:1.5}
.status.error{color:var(--danger)}
.scan-note{margin:0;padding-top:14px;border-top:1px solid var(--line);color:var(--muted);font-size:.72rem;line-height:1.55}

.results{margin-top:clamp(34px,5vw,64px);padding:clamp(22px,3vw,34px);border:1px solid var(--line);border-radius:24px;background:var(--surface);box-shadow:var(--shadow)}
.results-heading,.section-head,.insight-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}
.results-heading h2,.section-head h2,.token-section h2,.insight-heading h2{margin:0;font-size:clamp(1.55rem,2.8vw,2.35rem);line-height:1.04;letter-spacing:-.045em}
.actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:9px}
.actions button{min-height:42px;background:var(--surface-soft);border-color:var(--line);color:var(--ink);box-shadow:none}
.actions button:first-child{background:var(--primary);border-color:var(--primary);color:#fff}

.summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px;margin-top:24px}
.summary article{min-width:0;padding:17px;border:1px solid var(--line);border-radius:15px;background:var(--surface-soft)}
.summary span{display:block;color:var(--muted);font-size:.7rem;font-weight:750}
.summary strong{display:block;margin-top:7px;font:800 clamp(1.65rem,3vw,2.3rem)/1 "Space Mono",monospace}

.insight-panel{margin-top:24px;padding:clamp(20px,3vw,28px);border:1px solid #cfe1d4;border-radius:19px;background:linear-gradient(145deg,#fbfefc,#f2f8f4)}
.insight-heading>div:first-child{max-width:800px}
.insight-heading>div:first-child>p:last-child{max-width:760px;margin:12px 0 0;color:var(--muted);font-size:.85rem;line-height:1.6}
.insight-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.insight-actions a{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:42px;border:1px solid #c9d9cd;border-radius:11px;padding:0 14px;background:#fff;color:var(--ink);text-decoration:none;font-size:.78rem;font-weight:800}
.insight-actions a:first-child{background:var(--primary);border-color:var(--primary);color:#fff}
.scan-insight-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:20px}
.scan-insight{position:relative;min-width:0;padding:16px;border:1px solid #d5e3d9;border-radius:14px;background:rgba(255,255,255,.8)}
.scan-insight[style]::before{content:"";display:block;width:38px;height:38px;margin-bottom:12px;border:1px solid rgba(17,24,39,.14);border-radius:10px;background:var(--insight-color)}
.scan-insight>span{display:block;color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
.scan-insight>strong{display:block;margin-top:7px;font-size:1.05rem;line-height:1.2}
.scan-insight>p{margin:8px 0 0;color:var(--muted);font-size:.75rem;line-height:1.5}

.report-section{margin-top:34px;padding-top:30px;border-top:1px solid var(--line)}
.section-head{align-items:flex-end}
.section-head>p{max-width:460px;margin:0;color:var(--muted);font-size:.78rem;line-height:1.55;text-align:right}
.inventory-toolbar{display:flex;align-items:center;gap:9px;margin-top:18px}
.inventory-search{display:flex;align-items:center;gap:8px;flex:1;min-height:44px;border:1px solid var(--line);border-radius:11px;padding:0 12px;background:var(--surface-soft)}
.inventory-search span{color:var(--muted);font-size:1rem}
.inventory-search input{width:100%;min-width:0;border:0;outline:0;background:transparent;color:var(--ink)}
.inventory-sort{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:.72rem;font-weight:800}
.inventory-sort select{min-height:44px;border:1px solid var(--line);border-radius:11px;padding:0 12px;background:var(--surface-soft);color:var(--ink);font-weight:750}
.secondary-button{min-height:44px;background:var(--surface-soft);border-color:var(--line);color:var(--ink);box-shadow:none}
.secondary-button.active{background:var(--primary);border-color:var(--primary);color:#fff}
.selection-bar{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-top:12px;padding:13px 14px;border:1px solid var(--line);border-radius:13px;background:#f0f4f7}
.selection-bar[hidden]{display:none}
.selection-bar>div:first-child{display:grid;gap:3px}
.selection-bar strong{font-size:.8rem}
.selection-bar small{color:var(--muted);font-size:.68rem}
.selection-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px}
.selection-actions button{min-height:38px;padding:0 12px;background:#fff;border-color:var(--line);color:var(--ink);box-shadow:none;font-size:.72rem}
.selection-actions button:not(:disabled):first-child{background:var(--primary);border-color:var(--primary);color:#fff}
.selection-actions .text-button{border-color:transparent;background:transparent;color:var(--muted);text-decoration:underline;text-underline-offset:3px}
.color-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:11px;margin-top:18px}
.color-card{position:relative;min-width:0;overflow:hidden;padding:0;border:1px solid var(--line);border-radius:15px;background:#fff;color:var(--ink);cursor:pointer;text-align:left;transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease}
.color-card:hover{transform:translateY(-2px);border-color:#b8c2cd;box-shadow:0 10px 26px rgba(16,24,40,.08)}
.color-card.selected{border-color:var(--primary);box-shadow:0 0 0 3px rgba(17,24,39,.13)}
.color-card.selected::after{content:"✓";position:absolute;top:9px;right:9px;display:grid;place-items:center;width:28px;height:28px;border-radius:9px;background:#fff;color:#111827;font-weight:900;box-shadow:0 4px 12px rgba(16,24,40,.18)}
.selection-mode .color-card{cursor:crosshair}
.color-sample{height:112px}
.color-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px}
.color-meta code{font-size:.78rem;font-weight:800}
.color-meta span{color:var(--muted);font-size:.7rem;white-space:nowrap}

.token-section{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(360px,.9fr);gap:30px;align-items:start;margin-top:34px;padding:24px;border:1px solid var(--line);border-radius:18px;background:var(--surface-soft)}
.token-section p:last-child{max-width:630px;margin:12px 0 0;color:var(--muted);font-size:.82rem;line-height:1.6}
.token-section pre{min-height:190px;margin:0;padding:18px;overflow:auto;border-radius:14px;background:#111827;color:#e5e7eb;font:700 .78rem/1.7 "Space Mono",monospace;white-space:pre-wrap}

.duplicate-groups{display:grid;gap:11px;margin-top:18px}
.duplicate-group{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--surface-soft);overflow:auto}
.duplicate-chip{flex:0 0 auto;display:flex;align-items:center;gap:7px;padding:6px 8px;border:1px solid var(--line);border-radius:10px;background:#fff}
.duplicate-chip i{width:32px;height:32px;border:1px solid rgba(0,0,0,.12);border-radius:8px}
.duplicate-chip code{font-size:.7rem}
.empty-note,.limitations{padding:17px;border:1px solid var(--line);border-radius:14px;background:var(--surface-soft);color:var(--muted)}
.limitations{margin-top:28px;font-size:.8rem;line-height:1.6}
.limitations strong{color:var(--ink)}
.limitations ul{margin:9px 0 0;padding-left:20px}

footer{display:flex;justify-content:center;gap:20px;padding:24px 18px calc(30px + env(safe-area-inset-bottom))}

@media(max-width:1120px){
  .scanner-hero{grid-template-columns:minmax(0,1fr) minmax(390px,.82fr)}
  .color-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .actions{max-width:510px}
}
@media(max-width:900px){
  .scanner-hero{grid-template-columns:1fr;align-items:start}
  .hero-copy h1{max-width:760px}
  .scan-card{max-width:none}
  .token-section{grid-template-columns:1fr}
  .insight-heading{display:grid}
  .insight-actions{justify-content:flex-start}
}
@media(max-width:720px){
  .header-inner{min-height:64px}
  nav{display:none}
  .scanner-main{padding-top:30px}
  .hero-copy h1{font-size:clamp(2.65rem,13vw,4.1rem)}
  .results-heading,.section-head{flex-direction:column;align-items:flex-start}
  .section-head>p{text-align:left}
  .actions{width:100%;max-width:none;justify-content:flex-start}
  .actions button{flex:1 1 calc(50% - 9px)}
  .summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .scan-insight-grid{grid-template-columns:1fr}
  .inventory-toolbar{align-items:stretch;flex-wrap:wrap}
  .inventory-search{flex-basis:100%}
  .inventory-sort{flex:1}
  .inventory-sort select{flex:1}
  .selection-bar{align-items:flex-start;flex-direction:column}
  .selection-actions{justify-content:flex-start}
  .color-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:430px){
  .scan-card,.results{padding:18px;border-radius:18px}
  .summary{grid-template-columns:1fr}
  .insight-actions{display:grid}
  .actions button,.insight-actions a{width:100%}
  .inventory-sort,.secondary-button{width:100%}
  .selection-actions{display:grid;width:100%}
  .selection-actions button{width:100%}
  .color-grid{grid-template-columns:1fr 1fr}
  .color-sample{height:92px}
  .color-meta{display:grid;gap:4px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}