:root {
  color-scheme: dark;
  --bg: #09090f;
  --raised: #121220;
  --raised-2: #161625;
  --line: #1c1c30;
  --line-soft: #26263b;
  --text: #f3f1f8;
  --muted: #9592a3;
  --muted-2: #6f6c7d;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --success: #a4cfb0;
  --warning: #d0b28f;
  --danger: #d097a0;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Work Sans', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { width: min(100%, 760px); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { border: 0; background: transparent; display: inline-flex; align-items: center; gap: 10px; padding: 8px 0; font-weight: 650; font-size: 18px; cursor: pointer; }
.brand-mark { width: 24px; height: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; transform: rotate(-8deg); }
.brand-mark span { border-radius: 7px 4px 7px 4px; background: var(--accent); }
.brand-mark span:last-child { opacity: .45; transform: translateY(5px); }
.target-pill { border: 1px solid var(--line-soft); background: rgba(255,255,255,.02); border-radius: 999px; padding: 9px 11px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.target-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); display: inline-block; flex: 0 0 auto; }
.view { min-height: calc(100vh - 76px); padding: 18px 0 44px; }
.eyebrow { margin: 0; font-family: var(--mono); font-size: 10px; line-height: 1.4; letter-spacing: .14em; color: var(--muted-2); font-weight: 600; }
.mono, code, pre { font-family: var(--mono); }

.home-view { display: flex; flex-direction: column; }
.hero-block { padding-top: clamp(26px, 8vh, 86px); max-width: 610px; }
.hero-block h1 { margin: 16px 0 18px; font-size: clamp(42px, 12vw, 76px); line-height: .96; letter-spacing: -.055em; font-weight: 650; }
.hero-block h1 span { color: #bba4ff; }
.hero-copy { margin: 0; max-width: 540px; color: var(--muted); font-size: clamp(16px, 4vw, 19px); line-height: 1.55; }
.scan-form { margin-top: 44px; }
.field-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.repo-input-wrap { min-height: 100px; background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 16px 12px; transition: border-color .2s, background .2s; }
.repo-input-wrap:focus-within { border-color: #6f4fc0; background: #141422; }
.repo-prefix { display: block; font-family: var(--mono); color: var(--muted-2); font-size: 12px; margin-bottom: 7px; }
textarea { display: block; width: 100%; resize: none; border: 0; outline: 0 !important; background: transparent; color: var(--text); font-family: var(--mono); font-size: 16px; line-height: 1.5; padding: 0; }
textarea::placeholder { color: #565364; }
textarea.invalid { color: var(--danger); }
.field-error { min-height: 20px; color: var(--danger); font-size: 12px; margin: 8px 2px 0; }
.primary-button { width: 100%; border: 0; border-radius: var(--radius); background: var(--accent); color: white; padding: 16px 18px; min-height: 56px; font-weight: 600; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: transform .18s, filter .18s; }
.primary-button:active { transform: scale(.988); }
.primary-button:hover { filter: brightness(1.06); }
.button-arrow { font-family: var(--mono); font-size: 20px; font-weight: 400; }
.home-footnote { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 12px; margin: 15px 2px 0; }
.pulse-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.inline-link { border: 0; background: transparent; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.recent-section { margin-top: 76px; border-top: 1px solid var(--line); padding-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted-2); font-size: 11px; }
.recent-list { margin-top: 8px; }
.recent-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 17px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; gap: 12px; align-items: center; text-align: left; cursor: pointer; }
.recent-row .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #cbc7d5; }
.recent-verdict { font-size: 12px; color: var(--muted); }
.row-arrow { color: var(--muted-2); font-size: 18px; }

.back-link { border: 0; background: transparent; color: var(--muted); padding: 8px 0; font-size: 13px; cursor: pointer; }
.scan-state-center { min-height: 68vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.repo-slug { color: #bbb7c7; font-size: 11px; letter-spacing: -.02em; }
.scan-orbit { width: 62px; height: 62px; border: 1px solid #29283b; border-radius: 50%; margin: 28px 0 30px; position: relative; }
.scan-orbit::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--accent-soft); }
.scan-orbit span { position: absolute; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; left: 27px; top: -4px; transform-origin: 4px 35px; animation: orbit 1.4s linear infinite; z-index: 2; }
@keyframes orbit { to { transform: rotate(360deg); } }
.scan-state h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.scan-state-center > p:not(.repo-slug) { color: var(--muted); margin: 10px 0 28px; }
.quiet-button { border: 1px solid var(--line-soft); background: transparent; color: var(--muted); border-radius: 10px; padding: 10px 14px; cursor: pointer; }

.result-view { position: relative; }
.result-hero { padding: 30px 0 34px; }
.repo-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 42px; }
.provenance { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; white-space: nowrap; }
.result-hero h1 { max-width: 650px; margin: 12px 0 18px; font-size: clamp(48px, 13vw, 82px); line-height: .92; letter-spacing: -.06em; font-weight: 650; }
.verdict-native .result-hero h1 { color: var(--success); }
.verdict-fixes .result-hero h1 { color: #b7a3e8; }
.verdict-partial .result-hero h1 { color: var(--warning); }
.verdict-fallback .result-hero h1 { color: #aaa7be; }
.result-summary { margin: 0; max-width: 570px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.metric-rail { display: grid; grid-template-columns: .8fr 1fr 1.6fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-rail > div { padding: 18px 12px 18px 0; min-width: 0; }
.metric-rail > div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.metric-label { display: block; color: var(--muted-2); font-size: 10px; margin-bottom: 7px; }
.metric-rail strong { display: block; font-size: 12px; font-weight: 500; color: #dedbe6; overflow: hidden; text-overflow: ellipsis; }
.target-context { width: 100%; margin: 14px 0 0; padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; background: transparent; color: var(--muted-2); font-size: 10px; cursor: pointer; }
.target-context > span:first-child { display: flex; align-items: center; gap: 8px; }
.target-context .mono { color: var(--muted); font-size: 9px; text-align: right; }
.content-section { margin-top: 58px; }
.section-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 17px; }
.section-title-row h2 { margin: 7px 0 0; font-size: 23px; letter-spacing: -.035em; font-weight: 600; }
.section-count { color: var(--muted-2); font-size: 11px; }
.component-list, .finding-groups { border-top: 1px solid var(--line); }
details { border-bottom: 1px solid var(--line); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.component-row summary { min-height: 68px; display: grid; grid-template-columns: minmax(0,1fr) 68px 74px 20px; gap: 10px; align-items: center; cursor: pointer; }
.component-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.component-main strong { text-transform: capitalize; font-size: 15px; }
.component-main span { color: var(--muted-2); font-size: 11px; }
.component-score { font-size: 11px; color: #d7d3df; }
.strategy-tag { font-size: 9px; color: var(--muted); }
.disclosure { color: var(--muted-2); font-family: var(--mono); font-size: 16px; transition: transform .18s; }
details[open] > summary .disclosure { transform: rotate(45deg); }
.component-detail { padding: 0 0 17px; display: grid; gap: 9px; }
.component-detail > div { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 10px; color: var(--muted-2); font-size: 10px; }
.component-detail code { color: var(--muted); word-break: break-all; font-size: 10px; }
.finding-group summary { min-height: 67px; display: grid; grid-template-columns: minmax(0,1fr) 42px 20px; gap: 10px; align-items: center; cursor: pointer; }
.finding-group summary > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.finding-group strong { font-size: 14px; }
.finding-group summary span:not(.disclosure) { font-size: 10px; color: var(--muted-2); }
.group-count { font-size: 10px; color: var(--muted); text-align: right; }
.finding-list { padding-bottom: 15px; }
.finding-item { margin: 0 0 9px; background: var(--raised); border: 1px solid var(--line); border-radius: 11px; padding: 13px; }
.finding-meta { display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 9px; text-transform: uppercase; }
.finding-meta .kind { margin-left: auto; text-transform: none; }
.severity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.severity-high .severity-dot { background: var(--danger); }
.severity-medium .severity-dot { background: var(--warning); }
.severity-low .severity-dot { background: #8f8ba0; }
.finding-item p { margin: 10px 0 8px; color: #c8c4d0; font-size: 13px; line-height: 1.45; }
.finding-item code { display: block; color: var(--muted-2); font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.technical-links { margin: 40px 0 0; color: var(--muted-2); font-size: 11px; display: flex; gap: 8px; justify-content: center; }
.technical-links button { background: transparent; border: 0; color: var(--muted); font-family: var(--mono); font-size: 10px; padding: 6px; cursor: pointer; }
.sticky-action-space { height: 110px; }
.sticky-action { position: fixed; z-index: 8; bottom: 0; left: 50%; width: min(100%, 760px); transform: translateX(-50%); padding: 16px 20px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, rgba(9,9,15,0)); }
.unavailable-block { padding: 70px 0 0; max-width: 570px; }
.unavailable-block .eyebrow { margin-top: 48px; color: var(--warning); }
.unavailable-block h1 { font-size: clamp(48px, 13vw, 74px); line-height: .95; letter-spacing: -.055em; margin: 12px 0 20px; }
.unavailable-block > p:not(.eyebrow):not(.repo-slug) { color: var(--muted); font-size: 17px; line-height: 1.5; }
.unavailable-note { margin: 34px 0; border-left: 2px solid var(--line-soft); padding: 3px 0 3px 16px; color: var(--muted-2); font-size: 13px; line-height: 1.5; }

.target-header { padding: 40px 0 38px; }
.target-header h1 { margin: 13px 0 17px; font-size: clamp(38px, 10vw, 62px); line-height: .98; letter-spacing: -.05em; max-width: 620px; }
.target-header > p:last-child { color: var(--muted); max-width: 550px; line-height: 1.55; margin: 0; }
.target-form { display: grid; gap: 28px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; }
.setting-row label, .setting-block legend { font-weight: 600; font-size: 14px; }
.setting-row p { margin: 4px 0 0; color: var(--muted-2); font-size: 11px; }
.setting-row strong { font-size: 11px; color: var(--muted); }
.setting-block { border: 0; padding: 0; margin: 0; }
.setting-block legend { margin-bottom: 11px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 46px; border: 1px solid var(--line-soft); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; cursor: pointer; text-transform: capitalize; }
.segmented input:checked + span { border-color: #6c4fc0; background: var(--accent-soft); color: #d7ccf7; }
.target-note { display: grid; grid-template-columns: 24px 1fr; gap: 10px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.target-note > span { width: 20px; height: 20px; border: 1px solid var(--line-soft); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); }
.target-note p { margin: 0; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.68); z-index: 20; opacity: 0; transition: opacity .18s; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 104%); width: min(100%, 760px); z-index: 21; background: #11111c; border: 1px solid var(--line-soft); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 9px 20px max(24px, env(safe-area-inset-bottom)); max-height: min(82vh, 720px); overflow: auto; transition: transform .22s ease-out; }
.sheet-open .sheet-backdrop { opacity: 1; }
.sheet-open .sheet { transform: translate(-50%, 0); }
.sheet-grabber { width: 34px; height: 4px; border-radius: 4px; background: #393748; margin: 2px auto 19px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.sheet-head h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.04em; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line-soft); border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.sheet-body { padding: 23px 0 6px; }
.sheet-copy { margin: 0 0 12px; color: #d3cfdb; line-height: 1.5; font-size: 14px; }
.sheet-copy.muted { color: var(--muted); }
.command-block { margin: 22px 0; background: #0b0b12; border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.command-block code { font-size: 10px; color: #d5d1dc; overflow-wrap: anywhere; }
.copy-button { border: 1px solid #39364c; background: var(--raised-2); color: #c7c1d3; border-radius: 9px; padding: 8px 10px; font-size: 10px; cursor: pointer; }
.sheet-note { color: var(--muted-2); font-size: 11px; line-height: 1.5; border-top: 1px solid var(--line); padding-top: 16px; }
.raw-json { margin: 0; white-space: pre-wrap; word-break: break-word; color: #b7b2c2; font-size: 9px; line-height: 1.6; }

@media (min-width: 700px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .sticky-action { padding-left: 28px; padding-right: 28px; }
  .scan-form { max-width: 610px; }
}

@media (max-width: 430px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .topbar { height: 68px; }
  .target-pill { font-size: 10px; padding: 8px 9px; }
  .hero-block { padding-top: 18px; }
  .hero-block h1 { font-size: 47px; }
  .scan-form { margin-top: 34px; }
  .repo-line { margin-bottom: 34px; }
  .result-hero { padding-top: 20px; }
  .metric-rail { grid-template-columns: .8fr 1fr 1.4fr; }
  .metric-rail > div { padding-top: 15px; padding-bottom: 15px; }
  .component-row summary { grid-template-columns: minmax(0,1fr) 58px 62px 16px; }
  .sticky-action { padding-left: 16px; padding-right: 16px; }
  .sheet { padding-left: 16px; padding-right: 16px; }
}
