/* Paint uses the existing BUILD -> PAINT -> WRITE function menu.
   The compact MS Paint-style palette stays on the RIGHT edge above combat
   controls, rather than opening a wide modal over the arena or chat. */
#hud #paint-button.paint-active{
 outline:2px solid #b7f1c8;outline-offset:1px;
 background:#e4ffed!important;color:#164b2a!important;
}
#paint-toolbar[hidden]{display:none!important}
#hud #paint-toolbar{
 position:fixed;z-index:120;left:auto;right:max(10px,env(safe-area-inset-right) + 8px);
 top:max(106px,calc(env(safe-area-inset-top) + 76px));
 transform:none;box-sizing:border-box;
 display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
 gap:6px;width:96px;max-width:calc(100vw - 24px);
 max-height:calc(100dvh - 246px);overflow-y:auto;overscroll-behavior:contain;
 padding:6px;border:2px solid;border-color:#fafafa #505050 #505050 #fafafa;
 border-radius:0;background:#c0c0c0;color:#111;
 box-shadow:2px 3px 0 #0007;font:700 11px/1.15 Tahoma,Arial,sans-serif;
 pointer-events:auto;touch-action:pan-y;
}
#hud #paint-toolbar .paint-title{
 display:block;padding:5px 3px;background:#000080;color:white;
 font:700 10px Tahoma,Arial,sans-serif;letter-spacing:.08em;text-align:center;
}
#hud #paint-toolbar button{
 display:flex;align-items:center;justify-content:center;box-sizing:border-box;
 width:100%;min-height:34px;margin:0;padding:5px 3px;
 border:2px solid;border-color:#fff #555 #555 #fff;border-radius:0;
 background:#c0c0c0;color:#111;box-shadow:none;
 font:700 11px/1.2 Tahoma,Arial,sans-serif;
 cursor:pointer;touch-action:manipulation;
}
#hud #paint-toolbar button.active,
#hud #paint-toolbar button:active{
 background:#e8e8e8;border-color:#555 #fff #fff #555;
 box-shadow:inset 1px 1px #666;
}
#hud #paint-toolbar button:focus-visible,
#hud #paint-toolbar input:focus-visible{outline:2px solid #000080;outline-offset:1px}
#hud #paint-toolbar label{
 display:flex;flex-direction:column;align-items:center;justify-content:center;
 gap:4px;margin:0;padding:2px 0;color:#111;min-width:0;
}
#hud #paint-toolbar input[type=color]{
 display:block;box-sizing:border-box;width:40px;height:33px;min-height:33px;
 padding:2px;cursor:pointer;border:2px solid;
 border-color:#555 #fff #fff #555;background:#c0c0c0;touch-action:manipulation;
}
#hud #paint-toolbar input[type=range]{
 box-sizing:border-box;display:block;width:100%;min-height:20px;margin:0;
 accent-color:#000080;touch-action:pan-x;
}
body.wall-paint-active #game{cursor:crosshair!important;touch-action:none}
body.wall-paint-active #crosshair{opacity:.4}
@media(max-width:720px),(pointer:coarse){
 #hud #paint-toolbar{
  right:max(7px,env(safe-area-inset-right) + 6px);
  top:max(94px,calc(env(safe-area-inset-top) + 67px));
  width:76px;padding:4px;gap:4px;
  max-height:calc(100dvh - 255px);
  box-shadow:1px 2px 0 #0006;
 }
 #hud #paint-toolbar .paint-title{padding:4px 2px;font-size:10px}
 #hud #paint-toolbar button{min-height:32px;font-size:10px;padding:4px 2px}
 #hud #paint-toolbar label{gap:2px;padding:0;font-size:10px}
 #hud #paint-toolbar input[type=color]{height:30px;min-height:30px;width:37px}
 #hud #paint-toolbar input[type=range]{min-height:17px}
}
@media(pointer:coarse) and (orientation:landscape) and (max-height:530px){
 #hud #paint-toolbar{
  right:max(7px,env(safe-area-inset-right) + 6px);
  top:max(55px,calc(env(safe-area-inset-top) + 45px));
  width:78px;max-height:calc(100dvh - 136px);
 }
 #hud #paint-toolbar button{min-height:28px}
}

/* Pointer capture keeps the full native range reachable even on touch screens. */
#hud #paint-toolbar input[type=range]{touch-action:none;min-width:0;max-width:100%;padding:0;cursor:ew-resize;}
#hud #paint-size-value{font:10px/1.2 monospace;font-variant-numeric:tabular-nums;}

#paint-3d-flight[hidden]{display:none!important}
#hud #paint-3d-flight{position:fixed;left:max(10px,env(safe-area-inset-left));top:40%;z-index:120;display:grid;grid-template-columns:repeat(2,minmax(44px,1fr));gap:4px;padding:5px;background:#c0c0c0;border:2px solid;border-color:#fafafa #505050 #505050 #fafafa;color:#111;font:700 10px Tahoma,Arial,sans-serif;pointer-events:auto;touch-action:none;user-select:none;}
#paint-3d-flight span{grid-column:1/-1;background:#000080;color:#fff;padding:4px;text-align:center;}
#hud #paint-3d-flight button{min-width:44px;min-height:44px;border:2px solid;border-color:#fff #555 #555 #fff;border-radius:0;background:#c0c0c0;color:#111;touch-action:none;font:700 10px Tahoma,Arial,sans-serif;padding:3px;}
#hud #paint-3d-flight button:active{background:#000080;color:#fff;}
@media(pointer:coarse) and (orientation:landscape) and (max-height:530px){#hud #paint-3d-flight{top:28%;}#hud #paint-3d-flight button{min-height:36px;}}

/* Fine depth adjustment stays within the existing 3D palette width. */
#hud #paint-toolbar .paint-distance-step{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;}
