/* 甲的樣式。所有 class 用 w- 開頭，避免跟別人撞名。 */
.w-hp { position: absolute; left: 20px; top: 20px; width: 240px; height: 22px; border-radius: 11px;
  background: rgba(0, 0, 0, .45); overflow: hidden; border: 2px solid rgba(255, 255, 255, .6); }
.w-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5d6c, #ff9f7a); transition: width .15s; }
.w-hp span { position: absolute; left: 10px; top: 1px; font-size: 13px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.w-keys { position: absolute; left: 20px; top: 52px; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; opacity: .9; }
.w-touch-enabled .w-keys,
.w-touch-controls[hidden] { display: none; }

.w-touch-controls {
  --w-touch-inset: 20px;
  --w-touch-bottom: 20px;
  --w-touch-weapon-bar-height: 110px;
  --w-touch-bar-gap: 16px;
  --w-touch-stick-size: 112px;
  --w-touch-attack-size: 88px;
  --w-touch-secondary-size: 52px;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.w-touch-camera,
.w-touch-stick,
.w-touch-button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.w-touch-stick,
.w-touch-actions {
  position: absolute;
  bottom: calc(var(--w-touch-bottom) + env(safe-area-inset-bottom, 0px));
}
.w-touch-stick {
  left: max(var(--w-touch-inset), env(safe-area-inset-left, 0px));
  width: var(--w-touch-stick-size);
  height: var(--w-touch-stick-size);
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: rgba(20, 24, 40, .72);
  pointer-events: auto;
}
.w-touch-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, .55);
  box-sizing: border-box;
  border-radius: 50%;
  background: #6a7186;
  transform: translate(-50%, -50%) translate(var(--w-stick-x, 0px), var(--w-stick-y, 0px));
  pointer-events: none;
}
.w-touch-actions {
  right: max(var(--w-touch-inset), env(safe-area-inset-right, 0px));
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.w-touch-secondary { display: grid; gap: 8px; }
.w-touch-button {
  appearance: none;
  box-sizing: border-box;
  width: var(--w-touch-secondary-size);
  height: var(--w-touch-secondary-size);
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .4);
  border-radius: 50%;
  background: rgba(20, 24, 40, .87);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.w-touch-attack {
  width: var(--w-touch-attack-size);
  height: var(--w-touch-attack-size);
  border-color: #fff0ba;
  background: #ffd23f;
  color: #1b1b1b;
  font-size: 20px;
}
.w-touch-button:active { filter: brightness(.8); }
.w-touch-button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (max-width: 900px) {
  .w-touch-controls { --w-touch-bottom: calc(var(--w-touch-weapon-bar-height) + var(--w-touch-bar-gap)); }
}
