/* =========================================================
   PC Hardware Test — Stylesheet
   Design language: precision hardware testing panel.
   Sans (IBM Plex Sans) for reading text, Mono (IBM Plex Mono)
   reserved for measured/technical values so real numbers stay
   tabular and legible — not a decorative flourish.
   ========================================================= */

:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #eceeea;
  --border: #dcdfe3;
  --text: #16181c;
  --muted: #5b6470;
  --accent: #b3671a;
  --accent-strong: #8f5314;
  --accent-contrast: #ffffff;

  --ok: #1c7c4d;
  --ok-bg: #e7f5ee;
  --warn: #a15c00;
  --warn-bg: #fbf0dd;
  --err: #b3261e;
  --err-bg: #fbe9e8;
  --info: #2a5ea8;
  --info-bg: #e9f0fb;
  --off: #6b7280;
  --off-bg: #eef0f2;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(15, 18, 22, 0.06);
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1420;
    --surface: #161d2b;
    --surface-2: #1c2536;
    --border: #2b3548;
    --text: #e7ecf3;
    --muted: #8c97aa;
    --accent: #f2a93b;
    --accent-strong: #ffc266;
    --accent-contrast: #14100a;

    --ok: #52c98d;
    --ok-bg: #12251c;
    --warn: #f2a93b;
    --warn-bg: #2a2010;
    --err: #f2716a;
    --err-bg: #2a1616;
    --info: #7bb0f2;
    --info-bg: #131f2e;
    --off: #8c97aa;
    --off-bg: #1c2536;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0e1420;
  --surface: #161d2b;
  --surface-2: #1c2536;
  --border: #2b3548;
  --text: #e7ecf3;
  --muted: #8c97aa;
  --accent: #f2a93b;
  --accent-strong: #ffc266;
  --accent-contrast: #14100a;

  --ok: #52c98d;
  --ok-bg: #12251c;
  --warn: #f2a93b;
  --warn-bg: #2a2010;
  --err: #f2716a;
  --err-bg: #2a1616;
  --info: #7bb0f2;
  --info-bg: #131f2e;
  --off: #8c97aa;
  --off-bg: #1c2536;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

img, svg, canvas, video { max-width: 100%; display: block; }

a { color: var(--accent-strong); }
a:hover { text-decoration-thickness: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}
.brand-logo {
  display: block;
  width: 174px;
  height: auto;
  max-width: 58vw;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--accent-contrast);
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -0.2px;
  text-align: center;
  box-sizing: border-box;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(90deg, #4285f4 0%, #12b8c4 22%, #34a853 43%, #fbbc04 63%, #fb8c00 81%, #ea4335 100%);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: linear-gradient(90deg, #4285f4 0%, #12b8c4 22%, #34a853 43%, #fbbc04 63%, #fb8c00 81%, #ea4335 100%); border-color: var(--accent-strong); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-danger { color: var(--err); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.hero .wrap { padding-top: 40px; padding-bottom: 32px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: start;
}
h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.12;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.hero-sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 54ch;
  margin: 0 0 20px;
}
.hero-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.hero-benefit {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.readout {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
}
.readout-title {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.readout-item { display: flex; flex-direction: column; gap: 2px; }
.readout-label { font-size: 12px; color: var(--muted); }
.readout-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Quick check ---------- */
.quickcheck {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.section-heading {
  font-size: 13px;
  text-transform: none;
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 600;
}
h2 { font-size: 22px; margin: 0 0 10px; letter-spacing: -0.005em; }
.qc-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.qc-summary {
  color: var(--muted);
  font-size: 14px;
}
.qc-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.qc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  font-size: 13.5px;
}
.qc-item .qc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.qc-item strong { font-weight: 600; }
.qc-item span.qc-detail { color: var(--muted); margin-left: auto; font-family: var(--font-mono); font-size: 12px; }

/* status colors, always paired with icon/text, never color alone */
.status-pass, .status-detected, .status-tested, .status-ready { color: var(--ok); }
.status-action, .status-manual { color: var(--warn); }
.status-denied, .status-error { color: var(--err); }
.status-unsupported { color: var(--off); }
.dot-pass, .dot-detected, .dot-tested, .dot-ready { background: var(--ok); }
.dot-action, .dot-manual { background: var(--warn); }
.dot-denied, .dot-error { background: var(--err); }
.dot-unsupported { background: var(--off); }

/* ---------- Test grid ---------- */
.tests { padding: 32px 0; }
.test-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}
@media (max-width: 900px) {
  .test-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .test-grid { grid-template-columns: 1fr; }
}

/* The keyboard test is much wider than a single card, so let it take the
   full row when expanded rather than cramping a full keyboard into one
   grid column. */
#card-keyboard[open] { grid-column: 1 / -1; }

.test-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.test-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}
.test-card > summary::-webkit-details-marker { display: none; }
.test-card > summary::after {
  content: "+";
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.test-card[open] > summary::after { content: "\2212"; }
.test-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 16px;
}
.test-card h3 { margin: 0 0 3px; font-size: 15.5px; }
.test-card .test-desc { margin: 0; font-size: 13px; color: var(--muted); }
.test-card .test-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.test-body {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: var(--surface-2);
}
.test-card[open] { grid-column: span 1; }

.field-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
select, input[type="range"] {
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
label { font-size: 13px; color: var(--muted); }

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.status-line.ok { background: var(--ok-bg); color: var(--ok); }
.status-line.warn { background: var(--warn-bg); color: var(--warn); }
.status-line.err { background: var(--err-bg); color: var(--err); }
.status-line.info { background: var(--info-bg); color: var(--info); }
.status-line.off { background: var(--off-bg); color: var(--off); }

.note {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding-left: 10px;
  margin: 10px 0;
}

canvas.viz {
  width: 100%;
  height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 10px;
}
.meter > i { display: block; height: 100%; width: 0%; background: var(--accent); }

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 14px;
  margin: 10px 0;
}
.data-item { display: flex; flex-direction: column; gap: 2px; }
.data-item .k { font-size: 11.5px; color: var(--muted); }
.data-item .v { font-family: var(--font-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; word-break: break-word; }

/* keyboard tester */
/* keyboard tester — full-size layout */
.kb-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 10px 0;
  padding-bottom: 10px;
}
.kb-board {
  --u: 40px;
  --gap: 4px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: max-content;
  min-width: 100%;
}
.kb-block { display: flex; flex-direction: column; gap: var(--gap); }
.kb-row2 { display: flex; gap: var(--gap); }
.kb-key2 {
  height: var(--u);
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.15;
  padding: 2px;
  user-select: none;
  flex-shrink: 0;
}
.kb-key2.kb-gap-l { margin-left: calc(var(--u) * 0.5); }
.kb-key2.is-down { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.kb-key2.was-tested:not(.is-down) { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }

.kb-nav-col { display: flex; flex-direction: column; gap: calc(var(--u) * 0.6); }
.kb-nav6 { display: grid; grid-template-columns: repeat(3, var(--u)); grid-auto-rows: var(--u); gap: var(--gap); }
.kb-arrows { display: grid; grid-template-columns: repeat(3, var(--u)); grid-auto-rows: var(--u); gap: var(--gap); }

.kb-numpad {
  display: grid;
  grid-template-columns: repeat(4, var(--u));
  grid-template-rows: repeat(5, var(--u));
  gap: var(--gap);
}
.kb-numpad .kb-key2 { height: auto; }

.kb-caption {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* mouse test */
.mouse-area {
  position: relative;
  height: 220px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}
.mouse-dot {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
}
.mouse-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mouse-btn-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.mouse-btn-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* screen test */
.screen-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.swatch-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
}
#screen-fullscreen-target {
  position: fixed; inset: 0; background: #000; display: none; z-index: 999;
}
#screen-fullscreen-target.active { display: block; }
.fs-controls {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; background: rgba(20,20,20,0.7); padding: 8px; border-radius: 8px;
}
.fs-controls button {
  background: #222; color: #fff; border: 1px solid #444; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.fs-label {
  position: absolute; top: 16px; left: 16px; color: #fff; font-family: var(--font-mono); font-size: 12px; background: rgba(0,0,0,0.5); padding: 4px 8px; border-radius: 4px;
}

/* gamepad viz */
.pad-face { display: flex; gap: 24px; margin: 12px 0; flex-wrap: wrap; }
.stick { position: relative; width: 80px; height: 80px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); }
.stick-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); top: 50%; left: 50%; transform: translate(-50%,-50%); }
.pad-buttons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-width: 260px; }
.pad-btn { font-family: var(--font-mono); font-size: 10px; text-align: center; padding: 6px 2px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--muted); }
.pad-btn.pressed { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* ad slots */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 90px;
  margin: 24px auto;
}
.ad-top, .ad-bottom, .ad-before-guides { max-width: 728px; }
.ad-top {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.ad-banner-link {
  display: block;
  width: 100%;
  line-height: 0;
}
.ad-banner-image {
  display: block;
  width: 100%;
  max-width: 728px;
  height: auto;
  border: 0;
  border-radius: var(--radius-sm);
}
.ad-after-hero { max-width: 970px; min-height: 180px; }
.ad-before-tests, .ad-before-faq { max-width: 100%; min-height: 120px; }
.ad-middle { max-width: 100%; min-height: 120px; }
.ad-sidebar { display: none; }
@media (min-width: 1100px) {
  .layout-with-sidebar { display: grid; grid-template-columns: 1fr 240px; gap: 24px; }
  .ad-sidebar { display: flex; min-height: 250px; }
}

/* content sections */
.content-section { padding: 30px 0; border-bottom: 1px solid var(--border); }
.content-section p { color: var(--text); max-width: 74ch; }
.content-section ul { max-width: 74ch; }
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.guide-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 28px; margin-top: 14px; }
@media (max-width: 700px) { .guide-list { grid-template-columns: 1fr; } }
.guide-list h3 { font-size: 15px; margin: 0 0 6px; }
.guide-list p { font-size: 14px; margin: 0; color: var(--muted); }

/* privacy */
.privacy-list { display: grid; gap: 8px; padding: 0; list-style: none; margin: 14px 0; }
.privacy-list li {
  display: flex; gap: 10px; font-size: 14.5px; align-items: flex-start;
}
.privacy-list li::before {
  content: "\2713";
  color: var(--ok);
  font-weight: 700;
  flex-shrink: 0;
}

/* faq */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq-item > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: "+"; color: var(--muted); font-family: var(--font-mono); }
.faq-item[open] > summary::after { content: "\2212"; }
.faq-item p { color: var(--muted); margin: 10px 0 0; font-size: 14.5px; max-width: 70ch; }

/* footer */
.site-footer {
  padding: 30px 0 40px;
  color: var(--muted);
  font-size: 13px;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.footer-links a { color: var(--muted); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

[aria-live] { scroll-margin-top: 80px; }


/* legal / information pages */
.page-main { padding: 24px 0 56px; }
.page-hero { padding: 28px 0 22px; border-bottom: 1px solid var(--border); }
.page-kicker { margin: 0 0 8px; color: var(--accent-strong); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.page-title { margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.02em; }
.page-lead { margin: 14px 0 0; max-width: 72ch; color: var(--muted); font-size: 17px; line-height: 1.7; }
.page-content { padding-top: 28px; max-width: 860px; }
.page-content h2 { margin: 32px 0 10px; font-size: 24px; }
.page-content h3 { margin: 24px 0 8px; font-size: 18px; }
.page-content p, .page-content li { color: var(--muted); line-height: 1.75; }
.page-content ul, .page-content ol { padding-left: 22px; }
.page-content strong { color: var(--text); }
.page-note { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.page-meta { color: var(--muted); font-size: 13px; }
.contact-card { display: grid; gap: 10px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.contact-card h2 { margin-top: 0; }
.contact-card label { font-weight: 600; font-size: 14px; margin-top: 4px; }
.contact-card input, .contact-card textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; background: var(--surface); color: var(--text); font: inherit; }
.contact-status { padding: 12px 14px; border-radius: var(--radius); background: var(--info-bg); color: var(--text); }
.footer-brand { color: var(--text); font-weight: 600; }
@media (max-width: 700px) { .page-main { padding-bottom: 36px; } .page-content h2 { font-size: 21px; } .page-lead { font-size: 16px; } }

.brand-name { display: inline-block; white-space: nowrap; }
