.combat-hud {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: min(290px, 65%);
  z-index: 6;
  padding: 9px 12px;
  background: linear-gradient(130deg, #142631f2, #291827ed);
  border: 1px solid #d7ad6f;
  border-radius: 10px;
  box-shadow: 0 4px 16px #0008;
  color: #fff3dc;
  pointer-events: auto;
}
.combat-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.combat-name {
  font:
    600 15px Georgia,
    serif;
  flex: 1;
}
.combat-title button {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: #f3dfb5;
  border: 0;
}
.combat-health {
  height: 7px;
  border-radius: 6px;
  background: #090b11;
  overflow: hidden;
}
.combat-health i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #943641, #f18769);
  transition: width 0.15s;
}
.combat-status {
  font-size: 11px;
  margin-top: 5px;
  color: #e4cead;
}
.combat-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid #bca17499;
  border-radius: 16px;
  background: #10202ef0;
  box-shadow: 0 5px 20px #0009;
}
.combat-actions button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 56px;
  min-height: 56px;
  padding: 6px;
  color: #fce9c0;
  border: 1px solid #bead7d80;
  border-radius: 12px;
  background: radial-gradient(ellipse at top, #397c80, #17283d 80%);
  touch-action: manipulation;
}
.combat-actions button:first-child {
  background: radial-gradient(ellipse at top, #a84f56, #391d35 85%);
}
.combat-actions b {
  font-size: 22px;
  font-weight: normal;
  line-height: 1;
}
.combat-actions span {
  font-size: 10px;
}
.combat-actions kbd {
  font-size: 9px;
  opacity: 0.7;
}
.combat-actions button:active {
  filter: brightness(1.4);
  transform: translateY(1px);
}
.combat-actions button:focus-visible,
.combat-title button:focus-visible {
  outline: 2px solid #fff0a4;
  outline-offset: 3px;
}
.combat-hud[hidden],
.combat-actions[hidden] {
  display: none;
}
@media (pointer: coarse) {
  .combat-actions kbd {
    display: none;
  }
  .combat-title button {
    min-width: 44px;
    min-height: 44px;
  }
  .combat-hud {
    top: 65px;
    padding: 4px 9px;
  }
  .combat-actions {
    right: 8px;
    bottom: 8px;
  }
  .combat-actions button {
    min-width: 50px;
    min-height: 54px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .combat-health i {
    transition: none;
  }
  .combat-actions button:active {
    transform: none;
  }
}

.combat-actions {
  bottom: 70px;
}
.combat-actions svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 4px #8be8db88);
}
.combat-actions button:hover {
  border-color: #fff1b4;
  background-color: #296070;
}
.combat-actions button:disabled {
  opacity: 0.42;
  filter: grayscale(0.7);
}
@media (max-width: 600px) {
  .combat-hud {
    top: 100px;
    width: calc(100% - 112px);
    left: 10px;
    transform: none;
  }
  .combat-name {
    font-size: 13px;
  }
  .combat-actions {
    bottom: 68px;
    right: 10px;
  }
  .combat-actions kbd {
    display: none;
  }
  .combat-actions {
    gap: 4px;
    padding: 5px;
  }
  .combat-actions button {
    min-width: 48px;
    min-height: 56px;
  }
  .combat-actions span {
    font-size: 9px;
  }
}

.combat-actions button:first-child {
  box-shadow: inset 0 -3px 0 #f6c28c;
  background-image:
    linear-gradient(
      to top,
      #090f2780 var(--recovery, 0%),
      transparent var(--recovery, 0%)
    ),
    radial-gradient(ellipse at top, #a84f56, #391d35 85%);
}
.combat-preferences {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid #b49a6655;
  border-radius: 12px;
  background: #102c32;
}
.combat-preferences summary {
  cursor: pointer;
  color: #f4d9a2;
  padding: 8px 0;
}
.combat-preferences label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}
.combat-preferences select {
  min-height: 44px;
  min-width: 90px;
  color: #fff;
  background: #173c43;
  border: 1px solid #b49a66;
  border-radius: 6px;
}
.combat-preferences :focus-visible {
  outline: 2px solid #ffe8a9;
  outline-offset: 3px;
}
/* Keep walking available; the combat bar replaces only the overlapping actions. */
.world:has(.combat-actions:not([hidden])) #controls .primary-actions {
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 600px) {
  .combat-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(48px, 1fr));
    width: min(220px, calc(100% - 130px));
  }
  .combat-actions[hidden] {
    display: none;
  }
}

/* A held cast owns its drag; browser panning must not cancel the aiming gesture. */
.combat-actions button[data-combat="cast"] { touch-action: none; }
.field-tools button.move-only-cancel,
.everdawn-ui .field-tools button.move-only-cancel {
  width:auto;max-width:190px;min-height:44px;height:auto;padding:7px 10px;
  border:1px solid #c8b986;border-radius:12px;background:#103846cc;
  color:#fff2d0;font-size:12px;line-height:1.25;touch-action:manipulation;
}
