#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#touch-controls[hidden],
#touch-controls [hidden] {
  display: none !important;
}
#touch-controls button {
  pointer-events: auto;
  touch-action: none;
  min-width: 48px;
  min-height: 48px;
  border: 2px solid #a79362;
  background: #201d17e8;
  color: #f0e4c7;
  border-radius: 50%;
  font: 12px sans-serif;
  box-shadow: 0 2px 8px #0009;
}
.touch-move-zone {
  position: absolute;
  left: env(safe-area-inset-left, 0px);
  top: 22%;
  bottom: env(safe-area-inset-bottom, 0px);
  width: 42%;
  pointer-events: auto;
  touch-action: none;
}
.touch-stick {
  position: fixed;
  width: 108px;
  height: 108px;
  margin: -54px;
  border: 2px solid #e6d49b99;
  background: #1c242b66;
  border-radius: 50%;
  pointer-events: none;
}
.touch-stick i {
  position: absolute;
  left: 34px;
  top: 34px;
  width: 40px;
  height: 40px;
  background: #e9dba599;
  border-radius: 50%;
}
.touch-attack {
  position: absolute;
  right: calc(42px + env(safe-area-inset-right, 0px));
  bottom: calc(45px + env(safe-area-inset-bottom, 0px));
  width: 78px;
  height: 78px;
  overflow: hidden;
}
.touch-skill-arc {
  position: absolute;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 220px;
  height: 200px;
  pointer-events: none;
}
.touch-skill {
  position: absolute;
  width: 58px;
  height: 58px;
  overflow: hidden;
}
.touch-skill:disabled {
  opacity: 0.35;
}
.touch-slot-1 {
  left: 20px;
  bottom: 18px;
}
.touch-slot-2 {
  left: 2px;
  bottom: 87px;
}
.touch-slot-3 {
  left: 48px;
  bottom: 140px;
}
.touch-slot-4 {
  left: 116px;
  bottom: 147px;
}
.touch-slot-5 {
  left: 160px;
  bottom: 100px;
}
.touch-skill-icon {
  display: block;
  width: 32px;
  height: 32px;
  margin: 4px auto;
  background-image: url("../art/ui/px/skill-icons.png");
  background-size: 832px 96px;
  image-rendering: pixelated;
  position: relative;
  z-index: 2;
}
.touch-skill-label {
  position: absolute;
  font-size: 8px;
  bottom: 3px;
  left: 0;
  right: 0;
  z-index: 2;
  white-space: nowrap;
}
.touch-skill:before,
.touch-attack:before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(#000a var(--cooldown, 0deg), transparent 0);
}
.touch-cooldown {
  position: absolute;
  inset: 12px;
  font-size: 18px;
  z-index: 3;
}
.touch-context {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 44%;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
#touch-controls .touch-context button {
  border-radius: 10px;
  padding: 5px 8px;
}
.touch-nav {
  position: absolute;
  right: calc(8px + env(safe-area-inset-right, 0px));
  top: calc(8px + env(safe-area-inset-top, 0px));
  display: flex;
  gap: 8px;
}
.touch-aim {
  position: fixed;
  width: 95px;
  height: 8px;
  background: linear-gradient(90deg, #cfb973, #fff4b1);
  transform-origin: 0 50%;
  border-radius: 4px;
  pointer-events: none;
}
.touch-cancel {
  position: absolute;
  left: 45%;
  top: 30%;
  width: 120px;
  height: 70px;
  border: 2px dashed #d89f94;
  border-radius: 40px;
  color: #ffcec4;
  text-align: center;
  padding-top: 22px;
  box-sizing: border-box;
}
.touch-cancel.selected {
  background: #a43f4199;
}
body.touch-mode .k-pad,
body.touch-mode .k-kb,
body.touch-mode #hud-menu-hints,
body.touch-mode #ability-hud {
  display: none !important;
}
body.touch-mode #screens {
  position: fixed;
  inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
body.touch-mode .menu-btn,
body.touch-mode [data-nav],
body.touch-mode .subtab,
body.touch-mode .menu-close {
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
}
body.touch-mode .menu-body {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
body.touch-mode .icell {
  width: 52px;
  height: 52px;
}
body.touch-mode .menu-head {
  padding: 0.5rem;
}
body.touch-mode .menu-foot {
  display: none;
}
body.touch-mode .screen {
  inset: 2% 2%;
}
body.touch-mode .title-menu {
  max-height: 70vh;
  overflow: auto;
}
@media (max-height: 430px) {
  .touch-skill-arc {
    height: 185px;
  }
  .touch-context {
    left: 37%;
    bottom: 5px;
  }
  .touch-attack {
    bottom: 34px;
  }
  body.touch-mode #hud {
    max-width: 60%;
    font-size: 10px;
  }
}

body.touch-mode .icell {
  touch-action: none;
}
.touch-item-sheet {
  position: fixed;
  z-index: 10070;
  right: calc(8px + env(safe-area-inset-right, 0px));
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  width: min(400px, 48vw);
  max-height: 85vh;
  overflow: auto;
  box-sizing: border-box;
  padding: 12px;
  border: 2px solid #bd9d53;
  background: #161715f5;
  color: #eee1bf;
  touch-action: pan-y;
}
.touch-item-sheet .tip-art {
  width: 64px;
  height: 64px;
}
.touch-item-sheet .touch-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.touch-item-actions button {
  min-height: 44px;
  min-width: 64px;
  padding: 8px;
  background: #3a3020;
  color: #f4e4bc;
  border: 1px solid #bca16b;
}
.touch-item-actions button:disabled {
  opacity: 0.35;
}
.touch-item-ghost {
  position: fixed;
  z-index: 11000;
  pointer-events: none;
  padding: 12px;
  background: #514729;
  color: #fff;
  border: 2px solid #dec58d;
  transform: translate(-50%, -50%);
}

@media (max-width: 740px) {
  .touch-context {
    left: 42%;
    max-width: 125px;
    flex-wrap: wrap;
    gap: 4px;
  }
  #touch-controls .touch-context button {
    padding: 4px;
  }
  .touch-nav button {
    min-width: 48px;
  }
}

body.touch-mode .atlas-map,
body.touch-mode .atlas-layer,
body.touch-mode .web-vp {
  touch-action: none;
}
body.touch-mode .atlas-node,
body.touch-mode .atlas-pinnacle {
  min-width: 44px;
  min-height: 44px;
}
body.touch-mode .web-node {
  transform: translate(-50%, -50%);
}
body.touch-mode .web-node:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(44px / var(--touch-web-zoom, 1));
  height: calc(44px / var(--touch-web-zoom, 1));
  transform: translate(-50%, -50%);
  pointer-events: auto;
  background: transparent;
}

body.touch-mode button,
body.touch-mode a[href],
body.touch-mode input {
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}
body.touch-mode .title-logo {
  font-size: 2.5rem;
}
body.touch-mode .title-tag {
  font-size: 0.8rem;
  margin: 8px;
}
body.touch-mode .title-foot {
  display: none;
}

body.touch-mode .opt-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

body.touch-mode .touch-held-ready {
  outline: 2px solid #efd286;
  outline-offset: 3px;
}

.touch-attack .touch-skill-icon {
  width: 48px;
  height: 48px;
  margin: 5px auto;
}
.touch-attack .touch-skill-label {
  font-size: 9px;
}

/* Keep account vitals without duplicating the desktop ability and potion bar. */
body.touch-mode #action-bar {
  position: fixed;
  left: calc(8px + env(safe-area-inset-left, 0px));
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
  width: auto;
  transform: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  z-index: 44;
  pointer-events: none;
}
body.touch-mode #action-bar .ab-center {
  display: none;
}
body.touch-mode #action-bar .orb {
  width: 48px;
  height: 48px;
  border-width: 2px;
  margin-top: 0;
}
body.touch-mode #action-bar .orb-val {
  font-size: 13px;
}
body.touch-mode #action-bar .orb-cap {
  font-size: 8px;
  bottom: 4px;
  letter-spacing: 0;
}
body.touch-mode #hud-minimap {
  right: calc(8px + env(safe-area-inset-right, 0px));
  top: calc(62px + env(safe-area-inset-top, 0px));
  max-width: 90px;
}
body.touch-mode #hud-minimap canvas {
  width: 80px;
  height: 80px;
}
body.touch-mode #hud-minimap #minimap-label {
  font-size: 8px;
}
