/* hardwarecheckup.com — design system
   Warm-graphite hardware-testing aesthetic, system monospace stack (zero external font requests).
   Base tokens & shell shared with the wider tool-site portfolio; tool-specific UI appended below. */

:root {
  --bg: #14161a;
  --bg-raised: #1b1e24;
  --bg-inset: #0f1114;
  --border: #2b2f37;
  --border-soft: #21242b;
  --text: #e9e7e2;
  --text-dim: #a2a7b0;
  --text-faint: #62666f;
  --accent: #ffb454;
  --accent-dim: #b9822f;
  --accent-contrast: #201200;
  --correct: #6fd68a;
  --incorrect: #ff6b6b;
  --incorrect-bg: rgba(255, 107, 107, 0.14);
  --focus: #7cc6ff;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Menlo", "Consolas",
    "Liberation Mono", monospace;
  --maxw: 860px;
}

:root[data-theme="light"] {
  --bg: #f7f5f1;
  --bg-raised: #ffffff;
  --bg-inset: #edeae3;
  --border: #ddd7cb;
  --border-soft: #e7e2d8;
  --text: #201c16;
  --text-dim: #5a5648;
  --text-faint: #928d7e;
  --accent: #b9722a;
  --accent-dim: #8f5a20;
  --accent-contrast: #fff8ee;
  --correct: #2f8f52;
  --incorrect: #c8362b;
  --incorrect-bg: rgba(200, 54, 43, 0.1);
  --focus: #0a6cbf;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f5f1;
    --bg-raised: #ffffff;
    --bg-inset: #edeae3;
    --border: #ddd7cb;
    --border-soft: #e7e2d8;
    --text: #201c16;
    --text-dim: #5a5648;
    --text-faint: #928d7e;
    --accent: #b9722a;
    --accent-dim: #8f5a20;
    --accent-contrast: #fff8ee;
    --correct: #2f8f52;
    --incorrect: #c8362b;
    --incorrect-bg: rgba(200, 54, 43, 0.1);
    --focus: #0a6cbf;
  }
}

* { box-sizing: border-box; }
html { color-scheme: dark light; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 8px 12px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

button, select, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 14px;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
button:hover { border-color: var(--accent-dim); color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
button.primary:hover { color: var(--accent-contrast); filter: brightness(1.08); }
button.icon-btn { padding: 6px 10px; font-size: 13px; }

/* ---------- layout shell ---------- */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-mark .bracket { color: var(--accent); }
.brand-tag { color: var(--text-faint); font-size: 12px; display: none; }
@media (min-width: 640px) { .brand-tag { display: inline; } }

.header-actions { display: flex; align-items: center; gap: 8px; }

main { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 60px; }

.container-narrow { max-width: 700px; margin: 0 auto; padding: 40px 20px 60px; }
.container-narrow h1 { font-size: 22px; }
.container-narrow h2 { font-size: 16px; margin-top: 32px; }
.container-narrow p, .container-narrow li { color: var(--text-dim); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 20px 0 24px; }
.hero h1 {
  font-size: clamp(22px, 4vw, 32px);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.hero p { color: var(--text-dim); margin: 0; font-size: 14.5px; }

/* ---------- duration selector ---------- */
.duration-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.segmented { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented button {
  border: none; border-radius: 0; background: var(--bg-inset);
  border-right: 1px solid var(--border);
  padding: 8px 16px;
  min-width: 56px;
}
.segmented button:last-child { border-right: none; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }

/* ---------- live stats ---------- */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.stat { text-align: center; }
.stat .stat-value { display: block; font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat .stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-top: 2px; }

/* ---------- typing surface ---------- */
.type-wrap { position: relative; }
.type-input-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.type-surface {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 22px 26px;
  cursor: text;
  max-height: 4.8em;
  overflow: hidden;
  position: relative;
}
.type-surface:focus-within { border-color: var(--accent-dim); }
.passage {
  font-size: 21px;
  line-height: 1.6em;
  letter-spacing: .01em;
  color: var(--text-faint);
  word-break: break-word;
}
.char { position: relative; white-space: pre-wrap; }
.char.correct { color: var(--text); }
.char.incorrect { color: var(--incorrect); background: var(--incorrect-bg); border-radius: 2px; }
.char.current::before {
  content: "";
  position: absolute;
  left: -1px; top: 1px; bottom: 1px;
  width: 2px;
  background: var(--accent);
  animation: caret-blink 1s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.type-hint {
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
  margin: 10px 0 0;
}

.controls-row {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

/* ---------- results screen ---------- */
.results-panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
}
.results-headline { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; margin-bottom: 10px; }
.results-headline .stat-value { font-size: 44px; }
.results-headline .stat-label { font-size: 12px; }

.rating-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 14px;
  border-radius: 999px;
  margin-top: 6px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
}
.rating-message { color: var(--text-dim); font-size: 13px; margin: 8px 0 0; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
  text-align: left;
}
@media (min-width: 520px) { .results-grid { grid-template-columns: repeat(4, 1fr); } }
.results-grid .cell {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
}
.results-grid .cell .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.results-grid .cell .v { display: block; font-size: 18px; font-weight: 700; margin-top: 2px; }
.results-grid .cell.correct .v { color: var(--correct); }
.results-grid .cell.incorrect .v { color: var(--incorrect); }

.best-line { color: var(--text-dim); font-size: 13px; margin: 4px 0 20px; }
.best-line strong { color: var(--accent); }

/* ---------- history ---------- */
.history-section { margin-top: 24px; text-align: left; }
.history-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sparkline { color: var(--accent); width: 140px; height: 30px; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
}
.history-list .h-wpm { font-weight: 700; color: var(--text); }
.history-list .h-meta { color: var(--text-faint); }
.history-empty { justify-content: center; color: var(--text-faint); }

/* ---------- about section ---------- */
.about-section { margin-top: 40px; }
.about-section h2 { font-size: 16px; }
.about-section p { color: var(--text-dim); }

/* ---------- faq / article list items ---------- */
.faq-item { margin-bottom: 18px; }
.faq-item h3 { font-size: 15px; margin: 0 0 6px; }
.faq-item p { margin: 0; color: var(--text-dim); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 12.5px;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--text-dim); }

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

::selection { background: var(--accent); color: var(--accent-contrast); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-inset); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ================================================================
   hardwarecheckup.com — tool hub extensions
   ================================================================ */

/* ---------- header nav ---------- */
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 5px 9px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-color: var(--border); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent-dim); }
@media (max-width: 720px) { .site-nav { display: none; } }

/* ---------- privacy note ---------- */
.privacy-note {
  max-width: 700px;
  margin: 8px auto 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}
.privacy-note strong { color: var(--correct); }

/* ---------- tool card grid (homepage) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 28px 0 8px;
}
@media (min-width: 560px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px 18px 16px;
  color: inherit;
  transition: border-color .12s ease, transform .12s ease;
}
.tool-card:hover { border-color: var(--accent-dim); text-decoration: none; transform: translateY(-2px); }
.tool-card .tc-icon { font-size: 22px; line-height: 1; display: block; margin-bottom: 10px; }
.tool-card h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--text); }
.tool-card p { margin: 0; font-size: 13px; color: var(--text-dim); }
.tool-card .tc-go { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--accent); }

/* ---------- tool page shell ---------- */
.tool-hero { text-align: center; padding: 12px 0 8px; }
.tool-hero h1 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 8px; letter-spacing: -0.01em; }
.tool-hero p { color: var(--text-dim); margin: 0 auto; max-width: 640px; font-size: 14.5px; }

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 22px 0;
}
.panel h2 { font-size: 15px; margin: 0 0 14px; }

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 14px;
}
.control-row label { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
select {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  max-width: 100%;
}
select:hover { border-color: var(--accent-dim); }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}
@media (min-width: 520px) { .field-grid { grid-template-columns: repeat(4, 1fr); } }
.field {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
}
.field .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.field .v { display: block; font-size: 18px; font-weight: 700; margin-top: 3px; color: var(--accent); font-variant-numeric: tabular-nums; }

.status-msg {
  font-size: 13px;
  color: var(--text-dim);
  margin: 10px 0 0;
  min-height: 1.2em;
}
.status-msg.error { color: var(--incorrect); }
.status-msg.ok { color: var(--correct); }

/* ---------- webcam ---------- */
.video-frame {
  position: relative;
  background: #000;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-frame video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-frame video.mirrored { transform: scaleX(-1); }
.video-placeholder { color: var(--text-faint); font-size: 13px; text-align: center; padding: 20px; }

/* ---------- mic ---------- */
.meter-track {
  height: 22px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--correct), var(--accent) 70%, var(--incorrect));
  transition: width .05s linear;
}
canvas.scope {
  width: 100%;
  height: 140px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  display: block;
}

/* ---------- speaker ---------- */
.btn-cluster { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-cluster button { min-width: 96px; }
.range-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-row .rv { min-width: 84px; text-align: right; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- keyboard tester ---------- */
.kb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.kb-row { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; }
.key {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 34px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 6px;
  flex: 0 0 auto;
  user-select: none;
  transition: background .05s ease, color .05s ease, border-color .05s ease;
}
.key.w-15 { min-width: 54px; }
.key.w-175 { min-width: 64px; }
.key.w-20 { min-width: 74px; }
.key.w-225 { min-width: 84px; }
.key.w-275 { min-width: 104px; }
.key.w-space { min-width: 260px; flex: 1 1 auto; }
.key.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.key.held { background: var(--accent-dim); color: var(--accent-contrast); border-color: var(--accent-dim); }
.kb-readout { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }

/* ---------- mouse tester ---------- */
.mouse-body {
  width: 120px;
  height: 190px;
  margin: 0 auto 8px;
  border: 2px solid var(--border);
  border-radius: 60px 60px 48px 48px;
  position: relative;
  background: var(--bg-inset);
}
.mouse-btn {
  position: absolute;
  top: 0;
  width: 48%;
  height: 44%;
  border: 1px solid var(--border);
}
.mouse-btn.left { left: 0; border-radius: 58px 0 0 0; border-right: none; }
.mouse-btn.right { right: 0; border-radius: 0 58px 0 0; border-left: none; }
.mouse-btn.middle {
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
  width: 14px;
  height: 30%;
  border-radius: 8px;
}
.mouse-btn.active { background: var(--accent); border-color: var(--accent); }
.drag-pad {
  height: 130px;
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  user-select: none;
  touch-action: none;
}
.drag-pad.dragging { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* ---------- dead pixel ---------- */
.dp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #ff0000;
  display: none;
  cursor: none;
}
.dp-overlay.open { display: block; }
.dp-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 8px;
  pointer-events: none;
  text-align: center;
}
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.swatch {
  width: 30px; height: 30px; border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0; cursor: pointer;
}
