.controller-panel{box-sizing:border-box;width:min(680px,calc(100vw - 28px));max-height:calc(100dvh - 28px);margin:auto;padding:0;border:1px solid #626557;border-radius:20px;background:#202821;color:#f1f0df;box-shadow:0 28px 110px #0008;font-family:Arial,Helvetica,sans-serif;overflow:auto;color-scheme:dark}
.controller-panel::backdrop{background:#101910b8;backdrop-filter:blur(5px)}
.controller-panel *{box-sizing:border-box}
.controller-panel button,.controller-panel select{font:inherit;touch-action:manipulation}
.controller-panel button{min-height:44px;padding:10px 15px;border:1px solid #616454;border-radius:9px;background:#323c32;color:#f1f0df;font-size:13px;font-weight:700;cursor:pointer}
.controller-panel button:hover{background:#414b3d}
.controller-panel button:disabled{opacity:.4;cursor:default}
.controller-panel button:focus-visible,.controller-panel select:focus-visible{outline:3px solid #f0c56b;outline-offset:3px}
.controller-panel [hidden]{display:none!important}
.controller-gamepad-view{display:contents}
.controller-tabs{display:flex;gap:8px;margin:0 26px 20px;border-bottom:1px solid #46523f;padding-bottom:12px}
.controller-tabs button{flex:1;background:transparent}
.controller-tabs button[aria-selected=true]{border-color:#d8bd79;background:#ddbd6a20;color:#f4d590}
.keyboard-controls{grid-column:1/-1;min-width:0}
.keyboard-bindings{display:grid;gap:0;margin-bottom:18px}
.keyboard-binding-row{display:grid;grid-template-columns:minmax(130px,1fr) minmax(0,1.6fr);gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid #ffffff12}
.keyboard-action{min-width:0}.keyboard-action strong{font-size:13px}.keyboard-action small{display:block;margin-top:5px;font-size:11px;line-height:1.4;color:#aab89e}
.keyboard-key-options{display:flex;flex-wrap:wrap;gap:7px;justify-content:flex-end;min-width:0}
.keyboard-key-pair{display:inline-flex;min-width:0}
.controller-panel .keyboard-key{border-radius:7px 0 0 7px;padding:8px 10px;min-width:42px;font:12px ui-monospace,SFMono-Regular,Menlo,monospace}
.controller-panel .keyboard-remove{border-left:0;border-radius:0 7px 7px 0;padding:8px;min-width:32px;font-size:17px}
.controller-panel .keyboard-key[data-capturing=true],.controller-panel .keyboard-add[data-capturing=true]{border-color:#f1c364;outline:2px solid #f1c364;outline-offset:2px;background:#67582e;color:#fff3bc}
.controller-panel .keyboard-add{font-size:11px;padding:8px}
.keyboard-feedback{min-height:38px;margin:12px 0;color:#d9dfbb;font-size:12px;line-height:1.55}
.keyboard-feedback[data-error=true]{color:#ffd19a}
.keyboard-tools{display:flex;flex-wrap:wrap;gap:8px}
@media(max-width:520px){.controller-tabs{margin:0 17px 17px}.keyboard-binding-row{grid-template-columns:1fr;gap:9px}.keyboard-key-options{justify-content:flex-start}.keyboard-action small{max-width:270px}.controller-panel .keyboard-remove{min-width:40px}.keyboard-tools button{flex:1 1 auto}}
.controller-panel .controller-primary{background:#f0c56b;border-color:#f0c56b;color:#252d23}
.controller-panel .controller-primary:hover{background:#ffda8e}
.controller-panel .controller-quiet{background:transparent}
.controller-head{display:flex;align-items:center;gap:14px;padding:24px 26px 18px}
.controller-mark{display:grid;place-items:center;width:48px;height:48px;flex:none;border:1px solid #778267;border-radius:14px;background:#354132;color:#d9e4b9}
.controller-mark svg{width:34px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.controller-heading{flex:1}.controller-kicker{margin:0 0 5px;font:10px ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:2px;color:#b8bea9}.controller-panel h2{margin:0;font-size:24px;letter-spacing:-.6px}.controller-close{min-width:44px;font-size:20px!important}
.controller-content{padding:0 26px 24px}.controller-intro{margin:0 0 20px;color:#bcc4b0;font-size:13px;line-height:1.6}
.controller-device-row{display:flex;align-items:center;gap:12px;margin-bottom:10px}.controller-device-row label{flex:1;min-width:0;font-size:11px;font-weight:700;color:#aeb9a1}.controller-device-row select{display:block;width:100%;min-height:44px;margin-top:7px;border:1px solid #606957;border-radius:9px;background:#2b352b;color:#f1f0df;padding:10px 34px 10px 12px;font-size:13px;text-overflow:ellipsis}.controller-status{min-height:19px;margin:0 0 14px;font:11px ui-monospace,SFMono-Regular,Menlo,monospace;color:#c8d5ad;line-height:1.5}.controller-status[data-state=waiting]{color:#e8c888}.controller-status[data-state=error]{color:#ffb095}
.controller-live{position:relative;display:flex;gap:14px;align-items:center;min-height:82px;border:1px solid #46523f;border-radius:12px;background:repeating-linear-gradient(0deg,transparent,transparent 15px,#ffffff04 15px,#ffffff04 16px),#19221b;padding:12px 14px;margin-bottom:20px}.controller-stick{position:relative;flex:none;width:51px;height:51px;border:1px solid #526548;border-radius:50%;background:linear-gradient(transparent 49%,#48613d 50%,transparent 52%),linear-gradient(90deg,transparent 49%,#48613d 50%,transparent 52%)}.controller-stick:before{content:"";position:absolute;inset:10px;border:1px solid #526548;border-radius:50%}.controller-stick-dot{position:absolute;left:20px;top:20px;width:9px;height:9px;border-radius:50%;background:#d7e6ac;box-shadow:0 0 9px #bada7540;will-change:transform}.controller-live-content{min-width:0;flex:1}.controller-live-label{margin:0 0 7px;font:9px ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:1.5px;color:#a2b38c}.controller-live-readout{min-height:26px;display:flex;gap:5px;flex-wrap:wrap;align-items:center;color:#a9b799;font:11px ui-monospace,SFMono-Regular,Menlo,monospace}.controller-input-chip{display:inline-block;padding:5px 7px;border:1px solid #a5c174;border-radius:5px;background:#bada7520;color:#e4efc4}.controller-panel h3{font-size:13px;margin:0 0 10px}.controller-legend{display:grid;grid-template-columns:1fr 1fr;gap:6px 14px;margin:0 0 14px}.controller-legend-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:39px;padding:7px 0;border-bottom:1px solid #ffffff0d;font-size:12px}.controller-legend-row dt{color:#d6dfcb;white-space:nowrap}.controller-legend-row dd{margin:0;color:#b7c2a8;text-align:right;font-size:11px;line-height:1.3}.controller-legend-row[data-complete=true] dd{color:#dbeaac}.controller-legend-row[data-active=true]{color:#f6cd75;border-bottom-color:#f6cd75}.controller-legend-row[data-active=true] dt,.controller-legend-row[data-active=true] dd{color:#f6cd75}.controller-note{margin:0;color:#97a78c;font-size:11px;line-height:1.55}.controller-tools{display:flex;gap:9px;flex-wrap:wrap;margin:19px 0 0}
.controller-calibration{margin-top:18px;padding:17px;border:1px solid #a68d52;border-radius:12px;background:#51412535}.controller-calibration-step{margin:0 0 8px;color:#e2bc70;font:10px ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:1.4px}.controller-calibration h3{margin:0 0 8px;font-size:20px;letter-spacing:-.3px}.controller-calibration-help{min-height:32px;margin:0;color:#e1d1ac;font-size:12px;line-height:1.5}.controller-calibration-actions{display:flex;gap:9px;margin-top:13px}
.controller-footer{display:flex;align-items:center;gap:16px;justify-content:space-between;border-top:1px solid #46513d;padding:15px 26px;background:#273126;position:sticky;bottom:0;z-index:1}.controller-footer p{margin:0;color:#aebc9f;font-size:11px;line-height:1.4}.controller-footer button{min-width:96px}.controller-feedback{margin:15px 0 0;min-height:17px;font-size:12px;line-height:1.5;color:#f4d084}
@media(max-width:520px){.controller-panel{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:15px}.controller-head{padding:18px 17px 15px;gap:10px}.controller-content{padding:0 17px 18px}.controller-panel h2{font-size:21px}.controller-mark{width:42px;height:42px}.controller-footer{padding:12px 17px}.controller-legend{gap:4px 10px}.controller-legend-row{font-size:11px}.controller-legend-row dd{font-size:10px}.controller-intro{font-size:12px;margin-bottom:15px}.controller-tools button{flex:1;padding:10px}.controller-footer p{font-size:10px}}
@media(max-height:520px) and (min-width:600px){.controller-panel{width:min(850px,calc(100vw - 24px))}.controller-head{padding:15px 23px 12px}.controller-content{display:grid;grid-template-columns:1fr 1fr;gap:0 24px;padding:0 23px 15px}.controller-intro{grid-column:1/-1;margin-bottom:12px}.controller-left{min-width:0}.controller-right{min-width:0}.controller-feedback{grid-column:1/-1}.controller-live{margin-bottom:0}.controller-calibration{grid-column:1/-1}.controller-footer{padding:10px 23px}.controller-mark{width:38px;height:38px}.controller-panel h2{font-size:21px}.controller-tools{margin-top:12px}.controller-note{font-size:10px}}
@media(prefers-reduced-motion:reduce){.controller-stick-dot{will-change:auto}}
