/* Shared corner stacks prevent independent panels from covering one another. */
:root{--cm-hud-left:max(18px,env(safe-area-inset-left));--cm-hud-right:max(18px,env(safe-area-inset-right));--cm-hud-top:max(16px,env(safe-area-inset-top));--cm-badge-clearance:max(68px,calc(env(safe-area-inset-bottom) + 58px))}
.cm-hud-location{position:absolute;left:var(--cm-hud-left);top:var(--cm-hud-top);display:flex;flex-direction:column;align-items:flex-start;gap:6px;max-width:calc(50% - 24px)}
.cm-hud-location .territoryHud,.cm-hud-location .world-clock{position:static;inset:auto;transform:none;margin:0;max-width:100%;min-height:28px;display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cm-hud-location .territoryHud{padding:6px 9px;border:1px solid #becbab33;border-left:3px solid var(--team-color,#aaa);background:#101c16dd;color:#d7dfc9;font:600 10px/1.2 system-ui}
.hud .topbar{left:auto;right:var(--cm-hud-right);top:var(--cm-hud-top);max-width:calc(50% - 24px);z-index:8}
.hud .topright{display:grid;grid-template-columns:minmax(0,auto) minmax(0,auto);max-width:100%;min-width:0;gap:7px 8px;align-items:start;justify-items:end}
.topright button{pointer-events:auto}
.topright #controlsButton{grid-column:1;grid-row:1;align-self:center;margin:0;white-space:nowrap}
.topright .cm-online-button{grid-column:2;grid-row:1;margin:0;min-height:30px;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.topright .voice-button{grid-column:1/-1;grid-row:2;position:static;inset:auto;max-width:100%;min-height:30px;margin:0;padding:8px 10px;white-space:normal;line-height:1.4;text-align:right}
.topright .cm-pause-toggle{grid-column:2;grid-row:3;position:static;inset:auto;min-height:30px;margin:0}
.topright #devHud{grid-column:1/-1;grid-row:4;max-width:min(490px,70vw);margin:0}
.weaponPanel{bottom:var(--cm-badge-clearance);right:var(--cm-hud-right);max-width:260px}
.cm-chat{left:calc(var(--cm-vx,0px) + var(--cm-hud-left));top:calc(var(--cm-vy,0px) + var(--cm-hud-top) + 78px);bottom:auto;max-height:calc(var(--cm-vh,100dvh) - 238px);width:288px;font-size:12px;border-color:#9aa98355;border-radius:3px;background:#111b17ed;box-shadow:0 5px 20px #0004}
.cm-chat-head{background:#1a271fee}.cm-chat button{border-radius:2px}.cm-chat-messages{height:136px;flex:1;min-height:26px;max-height:24vh}.cm-chat.is-minimized .cm-chat-toggle{min-height:32px;border-radius:2px;padding:7px 12px}.cm-chat-content{flex:1;min-height:0}.cm-chat-tabs button{padding:5px 8px}.cm-chat-note{font-size:10px}.cm-chat-form input{padding:6px}
.cm-quickslots{position:absolute;left:50%;bottom:max(20px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:9;display:grid;grid-template-columns:repeat(4,68px);gap:8px;pointer-events:auto}
.cm-quickslots[hidden]{display:none!important}
.cm-quickslot{position:relative;display:grid;grid-template-rows:42px 16px;place-items:center;min-width:0;height:76px;padding:10px 4px 4px;border:1px solid #acb49655;border-radius:3px;background:linear-gradient(150deg,#1a251bee,#0c140fee);color:#cbd3bc;font:10px/1.2 system-ui;box-shadow:0 4px 12px #0004;cursor:pointer;touch-action:manipulation}
.cm-quickslot kbd{position:absolute;top:5px;left:7px;font:700 10px/1 system-ui;color:#d5d9c5}.cm-quickslot canvas{width:44px;height:40px;object-fit:contain;pointer-events:none}.cm-quickslot-empty{font:300 24px/1 system-ui;color:#83927b}.cm-quickslot-name{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px;text-align:center}.cm-quickslot small{position:absolute;right:5px;top:5px;padding:1px 3px;font:700 9px system-ui;background:#080e09bd;color:#e4d6a9}.cm-quickslot.is-active{border-color:#d2c391;color:#f2e6b8;background:linear-gradient(150deg,#3f492cee,#182318ee);box-shadow:inset 0 -3px #d2c391,0 4px 12px #0005}.cm-quickslot.is-active kbd{color:#f4df9d}.cm-quickslot.is-unavailable{opacity:.5}.cm-quickslot:hover{border-color:#c6d0aa;background-color:#415333}.cm-quickslot:focus-visible,.cm-shortcut-config button:focus-visible{outline:2px solid #eddaa1;outline-offset:3px}
.cm-inventory-shortcuts{margin:12px 0;border-top:1px solid #a3b28e30;padding-top:8px}.cm-inventory-shortcuts .equipment-heading{gap:8px;flex-wrap:wrap;margin:0 0 8px}.cm-inventory-shortcuts .equipment-heading small{font-size:9px}.cm-shortcut-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.cm-shortcut-config{position:relative;min-width:0;border:1px solid #71856755;background:#0c160f66;border-radius:3px}.cm-shortcut-config>button:first-child{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;min-height:76px;padding:9px 3px 5px;background:transparent;border:0;color:#ced8c0;cursor:pointer;font:9px system-ui}.cm-shortcut-config kbd{position:absolute;left:5px;top:4px;color:#e7d4a0;font:700 10px system-ui}.cm-shortcut-config .gear-icon{width:36px;height:32px}.cm-shortcut-config b{font-size:22px;font-weight:300;color:#879780}.cm-shortcut-config span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cm-shortcut-config small{font-size:8px;color:#cda88a}.cm-shortcut-config .cm-shortcut-clear{position:absolute;right:0;top:0;border:0;background:#17251ae8;color:#d2bba4;width:23px;height:23px;cursor:pointer;font-size:15px}.cm-shortcut-config.drop-hover,.cm-shortcut-config.drop-compatible{border-color:#c4d496;background:#52683c33}.cm-shortcut-config.drop-hover{outline:2px solid #d3dda7}
.cm-shortcut-assign{margin-top:14px;padding-top:10px;border-top:1px solid #91a17c33}.cm-shortcut-assign p{font-size:10px!important;margin:0 0 8px!important}.cm-shortcut-assign>div{display:flex;gap:7px}.cm-shortcut-assign button{min-width:34px;min-height:32px;font-weight:700}
@media(max-width:800px){.cm-quickslots{grid-template-columns:repeat(4,56px);gap:6px}.cm-quickslot{height:66px;grid-template-rows:34px 14px}.cm-quickslot canvas{width:38px;height:34px}.status{width:176px}.weaponPanel{min-width:145px;max-width:180px}.cm-chat{width:260px}#controlsButton{font-size:9px}}
@media(max-width:600px){body:not(.cm-touch-device) .cm-quickslots{bottom:18px}body:not(.cm-touch-device) .status{bottom:100px;width:156px}body:not(.cm-touch-device) .weaponPanel{bottom:max(100px,env(safe-area-inset-bottom));max-width:160px}body:not(.cm-touch-device) .cm-chat{max-height:calc(var(--cm-vh,100dvh) - 310px)}.topright #controlsButton{grid-column:1/-1;grid-row:3}.topright .cm-online-button{grid-column:1/-1}.topright .cm-pause-toggle{grid-row:4}.topright #devHud{grid-row:5}}
/* Touch controls retain their own corners; the bar clears movement and aim. */
body.cm-touch-device{--cm-hud-left:max(12px,env(safe-area-inset-left));--cm-hud-right:max(12px,env(safe-area-inset-right));--cm-hud-top:max(12px,env(safe-area-inset-top))}
body.cm-touch-device .cm-hud-location{max-width:calc(50% - 10px)}
body.cm-touch-device .cm-hud-location .territoryHud,body.cm-touch-device .cm-hud-location .world-clock{position:static;inset:auto;transform:none;max-width:100%;min-height:24px;font-size:9px;gap:4px}
body.cm-touch-device .status,body.cm-touch-device .weaponPanel{top:82px;bottom:auto}
body.cm-touch-device .cm-chat{top:212px;left:var(--cm-hud-left);width:min(276px,calc(100vw - 24px));max-height:max(140px,calc(var(--cm-vh,100dvh) - 547px))}
body.cm-touch-device .cm-chat button{min-height:36px}.cm-touch-quick{display:none}
body.cm-touch-device .cm-quickslots{bottom:max(250px,calc(env(safe-area-inset-bottom) + 238px));grid-template-columns:repeat(4,52px);gap:6px;z-index:2147483101}
body.cm-touch-device .cm-quickslot{height:62px;grid-template-rows:31px 13px;padding-top:12px}
body.cm-touch-device .cm-quickslot canvas{width:34px;height:29px}
body.cm-touch-device .prompt{bottom:max(326px,calc(env(safe-area-inset-bottom) + 314px));max-width:65%}
body.cm-touch-device .cm-touch-talk{bottom:max(28px,env(safe-area-inset-bottom))}
@media(orientation:landscape) and (max-height:550px){body.cm-touch-device .cm-hud-location{max-width:190px}body.cm-touch-device .cm-hud-location .territoryHud,body.cm-touch-device .cm-hud-location .world-clock{min-height:21px;font-size:8px}body.cm-touch-device .status,body.cm-touch-device .weaponPanel{top:68px}body.cm-touch-device .cm-chat{top:146px;max-height:calc(var(--cm-vh,100dvh) - 330px);width:250px}body.cm-touch-device .cm-chat-messages{height:50px}body.cm-touch-device .cm-chat-note{display:none}body.cm-touch-device .cm-quickslots{bottom:max(72px,calc(env(safe-area-inset-bottom) + 62px))}body.cm-touch-device .prompt{bottom:146px;max-width:42%}body.cm-touch-device .survival-state{top:143px}body.cm-touch-device .cm-touch-talk{bottom:max(12px,env(safe-area-inset-bottom))}}
/* An expanded chat gets the center on short touch screens. */
@media(orientation:landscape) and (max-height:550px){body.cm-touch-device .cm-chat:not(.is-minimized){left:50%;top:74px;transform:translateX(-50%);width:min(350px,calc(100vw - 350px));max-height:calc(var(--cm-vh,100dvh) - 92px)}body.cm-touch-device:has(.cm-chat:not(.is-minimized):not([hidden])) .cm-quickslots,body.cm-touch-device:has(.cm-chat:not(.is-minimized):not([hidden])) .prompt{visibility:hidden}}
.cm-inventory-shortcuts{flex-shrink:0}.survivor-overlay:not(.is-title) .character-panel{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
