* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  font-family: "Segoe UI", Consolas, "Courier New", monospace;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#game { display: block; width: 100%; height: 100%; cursor: crosshair; }

#waterOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: #2a5cbb;
  opacity: 0;
  transition: opacity .18s;
  z-index: 5;
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  display: none;
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: "";
  position: absolute;
  background: #fff;
}
#crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; margin-left: -1px; }
#crosshair::after  { top: 50%; left: 0; height: 2px; width: 100%; margin-top: -1px; }
#crosshair.on { display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; }

#stats {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 13px;
  line-height: 1.5;
  text-shadow: 1px 1px 0 #000;
  background: rgba(0, 0, 0, .35);
  padding: 6px 10px;
  border-radius: 4px;
  display: none;
  white-space: pre;
}
#stats.on { display: block; }

#hotbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 6px;
}
#hotbar.on { display: flex; }

.slot {
  position: relative;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, .07);
  border: 2px solid rgba(0, 0, 0, .35);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .35));
}
.slot .key {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 10px;
  color: #cfcfcf;
  text-shadow: 1px 1px 0 #000;
}
.slot.sel {
  border-color: #fff;
  background: rgba(255, 255, 255, .2);
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .4);
}

#toast {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  font-size: 15px;
  text-shadow: 1px 1px 0 #000;
  background: rgba(0, 0, 0, .5);
  padding: 5px 12px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .35s;
}
#toast.on { opacity: 1; }

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #22345c, #070b16 70%);
  z-index: 10;
}
#menu {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(7, 11, 22, .5), rgba(7, 11, 22, .82));
  z-index: 10;
}
#loading.hide { display: none; }
#menu { display: none; }
#menu.on { display: flex; }

.panel {
  text-align: center;
  padding: 26px 34px;
  background: rgba(0, 0, 0, .35);
  border: 2px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  max-width: 560px;
}

h1 {
  font-size: 40px;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #1b6b1b;
}
h1 span { color: #7ed07e; }

.sub { margin: 6px 0 16px; font-size: 14px; color: #b9c6e2; }

.bar {
  width: 320px;
  height: 14px;
  margin: 0 auto;
  background: rgba(0, 0, 0, .5);
  border: 2px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  overflow: hidden;
}
.fill { height: 100%; width: 0%; background: linear-gradient(90deg, #4caf50, #8bd66b); transition: width .12s; }
.pct { margin-top: 6px; font-size: 12px; color: #9fb0d0; }

button {
  margin: 4px 0 14px;
  padding: 12px 42px;
  font-size: 20px;
  font-family: inherit;
  letter-spacing: 2px;
  color: #fff;
  background: #3f9c3f;
  border: 3px solid #2c6b2c;
  border-bottom-width: 5px;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .4);
}
button:hover { background: #4cb14c; }
button:active { transform: translateY(2px); border-bottom-width: 3px; }

.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 22px;
  font-size: 12.5px;
  color: #c8d4ea;
  text-align: left;
}
.keys b { color: #ffe28a; display: inline-block; min-width: 74px; }
.keys .hint {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 226, 138, .18);
  color: #9fb0cc;
  font-size: 11.5px;
  line-height: 1.5;
}
.keys .hint b { color: #8ef0a8; min-width: 0; }
