/* Visual adapter for the pinned client's real HUD/inventory components.
 * Coordinates remain owned by the game so drag, equipment, health changes,
 * half hearts, hunger, hardcore, damage blinking and safe areas still work.
 */
@font-face {
  font-family: "Minecraft Unifont";
  src: url("/java/vanilla/font/unifont.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.health,
.foodbar,
.armor_container,
.breathbar,
#xp-bar-bg,
.crosshair,
[class*="crosshair-"] {
  --gui-icons: url("/java/vanilla/textures/gui/compat/hud-icons.png"), url("/java/vanilla/textures/gui/compat/hud-icons.png");
  image-rendering: pixelated;
}

/* The original client includes a 4px extra gap above the hotbar. Java 1.21.4
 * puts the XP strip 24px, hearts 30px and armor 40px above the bottom edge. */
.health,
.foodbar,
.armor_container,
.breathbar,
#xp-bar-bg {
  --safe-area-inset-bottom: calc(var(--hud-bottom-raw, 0px) / var(--guiScale, 1) + 24px);
}

.health .heart {
  height: 9px;
}

.crosshair {
  width: 15px;
  height: 15px;
  background-repeat: no-repeat;
}

#xp-bar-bg [class*="xp-label-"] {
  color: #80ff20;
  font-size: 8px;
  top: -6px;
}

/* These are the original nine slots and original selection overlay. The
 * compact compatibility atlas has identical UVs and current Java pixels. */
.hotbar {
  line-height: 0;
}

/* These decorations are embedded data URLs in this pinned build. Avoid URL
 * matching and target only the background, selector and offhand frame;
 * inventory item images live in slot-wrapper descendants and are excluded. */
.hotbar .mc-inv-background-image,
.hotbar .mc-inv-background-slots > div:not(.mc-inv-slot-wrapper) > div > img,
.hotbar .mc-inv-hotbar-offhand > div:first-child > div > img,
.hotbar .mc-inv-hotbar-open-inv > div:first-child > div > img {
  content: url("/java/vanilla/textures/gui/compat/hud-widgets.png");
}

.mc-inv-root,
.mc-inv-root button,
.mc-inv-root input,
.mc-inv-tooltip,
.mc-inv-item-count,
.mc-inv-cursor-zero,
.mc-inv-drag-preview-count,
.mc-inv-background-title,
.chat,
.chat-input,
.chat-completions-items,
.scoreboard-container,
.bossbar-title {
  font-family: minecraft, mojangles, "Minecraft Unifont", monospace !important;
  font-synthesis: none;
  -webkit-font-smoothing: none;
}

.mc-inv-background-title,
.mc-inv-item-count {
  font-size: calc(8px * var(--mc-scale, 2)) !important;
  font-weight: 400 !important;
}

.mc-inv-background-title {
  text-shadow: none;
}

/* This library's version watermark and inventory settings shortcut do not
 * belong to the Java inventory screen. The same settings remain available
 * through Options > Video Settings > Web Client Settings. */
html[data-baiji-vanilla] .mc-inv-watermark,
html[data-baiji-vanilla] .mc-inv-settings-btn {
  display: none !important;
}

/* The player definition suppresses its title entirely. Java draws only the
 * crafting heading here (97,8), above the working 2x2 input grid; it does not
 * draw a second Inventory label above the player's own lower 27 slots.
 * The library embeds textures as data URLs, so identify the real player
 * window by its crafting result plus offhand slots (unique together). */
html[data-baiji-vanilla] .mc-inv-overlay-window .mc-inv-background:has([data-slot="0"][class*="resultSlot-"]):has([data-slot="45"])::after {
  content: "合成";
  position: absolute;
  left: calc(97px * var(--mc-scale, 2));
  top: calc(8px * var(--mc-scale, 2));
  color: #404040;
  font: calc(8px * var(--mc-scale, 2))/1 minecraft, mojangles, "Minecraft Unifont", monospace;
  text-shadow: none;
  pointer-events: none;
}

.mc-inv-item-count {
  text-shadow: calc(1px * var(--mc-scale, 2)) calc(1px * var(--mc-scale, 2)) #3f3f3f !important;
}

/* 1.21.4 renders these two nine-sliced sprites around the tooltip. Their
 * eight transparent outer pixels are retained by the negative inset. The
 * em unit follows the tooltip's real per-window scale (portaled to body). */
.mc-inv-tooltip {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  isolation: isolate;
  image-rendering: pixelated;
  text-shadow: 1px 1px #3f3f3f;
}

.mc-inv-tooltip::before,
.mc-inv-tooltip::after {
  content: "";
  position: absolute;
  inset: -1em;
  z-index: -1;
  pointer-events: none;
  border-style: solid;
  border-color: transparent;
  border-image-repeat: stretch;
}

.mc-inv-tooltip::before {
  border-width: 1.125em;
  border-image-source: url("/java/vanilla/textures/gui/sprites/tooltip/background.png");
  border-image-slice: 9 fill;
}

.mc-inv-tooltip::after {
  border-width: 1.25em;
  border-image-source: url("/java/vanilla/textures/gui/sprites/tooltip/frame.png");
  border-image-slice: 10 fill;
}

.mc-inv-tooltip [class*="name-"] {
  font-weight: 400;
}

/* The upstream web inventory adds a technical item ID below the display
 * name. Vanilla Java tooltips do not expose that implementation detail. */
html[data-baiji-vanilla] .mc-inv-tooltip [class*="typeId-"] {
  display: none !important;
}

.chat,
.chat-input,
.chat-completions-items,
.scoreboard-container,
.bossbar-title {
  font-size: 8px;
  line-height: 9px;
}

.bossBars {
  top: 3px;
  gap: 5px;
}

.bossBars.mobile {
  top: 18px;
}
