#text-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  pointer-events: none;
  z-index: 10000;
  /* Force GPU rendering for smoother transforms */
  will-change: transform;
  transform: translateZ(0);
}

/* Prototypes are always hidden */
.prototype {
  display: none;
}

.text-bubble {
  background-color: transparent;
  border: none;
  border-radius: 8px;
  padding: 4px;
  text-align: center;
  overflow-wrap: break-word;
  text-shadow:
    -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000,
    -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000;
  /* Thicker outline */
  font-family: "Verdana", sans-serif;
  font-weight: 900;
  font-size: 14px;
  /* Wrap long messages into multiple lines like the Tibia client (275px at 11px font, scaled to 14px) */
  width: max-content;
  max-width: 350px;
  white-space: normal;
}

/* The speaker name always stays on a single line */
.text-bubble > span:first-child {
  white-space: nowrap;
}

.text-window {
  line-height: 14px;
  pointer-events: none;
  position: absolute;
  font-size: 10px;
  text-align: center;
  /* Force GPU rendering for smoother transforms */
  will-change: transform;
  backface-visibility: hidden;
}

/* Settings > Gameplay > Hide Player Names: the name keeps its space so the health bar stays in place */
body.hide-player-names .character-element-player > span {
  visibility: hidden;
}

.character-element-bar {
  margin: 0px auto;
  width: 32px;
  background-color: black;
  border: 1px solid black;
}

.value-health {
  background-color: green;
  height: 2px;
  width: 100%;
}

.value-mana {
  background-color: blue;
  height: 2px;
  width: 100%;
}

/* NPC Icon styles */
.npc-icon {
  display: block;
  width: 16px;
  height: 16px;
  margin: 4px auto 0 auto;
  margin-left: 40px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8));
}

/* Party shield and skull like the classic client: they start right after the end of the health bar and hang just below it
   (the bars are 34px wide and 4px tall, centered below the 14px name: the health bar ends at 50% + 17px and 18px from the top) */
.character-icons {
  position: absolute;
  top: 19px;
  left: calc(50% + 18px);
  display: flex;
  align-items: center;
  line-height: 0;
}

/* The skull follows the shield: an empty slot takes no space */
.character-icons > div:not(:empty) + div:not(:empty) {
  margin-left: 2px;
}

/* On the name plate both icons are drawn slightly smaller: 10/11 of --skull-size still ends on whole screen pixels */
.character-icons .skull,
.character-icons .party-shield {
  width: calc(var(--skull-size, 11px) * 10 / 11);
  height: calc(var(--skull-size, 11px) * 10 / 11);
}

/* Skull and party shield after the name in the battle list */
.battle-window-target-title .party-shield,
.battle-window-target-title .skull {
  margin-left: 3px;
  vertical-align: middle;
}

/* Classic 11x11 skull: a frame of the sprite sheet png/skulls.png (white, red, green, yellow and orange side by side).
   The sheet is scaled to five frames of the element size, so the icon can be drawn larger (e.g., Menu > Character).
   --skull-size (Skulls.__updateIconSize) is about 11px and keeps every sprite pixel on whole screen pixels, so it stays sharp.
   A soft dark shadow keeps the skull readable on light ground */
.skull {
  display: inline-block;
  width: var(--skull-size, 11px);
  height: var(--skull-size, 11px);
  background-image: url("/png/skulls.png?v=ee63a278393f");
  background-repeat: no-repeat;
  background-size: 500% 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8));
}

.skull-white {
  background-position: 0% 0;
}

.skull-red {
  background-position: 25% 0;
}

.skull-green {
  background-position: 50% 0;
}

.skull-yellow {
  background-position: 75% 0;
}

/* The sheet has no black skull: the white skull darkened, with a red aura around it */
.skull-black {
  background-position: 0% 0;
  filter: brightness(0.3) drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 2px var(--color-skull-black-glow));
}

/* A skull that is about to end blinks three times slowly (Skulls.BLINK_PERIOD_MS and BLINK_COUNT) */
.skull-blink {
  animation: skull-blink 1s ease-in-out 3;
}

@keyframes skull-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.1; }
}

/* The shield is as large as the skull next to it (--skull-size, see .skull): the vector shield stays sharp at any size */
.party-shield {
  display: inline-block;
  overflow: visible;
  width: var(--skull-size, 11px);
  height: var(--skull-size, 11px);
}

.party-shield-body,
.party-shield-inner {
  stroke: var(--color-party-outline);
  stroke-width: 1;
  stroke-linejoin: round;
}

.party-shield-leader .party-shield-body,
.party-shield-leader .party-shield-inner {
  fill: var(--color-party-leader);
}

.party-shield-member .party-shield-body,
.party-shield-member .party-shield-inner {
  fill: var(--color-party-member);
}

/* Invitations: white shield around a small shield of the leader or member color */
.party-shield-invitation .party-shield-body {
  fill: var(--color-party-invitation);
}

.party-shield-inner {
  stroke-width: 0.6;
}

.party-shield-mark {
  fill: none;
  stroke: var(--color-party-shared);
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* Shared experience is enabled but the rules are not met: red plus and blinking shield */
.party-shield-inactive .party-shield-mark {
  stroke: var(--color-error);
}

.party-shield-inactive {
  animation: party-shield-blink 1s steps(1) infinite;
}

@keyframes party-shield-blink {
  50% {
    opacity: 0.35;
  }
}