* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: sans-serif;
  background: #8cc6ff;
}

canvas {
  display: block;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(34, 54, 82, 0.58), rgba(9, 14, 22, 0.9)),
    rgba(0, 0, 0, 0.74);
  pointer-events: auto;
}

#loading-screen.hidden {
  display: none;
}

#loading-panel {
  width: min(92vw, 460px);
  border: 3px solid #171717;
  padding: 16px 16px 12px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)) top / 100%
      40% no-repeat,
    linear-gradient(#595f67, #31363d);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.6),
    0 18px 46px rgba(0, 0, 0, 0.6);
}

#loading-title {
  color: #f3f7fd;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 30px;
  line-height: 1.05;
  font-weight: 700;
  text-shadow: 2px 2px 0 #000000;
}

#loading-status {
  margin-top: 8px;
  color: #d7e4f7;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.15;
  text-shadow: 1px 1px 0 #000000;
}

#loading-progress-track {
  margin-top: 10px;
  height: 16px;
  border: 2px solid #1b1b1b;
  background: linear-gradient(#30343a, #23272d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.56);
  overflow: hidden;
}

#loading-progress-fill {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0)) top / 100%
      42% no-repeat,
    linear-gradient(#7ebd68, #4f8f43);
  box-shadow:
    inset 0 1px 0 rgba(206, 244, 184, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42);
}

#loading-detail {
  margin-top: 8px;
  color: #e0e8f3;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.15;
  text-shadow: 1px 1px 0 #000000;
  white-space: pre-wrap;
}

#hud {
  position: fixed;
  top: 16px;
  left: 192px;
  z-index: 2;
  color: #ffffff;
  text-shadow: 0 1px 2px #000000;
  user-select: none;
  pointer-events: none;
}

#minimap {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 160px;
  height: 160px;
  z-index: 3;
  border: 3px solid #1a1a1a;
  background: #3a5d3a;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 0 rgba(0, 0, 0, 0.45),
    0 5px 14px rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
  pointer-events: none;
}

#world-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(35, 44, 54, 0.62), rgba(5, 8, 10, 0.88)),
    rgba(0, 0, 0, 0.68);
}

#world-map-overlay.visible {
  display: flex;
}

#world-map-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px;
  border: 3px solid #131313;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)) top / 100%
      38% no-repeat,
    linear-gradient(#5a5f68, #2d323a);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.62),
    0 20px 55px rgba(0, 0, 0, 0.62);
}

#world-map {
  width: min(88vw, 88vh);
  height: min(88vw, 88vh);
  max-width: 920px;
  max-height: 920px;
  border: 3px solid #151515;
  background: #2b3a2b;
  image-rendering: pixelated;
}

#world-map-caption {
  color: #e7edf3;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
  user-select: none;
}

#underwater-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(110, 165, 255, 0.16), rgba(8, 36, 85, 0.56)),
    linear-gradient(rgba(34, 104, 194, 0.2), rgba(6, 30, 76, 0.5));
  transition: opacity 120ms linear;
}

#death-screen {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 98, 98, 0.36), rgba(20, 0, 0, 0.86)),
    linear-gradient(rgba(120, 0, 0, 0.48), rgba(45, 0, 0, 0.78));
  pointer-events: auto;
}

#death-screen.visible {
  display: flex;
}

#death-panel {
  min-width: min(92vw, 360px);
  border: 3px solid #2b0404;
  padding: 18px 18px 14px;
  background: rgba(42, 6, 6, 0.86);
  box-shadow:
    inset 1px 1px 0 rgba(255, 170, 170, 0.2),
    inset -1px -1px 0 rgba(0, 0, 0, 0.5),
    0 20px 50px rgba(0, 0, 0, 0.56);
  image-rendering: pixelated;
  text-align: center;
}

#death-title {
  color: #ffdfdf;
  font-family: "Courier New", monospace;
  font-size: 34px;
  font-weight: 700;
  text-shadow: 2px 2px 0 #000000;
}

#death-subtitle {
  margin-top: 6px;
  color: #f7c6c6;
  font-family: "Courier New", monospace;
  font-size: 14px;
  text-shadow: 1px 1px 0 #000000;
}

#respawn-button {
  margin-top: 14px;
  min-width: 170px;
  border: 2px solid #2f2f2f;
  border-top-color: #7a7a7a;
  border-left-color: #7a7a7a;
  border-right-color: #1d1d1d;
  border-bottom-color: #1d1d1d;
  padding: 8px 12px;
  color: #f5f5f5;
  font-family: "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000000;
  background: linear-gradient(#696969, #404040);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.28),
    inset -1px -1px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  image-rendering: pixelated;
}

#respawn-button:hover {
  filter: brightness(1.08);
}

#respawn-button:active {
  transform: translateY(1px);
}

#hud .hint {
  font-weight: 700;
  margin-bottom: 4px;
}

#hud .keys {
  font-size: 14px;
}

#economy {
  position: fixed;
  top: 18px;
  right: 16px;
  z-index: 4;
  padding: 6px 10px;
  color: #f8de7c;
  font-family: "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 1px 1px 0 #000000;
  border: 2px solid #3a2e0f;
  background:
    linear-gradient(rgba(255, 225, 138, 0.2), rgba(255, 225, 138, 0)),
    linear-gradient(#4f3f16, #2f250d);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 176, 0.34),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  user-select: none;
}

#chat {
  position: fixed;
  left: 10px;
  bottom: 118px;
  width: 640px;
  max-width: calc(100vw - 20px);
  z-index: 4;
  font-family: "Lucida Console", "Courier New", monospace;
  image-rendering: pixelated;
  pointer-events: none;
}

#chat-log {
  max-height: 176px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
  pointer-events: auto;
}

#chat-log .line {
  color: #ffffff;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.96);
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.52);
  white-space: pre-wrap;
}

#chat-log .line.player {
  color: #b8d4ff;
}

#chat-log .line.npc {
  color: #aff0a5;
}

#chat-log .line.system {
  color: #ffd685;
}

#chat-input {
  width: 100%;
  border: 2px solid #191919;
  border-top-color: #2a2a2a;
  border-left-color: #2a2a2a;
  border-right-color: #0c0c0c;
  border-bottom-color: #0c0c0c;
  outline: none;
  padding: 6px 8px;
  color: #f8f8f8;
  background: rgba(0, 0, 0, 0.78);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.1;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  display: none;
}

#chat-input::placeholder {
  color: #aab2bf;
  opacity: 1;
}

#chat-input.active {
  display: block;
}

#shop {
  position: fixed;
  right: 16px;
  top: 56px;
  width: 254px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  z-index: 5;
  padding: 9px;
  border: 2px solid #1b1b1b;
  background:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)) top / 100%
      55% no-repeat,
    linear-gradient(#5a5a5a, #2f2f2f);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.24),
    inset 0 -2px 0 rgba(0, 0, 0, 0.62),
    0 10px 26px rgba(0, 0, 0, 0.46);
  image-rendering: pixelated;
  display: none;
}

#shop.visible {
  display: block;
}

#shop-title {
  color: #ffffff;
  font-family: "Courier New", monospace;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000000;
  margin-bottom: 8px;
}

#shop-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#shop-items button {
  border: 2px solid #252525;
  padding: 7px 6px;
  color: #f0f0f0;
  text-align: left;
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(#6a6a6a, #404040);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.28),
    inset -1px -1px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

#shop-items button:hover {
  filter: brightness(1.07);
}

#shop-items button:disabled {
  opacity: 0.6;
  cursor: default;
}

#shop-footnote {
  margin-top: 8px;
  color: #d7d7d7;
  font-family: "Courier New", monospace;
  font-size: 11px;
  text-shadow: 1px 1px 0 #000000;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  z-index: 2;
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: #ffffff;
  box-shadow: 0 0 2px #000000;
}

#crosshair::before {
  left: 6px;
  top: 0;
  width: 2px;
  height: 14px;
}

#crosshair::after {
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
}

body.mobile-controls-enabled {
  touch-action: none;
}

#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: none;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 100ms linear;
}

body.mobile-controls-enabled #mobile-controls {
  display: block;
}

body.mobile-controls-enabled #mobile-controls.active {
  opacity: 1;
}

#mobile-move-zone {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 12px));
  width: min(42vw, 184px);
  height: min(42vw, 184px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#mobile-move-pad {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(34, 34, 34, 0.85);
  background:
    radial-gradient(circle at 28% 28%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    radial-gradient(circle at center, rgba(120, 120, 120, 0.34), rgba(32, 32, 32, 0.44));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.34),
    0 6px 16px rgba(0, 0, 0, 0.3);
  touch-action: none;
  pointer-events: auto;
  position: relative;
}

#mobile-move-stick {
  --mobile-stick-x: 0px;
  --mobile-stick-y: 0px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 43%;
  height: 43%;
  border-radius: 50%;
  border: 2px solid rgba(24, 24, 24, 0.95);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)),
    radial-gradient(circle at center, rgba(186, 186, 186, 0.9), rgba(96, 96, 96, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.36),
    0 2px 8px rgba(0, 0, 0, 0.34);
  transform: translate(
    calc(-50% + var(--mobile-stick-x)),
    calc(-50% + var(--mobile-stick-y))
  );
}

#mobile-action-zone {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}

.mobile-action-button {
  width: 78px;
  height: 78px;
  border: 2px solid rgba(24, 24, 24, 0.9);
  border-radius: 14px;
  color: #f4f4f4;
  font-family: "Courier New", monospace;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.9);
  background:
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0)) top / 100%
      42% no-repeat,
    linear-gradient(rgba(88, 88, 88, 0.9), rgba(58, 58, 58, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.46),
    0 4px 14px rgba(0, 0, 0, 0.42);
  image-rendering: pixelated;
  touch-action: none;
  pointer-events: auto;
}

.mobile-action-button.pressed,
.mobile-action-button:active {
  transform: translateY(1px);
  filter: brightness(1.08);
}

body.inventory-open #mobile-controls,
body.player-dead #mobile-controls {
  opacity: 0;
}

:root {
  --mc-slot-size: 40px;
  --mc-slot-gap: 4px;
  --mc-hotbar-padding: 2px;
  --mc-heart-size: 18px;
}

#health {
  position: fixed;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  z-index: 3;
  width: calc(var(--mc-slot-size) * 9 + var(--mc-hotbar-padding) * 2);
  pointer-events: none;
  user-select: none;
}

#health .hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#health .hud-icons {
  display: flex;
  align-items: center;
  gap: 1px;
}

#health .hud-icon {
  width: var(--mc-heart-size);
  height: var(--mc-heart-size);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.9));
}

#health .heart-icon.empty {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/heart/container.png");
}

#health .heart-icon.full {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/heart/full.png");
}

#health .heart-icon.half {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/heart/half.png");
}

#health .armor-icon.empty {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/armor_empty.png");
}

#health .armor-icon.full {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/armor_full.png");
}

#health .armor-icon.half {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/armor_half.png");
}

#inventory {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  user-select: none;
}

#inventory-hotbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(9, var(--mc-slot-size));
  gap: 0;
  padding: var(--mc-hotbar-padding);
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/hotbar.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-color: rgba(26, 26, 26, 0.86);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.46);
  image-rendering: pixelated;
  pointer-events: none;
}

#inventory.inventory-open #inventory-hotbar {
  opacity: 0;
}

.inventory-slot {
  width: var(--mc-slot-size);
  height: var(--mc-slot-size);
  position: relative;
  border: 2px solid #353535;
  border-top-color: #575757;
  border-left-color: #575757;
  border-right-color: #242424;
  border-bottom-color: #242424;
  background: #8e8e8e;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.36),
    inset -1px -1px 0 rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
}

.inventory-slot.empty {
  background: #8a8a8a;
}

#inventory-panel .inventory-slot.selected {
  border-color: #eeeeee;
}

#inventory-hotbar .inventory-slot {
  border: none;
  background: transparent;
  box-shadow: none;
}

#inventory-hotbar .inventory-slot.selected::before {
  content: "";
  position: absolute;
  inset: -2px;
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/hud/hotbar_selection.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}

#inventory-hotbar .inventory-slot.selected {
  border: none;
  transform: none;
  box-shadow: none;
}

.inventory-slot img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}

.inventory-slot img:not([src]) {
  display: none;
}

.inventory-slot .count {
  position: absolute;
  right: 3px;
  bottom: 2px;
  color: #ffffff;
  font-size: 14px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
}

.inventory-slot .hotkey {
  display: none;
}

.inventory-slot .hotkey.hidden {
  display: none;
}

.inventory-slot .hotkey.selected {
  color: rgba(255, 255, 255, 0.76);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75);
}

#inventory-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.56);
  pointer-events: auto;
}

#inventory.inventory-open #inventory-screen {
  display: flex;
}

#inventory-panel {
  width: min(92vw, 640px);
  border: 4px solid #171717;
  padding: 14px 16px 16px;
  background: #b8b8b8;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.52),
    inset -2px -2px 0 rgba(0, 0, 0, 0.42),
    0 16px 46px rgba(0, 0, 0, 0.62);
  image-rendering: pixelated;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#inventory-top-row {
  display: grid;
  grid-template-columns: var(--mc-slot-size) minmax(90px, 1fr) auto;
  gap: 12px;
  align-items: start;
}

#inventory-armor-column {
  display: grid;
  grid-template-rows: repeat(4, var(--mc-slot-size));
  gap: var(--mc-slot-gap);
}

#inventory-player-preview {
  min-width: 120px;
  height: calc(var(--mc-slot-size) * 4 + var(--mc-slot-gap) * 3);
  border: 2px solid #282828;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.28)),
    #2f2f2f;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.22),
    inset -1px -1px 0 rgba(0, 0, 0, 0.45);
}

#inventory-crafting {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 228px;
}

#inventory-crafting-title {
  color: #4e4e4e;
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

#inventory-crafting-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#inventory-crafting-grid {
  display: grid;
  grid-template-columns: repeat(2, var(--mc-slot-size));
  gap: var(--mc-slot-gap);
}

#inventory[data-container-mode="crafting_table"] #inventory-crafting-grid {
  grid-template-columns: repeat(3, var(--mc-slot-size));
}

#inventory-crafting-grid .hidden-slot {
  display: none;
}

#inventory-crafting-arrow {
  color: #8e8e8e;
  font-family: "Courier New", monospace;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

#inventory-furnace {
  display: none;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

#inventory-chest {
  display: none;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

#inventory-chest-title {
  color: #4e4e4e;
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

#inventory-chest-grid {
  display: grid;
  grid-template-columns: repeat(9, var(--mc-slot-size));
  gap: var(--mc-slot-gap);
}

#inventory[data-container-mode="furnace"] #inventory-crafting {
  display: none;
}

#inventory[data-container-mode="furnace"] #inventory-furnace {
  display: flex;
}

#inventory[data-container-mode="chest"] #inventory-armor-column,
#inventory[data-container-mode="chest"] #inventory-player-preview,
#inventory[data-container-mode="chest"] #inventory-crafting,
#inventory[data-container-mode="chest"] #inventory-furnace {
  display: none;
}

#inventory[data-container-mode="chest"] #inventory-top-row {
  display: flex;
  justify-content: center;
}

#inventory[data-container-mode="chest"] #inventory-chest {
  display: flex;
}

.furnace-left-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.furnace-center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.furnace-meter {
  position: relative;
  border: 2px solid #2f2f2f;
  background: #5b5b5b;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.22),
    inset -1px -1px 0 rgba(0, 0, 0, 0.45);
}

.furnace-meter .fill {
  position: absolute;
  image-rendering: pixelated;
}

.furnace-meter.burn {
  width: 16px;
  height: 24px;
}

.furnace-meter.burn .fill {
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 0%;
  background: linear-gradient(to top, #ff6f2a, #ffd163);
}

.furnace-meter.progress {
  width: 34px;
  height: 10px;
}

.furnace-meter.progress .fill {
  left: 1px;
  top: 1px;
  bottom: 1px;
  width: 0%;
  background: linear-gradient(to right, #f8b846, #fff0aa);
}

#inventory-storage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#inventory-main-grid,
#inventory-panel-hotbar {
  display: grid;
  grid-template-columns: repeat(9, var(--mc-slot-size));
  gap: var(--mc-slot-gap);
  justify-content: center;
}

#inventory-panel-hotbar {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 2px solid rgba(0, 0, 0, 0.28);
}

#inventory-panel .inventory-slot.interactive {
  cursor: pointer;
  pointer-events: auto;
}

.inventory-slot.decorative {
  pointer-events: none;
}

#inventory-armor-column .inventory-slot[data-armor-type="helmet"] {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/container/slot/helmet.png");
  background-size: 68% 68%;
  background-position: center;
  background-repeat: no-repeat;
}

#inventory-armor-column .inventory-slot[data-armor-type="chestplate"] {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/container/slot/chestplate.png");
  background-size: 68% 68%;
  background-position: center;
  background-repeat: no-repeat;
}

#inventory-armor-column .inventory-slot[data-armor-type="leggings"] {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/container/slot/leggings.png");
  background-size: 68% 68%;
  background-position: center;
  background-repeat: no-repeat;
}

#inventory-armor-column .inventory-slot[data-armor-type="boots"] {
  background-image: url("./prime_hd_texturepack/assets/minecraft/textures/gui/sprites/container/slot/boots.png");
  background-size: 68% 68%;
  background-position: center;
  background-repeat: no-repeat;
}

#inventory-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--mc-slot-size);
  height: var(--mc-slot-size);
  z-index: 10;
  pointer-events: none;
  display: none;
}

#inventory-cursor.visible {
  display: block;
}

#inventory-cursor img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}

#inventory-cursor img:not([src]) {
  display: none;
}

#inventory-cursor .count {
  position: absolute;
  right: 3px;
  bottom: 2px;
  color: #ffffff;
  font-size: 14px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
}

#inventory-selected-label {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  z-index: 3;
  min-height: 18px;
  padding: 0 8px;
  color: #ffffff;
  font-size: 14px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 2px 2px 0 #000000;
  background: transparent;
  border: 0;
  image-rendering: pixelated;
  pointer-events: none;
  user-select: none;
}

#inventory-selected-label.empty {
  opacity: 0.55;
}

body.inventory-open #inventory-selected-label {
  opacity: 0;
}

body.inventory-open #crosshair {
  opacity: 0;
}

body.player-dead #crosshair,
body.player-dead #inventory-hotbar,
body.player-dead #inventory-selected-label {
  opacity: 0;
}

@media (max-width: 520px) {
  :root {
    --mc-slot-size: 32px;
    --mc-slot-gap: 3px;
    --mc-heart-size: 14px;
  }

  #minimap {
    width: 124px;
    height: 124px;
    left: 10px;
    top: 10px;
  }

  #economy {
    right: 10px;
    top: 10px;
    font-size: 12px;
    padding: 5px 7px;
  }

  #chat {
    left: 10px;
    bottom: 106px;
    width: calc(100vw - 20px);
  }

  #chat-log .line {
    font-size: 13px;
  }

  #chat-input {
    font-size: 13px;
    padding: 5px 7px;
  }

  #shop {
    right: 10px;
    top: 44px;
    width: 220px;
    padding: 7px;
  }

  #shop-title {
    font-size: 14px;
  }

  #inventory-hotbar {
    bottom: 12px;
  }

  .inventory-slot img {
    width: 24px;
    height: 24px;
  }

  .inventory-slot .count {
    font-size: 12px;
  }

  #inventory-panel {
    width: min(95vw, 430px);
    padding: 10px 9px 11px;
    gap: 10px;
  }

  #inventory-top-row {
    grid-template-columns: var(--mc-slot-size) minmax(80px, 1fr);
    gap: 8px;
  }

  #inventory-player-preview {
    min-width: 0;
  }

  #inventory-crafting {
    grid-column: 1 / -1;
    min-width: 0;
  }

  #inventory-furnace {
    grid-column: 1 / -1;
    justify-content: center;
    min-width: 0;
  }

  #inventory-chest {
    grid-column: 1 / -1;
    align-items: center;
  }

  #inventory-chest-title {
    font-size: 22px;
  }

  #inventory-crafting-title {
    font-size: 22px;
  }

  #inventory-crafting-arrow {
    font-size: 22px;
  }

  #inventory-panel-hotbar {
    padding-top: 8px;
  }

  #health {
    bottom: 52px;
  }

  #inventory-selected-label {
    bottom: 86px;
    font-size: 12px;
  }

  #mobile-move-zone {
    width: min(46vw, 160px);
    height: min(46vw, 160px);
    left: max(10px, env(safe-area-inset-left));
    bottom: max(10px, calc(env(safe-area-inset-bottom) + 8px));
  }

  #mobile-action-zone {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, calc(env(safe-area-inset-bottom) + 8px));
    gap: 8px;
  }

  .mobile-action-button {
    width: 66px;
    height: 66px;
    font-size: 15px;
  }
}
