body {
  font-family: "Arial Black", Arial, sans-serif;
  background: url("textures/background.jpg") center / cover no-repeat fixed;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100svh;
  overflow: hidden;
}

.container {
  background: transparent;
  padding: 10px 20px 10px;
  width: 100%;
  max-width: min(900px, calc((100svh * 10 - 168px) / 12));
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100svh;
  box-sizing: border-box;
  margin: 0 auto;
}

h1 {
  text-align: center;
  color: #2e7d32;
  font-size: 2.5em;
  margin: 0 0 10px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.title-icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
  image-rendering: pixelated;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  margin: 0;
  position: relative;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  padding: 2px;
  min-height: 0;
  flex: 1 1 auto;
}

.block {
  aspect-ratio: 1;
  border: 2px solid #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
  color: white;
  font-size: 0.7em;
  position: relative;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.8),
    -1px -1px 2px rgba(0, 0, 0, 0.5);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.block:hover {
  transform: scale(1.1);
  z-index: 1;
}

.block.completed {
  background: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
}

.block.completed > div {
  visibility: hidden;
}

.block.tnt {
  background-image: url("textures/blocks/tnt_side.png") !important;
}

.block.tnt.flash {
  background: white !important;
  background-image: none !important;
}

.grid-explosion {
  position: absolute;
  inset: -20%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 10;
}

.item-drop {
  position: absolute;
  width: 75%;
  height: 75%;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 20;
  animation: item-pop 0.6s ease-out forwards;
}

@keyframes item-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -180%) scale(1) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -220%) scale(0.8) rotate(360deg);
    opacity: 0;
  }
}

.diamond-rain {
  position: fixed;
  top: -50px;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 100;
  animation: diamond-fall linear forwards;
}

@keyframes diamond-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

.block-number {
  font-size: 0.9em;
  margin-top: 2px;
}

.xp-bar {
  width: 100%;
  height: 10px;
  background: url("textures/gui/experience_bar_background.png") left center / 50% 100% repeat-x;
  image-rendering: pixelated;
  margin: 4px 0 0;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.xp-fill {
  height: 100%;
  overflow: hidden;
  transition: width 0.3s;
}

.xp-fill-inner {
  width: 0;
  height: 100%;
  background: url("textures/gui/experience_bar_progress.png") left center / 50% 100% repeat-x;
  image-rendering: pixelated;
}

.xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #80e825;
  font-size: 10px;
  font-weight: bold;
  text-shadow:
    1px 1px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000;
  white-space: nowrap;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  margin: 4px 0 20px;
  background: #8b8b8b;
  border: 3px solid #333;
  border-radius: 3px;
  padding: 4px;
  flex: 0 0 auto;
}

.toolbar-slot {
  aspect-ratio: 1;
  background: #555;
  border: 3px solid #444;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.toolbar-slot.empty {
  cursor: default;
}

.toolbar-slot img {
  width: 70%;
  height: 70%;
  image-rendering: pixelated;
  pointer-events: none;
}

button.toolbar-slot:hover {
  background: #6a6a6a;
}

button.toolbar-slot:active {
  transform: scale(0.95);
}

.toolbar-slot.active {
  border-color: #fc0;
  box-shadow:
    inset 0 0 8px rgba(255, 204, 0, 0.4);
  background: #6a6a6a;
}

@media print {
  body {
    background: white;
  }
  .toolbar {
    display: none;
  }
}
