/* Тест геймпада */
.gp-top{flex-wrap:wrap}
.gp-device{flex:1 1 260px;max-width:460px}
.gp-device select{width:100%;max-width:none}
.gp[data-mode=xbox] [data-mode-only=ps],.gp[data-mode=ps] [data-mode-only=xbox]{display:none}

/* Схема геймпада */
.gp-stage{position:relative;padding:16px 12px 8px;border-radius:18px;background:var(--soft)}
.gp-svg{width:100%;max-width:560px;height:auto;margin:0 auto;overflow:visible}
.gp-body{fill:#fff;stroke:#C9CDDB;stroke-width:2}
.gp-shape{fill:#EEF0F7;stroke:#C9CDDB;stroke-width:1.5;transition:fill .1s,stroke .1s}
.gp-dpad-c{fill:#EEF0F7}
.gp-stick-base{fill:#E3E6EF;stroke:#C9CDDB;stroke-width:1.5}
.gp-cap-ring{fill:none;stroke:#C9CDDB;stroke-width:1.5}
.gp-lab{font:700 13px "Onest",system-ui,sans-serif;fill:#5B6075;text-anchor:middle;dominant-baseline:central;pointer-events:none;user-select:none}
.gp-lab-sm{font-size:11px}
.gp-glyph{fill:none;stroke:#5B6075;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.gp-glyph-sm{stroke-width:1.4}
.gp-arrow{fill:#A3A8BA;pointer-events:none}
.gp-trig-fill{fill:var(--acc);opacity:.45}
.gp-key.is-tested .gp-shape{fill:#DCFCE7;stroke:#8FD3A8}
.gp-key.is-tested .gp-lab{fill:#166534}
.gp-key.is-tested .gp-glyph{stroke:#166534}
.gp-key.is-tested .gp-arrow{fill:#4C9A6A}
.gp-key.is-down .gp-shape{fill:var(--acc);stroke:var(--acc)}
.gp-key.is-down .gp-lab{fill:#fff}
.gp-key.is-down .gp-glyph,.gp-key.is-down .gp-cap-ring{stroke:rgba(255,255,255,.8)}
.gp-key.is-down .gp-arrow{fill:#fff}
/* У курка натискання показує заливка, а не колір усього курка */
.gp-trig.is-down .gp-shape{fill:#EEF0F7;stroke:var(--acc)}
.gp-trig.is-down.is-tested .gp-shape{fill:#DCFCE7}
.gp-trig.is-down .gp-lab{fill:var(--ink)}
.gp-nonstd{margin:4px auto 0;max-width:60ch;font-size:13px;color:#B45309;text-align:center}
.gp-nonstd[hidden]{display:none}

.gp-wait{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:20px;border-radius:18px;background:rgba(245,246,251,.78);text-align:center}
.gp-wait b{font-size:18px;max-width:30ch}
.gp-wait span:last-child{font-size:14px;color:var(--mut);max-width:44ch}
.gp-wait-ic{display:grid;place-items:center;width:68px;height:68px;margin-bottom:4px;border-radius:50%;background:#fff;color:var(--acc);box-shadow:0 10px 30px -12px rgba(79,70,229,.5);animation:gp-pulse 1.8s ease-in-out infinite}
.gp-wait-ic .ic{width:32px;height:32px}
@keyframes gp-pulse{50%{transform:scale(1.08)}}
.gp.is-live .gp-wait{display:none}

/* Стіки */
.gp-sticks{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
.gp-stick{display:flex;align-items:center;gap:14px;min-width:0;padding:12px;border:1px solid var(--line);border-radius:18px}
.tool .gp-canvas{width:150px;height:150px;flex:none}
.gp-stick-info{flex:1;min-width:0}
.gp-stick-info>b{display:block;margin-bottom:8px;font-size:15px}
.gp-stick-info dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;margin:0}
.gp-stick-info dt{font-size:12px;color:var(--mut)}
.gp-stick-info dd{margin:2px 0 0;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}
.gp-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px 18px;margin-top:12px}
.gp-dz{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:600;color:var(--mut)}
.gp-dz input{width:160px;accent-color:var(--acc)}
.gp-dz output{min-width:44px;color:var(--ink);font-variant-numeric:tabular-nums}
.gp-hint{flex:1;min-width:200px;font-size:13px;color:var(--mut)}

/* Курки */
.gp-trigs{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
.gp-trig-row{display:grid;grid-template-columns:auto minmax(0,1fr) 52px;align-items:center;gap:10px;font-size:13px;font-weight:600;color:var(--mut)}
.gp-trig-row em{font-style:normal;color:var(--acc)}
.gp-bar{height:10px;border-radius:999px;background:var(--soft);overflow:hidden}
.gp-bar i{display:block;width:100%;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--acc),var(--acc2));transform:scaleX(0);transform-origin:left}
.gp-trig-row b{text-align:right;color:var(--ink);font-variant-numeric:tabular-nums}

.gp .tool-grid{grid-template-columns:1fr 1fr}
.gp .stats{display:grid;grid-template-columns:1fr 1fr}
.gp .stats div{min-width:0}

/* Сирі дані */
.gp-raw{margin-top:12px;padding:14px 16px;border:1px solid var(--line);border-radius:16px}
.gp-info{display:flex;flex-wrap:wrap;gap:8px 22px;margin:0 0 14px}
.gp-info dt{font-size:12px;color:var(--mut)}
.gp-info dd{margin:2px 0 0;font-weight:600}
.gp-id{flex-basis:100%}
.gp-id dd{font:500 13px ui-monospace,SFMono-Regular,Consolas,monospace;word-break:break-word}
.gp-raw-cols{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);gap:16px}
.gp-raw-h{display:block;margin-bottom:8px;font-size:12px;color:var(--mut)}
.gp-empty{color:var(--mut)}
.gp-axes{display:grid;gap:7px}
.gp-axis{display:grid;grid-template-columns:auto minmax(0,1fr) 62px;align-items:center;gap:10px;font-size:12px;font-weight:600;color:#3A3F55}
.gp-axis i{position:relative;height:8px;border-radius:999px;background:var(--soft)}
.gp-axis i::after{content:"";position:absolute;top:-2px;bottom:-2px;left:50%;width:1px;background:#C9CDDB}
.gp-axis i b{position:absolute;top:0;bottom:0;left:50%;width:0;border-radius:999px;background:var(--acc)}
.gp-axis code{font:600 12px ui-monospace,SFMono-Regular,Consolas,monospace;text-align:right;font-variant-numeric:tabular-nums}
.gp-btns{display:flex;flex-wrap:wrap;gap:6px}
.gp-b{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:8px;background:var(--soft);font-size:12px;font-weight:600;color:#3A3F55;white-space:nowrap;font-variant-numeric:tabular-nums}
.gp-b code{font:600 11px ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--mut)}
.gp-b em{font-style:normal;font-weight:500;color:var(--mut)}
.gp-b.is-tested{background:#DCFCE7;color:#166534}
.gp-b.is-down{background:var(--acc);color:#fff}
.gp-b.is-down code,.gp-b.is-down em{color:rgba(255,255,255,.8)}

.gp-actions .btn .ic{width:20px;height:20px}
.gp-actions .btn:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none}
.gp-toast{margin-top:10px;text-align:center;font-size:13px;font-weight:600;color:var(--acc)}
.gp-toast[hidden]{display:none}

/* Стани діагнозу, яких немає в site.css */
.tool[data-state=slight] .diag,.tool[data-state=lost] .diag{background:#FFF7E6}
.tool[data-state=slight] .diag-ic,.tool[data-state=lost] .diag-ic{color:var(--warn)}
.tool[data-state=slight] .status i,.tool[data-state=lost] .status i{background:var(--warn)}
.tool[data-state=drift] .diag{background:#FEF0F0}
.tool[data-state=drift] .diag-ic{color:var(--bad)}
.tool[data-state=drift] .status i{background:var(--bad)}

@media (max-width:760px){
  .gp-top .tool-top-r{width:100%}
  .gp-device{max-width:none}
  .gp-stage{padding:10px 4px 4px}
  .gp-wait b{font-size:16px}
  .gp-sticks,.gp-trigs{grid-template-columns:1fr}
  .tool .gp-canvas{width:128px;height:128px;margin:0 auto}
  .gp-stick{flex-direction:column;align-items:stretch}
  .gp-dz{width:100%}
  .gp-dz input{flex:1;width:auto;min-width:0}
  .gp .tool-grid{grid-template-columns:1fr}
  .gp .stats div{padding:10px 12px}
  .gp-raw-cols{grid-template-columns:1fr}
}
