/* Squint — a tool, so it looks like one: dark, quiet, and out of the way of
   the thing being looked at. The only saturated colour on screen belongs to
   the overlays, because the overlays are the point. */

:root {
  --bg: #0b0e13;
  --panel: #10141b;
  --card: #151a23;
  --line: #1e2531;
  --ink: #e9eff7;
  --dim: #8e9bad;
  --dimmer: #5f6b7c;
  --acc: #3ddc97;
  --warn: #ffb020;
  --bad: #ff4d5e;
  --alt: #c08bff;
  --blue: #7cd4ff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --panelw: 400px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, select, input { font: inherit; color: inherit; }

.app { height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

/* ── bar ────────────────────────────────────────────────────────────────── */
.bar {
  display: flex; align-items: center; gap: 14px; overflow: hidden;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; letter-spacing: .02em; }
.brand svg { width: 22px; height: 22px; fill: none; stroke: var(--acc); stroke-width: 1.6; }
.brand b { font-weight: 650; font-size: 15px; }
.file { font: 500 12px/1.3 var(--mono); color: var(--dim); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dpr { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim); }
.dpr span { display: none; }
select, .ghost {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; cursor: pointer;
}
.ghost:hover, select:hover { border-color: #2c3646; }
.ghost:active { transform: translateY(1px); }
.ghost.done { color: var(--acc); border-color: var(--acc); }
.narrow { display: none; }

/* ── stage ──────────────────────────────────────────────────────────────── */
.stage { display: grid; min-height: 0;
  grid-template-columns: 1fr var(--panelw); grid-template-rows: 1fr auto; }
.viewport { grid-area: 1 / 1; position: relative; min-height: 0;
  background:
    linear-gradient(45deg, #0e1219 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(-45deg, #0e1219 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(45deg, transparent 75%, #0e1219 75%) -8px 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, #0e1219 75%) -8px 0/16px 16px,
    #0a0d12;
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#cv:active { cursor: grabbing; }
.hint { position: absolute; left: 12px; bottom: 10px; margin: 0; max-width: 62%;
  font: 400 12px/1.45 var(--sans); color: var(--dim);
  background: rgba(8,11,16,.82); border: 1px solid var(--line);
  padding: 7px 10px; border-radius: 9px; backdrop-filter: blur(6px); }

.squintbar[hidden] { display: none; }
.squintbar { position: absolute; right: 12px; top: 12px; display: flex; align-items: center; gap: 10px;
  background: rgba(8,11,16,.86); border: 1px solid var(--line); padding: 8px 12px;
  border-radius: 10px; backdrop-filter: blur(6px); font-size: 12px; color: var(--dim); }
.squintbar output { font: 500 12px var(--mono); color: var(--acc); min-width: 46px; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 130px; height: 3px;
  background: var(--line); border-radius: 3px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--acc); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0;
  border-radius: 50%; background: var(--acc); cursor: pointer; }

/* ── layers ─────────────────────────────────────────────────────────────── */
.layers { grid-area: 2 / 1; display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--line); background: var(--panel);
  overflow-x: auto; scrollbar-width: none; }
.layers::-webkit-scrollbar { display: none; }
.layers button {
  flex: 0 0 auto; background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; color: var(--dim); cursor: pointer;
}
.layers button:hover { color: var(--ink); border-color: #2c3646; }
.layers button[aria-pressed=true] { background: var(--acc); border-color: var(--acc); color: #06130d; font-weight: 600; }

/* ── panel ──────────────────────────────────────────────────────────────── */
.panel { grid-area: 1 / 2 / 3 / 3; border-left: 1px solid var(--line);
  background: var(--panel); overflow-y: auto; overscroll-behavior: contain; }
.sec { padding: 16px; border-bottom: 1px solid var(--line); }
.sec h2 { margin: 0 0 3px; font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--dimmer); font-weight: 600; }
.sec .sub { margin: 0 0 12px; font-size: 12.5px; color: var(--dim); line-height: 1.45; }

.stat { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; }
.stat b { font: 650 26px/1 var(--sans); }
.stat span { font-size: 12.5px; color: var(--dim); }

.rows { display: flex; flex-direction: column; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; background: var(--card);
  padding: 8px 10px; font-size: 12.5px; }
.row.click { cursor: pointer; }
.row.click:hover { background: #1a212c; }
.row .k { color: var(--dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .v { font: 500 12.5px var(--mono); }
.row .v.warn { color: var(--warn); }
.row .v.bad { color: var(--bad); }
.row .v.good { color: var(--acc); }
.sw { width: 18px; height: 18px; border-radius: 5px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.16); }
.bar-track { height: 5px; border-radius: 3px; background: #202836; flex: 0 0 74px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--acc); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 11.5px var(--mono); padding: 3px 8px; border-radius: 6px;
  background: #1a212c; border: 1px solid var(--line); color: var(--dim); }
.chip.off { color: var(--warn); border-color: rgba(255,176,32,.35); }

.hist { display: flex; align-items: flex-end; gap: 3px; height: 62px; margin: 4px 0 8px; }
.hist div { flex: 1; background: #263041; border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.hist div.on { background: var(--acc); }
.hist div.off { background: var(--warn); }
.histx { display: flex; gap: 3px; font: 500 9.5px var(--mono); color: var(--dimmer); }
.histx span { flex: 1; text-align: center; }

/* findings */
.find { display: block; width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--line); border-left: 3px solid var(--dimmer);
  border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.find:hover { background: #1a212c; }
.find[data-level=bad] { border-left-color: var(--bad); }
.find[data-level=warn] { border-left-color: var(--warn); }
.find[data-level=good] { border-left-color: var(--acc); }
.find[data-level=note] { border-left-color: #3b475a; }
.find h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.find p { margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.find .tagline { display: flex; gap: 8px; align-items: center; margin-top: 7px;
  font: 500 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--dimmer); }

/* ── start screen ───────────────────────────────────────────────────────── */
.start { position: fixed; inset: 0; z-index: 30; background: var(--bg);
  overflow-y: auto; display: grid; place-items: center; padding: 28px 20px 40px; }
.app[data-state=ready] .start { display: none; }
.startin { width: min(760px, 100%); }
.start h1 { margin: 0 0 10px; font-size: clamp(38px, 9vw, 62px); font-weight: 680; letter-spacing: -.03em; }
.lede { margin: 0 0 26px; font-size: clamp(15px, 2.4vw, 17.5px); line-height: 1.55; color: var(--dim); max-width: 60ch; }
.lede em { color: var(--ink); font-style: normal; }
.dropzone { border: 1.5px dashed #2b3444; border-radius: 16px; padding: 30px 20px;
  text-align: center; background: #0e1218; }
.big { background: var(--acc); color: #06130d; border: 0; border-radius: 10px;
  padding: 13px 22px; font-size: 15px; font-weight: 650; cursor: pointer; }
.big:hover { filter: brightness(1.06); }
.or { margin: 12px 0 0; font-size: 13px; color: var(--dimmer); }
kbd { font: 500 11.5px var(--mono); background: #1a212c; border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px; }
.samples-lead { margin: 24px 0 10px; font-size: 13px; color: var(--dim); }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.samples button { padding: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; overflow: hidden; cursor: pointer; text-align: left; }
.samples button:hover { border-color: #33405a; }
.samples img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: top center; background: #0a0d12; }
.samples span { display: block; padding: 8px 10px; font-size: 12px; color: var(--dim); }
.promises { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 8px; }
.promises li { font-size: 13px; color: var(--dim); line-height: 1.5; }
.promises b { color: var(--ink); font-weight: 600; }
.madeby { margin: 26px 0 0; font-size: 12px; color: var(--dimmer); }
.madeby a { color: var(--dim); }

.dragmask { position: fixed; inset: 0; z-index: 50; display: none; place-items: center;
  background: rgba(6,9,13,.86); border: 3px dashed var(--acc); }
.app.dragging .dragmask { display: grid; }
.dragmask span { font-size: 26px; font-weight: 650; color: var(--acc); }

.err { margin: 12px 0 0; color: var(--bad); font-size: 13px; }

/* ── phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .stage { grid-template-columns: 1fr; grid-template-rows: minmax(0, 46dvh) auto minmax(0, 1fr); }
  .viewport { grid-area: 1 / 1; }
  .layers { grid-area: 2 / 1; }
  .panel { grid-area: 3 / 1; border-left: 0; border-top: 1px solid var(--line);
    padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .hint { display: none; }
  .dpr span { display: none; }
  .bar { gap: 10px; flex-wrap: wrap; overflow: visible; }
  .file { order: 3; flex: 1 0 100%; font-size: 10.5px; white-space: normal; }
  .wide { display: none; }
  .narrow { display: inline; }
}
@media (min-width: 881px) { .dpr span { display: inline; } }
