/* Hardware-Tester.com - Gamepad Tester
   Loaded AFTER /css/styles.css and /css/keyboard-tester.css. The shared pieces
   (breadcrumb, .kt panel, .kt-card, .kt-stat, .kt-controls, .kt-alert, FAQ,
   section styles) come from keyboard-tester.css; only gamepad-specific rules live here. */

.gp {
  --gp-on: var(--accent);
  --gp-tested: #60a5fa;
  --gp-warn: #fbbf24;
}

.gp-block {
  margin-top: 1.1rem;
}

.gp-block > h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

/* Status ------------------------------------------------------------ */
.gp-status {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.gp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.gp-status-pill::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--text-muted);
}

.gp-status-pill[data-state="ok"]::before {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.gp-status-pill[data-state="warn"]::before {
  background: var(--gp-warn);
}

.gp-status-pill[data-state="info"]::before {
  background: var(--gp-tested);
}

.gp-status-detail,
.gp-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.97rem;
}

.gp-help {
  padding: 0.75rem 0.95rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 0.7rem 0.7rem 0;
  color: var(--text);
}

.gp-help ol {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

/* Selector + form controls ------------------------------------------ */
.gp-select-wrap label,
.gp-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.gp-select-wrap select {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.45rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 0.7rem;
}

.gp-select-wrap select:disabled {
  opacity: 0.7;
}

.gp-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.gp-field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.gp-field-row output {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}

/* Virtual controller ------------------------------------------------- */
.gp-pad-wrap {
  position: relative;
  padding: 0.75rem;
  background: #0d141c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.gp-pad {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  transition: opacity 0.2s ease;
}

.gp-pad.is-generic {
  opacity: 0.3;
}

.gp-pad .gp-part {
  fill: #1c2937;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  transition: fill 0.06s ease, stroke 0.06s ease;
}

.gp-pad .gp-body {
  fill: #162130;
  stroke: var(--border-strong);
  stroke-width: 2;
}

.gp-pad .gp-pad-trig-fill {
  fill: var(--accent);
}

.gp-pad .gp-trig-fill-bg {
  fill: #1c2937;
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.gp-pad .is-pressed {
  fill: var(--accent);
  stroke: #a5f3ec;
}

.gp-pad .gp-knob {
  transition: transform 0.05s linear;
}

.gp-pad text {
  font: 700 15px var(--font);
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.gp-pad .gp-small {
  font-size: 9px;
  fill: var(--text-muted);
}

.gp-pad .is-pressed + text {
  fill: #04221f;
}

.gp-pad-caption {
  margin: 0.5rem 0 0;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.gp-note {
  margin: 0.7rem 0 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  color: var(--text);
  background: rgba(251, 191, 36, 0.1);
  border-left: 3px solid var(--gp-warn);
  border-radius: 0 0.7rem 0.7rem 0;
}

/* Stick panels -------------------------------------------------------- */
.gp-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.9rem;
}

.gp-two.is-generic .gp-stick {
  opacity: 0.4;
}

.gp-stick-svg {
  width: min(100%, 13rem);
  margin: 0 auto 0.8rem;
}

.gp-stick-area {
  fill: #0d141c;
  stroke: var(--border-strong);
  stroke-width: 2;
}

.gp-stick-ring {
  fill: none;
  stroke: var(--border-strong);
  stroke-dasharray: 3 4;
}

.gp-stick-cross {
  stroke: var(--border);
  stroke-width: 1;
}

.gp-zone {
  fill: rgba(79, 209, 197, 0.12);
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.gp-dot {
  fill: var(--accent);
  stroke: #a5f3ec;
  stroke-width: 1.5;
  transition: transform 0.05s linear, fill 0.1s ease;
}

.gp-dot.is-off {
  fill: var(--gp-warn);
  stroke: #fde68a;
}

.gp-neutral.is-off {
  color: var(--gp-warn);
}

/* Threshold control */
.gp-threshold {
  margin-top: 0.9rem;
  max-width: 28rem;
}

.gp-small-note {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Button grid --------------------------------------------------------- */
.gp-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gp-btn {
  padding: 0.6rem 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  transition: border-color 0.08s ease, background 0.08s ease;
}

.gp-btn.is-tested {
  border-color: var(--gp-tested);
  background: rgba(96, 165, 250, 0.08);
}

.gp-btn.is-down {
  border-color: #a5f3ec;
  background: rgba(79, 209, 197, 0.2);
  box-shadow: 0 0 14px rgba(79, 209, 197, 0.35);
}

.gp-btn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.gp-btn-index {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.gp-badge {
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.gp-badge.is-on {
  color: #04221f;
  background: var(--accent);
  border-color: var(--accent);
}

.gp-btn-label {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 2.3em;
}

.gp-meter {
  height: 0.35rem;
  overflow: hidden;
  background: var(--bg);
  border-radius: 999px;
}

.gp-meter-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
}

.gp-btn-val,
.gp-btn-tested {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.gp-btn.is-tested .gp-btn-tested {
  color: #bcd7fc;
}

/* Axis list ------------------------------------------------------------ */
.gp-axes {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gp-axis {
  display: grid;
  grid-template-columns: 8rem minmax(6rem, 1fr) 4.6rem minmax(0, 11rem) 5.5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
}

.gp-axis.is-tested {
  border-color: var(--gp-tested);
}

.gp-axis-name {
  font-weight: 600;
}

.gp-axis-bar {
  position: relative;
  height: 0.6rem;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.gp-axis-mid {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}

.gp-axis-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  background: var(--accent);
}

.gp-axis-val,
.gp-axis-range {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.gp-axis-moved.is-on {
  color: var(--gp-tested);
  font-weight: 700;
}

.gp-axis-moved {
  color: var(--text-muted);
}

/* Triggers -------------------------------------------------------------- */
.gp-trig-bar {
  height: 1.4rem;
  margin-bottom: 0.8rem;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.gp-trig-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.gp-trig.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(79, 209, 197, 0.2);
}

/* Vibration ------------------------------------------------------------- */
.gp-vib {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.gp-vib-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.gp-vib-status {
  margin: 0.9rem 0 0;
  font-size: 0.95rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Monitor ---------------------------------------------------------------- */
.gp-monitor {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.gp-monitor dt {
  color: var(--text-muted);
}

.gp-monitor dd {
  margin: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.gp-log {
  max-height: 14rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-size: 0.88rem;
}

.gp-log-item {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.gp-log-item time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Stats + summary ---------------------------------------------------------- */
.gp-summary {
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.gp-summary h3 {
  margin: 0 0 0.6rem;
}

.gp-summary h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.gp-sum-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.gp-summary p {
  margin: 0.4rem 0;
}

@media (max-width: 760px) {
  .gp-axis {
    grid-template-columns: 1fr 4.6rem;
  }

  .gp-axis-bar {
    grid-column: 1 / -1;
    order: 3;
  }

  .gp-axis-range,
  .gp-axis-moved {
    grid-column: 1 / -1;
  }

  .gp-btn-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.2rem, 1fr));
  }
}
