/* =====================================================================
   Mando — prueba de sticks, gatillos y botones (pages/gamepad.js)
   Mismo lenguaje visual que Test de velocidad (paneles azul noche).
   Pensado para pintar poco: el punto del stick y las barras se mueven
   con transform; sin filtros, desenfoques ni animaciones continuas.
   ===================================================================== */
.gp-wrap {
  --gp-panel: linear-gradient(160deg, rgba(18,18,20,.96) 0%, rgba(13,13,14,.96) 58%, rgba(10,10,11,.96) 100%);
  --gp-border: rgba(200,200,205,.13);
  --gp-border-soft: rgba(200,200,205,.08);
  --gp-text: #f2f2f3; --gp-muted: rgba(245,245,247,.78); --gp-dim: rgba(245,245,247,.55);
  --gp-accent: #f5f5f5; --gp-accent-2: #e5e5e5; --gp-ok: #34d399;
  display: flex; flex-direction: column; gap: 14px; color: var(--gp-text);
}
.gp-wrap [hidden] { display: none !important; }

.gp-card {
  position: relative; background: var(--gp-panel); border: 1px solid var(--gp-border); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 26px rgba(0,0,0,.42);
  padding: 16px 18px;
}
.gp-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gp-muted);
}
.gp-card-head b { font-size: 13px; letter-spacing: 0; color: var(--gp-accent-2); font-variant-numeric: tabular-nums; }

/* ── Sin mando ── */
.gp-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 42px 24px; }
.gp-empty-ic { color: var(--gp-accent-2); opacity: .9; }
.gp-empty-title { font-size: 16px; font-weight: 700; }
.gp-empty-text { margin: 0; max-width: 460px; font-size: 13px; color: var(--gp-dim); }

/* ── Pestañas (varios mandos) ── */
.gp-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.gp-tab {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--gp-muted);
  background: rgba(255,255,255,.03); border: 1px solid var(--gp-border); border-radius: 999px; padding: 6px 14px;
}
.gp-tab.is-active { color: var(--gp-text); border-color: var(--gp-accent); background: rgba(245,245,245,.14); }

/* ── Cabecera del mando ── */
#gpMain { display: flex; flex-direction: column; gap: 14px; }
.gp-info { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; }
.gp-info-ic { color: var(--gp-accent-2); display: grid; place-items: center; }
.gp-info-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.gp-info-text b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-info-text span { font-size: 12px; color: var(--gp-ok); }
.gp-info-text .gp-note { color: var(--gp-dim); }
.gp-dz-ctl { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--gp-muted); }
.gp-dz-ctl input { width: 130px; accent-color: var(--gp-accent); }
.gp-dz-ctl b { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gp-text); }

/* ── Sticks ── */
.gp-sticks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gp-stick { display: flex; flex-direction: column; align-items: center; }
.gp-stick .gp-card-head { width: 100%; }
.gp-grid {
  position: relative; width: min(100%, 200px); aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: #0d0d0d; border: 1px solid var(--gp-border-soft);
}
.gp-grid-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.gp-grid-lines path { fill: none; stroke: rgba(200,200,205,.10); stroke-width: .6; vector-effect: non-scaling-stroke; }
.gp-grid-lines .gp-axis { stroke: rgba(200,200,205,.22); }
.gp-grid-lines circle { fill: none; stroke: rgba(200,200,205,.18); stroke-width: 1; vector-effect: non-scaling-stroke; }
.gp-dz {
  position: absolute; left: 50%; top: 50%; width: calc(var(--dz, .1) * 100%); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: rgba(52,211,153,.10); border: 1px dashed rgba(52,211,153,.55);
}
.gp-dot {
  position: absolute; left: calc(50% - 7px); top: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%;
  background: var(--gp-accent-2); box-shadow: 0 0 0 3px rgba(229,229,229,.25);
  will-change: transform;
}
.gp-dot.is-dz { background: var(--gp-ok); box-shadow: 0 0 0 3px rgba(52,211,153,.22); }
.gp-xy { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--gp-dim); }
.gp-xy b { color: var(--gp-text); font-variant-numeric: tabular-nums; display: inline-block; min-width: 46px; text-align: right; }

/* ── Gatillos / ejes ── */
.gp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; }
.gp-trig + .gp-trig { margin-top: 14px; }
.gp-trig-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--gp-muted); margin-bottom: 6px; }
.gp-trig-head b { color: var(--gp-text); font-variant-numeric: tabular-nums; }
.gp-bar { position: relative; height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.gp-bar i {
  position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gp-accent), var(--gp-accent-2));
  transform: scaleX(0); transform-origin: left center; will-change: transform;
}
/* Ejes sin mapear (-1…1): la barra crece desde el centro */
.gp-bar-c i { left: 50%; right: 0; transform-origin: left center; }
.gp-bar-c::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.25); }
.gp-raw .gp-trig + .gp-trig { margin-top: 10px; }

/* ── Botones ── */
.gp-btn-groups { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.gp-btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.gp-btn {
  min-width: 42px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center;
  border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--gp-muted);
  background: rgba(255,255,255,.04); border: 1px solid var(--gp-border);
}
.gp-btn.is-on { color: #fff; background: var(--gp-accent); border-color: var(--gp-accent-2); }
.gp-hint { margin: 0; font-size: 12.5px; color: var(--gp-dim); }

@media (max-width: 1000px) {
  .gp-row { grid-template-columns: 1fr; }
}
