/* Loaded last so account, strategy and graphics panels share viewport bounds. */
#game{touch-action:none}
#touch-controls{position:absolute;inset:0;pointer-events:none;user-select:none;-webkit-user-select:none}
#touch-controls button,#touch-stick{pointer-events:auto;touch-action:none;-webkit-touch-callout:none}
#touch-controls button{min-width:48px;min-height:48px;border:1px solid #bda474;border-radius:12px;background:#173f4aed;color:#fff1cc;font-weight:700;box-shadow:0 3px 8px #001b2955}
#touch-stick{position:absolute;bottom:calc(20px + env(safe-area-inset-bottom));left:calc(18px + env(safe-area-inset-left));width:116px;height:116px;border:2px solid #ecdbab88;border-radius:50%;background:#14394970;display:grid;place-items:center}
.touch-knob{width:48px;height:48px;border-radius:50%;background:#f2d28da6;border:2px solid #fff0c7;pointer-events:none}
#touch-stick small{position:absolute;bottom:8px;font-size:10px;color:#fff3d5;pointer-events:none}
.touch-flight{position:absolute;right:calc(18px + env(safe-area-inset-right));bottom:calc(20px + env(safe-area-inset-bottom));display:grid;grid-template-columns:48px 48px;gap:8px}
.touch-flight button:last-child{grid-column:1 / -1}
.touch-hint{position:absolute;bottom:calc(4px + env(safe-area-inset-bottom));width:100%;text-align:center;font-size:10px;color:#fff3d5;text-shadow:0 1px 3px #001b29}
.touch-actions{position:absolute;bottom:calc(150px + env(safe-area-inset-bottom));left:calc(10px + env(safe-area-inset-left));right:calc(10px + env(safe-area-inset-right));display:flex;gap:6px;overflow-x:auto;pointer-events:auto;overscroll-behavior:contain;padding:4px 0 8px}
.touch-actions button{flex-shrink:0;padding:8px 12px;touch-action:pan-x!important}
.touch-crosshair{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff4d7;font-size:30px;text-shadow:0 1px 3px #001b29}
.touch-device .status-chip{bottom:calc(214px + env(safe-area-inset-bottom));max-width:calc(100% - 28px)}
.touch-device .status-main{min-width:0}.touch-device #status-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:60vw}
.touch-device .battle-alert,.touch-device .notice-toast{bottom:calc(260px + env(safe-area-inset-bottom))}
.touch-device .close{min-width:44px;min-height:44px}
.mobile-privacy{display:none}
.touch-device .storage-link{display:none}.touch-device .mobile-privacy{display:block;margin-top:12px;min-height:44px}
@media(max-width:900px),(pointer:coarse){
  html,body{height:100dvh}#entrance{padding:calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));place-items:safe center}
  .brand-bar{display:none}.tools{top:calc(6px + env(safe-area-inset-top));left:calc(6px + env(safe-area-inset-left));right:calc(6px + env(safe-area-inset-right));max-width:none;flex-wrap:wrap;justify-content:center;gap:4px!important}
  .tools .tool,.tools .tool.icon-only,.tools .tool.primary{width:44px;min-width:44px;min-height:44px;padding:10px!important}.tools .tool span,.tools .tool kbd{display:none}.social-tools{gap:4px}
  .panel,#crests-panel,.social-card{top:calc(116px + env(safe-area-inset-top));bottom:calc(12px + env(safe-area-inset-bottom));left:calc(8px + env(safe-area-inset-left));right:calc(8px + env(safe-area-inset-right));width:auto;max-width:none;max-height:none;overscroll-behavior:contain}
  .panel{overflow:auto}.panel-head{position:sticky;top:0;z-index:1;flex-shrink:0}.panel-body{flex:1;min-height:0;overflow:auto;overflow-wrap:anywhere}.panel>.search-wrap,.panel>.faction-detail,.panel>.roster-meta{flex-shrink:0}.roster{flex:1 0 140px}
  .social-card{display:flex;flex-direction:column}#chat-log{height:auto;min-height:50px;flex:1}.social-dialog{max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  input,select,textarea{font-size:16px!important}.search-wrap{flex-wrap:wrap}.search-wrap input{width:120px}.detail-actions{flex-wrap:wrap}.person-heading{gap:8px}.person-portrait{width:70px;height:85px}.person-heading h3{font-size:18px}.controls{grid-template-columns:105px 1fr}
  #storage-notice{max-height:80dvh;overflow:auto;bottom:calc(8px + env(safe-area-inset-bottom));left:8px;right:8px}#storage-notice button{min-height:44px}.welcome .features{gap:12px}.welcome .play{min-width:0;max-width:100%}
  .storage-link{display:none}.mobile-privacy{display:block;margin-top:12px;min-height:44px}
}
@media(min-width:600px) and (max-width:900px),(pointer:coarse) and (min-width:600px){.panel,#crests-panel,.social-card{top:calc(68px + env(safe-area-inset-top))}}
@media(max-height:500px) and (pointer:coarse){
  #touch-stick{width:96px;height:96px;bottom:calc(16px + env(safe-area-inset-bottom))}.touch-flight{bottom:calc(16px + env(safe-area-inset-bottom))}.touch-actions{left:calc(130px + env(safe-area-inset-left));bottom:calc(16px + env(safe-area-inset-bottom))}
  .touch-device .status-chip{bottom:calc(126px + env(safe-area-inset-bottom));font-size:11px}.touch-device .battle-alert,.touch-device .notice-toast{bottom:calc(126px + env(safe-area-inset-bottom));left:auto;right:12px;max-height:120px;overflow:auto}.touch-device .storage-link{bottom:calc(112px + env(safe-area-inset-bottom))}
}
