/* ============================================================================
   components.css — per-tool widgets for the device testers (keyboard, mouse,
   webcam, speaker, dead-pixel, controller). Buddy (V9). Tokens only, no hex
   (enforced by tools/check-architecture.mjs). Shared chrome lives in base.css;
   shared tester components (mascot, hero, card, side, tip, vtile) in mic.css.
   ============================================================================ */

/* --- Shared result card actions + confetti --------------------------------- */
.result-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.result-actions .btn {
  flex: 1;
  min-height: 40px;
  font-size: 0.85rem;
  padding: 0 var(--space-3);
}
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-toast);
}

/* --- Interview Ready flow --------------------------------------------------- */
.interview {
  max-width: 720px;
  margin-inline: auto;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.step-card {
  background: var(--canvas);
  border: 3px solid var(--line);
  border-left-width: 8px;
  border-left-color: var(--ink-dim);
  border-radius: var(--r);
  box-shadow: var(--sticker);
  padding: var(--space-4) var(--space-5);
}
.step-card[data-state="checking"] { border-left-color: var(--info); }
.step-card[data-state="pass"] { border-left-color: var(--ok); }
.step-card[data-state="fail"] { border-left-color: var(--danger); }
.step-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.step-emoji { font-size: 28px; }
.step-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.step-status {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sticker-sm);
  padding: 3px var(--space-3);
}
.step-card[data-state="pass"] .step-status { background: var(--ok-soft); }
.step-card[data-state="fail"] .step-status { background: var(--danger-soft); }
.step-body { margin-top: var(--space-3); }
.step-hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: var(--space-2);
}
.step-btn { margin-top: var(--space-2); }
.cam-mini {
  position: relative;
  width: 220px;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sticker-sm);
  background: var(--surface);
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-2);
}
.cam-mini video { width: 100%; height: 100%; object-fit: cover; display: none; transform: scaleX(-1); }
.cam-mini[data-live="true"] video { display: block; }
.cam-mini-ph { color: var(--ink-dim); font-size: 0.8rem; font-family: var(--font-display); }
.cam-mini[data-live="true"] .cam-mini-ph { display: none; }

/* --- Keyboard tester ------------------------------------------------------- */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.krow {
  display: flex;
  gap: 7px;
  justify-content: center;
}
.key {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sticker-sm);
  user-select: none;
  text-align: center;
  padding: 0 4px;
  transition: transform var(--dur-fast) var(--ease);
}
.key.u125 { flex-grow: 1.25; }
.key.u15 { flex-grow: 1.5; }
.key.u175 { flex-grow: 1.75; }
.key.u2 { flex-grow: 2; }
.key.u225 { flex-grow: 2.25; }
.key.u275 { flex-grow: 2.75; }
.key.u625 { flex-grow: 6.25; }
.key.tested {
  background: var(--ok-soft);
  border-color: var(--line);
}
.key.pressed {
  background: var(--ac);
  color: var(--ac-contrast);
  transform: translateY(3px);
  box-shadow: var(--sticker-press);
}
@media (prefers-reduced-motion: reduce) {
  .key { transition: none; }
  .key.pressed { transform: none; }
}
@media (max-width: 640px) {
  .key { height: 38px; font-size: 0.66rem; }
}

/* --- Mouse tester ---------------------------------------------------------- */
.mouse-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sticker-sm);
  min-height: 280px;
  cursor: crosshair;
}
.mouse-body {
  position: relative;
  width: 130px;
  height: 200px;
  border: 3px solid var(--line);
  border-radius: 60px 60px 56px 56px;
  background: var(--canvas);
  box-shadow: var(--sticker);
}
.mouse-btn {
  position: absolute;
  top: 0;
  width: 48%;
  height: 44%;
  background: var(--surface);
  transition: background var(--dur-fast) var(--ease);
}
.mouse-left { left: 0; border-right: 1.5px solid var(--line); border-radius: 60px 0 0 0; }
.mouse-right { right: 0; border-left: 1.5px solid var(--line); border-radius: 0 60px 0 0; }
.mouse-mid {
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  width: 16px;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  z-index: 2;
}
.mouse-btn.on, .mouse-mid.on { background: var(--ac); }
.mouse-readout {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--canvas);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sticker-sm);
  padding: 4px var(--space-3);
}
.mouse-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--line);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* --- Keyboard WPM ---------------------------------------------------------- */
.wpm-sample {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
}

/* --- Mouse CPS pad --------------------------------------------------------- */
.cps-pad {
  margin-top: var(--space-3);
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 90px;
  border: 2px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: var(--space-3);
}
.cps-pad[data-active="true"] {
  border-style: solid;
  background: var(--ac-soft);
  color: var(--ink);
}

/* --- Speaker tester -------------------------------------------------------- */
.speaker-stage {
  display: flex;
  gap: var(--space-4);
}
.speaker-pad {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sticker-sm);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.speaker-pad:hover { transform: translate(-1px, -1px); box-shadow: var(--sticker); }
.speaker-pad.playing { background: var(--ac-soft); }
.speaker-pad .icon { width: 34px; height: 34px; color: var(--ac); }
.speaker-pad small { font-weight: 500; color: var(--ink-soft); font-family: var(--font-body); }
@media (prefers-reduced-motion: reduce) {
  .speaker-pad { transition: none; }
  .speaker-pad:hover { transform: none; }
}

/* --- Dead-pixel tester ----------------------------------------------------- */
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--line);
  box-shadow: var(--sticker-sm);
  cursor: pointer;
  padding: 0;
}
.fullscreen-stage {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
}
.fullscreen-stage[data-show="true"] { display: block; }
.fullscreen-stage .fs-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--canvas);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sticker);
  padding: var(--space-2) var(--space-4);
  opacity: 0.92;
}

/* --- Controller tester ----------------------------------------------------- */
.pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: var(--space-2);
}
.pad-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sticker-sm);
}
.pad-btn b { color: var(--ink); font-size: 0.95rem; }
.pad-btn.on { background: var(--ac); color: var(--ac-contrast); }
.pad-btn.on b { color: var(--ac-contrast); }
.stick {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line);
  box-shadow: var(--sticker-sm);
}
.stick .nub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ac);
  border: 2px solid var(--line);
  transform: translate(-50%, -50%);
}
.stick-row { display: flex; gap: var(--space-5); flex-wrap: wrap; }

/* --- Touchscreen tester ---------------------------------------------------- */
.touch-stage {
  position: relative;
  min-height: 340px;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sticker-sm);
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
  display: grid;
  place-items: center;
  text-align: center;
}
.touch-hint {
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-weight: 600;
  padding: var(--space-5);
  pointer-events: none;
}
.touch-dot {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ac-soft);
  border: 3px solid var(--ac);
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}

/* --- Network tester -------------------------------------------------------- */
.net-bars {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  height: 60px;
  margin: var(--space-3) 0;
}
.net-bar {
  flex: 1;
  border-radius: 6px 6px 0 0;
  border: 2px solid var(--line);
  background: var(--surface);
  transition: height var(--dur-base) var(--ease), background var(--dur-fast) var(--ease);
  height: 12%;
}
.net-bar.on { background: var(--ac); }
@media (prefers-reduced-motion: reduce) { .net-bar { transition: none; } }

/* --- Battery tester -------------------------------------------------------- */
.battery {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.battery-shell {
  position: relative;
  width: 120px;
  height: 60px;
  border: 3px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sticker-sm);
  background: var(--surface);
  padding: 5px;
  flex: none;
}
.battery-shell::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 18px;
  width: 7px;
  height: 24px;
  background: var(--line);
  border-radius: 0 4px 4px 0;
}
.battery-fill {
  height: 100%;
  width: 50%;
  border-radius: 5px;
  background: var(--ok);
  transition: width var(--dur-base) var(--ease);
}
.battery-fill[data-low="true"] { background: var(--danger); }

/* --- Webcam tester --------------------------------------------------------- */
.cam-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sticker-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.cam-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.cam-stage[data-live="true"] video { display: block; }
.cam-placeholder {
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
  padding: var(--space-5);
}
.cam-stage[data-live="true"] .cam-placeholder { display: none; }
