/* Two independent thumb pads; only their small surfaces capture touches. */
#touchControls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.touch-stick {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  width: 156px;
  height: 156px;
  padding: 0;
  border: 2px solid #c7dcc57a;
  border-radius: 50%;
  background: radial-gradient(circle, #183b4140 45%, #0c263b80);
  color: #e0e4c7;
  touch-action: none;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: inset 0 0 0 17px #c6dcc507;
}
#moveStick {
  left: calc(24px + env(safe-area-inset-left));
}
#aimStick {
  right: calc(24px + env(safe-area-inset-right));
}
.touch-stick .stick-thumb {
  position: absolute;
  left: calc(50% + var(--stick-x, 0%));
  top: calc(50% + var(--stick-y, 0%));
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border: 2px solid #e5deb58a;
  border-radius: 50%;
  background: #25474dc9;
  box-shadow: 0 3px 12px #061b2a55;
  pointer-events: none;
}
.touch-stick .stick-label {
  position: absolute;
  bottom: 16px;
  left: 0;
  width: 100%;
  font:
    700 12px 'Segoe UI',
    sans-serif;
  letter-spacing: 1px;
  pointer-events: none;
  text-shadow: 0 1px 3px #001c25;
}
.touch-stick.held {
  border-color: #eee2a6b3;
}
.touch-stick.held .stick-thumb {
  background: #7e8550c9;
  border-color: #f4df9c;
}
.touch-stick.held .stick-label {
  opacity: 0.4;
}
.touch-action {
  position: absolute;
  pointer-events: auto;
  touch-action: manipulation;
  min-width: 80px;
  min-height: 48px;
  border: 1px solid #a7bda780;
  border-radius: 8px;
  background: #15323cdb;
  color: #e7e9cd;
  padding: 10px 12px;
  font:
    600 15px 'Segoe UI',
    sans-serif;
  box-shadow: 0 3px 10px #10202e50;
}
.touch-action:disabled {
  opacity: 0.4;
}
.touch-action:active {
  background: #546347;
  border-color: #e5d898;
}
.touch-controls #game {
  touch-action: none;
  -webkit-touch-callout: none;
}
.touch-controls #coopConnection {
  right: 112px;
  top: 80px;
}
.touch-controls #mapOverlay {
  z-index: 3;
}
.touch-controls #mapOverlay .eyebrow span {
  display: none;
}
.touch-controls .touch-preference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.touch-preference {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.touch-preference label {
  font-size: 16px;
}
.touch-preference select {
  min-height: 44px;
  padding: 8px;
  font-size: 16px;
  background: #18343e;
  color: #e2e5ca;
  border: 1px solid #779788;
  border-radius: 5px;
}
.touch-controls .controls-keyboard,
.controls-page .controls-touch {
  display: none;
}
.touch-controls .controls-touch {
  display: grid;
}
@media (max-width: 900px) {
  .touch-controls #menu .selection-title {
    display: none;
  }
  .touch-controls #menu .selection-kicker {
    display: none;
  }
  .touch-controls #menu .selection-header {
    gap: 12px;
    padding: 16px;
  }
  .touch-controls #menu .selection-brand {
    min-width: 0;
    margin-right: auto;
  }
  .touch-controls #menu .wordmark {
    font-size: 18px;
    letter-spacing: 2px;
  }
  .touch-controls #menu .secondary {
    padding: 10px;
    font-size: 14px;
    min-height: 46px;
  }
}
@media (max-height: 600px) {
  .touch-stick {
    width: 126px;
    height: 126px;
    bottom: 18px;
  }
  #moveStick {
    left: 18px;
  }
  #aimStick {
    right: 18px;
  }
  .touch-controls .touch-preference,
  .touch-preference {
    margin-bottom: 8px;
  }
  .touch-preference select {
    min-height: 36px;
    font-size: 14px;
  }
  .controls-touch dt,
  .controls-touch dd {
    font-size: 13px;
  }
}
@media (max-width: 650px) {
  .touch-stick {
    width: 116px;
    height: 116px;
  }
  #moveStick {
    left: 12px;
  }
  #aimStick {
    right: 12px;
  }
}

/* Keep game gestures inside the application, including the briefing and dialogs. */
html,
body {
  touch-action: none;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.touch-controls {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.touch-controls input,
.touch-controls textarea {
  user-select: text;
  -webkit-user-select: text;
  font-size: 16px !important;
}
.touch-controls select {
  font-size: 16px !important;
}
.touch-controls kbd {
  display: none !important;
}
.touch-controls .screen-tabs button,
.touch-controls .page-controls button,
.touch-controls .preferences-footer button {
  min-height: 44px;
}

body:has(#matchSettings:not([hidden])) #coopConnection,
body:has(#results:not([hidden])) #coopConnection {
  display: none;
}

/* The outer ring lights only while the right thumb is at the firing edge. */
#aimStick.firing {
  border-color: #ffce83;
  box-shadow: inset 0 0 0 5px #ffc27745;
}
#aimStick.firing .stick-thumb {
  border-color: #ffe3a5;
  background: #956a3cdd;
}
#aimStick.firing .stick-label {
  color: #ffe3a5;
  opacity: 1;
}
