/* PortWatch Lab: the community test pages (lab/). Same palette as the main site. */
:root {
  --ink: #0d0e14; --ink-2: #2b2d38; --muted: #6b6f7e; --faint: #9a9eac; --line: #ebecf1; --soft: #f6f7fa;
  --bg: #ffffff; --violet: #7a5cff; --pink: #ff2e7e; --orange: #ff8a3d; --green: #16a36a; --red: #e5484d; --gold: #b7791f;
  --grad: linear-gradient(90deg, #7a5cff 0%, #ff2e7e 55%, #ff8a3d 100%);
  --radius: 18px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 30, .04), 0 8px 24px rgba(16, 18, 30, .06);
  --display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #eef0f6; --ink-2: #c9ccd8; --muted: #9a9eac; --faint: #6b6f7e; --line: #262833; --soft: #171922; --bg: #0d0e14; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--violet); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px 80px; }
header.lab-top { display: flex; align-items: center; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
header.lab-top .brand { font: 800 18px var(--display); color: var(--ink); text-decoration: none; }
header.lab-top .brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
header.lab-top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
header.lab-top nav a, .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; background: var(--bg); cursor: pointer; }
header.lab-top nav a[aria-current="page"], .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
h1 { font: 800 clamp(26px, 4vw, 38px)/1.15 var(--display); margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font: 700 21px/1.25 var(--display); margin: 34px 0 10px; }
h3 { font: 700 16px/1.3 var(--display); margin: 22px 0 8px; }
.lede { color: var(--muted); font-size: 17px; max-width: 68ch; margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: var(--bg); box-shadow: var(--shadow); margin: 14px 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat b { display: block; font: 800 24px var(--display); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; }
.good { color: var(--green); font-weight: 700; }
.bad { color: var(--red); font-weight: 700; }
.warn { color: var(--gold); font-weight: 700; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); border: 1px solid var(--line); }
.pill.ok { color: var(--green); } .pill.no { color: var(--red); }
form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 10px 0; }
label { display: grid; gap: 5px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: transparent; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 18px; margin: 18px 0; }
legend { font: 700 15px var(--display); padding: 0 6px; }
.choices { display: grid; gap: 6px; }
.choices label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 7%, transparent); }
.choices input { width: auto; margin-top: 4px; }
.feat { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; }
.feat .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.feat .seg label { padding: 4px 10px; font-weight: 500; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); display: block; }
.feat .seg label:last-child { border-right: 0; }
.feat .seg input { display: none; }
.feat .seg label:has(input:checked) { background: var(--ink); color: var(--bg); }
.issues { margin: 10px 0; padding: 0; list-style: none; }
.issues li { padding: 8px 12px; border-radius: var(--radius-sm); margin: 6px 0; background: var(--soft); }
.issues li.hard { color: var(--red); font-weight: 600; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--soft); border: 1px solid var(--line); margin: 14px 0; }
.notice.danger { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.bar { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); }
.hidden { display: none !important; }
code { font-size: 13px; background: var(--soft); padding: 1px 5px; border-radius: 6px; }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.controls label { min-width: 160px; }
fieldset:disabled { opacity: .5; }

/* "It worked" dialog (done() in lab-app.js): a checkmark that draws itself, then what was saved. */
.lab-done { width: min(420px, calc(100vw - 32px)); padding: 30px 26px 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); color: var(--ink); text-align: center; box-shadow: 0 24px 70px rgba(16, 18, 30, .28); }
.lab-done::backdrop { background: rgba(13, 14, 20, .45); backdrop-filter: blur(3px); }
.lab-done[open] { animation: done-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes done-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.done-check { display: block; width: 76px; height: 76px; margin: 0 auto 12px; fill: none; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 6px 16px rgba(22, 163, 106, .35)); }
.done-check circle { stroke: var(--green); stroke-width: 3; fill: rgba(22, 163, 106, .12); stroke-dasharray: 145; stroke-dashoffset: 145; animation: done-draw .5s ease-out forwards; }
.done-check path { stroke: var(--green); stroke-width: 4; stroke-dasharray: 36; stroke-dashoffset: 36; animation: done-draw .35s .4s ease-out forwards; }
@keyframes done-draw { to { stroke-dashoffset: 0; } }
.lab-done h2 { margin: 0 0 8px; font: 800 24px/1.2 var(--display); letter-spacing: -.02em; }
.done-body p { margin: 0 0 6px; }
.done-body .done-points { margin-bottom: 10px; font: 900 30px/1.1 var(--display); letter-spacing: -.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.done-body .issues { margin: 12px 0 0; text-align: left; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.done-actions .btn { font-family: inherit; }
/* "No 4K screen?" how-to in the report form's rule box. */
.shot-help { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(127, 127, 127, .08); }
.shot-help summary { cursor: pointer; }
.shot-help ol { margin: 10px 0 8px; padding-left: 20px; }
.shot-help li { margin: 6px 0; }
.shot-help ul { margin: 4px 0; padding-left: 18px; }
.shot-help code { overflow-wrap: anywhere; } /* the gamescope commands are long for a phone */

/* Flag dialog (openFlag() in lab-app.js): the same card, left-aligned for the form. */
.lab-flag { text-align: left; }
.lab-flag .choices label { display: block; margin: 6px 0; }
.lab-flag textarea { width: 100%; box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) { .lab-done[open] { animation: none; } .done-check circle, .done-check path { animation: none; stroke-dashoffset: 0; } }

/* Stats view (lab-stats.js, #stats/<build>): one build's report numbers in a dialog over the builds list.
   One hue for every chart (the Lab's violet) on a lighter track of the same hue; yes / partly / no use the
   fixed status colours, always with their words beside them. */
.lab-stats {
  --viz-1: #7a5cff; --viz-hover: #9479ff; --viz-track: #ebe7ff; --viz-axis: #c9cbd4;
  --viz-yes: #0ca30c; --viz-partly: #fab219; --viz-no: #d03b3b;
  width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 22px;
  background: var(--bg); color: var(--ink); box-shadow: 0 24px 70px rgba(16, 18, 30, .28); overflow: auto; overscroll-behavior: contain;
}
@media (prefers-color-scheme: dark) { .lab-stats { --viz-hover: #9a85ff; --viz-track: #262046; --viz-axis: #3a3d4c; } }
.lab-stats::backdrop { background: rgba(13, 14, 20, .45); backdrop-filter: blur(3px); }
.lab-stats[open] { animation: ls-in .2s ease-out; } /* opacity only: a transform would move the tooltip */
@keyframes ls-in { from { opacity: 0; } }
.ls-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 22px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.ls-kicker { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ls-head h2 { margin: 2px 0 0; font: 800 24px/1.2 var(--display); letter-spacing: -.02em; }
.ls-close { flex: none; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 400 24px/1 var(--body); cursor: pointer; }
.ls-close:hover { background: var(--soft); }
.ls-body { padding: 14px 22px 26px; }
.ls-intro { margin: 0 0 14px; max-width: 78ch; }
.ls-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.ls-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.ls-tile b { display: block; font: 800 26px/1.15 var(--display); }
.ls-tile span { font-size: 13px; color: var(--muted); }
.ls-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.ls-filter button { font: 600 14px var(--body); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.ls-filter button[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ls-filter button small { font-weight: 500; opacity: .7; margin-left: 2px; }
.ls-grid { display: grid; gap: 18px 24px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); margin-top: 14px; }
.ls-section { min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.ls-section h3 { margin: 0 0 2px; font: 700 16px/1.3 var(--display); }
.ls-sub { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.ls-recent { margin-top: 24px; }
.ls-recent h3 span { font: 500 13px var(--body); margin-left: 6px; }
.ls-chart { min-width: 0; }
.ls-meters { display: grid; gap: 7px; }
.ls-meter { display: grid; grid-template-columns: minmax(88px, 36%) minmax(40px, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.ls-name { min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.ls-track { display: block; height: 10px; border-radius: 999px; background: var(--viz-track); overflow: hidden; }
.ls-track i { display: block; height: 100%; border-radius: 999px; background: var(--viz-1); }
.ls-meter:hover .ls-track i { background: var(--viz-hover); }
.ls-val { text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.ls-val small { display: inline-block; min-width: 3ch; margin-left: 4px; color: var(--muted); font-weight: 500; }
/* Median fps by card: plain bars from one baseline, square there, rounded at the value end. */
.ls-bars .ls-track { height: 12px; border-radius: 0; background: none; border-left: 1px solid var(--viz-axis); overflow: visible; }
.ls-bars .ls-track i { border-radius: 0 4px 4px 0; }
/* What works: a thin bar per part, split yes / partly / no with a 2px gap; each part's hover area is taller than the bar. */
.ls-seg { display: flex; gap: 2px; height: 8px; }
.ls-seg i { position: relative; display: block; min-width: 3px; }
.ls-seg i::after { content: ""; position: absolute; inset: -7px 0; }
.ls-seg i:first-child { border-radius: 999px 0 0 999px; }
.ls-seg i:last-child { border-radius: 0 999px 999px 0; }
.ls-seg i:only-child { border-radius: 999px; }
.ls-seg i:hover { filter: brightness(1.12); }
.ls-k0 { background: var(--viz-yes); } .ls-k1 { background: var(--viz-partly); } .ls-k2 { background: var(--viz-no); }
.ls-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.ls-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
/* SVG charts */
.ls-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.ls-gridline { stroke: var(--line); stroke-width: 1; }
.ls-base { stroke: var(--viz-axis); stroke-width: 1; }
.ls-tick { fill: var(--muted); font: 11px var(--body); font-variant-numeric: tabular-nums; }
.ls-col { fill: var(--viz-1); }
.ls-hit { outline: none; }
.ls-hit:hover .ls-col, .ls-hit:focus .ls-col { fill: var(--viz-hover); }
.ls-hit:focus-visible .ls-col { stroke: var(--ink); stroke-width: 2; }
.ls-mark { stroke: var(--ink-2); stroke-width: 1; }
.ls-mark-label { fill: var(--ink-2); font: 600 11px var(--body); }
.ls-line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ls-dot { fill: var(--viz-1); stroke: var(--bg); stroke-width: 2; outline: none; }
.ls-dot.is-on, .ls-dot:focus { r: 6px; }
.ls-dot:focus-visible { stroke: var(--ink); }
.ls-cross { stroke: var(--muted); stroke-width: 1; }
.ls-end { fill: var(--ink); font: 600 12px var(--body); font-variant-numeric: tabular-nums; }
.ls-axisnote, .ls-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ls-table summary { margin-top: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.ls-scroll { overflow-x: auto; }
.ls-section table { font-size: 13px; }
.ls-section td, .ls-section th { padding: 6px 8px; }
.ls-minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ls-minis div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--soft); }
.ls-minis b { display: block; font: 800 22px/1.2 var(--display); }
.ls-minis span { font-size: 12.5px; color: var(--muted); }
.ls-memline { margin: 0 0 10px; font-size: 14px; }
.ls-empty { margin: 4px 0; }
.ls-tip { position: fixed; z-index: 10; max-width: 260px; padding: 7px 10px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.ls-tip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.ls-tip span { opacity: .8; }
@media (max-width: 560px) { .ls-body { padding: 12px 14px 22px; } .ls-head { padding: 14px 14px 10px; } .ls-tile { padding: 8px 10px; } .ls-tile b { font-size: 21px; } .ls-tile span { font-size: 12px; } .ls-meter { grid-template-columns: minmax(80px, 40%) minmax(30px, 1fr) auto; } }
@media (prefers-reduced-motion: reduce) { .lab-stats[open] { animation: none; } }
