/* Screen Machine — test-lab instrument aesthetic
   Workbench light surface, deep navy console, orange signal accents.
   Palette:
     --ink       #0E2A4E  deep navy (console, headings)
     --ink-2     #163D6E  navy panel
     --signal    #FF7A1A  orange signal (actions, live)
     --signal-hot#E03E1A  red-orange (critical)
     --amber     #E8A013  amber (minor)
     --pass      #1E62C9  calibrated blue (pass)
     --bench     #EEF2F7  workbench background
*/

:root {
  color-scheme: only light; /* committed light "workbench" design — block browser auto-darkening */
  --ink: #0E2A4E;
  --ink-2: #163D6E;
  --ink-3: #24528F;
  --signal: #FF7A1A;
  --signal-deep: #E4640A;
  --signal-hot: #D92D07;
  --amber: #D98E07;
  --pass: #1E62C9;
  --bench: #EEF2F7;
  --panel: #FFFFFF;
  --line: #D4DEEA;
  --text: #182A40;
  --text-soft: #4A5D75;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Space Grotesk", "Avenir Next", "Helvetica Neue", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", "Noto Sans CJK SC", "Noto Sans Arabic", sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(14, 42, 78, .06), 0 8px 24px -12px rgba(14, 42, 78, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bench);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}
img { max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); line-height: 1.15; margin: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--signal-deep);
}

/* ── console header ─────────────────────────────────────────────── */
.console { background: var(--ink); color: #fff; }
.console-inner {
  max-width: 1100px; margin: 0 auto; padding: 20px 24px 16px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: flex; gap: 3px; align-items: flex-end; height: 40px; }
.brand-mark .bar { width: 7px; border-radius: 2px; display: block; }
.bar.b1 { height: 40px; background: var(--signal); }
.bar.b2 { height: 30px; background: #FF9A4D; }
.bar.b3 { height: 22px; background: #6FA3E8; }
.bar.b4 { height: 30px; background: #2E6FD1; }
.bar.b5 { height: 40px; background: #1E62C9; }
.brand-text h1 {
  color: #fff; font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em;
}
.tagline { margin: 2px 0 0; font-family: var(--mono); font-size: .74rem; color: #9DB6D6; letter-spacing: .06em; }

.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; color: #B9CCE4; border: 1px solid #2C4E7E;
  border-bottom: none; border-radius: 8px 8px 0 0; padding: 9px 18px 11px;
  font-family: var(--display); font-weight: 600; font-size: .92rem;
}
.tab:hover { color: #fff; }
.tab.active { background: var(--bench); color: var(--ink); border-color: var(--bench); }
.tab:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--signal); outline-offset: 2px;
}

.calibration-strip {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--signal) 0 48px, #FF9A4D 48px 96px, #6FA3E8 96px 144px,
    #2E6FD1 144px 192px, #1E62C9 192px 240px, #0E2A4E 240px 288px);
}

/* ── layout ─────────────────────────────────────────────────────── */
main { max-width: 1100px; margin: 0 auto; padding: 36px 24px 80px; }
.view { display: none; }
.view.active { display: block; }

/* ── intake ─────────────────────────────────────────────────────── */
.intake-head h2, .library-head h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 6px 0 10px; }
.intake-sub { color: var(--text-soft); max-width: 62ch; margin: 0 0 22px; }

.scan-form {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.url-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.url-label {
  font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); align-self: center; padding-right: 4px;
}
#url-input {
  flex: 1; min-width: 240px;
  font-family: var(--mono); font-size: 1rem; color: var(--ink);
  padding: 13px 14px; border: 2px solid var(--line); border-radius: 8px; background: #F8FAFD;
}
#url-input:focus { border-color: var(--ink-3); outline: none; box-shadow: 0 0 0 3px rgba(30, 98, 201, .18); }
.run-btn {
  background: var(--signal); color: #2A1300; border: none; border-radius: 8px;
  font-family: var(--display); font-weight: 700; font-size: 1rem; padding: 13px 26px;
  transition: background .15s, transform .1s;
}
.run-btn:hover { background: #FF8C3A; }
.run-btn:active { transform: translateY(1px); }
.run-btn[disabled] { background: #F0C9A8; cursor: wait; }

.options-row { margin-top: 16px; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; max-width: 70ch; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  flex: none; width: 42px; height: 24px; border-radius: 12px; background: #C3D0E0;
  position: relative; transition: background .15s; margin-top: 2px;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.switch-row input:checked + .switch { background: var(--pass); }
.switch-row input:checked + .switch::after { left: 21px; }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--signal); outline-offset: 2px; }
.switch-label { font-size: .9rem; color: var(--text-soft); }
.switch-label strong { color: var(--text); }
.switch-row.disabled { opacity: .55; cursor: not-allowed; }
.deep-note { font-family: var(--mono); font-size: .78rem; color: var(--signal-deep); margin: 8px 0 0 54px; }

.demo-line { margin: 18px 0 0; font-size: .86rem; color: var(--text-soft); }
.linklike {
  background: none; border: none; padding: 0; color: var(--pass);
  text-decoration: underline; text-underline-offset: 3px; font-size: inherit;
}
.linklike:hover { color: var(--ink); }

/* ── progress ───────────────────────────────────────────────────── */
.progress-panel {
  margin-top: 28px; background: var(--ink); color: #D8E4F2;
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.progress-head h2 { color: #fff; font-size: 1.3rem; margin-top: 4px; }
.progress-bars { display: flex; gap: 5px; margin: 16px 0 14px; height: 10px; }
.progress-bars span { flex: 1; border-radius: 3px; background: #2C4E7E; animation: pulsebar 1.2s infinite; }
.progress-bars span:nth-child(1) { animation-delay: 0s; }
.progress-bars span:nth-child(2) { animation-delay: .15s; }
.progress-bars span:nth-child(3) { animation-delay: .3s; }
.progress-bars span:nth-child(4) { animation-delay: .45s; }
.progress-bars span:nth-child(5) { animation-delay: .6s; }
@keyframes pulsebar { 0%, 100% { background: #2C4E7E; } 50% { background: var(--signal); } }
.progress-log {
  margin: 0; padding: 0 0 0 18px; font-family: var(--mono); font-size: .8rem;
  max-height: 200px; overflow-y: auto; color: #9DB6D6;
}
.progress-log li { margin: 3px 0; }
.progress-log li:last-child { color: #fff; }
.cancel-btn { margin-top: 12px; color: #9DB6D6; }

/* ── report ─────────────────────────────────────────────────────── */
.report-band {
  margin-top: 34px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.report-band + .report-band, .report-band + .cat-section { margin-top: 22px; }
.band-pad { padding: 24px; }

.report-id { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.report-id h2 { font-size: 1.35rem; overflow-wrap: anywhere; }
.report-url { font-family: var(--mono); font-size: .82rem; color: var(--text-soft); overflow-wrap: anywhere; }
.report-meta-line { font-family: var(--mono); font-size: .74rem; color: var(--text-soft); margin-top: 8px; }
.report-meta-line b { color: var(--ink-3); font-weight: 600; }

.overall-badge { text-align: center; flex: none; }
.overall-badge .num {
  font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--ink);
}
.overall-badge .lbl { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); }

/* Device Bay — the signature gauge cluster */
.device-bay {
  display: flex; align-items: flex-end; justify-content: center; gap: clamp(14px, 4vw, 44px);
  padding: 30px 18px 8px; flex-wrap: wrap;
}
.gauge { text-align: center; }
.gauge .frame {
  border: 3px solid var(--ink); border-radius: 8px; background: #F5F8FC;
  display: flex; align-items: center; justify-content: center; position: relative;
  margin: 0 auto; box-shadow: inset 0 0 0 2px #fff;
}
.gauge.mobile .frame  { width: 54px;  height: 106px; }
.gauge.tablet .frame  { width: 92px;  height: 120px; }
.gauge.laptop .frame  { width: 148px; height: 96px;  }
.gauge.desktop .frame { width: 180px; height: 104px; }
.gauge .frame::after { /* stand / home bar */
  content: ""; position: absolute; background: var(--ink); border-radius: 2px;
}
.gauge.mobile .frame::after  { bottom: 5px; left: 50%; transform: translateX(-50%); width: 18px; height: 3px; }
.gauge.tablet .frame::after  { bottom: 4px; left: 50%; transform: translateX(-50%); width: 22px; height: 3px; }
.gauge.laptop .frame::after  { bottom: -10px; left: 50%; transform: translateX(-50%); width: 176px; height: 5px; }
.gauge.desktop .frame::after { bottom: -14px; left: 50%; transform: translateX(-50%); width: 44px; height: 11px; }
.gauge .score-fill {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(255,122,26,.16), rgba(255,122,26,.34));
  border-radius: 0 0 5px 5px;
}
.gauge[data-tone="good"] .score-fill { background: linear-gradient(180deg, rgba(30,98,201,.14), rgba(30,98,201,.30)); }
.gauge[data-tone="bad"]  .score-fill { background: linear-gradient(180deg, rgba(217,45,7,.14), rgba(217,45,7,.32)); }
.gauge .grade { position: relative; z-index: 1; font-family: var(--display); font-weight: 700; font-size: 1.7rem; color: var(--ink); }
.gauge .gscore { font-family: var(--mono); font-size: .78rem; color: var(--text-soft); }
.gauge .gname {
  font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 14px;
}
.gauge.laptop .gname, .gauge.desktop .gname { margin-top: 22px; }
.gauge .gfails { font-size: .74rem; color: var(--text-soft); }

.bay-legend {
  text-align: center; font-family: var(--mono); font-size: .72rem; color: var(--text-soft);
  padding: 14px 18px 20px;
}

/* fix order */
.fix-order { counter-reset: fix; margin: 0; padding: 0; list-style: none; }
.fix-order li {
  counter-increment: fix; display: flex; gap: 14px; align-items: baseline;
  padding: 10px 0; border-top: 1px dashed var(--line);
}
.fix-order li:first-child { border-top: none; }
.fix-order li::before {
  content: counter(fix, decimal-leading-zero);
  font-family: var(--mono); font-weight: 600; color: var(--signal-deep); flex: none;
}
.fix-order .sev { margin-left: auto; }
.fix-order button.jump { background: none; border: none; padding: 0; color: var(--ink); font-weight: 600; text-align: left; }
.fix-order button.jump:hover { color: var(--pass); text-decoration: underline; }

/* export row */
.export-row { display: flex; gap: 10px; flex-wrap: wrap; }
.export-btn {
  background: var(--ink); color: #fff; border: none; border-radius: 8px;
  font-family: var(--display); font-weight: 600; font-size: .88rem; padding: 10px 16px;
}
.export-btn:hover { background: var(--ink-2); }
.export-btn.secondary { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.export-btn.secondary:hover { background: #EAF0F8; }

/* screenshots strip */
.shots-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.shot { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #F5F8FC; padding: 0; text-align: left; }
.shot img { display: block; width: 100%; height: 150px; object-fit: cover; object-position: top; }
.shot figcaption, .shot .cap { font-family: var(--mono); font-size: .68rem; padding: 7px 9px; color: var(--text-soft); }
.shot .cap b { color: var(--ink); }
.shot:hover { border-color: var(--pass); }

/* findings */
.cat-section { margin-top: 26px; }
.cat-title {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px;
  border-bottom: 3px solid var(--ink); padding-bottom: 6px;
}
.cat-title h3 { font-size: 1.08rem; }
.cat-title .cat-count { font-family: var(--mono); font-size: .74rem; color: var(--text-soft); margin-left: auto; }

.finding {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; overflow: hidden;
}
.finding[data-status="fail"] { border-inline-start: 4px solid var(--signal-hot); }
.finding[data-status="fail"][data-sev="major"] { border-inline-start-color: var(--signal); }
.finding[data-status="fail"][data-sev="minor"] { border-inline-start-color: var(--amber); }
.finding[data-status="fail"][data-sev="info"] { border-inline-start-color: #8FA6C2; }
.finding[data-status="pass"] { border-inline-start: 4px solid var(--pass); }
.finding[data-status="na"], .finding[data-status="deep"] { border-inline-start: 4px solid #C3D0E0; }

.finding-head {
  width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: none; border: none; text-align: left; padding: 12px 14px;
}
.finding-head:hover { background: #F5F8FC; }
.f-id { font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--ink-3); flex: none; }
.f-name { font-weight: 600; color: var(--ink); }
.f-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.chip {
  font-family: var(--mono); font-size: .64rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; border-radius: 4px; padding: 3px 7px; white-space: nowrap;
}
.chip.status-pass { background: #E3EDFB; color: var(--pass); }
.chip.status-fail { background: #FDE4D6; color: var(--signal-hot); }
.chip.status-na { background: #EAF0F6; color: #6B7F98; }
.chip.status-deep { background: #EAF0F6; color: #6B7F98; }
.chip.status-note { background: #FFF2E0; color: var(--amber); }
.chip.sev-critical { background: var(--signal-hot); color: #fff; }
.chip.sev-major { background: var(--signal); color: #331500; }
.chip.sev-minor { background: #F6D9A0; color: #5C3A00; }
.chip.sev-info { background: #DCE6F2; color: #3A5170; }
.chip.dev { background: #F0F4FA; color: #4A5D75; border: 1px solid var(--line); text-transform: none; }

.finding-body { display: none; border-top: 1px solid var(--line); padding: 16px 18px 20px; }
.finding.open .finding-body { display: block; }

.evidence { background: #0E2A4E; color: #D8E4F2; border-radius: 8px; padding: 12px 16px; margin: 8px 0 16px; }
.evidence h4 { color: #9DB6D6; font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.evidence ul { margin: 0; padding-left: 18px; }
.evidence li { font-family: var(--mono); font-size: .8rem; margin: 4px 0; overflow-wrap: anywhere; unicode-bidi: plaintext; }

.kb h4 { font-size: .82rem; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 6px; }
.kb p { margin: 0 0 8px; color: var(--text); max-width: 78ch; white-space: pre-line; }
.kb .code-pair { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kb pre {
  margin: 0; background: #F5F8FC; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: .76rem; overflow-x: auto; white-space: pre-wrap;
}
.kb .code-pair .bad pre { border-inline-start: 4px solid var(--signal-hot); }
.kb .code-pair .good pre { border-inline-start: 4px solid var(--pass); }
.kb .code-lbl { font-family: var(--mono); font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.bad .code-lbl { color: var(--signal-hot); }
.good .code-lbl { color: var(--pass); }

.ai-prompt-box { position: relative; margin-top: 8px; }
.ai-prompt-box pre {
  background: #10233C; color: #D8E4F2; border: none; border-radius: 8px;
  padding: 14px 16px; font-size: .76rem; white-space: pre-wrap; margin: 0;
}
.copy-btn {
  position: absolute; top: 10px; inset-inline-end: 10px;
  background: var(--signal); border: none; color: #2A1300; border-radius: 6px;
  font-family: var(--mono); font-size: .68rem; font-weight: 600; padding: 6px 10px;
}
.copy-btn:hover { background: #FF8C3A; }
.copy-btn.copied { background: var(--pass); color: #fff; }

/* report filter bar */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: .74rem; font-weight: 600; padding: 7px 14px; color: var(--text-soft);
}
.filter-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* deep-unavailable note */
.deep-banner {
  background: #FFF2E0; border: 1px solid #F0CF9C; color: #5C3A00;
  border-radius: 8px; padding: 12px 16px; font-size: .88rem;
}
.deep-banner code { font-family: var(--mono); font-size: .8rem; background: #fff; padding: 1px 6px; border-radius: 4px; }

/* ── library ────────────────────────────────────────────────────── */
.library-controls { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
#library-search {
  font-family: var(--mono); font-size: .95rem; padding: 12px 14px; width: 100%; max-width: 520px;
  border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
#library-search:focus { border-color: var(--ink-3); outline: none; }
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.library-list { margin-top: 22px; }
.lib-cat-head { margin: 26px 0 8px; display: flex; align-items: baseline; gap: 10px; border-bottom: 3px solid var(--ink); padding-bottom: 5px; }
.lib-cat-head h3 { font-size: 1.05rem; }
.lib-cat-head .cat-count { font-family: var(--mono); font-size: .72rem; color: var(--text-soft); margin-left: auto; }
.lib-empty { color: var(--text-soft); font-style: italic; padding: 30px 0; }

/* ── footer ─────────────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: #9DB6D6; margin-top: 40px; }
.footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 22px 24px;
  display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; align-items: baseline;
}
.footer-brand { font-family: var(--display); font-weight: 700; color: #fff; }
.footer-local { margin-left: auto; font-family: var(--mono); font-size: .72rem; }

/* ── lightbox ───────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; background: rgba(10, 26, 48, .92); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; overflow: auto; text-align: center; }
.lightbox img { max-width: 100%; max-height: 82vh; width: auto; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox figcaption { color: #D8E4F2; font-family: var(--mono); font-size: .78rem; margin-top: 10px; }
.lightbox-close {
  position: absolute; top: 18px; inset-inline-end: 22px; background: none; border: 2px solid #9DB6D6;
  color: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 1rem;
}
.lightbox-close:hover { border-color: var(--signal); color: var(--signal); }

/* ── responsive ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .console-inner { padding: 16px 16px 12px; }
  main { padding: 24px 16px 60px; }
  .url-row { flex-direction: column; }
  .url-label { align-self: flex-start; }
  .run-btn { width: 100%; }
  .device-bay { gap: 18px; }
  .report-id { flex-direction: column; }
  .overall-badge { text-align: left; }
  .footer-local { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* hosted-build notice — honest about what the web version cannot measure */
.hosted-note {
  margin-top: 18px; background: #FFF6EC; border: 1px solid #F3D2AC;
  border-left: 4px solid var(--signal); border-radius: 8px;
  padding: 14px 16px; font-size: .88rem; color: #5C3A00; max-width: 70ch;
}
.hosted-note strong { color: var(--signal-deep); }
