/* Touch command deck: a compact cluster aligned with the build bar, mirroring
   its field-deck look. Buttons keep a fixed size instead of stretching. */
#touchControls {
  position: fixed;
  left: 22px;
  right: auto;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: max-content;
  max-width: calc(100vw - 44px);
  padding: 7px 9px 8px;
  background: linear-gradient(135deg, #394137f2, #171e1cf5 65%);
  border: 2px solid #6c7567;
  border-top-color: #a1aa91;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px #101612, 0 8px 24px #0009;
  color: #e6ebd5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#touchControls[hidden] { display: none; }

.touch-status {
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #d1d7b9;
  font-weight: 700;
  min-height: 13px;
  white-space: nowrap;
}

.touch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.touch-actions button {
  flex: 0 0 104px;
  min-height: 48px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #f0f1dc;
  background: linear-gradient(#2b3630, #1a231e);
  border: 1px solid #818971;
  border-bottom: 3px solid #a8ae77;
  border-radius: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.touch-actions button:hover:not(:disabled) {
  background: #384b39;
  border-color: #e5d99c;
}

.touch-actions button:active:not(:disabled) {
  transform: translateY(1px);
  border-bottom-width: 2px;
}

.touch-actions button[aria-pressed="true"] {
  background: #4a5c3b;
  border-color: #e5d99c;
  box-shadow: inset 0 0 10px #dce8a430;
  color: #ffefb0;
}

.touch-actions button:disabled {
  background: #202823;
  color: #9ba492;
  border-color: #4c584a;
  cursor: not-allowed;
}

.touch-actions button:focus-visible {
  outline: 2px solid #f1da83;
  outline-offset: 2px;
}

.touch-actions [data-touch="cancel"] {
  border-color: #8a6a58;
  border-bottom-color: #a8826a;
}

.touch-actions [data-touch="cancel"]:hover:not(:disabled) {
  border-color: #d9a07e;
}

/* Pointer Events need raw gesture input on the canvas, otherwise the browser
   steals touch drags and pinch zooms for page scrolling. */
#game {
  touch-action: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* The deck hint repeats the short touch help shown in the command deck. */
body[data-input-mode="touch"] #hint { display: none; }

@media (max-width: 1000px) {
  #touchControls { left: 10px; max-width: calc(100vw - 20px); }
  .touch-actions button { flex-basis: 92px; min-height: 46px; font-size: 11px; }
}

@media (max-width: 650px) {
  #touchControls { left: 10px; right: 10px; width: auto; max-width: none; padding: 5px 6px 6px; gap: 4px; }
  .touch-status { font-size: 9px; }
  .touch-actions button { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 10px; padding: 6px 4px; }
}
