:root { color-scheme:dark; font:16px/1.6 Arial,Helvetica,sans-serif; --background:#03070d; --surface:#0a0e15; --text:#f2f3f5; --muted:#bac2cf; --line:#38404d; --accent:#b5d6ff; --on-accent:#10151d; --error:#ffb9af; }
* { box-sizing:border-box; }
body { margin:0; background:var(--background); color:var(--text); }
main { max-width:850px; margin:0 auto; padding:clamp(20px,5vw,48px); }
nav { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; margin-bottom:40px; font-size:14px; }
a { color:var(--accent); text-underline-offset:3px; overflow-wrap:anywhere; }
header { margin-bottom:28px; }
h1 { margin:0; font-size:clamp(28px,5vw,42px); font-weight:400; line-height:1.15; letter-spacing:-.6px; overflow-wrap:anywhere; }
h2 { margin:0; font-size:23px; font-weight:400; line-height:1.3; }
p { margin:12px 0; }
section, details, .hardware-note { padding:clamp(18px,4vw,28px); margin:20px 0; border:1px solid var(--line); border-radius:7px; background:var(--surface); }
.hardware-note { border-color:#80694b; }
.label, .note, footer { color:var(--muted); font-size:14px; }
.label { letter-spacing:.5px; }
.accept { display:flex; align-items:flex-start; gap:12px; margin:24px 0; cursor:pointer; }
input[type=checkbox] { flex-shrink:0; width:22px; height:22px; margin-top:2px; accent-color:var(--accent); }
button, .button { display:inline-block; min-height:44px; max-width:100%; padding:10px 15px; border:1px solid #89929f; border-radius:4px; font:inherit; font-weight:400; background:#e2e7ed; color:#10151d; text-decoration:none; cursor:pointer; }
button.secondary { background:transparent; color:var(--accent); }
button:disabled { opacity:.55; cursor:default; }
:is(button,a,summary,input):focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
dt { font-weight:600; }
dd { margin:4px 0 16px; }
li { margin:12px 0; }
ol { padding-left:22px; }
summary { cursor:pointer; }
progress { width:100%; accent-color:var(--accent); }
.error, #status[data-error=yes] { color:var(--error); }
footer { margin-top:28px; }
.receiver-guide header { border-color:var(--line); }
.receiver-guide .wiring { padding:14px; background:#1c2532; border-radius:4px; }
.receiver-guide .label, .receiver-guide footer { color:var(--muted); }
.wiring-figure { margin:22px 0; }
.wiring-figure img { display:block; width:100%; height:auto; border:1px solid var(--line); border-radius:7px; background:#f5f7fa; }
.wiring-figure figcaption { margin-top:8px; font-size:14px; color:var(--muted); }
.wiring-preview { max-width:100%; margin-inline:auto; }
.wiring-connections { padding:16px; margin:16px 0; border:2px solid #78808b; border-radius:6px; font-size:18px; line-height:1.65; }
.wiring-connections p { margin:8px 0; }
.wiring-connections .wiring-positive { color:#ffadad; font-weight:bold; }
.wiring-table-wrap { overflow:auto; }
.wiring-table { width:100%; border-collapse:collapse; font-size:15px; }
.wiring-table th, .wiring-table td { text-align:left; vertical-align:top; padding:10px; border-bottom:1px solid var(--line); }
.wiring-table th { font-weight:600; }
#tester-reopen[hidden], #tester-readings[hidden] { display:none; }
#gamepad-tester { width:min(760px,calc(100% - 32px)); max-height:calc(100dvh - 32px); padding:clamp(18px,4vw,30px); color:var(--text); background:#0c121c; border:1px solid #78808b; border-radius:10px; overflow:auto; }
#gamepad-tester::backdrop { background:#000b; }
.tester-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; }
.tester-heading .label { margin-top:0; }
#tester-device { display:block; width:100%; min-height:44px; margin-top:8px; padding:9px; color:var(--text); background:var(--surface); border:1px solid #78808b; border-radius:4px; font:inherit; }
#gamepad-tester h3 { margin:20px 0 10px; font-size:17px; font-weight:400; }
.tester-axis { display:grid; grid-template-columns:65px minmax(40px,1fr) 125px; align-items:center; gap:12px; padding:8px 0; }
.tester-axis meter { width:100%; height:20px; accent-color:var(--accent); }
.tester-value { text-align:right; font:14px ui-monospace,monospace; }
#tester-buttons { display:flex; flex-wrap:wrap; gap:8px; }
.tester-key { display:inline-block; padding:7px 10px; border:1px solid var(--line); border-radius:5px; font-size:14px; }
.tester-key[data-pressed=true] { background:#b5d6ff; color:#10151d; border-color:#b5d6ff; font-weight:bold; }
@media(max-width:480px) {
  .tester-heading { flex-direction:column; gap:12px; }
  .tester-axis { grid-template-columns:58px minmax(35px,1fr); gap:8px; }
  .tester-value { grid-column:2; }
}
@media print {
  :root { color-scheme:light; --background:#fff; --surface:#fff; --text:#172923; --muted:#284d42; --accent:#284d42; --line:#b7cbc3; }
  main { max-width:none; padding:0; }
  nav { display:none; }
  section, .receiver-guide .wiring { background:#fff; }
  h2, h3 { break-after:avoid; }
  li { break-inside:avoid; }
  .wiring-connections .wiring-positive { color:#a51c1c; }
}
