/* The in-game mobile input deck stays in device pixels for reliable touch targets, independent of HUD zoom. */
.m-keyboard{position:fixed;left:0;right:0;bottom:0;z-index:220;box-sizing:border-box;padding:8px max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));background:#1b2124 url(/ui/mobile/popbg.png?v=3add4e59f44b5c98) center/100% 100%;border-top:1px solid #c7aa70;box-shadow:0 -6px 25px #0009;color:#efe6cf;touch-action:manipulation;-webkit-touch-callout:none;--key-height:42px}
.m-keyboard[hidden]{display:none!important}.m-keyboard *{box-sizing:border-box;font-family:system-ui,-apple-system,'Segoe UI',sans-serif!important}
.m-keyboard button{appearance:none;margin:0;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;color:inherit;font:inherit}
.m-keyboard button:disabled{opacity:.4;cursor:default}.m-keyboard :is(button,input):focus-visible{outline:2px solid #efcf83;outline-offset:1px}
.m-keyboard-head{display:flex;gap:12px;align-items:center;margin-bottom:6px;min-height:26px;font-size:12px}.m-keyboard-head strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:Georgia,serif!important;color:#e8cd8e;font-size:15px}
.m-keyboard-control{background:none;border:0;padding:4px;color:#d3c8ab!important;font-size:12px!important}
.m-keyboard-channels{display:flex;gap:4px;overflow-x:auto;margin-bottom:7px;scrollbar-width:thin}.m-keyboard-channel{flex:1;min-height:30px;border:1px solid #9b8a5d55;border-radius:3px;background:#101519aa;padding:4px 7px;font-size:11px!important;white-space:nowrap}.m-keyboard-channel[aria-pressed=true]{background:#e1c17a;border-color:#ffe6a4;color:#30230e}
.m-keyboard-compose{display:flex;gap:6px;align-items:center;margin-bottom:7px;min-width:0}.m-keyboard :is(input,textarea){height:40px;border:1px solid #85744d;border-radius:3px;background:#0b1115;color:#f6eaca;padding:8px;font-size:15px;min-width:0;-webkit-user-select:text;user-select:text}.m-keyboard :is(input,textarea)::placeholder{color:#92938b}.m-keyboard-recipient{flex:0 0 25%;width:25%}.m-keyboard-message{flex:1;width:0}.m-keyboard.recipient-active .m-keyboard-recipient{border-color:#f3d087}.m-keyboard-action{flex:none;border:0;min-height:40px;padding:7px 16px;background:url(/ui/mobile/btnY.png?v=be065432cc957cb3) center/100% 100%;font-size:13px!important;font-weight:700!important;color:#30230e!important}
.m-keyboard-row{display:flex;gap:5px;margin-top:5px}.m-keyboard-row.indent{padding:0 4%}.m-keyboard-key{flex:1;min-width:0;height:var(--key-height);border:1px solid #68716a;border-bottom:2px solid #080d0f;border-radius:5px;background:linear-gradient(#374146,#252e33);box-shadow:inset 0 1px 0 #b9b69715;font-size:16px!important;user-select:none;-webkit-user-select:none}
.m-keyboard-key:active,.m-keyboard-key.selected{background:#6d684d;color:#fff0b8}.m-keyboard-key.utility{background:linear-gradient(#252e32,#171f24);font-size:12px!important;color:#d0c6ac}.m-keyboard-key.wide{flex:1.5}.m-keyboard-key.space{flex:5;letter-spacing:.1em;font-size:11px!important}.m-keyboard-hint{font-size:11px;color:#bdad87;min-height:0}.m-keyboard-hint:empty{display:none}
.m-keyboard-keys.numeric{display:grid;grid-template-columns:repeat(3,1fr) 1.05fr;gap:5px;margin-top:7px;max-width:540px;margin-inline:auto}.m-keyboard-keys.numeric .m-keyboard-key{font-size:20px!important}.m-keyboard-keys.numeric .utility{font-size:12px!important}.m-keyboard-keys.numeric [aria-label=Backspace]{grid-column:4;grid-row:1}
.m-keyboard[data-mode=number] .m-keyboard-compose,.m-keyboard[data-mode=number] .m-keyboard-head,.m-keyboard[data-mode=number] .m-keyboard-hint{max-width:540px;margin-inline:auto}.m-keyboard[data-mode=number] .m-keyboard-message{text-align:right;font-size:21px}
/* Reserve visible content above the deck without moving the game world or resizing its canvas. */
body.m-keyboard-open :is(.m-chat,.m-dm){height:calc(100% - var(--app-keyboard-height,320px) / var(--m-scale,1) / var(--hud-ui-scale,1))!important;max-height:100%}
body.m-keyboard-open :is(.m-sheet,.m-shop,.m-trade,.m-nobility,.mobile-nobility){max-height:calc((100dvh - var(--app-keyboard-height,320px) - 16px) / var(--m-scale,1))!important;overflow:auto}
.m-keyboard-history{max-height:calc(var(--key-height)*4 + 20px);overflow:auto}.m-keyboard-history button{display:block;width:100%;background:none;border:0;border-bottom:1px solid #bba36a44;padding:10px;text-align:left;overflow-wrap:anywhere;font-size:13px}
@media(orientation:landscape) and (max-height:600px){.m-keyboard{--key-height:31px;padding-top:5px}.m-keyboard-head{min-height:22px;margin-bottom:3px}.m-keyboard-channels{margin-bottom:4px}.m-keyboard-channel{min-height:26px}.m-keyboard :is(input,textarea),.m-keyboard-action{height:34px;min-height:34px}.m-keyboard-row{margin-top:4px}.m-keyboard-compose{margin-bottom:4px}}
@media(max-width:430px){.m-keyboard{padding-left:max(6px,env(safe-area-inset-left));padding-right:max(6px,env(safe-area-inset-right))}.m-keyboard-channel{font-size:10px!important;padding:4px}.m-keyboard-row{gap:4px}.m-keyboard-action{padding:7px 11px}.m-keyboard :is(input,textarea){padding:7px;font-size:14px}.m-keyboard-key{font-size:15px!important}}

body.m-keyboard-open #mobile-hud .m-stage > :is(.m-sheet,.m-shop,.m-trade){top:0!important;bottom:auto!important;height:calc((100dvh - var(--app-keyboard-height,320px) - 8px) / var(--m-scale,1) / var(--hud-ui-scale,1))!important;min-height:0!important}
body.m-keyboard-open .nobility-panel{top:4px!important;transform:translateX(-50%)!important;max-height:calc((100dvh - var(--app-keyboard-height,320px) - 12px) / var(--hud-ui-scale,1))!important}

.m-keyboard textarea.m-keyboard-message{height:64px;resize:none;line-height:1.4}

/* The deck owns composition while open; retain source fields for drafts/validation and restore them on Hide. */
body.m-keyboard-open :is(.m-chat .m-cbar,.m-chat .m-cmenu,.m-chat .m-cdrawer,.m-dm .m-dm-bar){visibility:hidden!important;pointer-events:none!important}
body.m-keyboard-open .m-chat :is(.m-clist,.m-crail){bottom:3%}
.m-keyboard-emoji{height:calc(var(--key-height)*4 + 20px);display:flex;flex-direction:column;gap:6px;padding-top:5px}
.m-keyboard-emoji-tabs{display:flex;gap:5px;align-items:center;flex:none;min-height:30px}
.m-keyboard-emoji-tab{background:#11191c;border:1px solid #8e815e;border-radius:4px;color:#d7caab;padding:5px 9px;font-size:12px!important}
.m-keyboard-emoji-tab[aria-pressed=true]{color:#f9dea0;border-color:#d6b46d;background:#6d5a3544}
.m-keyboard-emoji-tabs .m-keyboard-key{flex:none;width:50px;height:30px;margin-left:auto}
.m-keyboard-emoji-grid{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:5px;overflow:auto;min-height:0;flex:1;align-content:start;overscroll-behavior:contain}
.m-keyboard-emoji-choice{min-height:var(--key-height);padding:3px;border:1px solid #73776566;border-radius:5px;background:#1a242a;font-family:'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif!important;font-size:24px!important;line-height:1.2}
.m-keyboard-emoji-choice:active{background:#70613d}
@media(max-width:430px){.m-keyboard-emoji-grid{grid-template-columns:repeat(6,minmax(0,1fr))}.m-keyboard-emoji-tab{font-size:11px!important;padding:5px 7px}}

.m-keyboard-compose{position:relative}
.m-keyboard :is(input,textarea){caret-color:transparent}
.m-keyboard-caret{position:absolute;width:2px;background:#ffe7a2;pointer-events:none;z-index:2;animation:m-keyboard-caret-blink 1s step-end infinite}
.m-keyboard-caret[hidden]{display:none!important}
.m-keyboard-caret-measure{position:fixed;left:-10000px;top:0;visibility:hidden;pointer-events:none;box-sizing:border-box;border:0;margin:0}
@keyframes m-keyboard-caret-blink{0%,49%{opacity:1}50%,100%{opacity:0}}
