html,
body {
  height: 100%;
}

body {
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #101820;
  color: #111;
  font-family: Helvetica, Arial, sans-serif;
}

body.inventory-open {
  cursor: default;
}

#voxelcontainer {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  user-select: none;
}

.defaultpanels {
  background: rgba(187, 187, 187, 0.8);
  border-radius: 8px;
}

#onscreenlog {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 20px));
  margin: 0;
  padding: 5px;
  pointer-events: none;
}

#onscreenlog p {
  padding: 0;
  margin: 0;
  font-size: 12px;
}

#bottomLeft {
  position: fixed;
  bottom: 40px;
  left: 10px;
  z-index: 100;
}

#coordinates p {
  padding: 2px;
  margin: 5px 10px;
  font-size: 18px;
  font-weight: bold;
}

#urlinfo {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  margin: 0;
  padding: 3px;
  background: rgba(204, 204, 204, 0.6);
}

#urlinfo p {
  padding: 0;
  margin: 0;
  overflow: hidden;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: #d00;
  border: 2px solid #333;
  border-radius: 8px;
  opacity: 0.3;
  pointer-events: none;
}

#actionpanel {
  position: fixed;
  top: 50%;
  left: 18px;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -36px;
  pointer-events: none;
}

#actionicon {
  width: 52px;
  height: 52px;
  padding: 8px;
  background: rgba(35, 41, 52, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  object-fit: contain;
}

#actioninfo {
  position: static;
  margin: 0;
  padding: 8px 10px;
  max-width: 170px;
  background: rgba(35, 41, 52, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #f1f4f8;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.25;
  white-space: pre-line;
}

#inventorybar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 120;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  width: min(960px, calc(100vw - 24px));
  transform: translateX(-50%);
}

.hotbar-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 6px 8px;
  background: rgba(22, 28, 36, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #f1f4f8;
  cursor: pointer;
}

.hotbar-slot.is-selected {
  border-color: #ffd166;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.3);
  transform: translateY(-4px);
}

.hotbar-key,
.hotbar-name,
.inventory-item-name {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hotbar-key {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.hotbar-name {
  font-size: 12px;
}

.material-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.material-preview.is-empty {
  color: rgba(241, 244, 248, 0.65);
  font-size: 11px;
  text-transform: uppercase;
}

.material-preview-image {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#inventorymodal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 12, 18, 0.7);
}

#inventorymodal[hidden] {
  display: none;
}

#inventorypanel {
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  padding: 18px;
  overflow: auto;
  background: rgba(220, 226, 230, 0.95);
}

#inventorypanelheader h2,
#inventorypanelheader p {
  margin: 0;
}

#inventorypanelheader p {
  margin-top: 6px;
  font-size: 14px;
}

#inventorygrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.inventory-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  color: #111827;
  cursor: grab;
}

.inventory-item:active {
  cursor: grabbing;
}

.inventory-item .material-preview {
  width: 56px;
  height: 56px;
  background: rgba(17, 24, 39, 0.08);
}

.inventory-item-name {
  font-size: 13px;
  font-weight: bold;
  text-align: center;
}

@media only screen and (max-width: 550px), only screen and (max-height: 500px) {
  #urlinfo {
    display: none;
  }

  #coordinates p {
    font-size: 14px;
  }

  #actionpanel {
    top: auto;
    left: 10px;
    bottom: 118px;
    margin-top: 0;
  }

  #actionicon {
    width: 42px;
    height: 42px;
    padding: 6px;
  }

  #actioninfo {
    max-width: 128px;
    font-size: 12px;
  }

  #inventorybar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    bottom: 10px;
    gap: 6px;
    width: calc(100vw - 12px);
  }

  .hotbar-slot {
    gap: 4px;
    padding: 8px 4px 6px;
  }

  .hotbar-name {
    font-size: 10px;
  }

  .material-preview {
    width: 34px;
    height: 34px;
  }

  #inventorymodal {
    padding: 10px;
  }

  #inventorypanel {
    padding: 14px;
  }

  #inventorygrid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
  }
}
