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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1420;
  font-family: system-ui, "Segoe UI", sans-serif;
  user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* --- crosshair --- */
#crosshair {
  position: fixed;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: "";
  position: absolute;
  background: #e8e8e8;
}
#crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
#crosshair::after  { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }

/* --- dynamite charge meter --- */
#charge {
  position: fixed;
  left: 50%; top: calc(50% + 34px);
  width: 130px; height: 7px;
  transform: translateX(-50%);
  background: rgba(10, 16, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  overflow: hidden;
  display: none;
  pointer-events: none;
  z-index: 5;
}
#charge.active { display: block; }
#charge-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffb347, #ff4422);
}

/* --- underwater tint --- */
#underwater {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(14, 70, 110, 0.28), rgba(6, 38, 64, 0.55));
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 4;
}
#underwater.active { opacity: 1; }

/* --- hotbar --- */
#hotbar {
  position: fixed;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(12, 18, 26, 0.55);
  border-radius: 10px;
  z-index: 6;
  pointer-events: none;
}
.slot {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background-size: cover;
  background-position: center;
  image-rendering: auto;
  transition: transform 0.08s, border-color 0.08s;
}
.slot.selected {
  border-color: #ffffff;
  transform: translateY(-4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.slot .key {
  position: absolute;
  left: 3px; top: 1px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.slot .name {
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  font-size: 8px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* --- debug --- */
#debug {
  position: fixed;
  left: 10px; top: 10px;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: pre;
  z-index: 6;
  display: none;
  pointer-events: none;
}
#debug.active { display: block; }

/* --- overlays (menu / loading) --- */
.overlay {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 14, 22, 0.62);
  backdrop-filter: blur(3px);
  z-index: 10;
}
.overlay.hidden { display: none; }

.panel {
  text-align: center;
  color: #eef4fa;
  padding: 34px 46px;
  background: rgba(13, 22, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.15s;
}

/* While dragging a settings slider, the menu gets out of the way so the
   effect is visible live in the world behind it. */
#menu.peek {
  background: transparent;
  backdrop-filter: none;
}
#menu.peek .panel { opacity: 0.15; }
.panel h1 {
  font-size: 34px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.panel .subtitle {
  color: rgba(238, 244, 250, 0.6);
  margin-bottom: 20px;
  font-size: 14px;
}
#play {
  font: 600 17px system-ui, sans-serif;
  color: #0b1420;
  background: #7ec8ff;
  border: none;
  border-radius: 8px;
  padding: 12px 34px;
  cursor: pointer;
  margin-bottom: 22px;
}
#play:hover { background: #a5d8ff; }

/* --- settings --- */
.settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.settings-label {
  font-size: 13px;
  color: rgba(238, 244, 250, 0.7);
}
.seg {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  font: 600 12px system-ui, sans-serif;
  color: rgba(238, 244, 250, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 14px;
  cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: rgba(255, 255, 255, 0.16); }
.seg button.active { background: #7ec8ff; color: #0b1420; }

.sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: -6px auto 20px;
  width: 250px;
}
.sliders.hidden { display: none; }
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: rgba(238, 244, 250, 0.7);
}
.slider-row input[type="range"] {
  width: 180px;
  accent-color: #7ec8ff;
  cursor: pointer;
}
.check-row { justify-content: flex-start; gap: 10px; }
.check-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #7ec8ff;
  cursor: pointer;
}

.controls {
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 13px;
  color: rgba(238, 244, 250, 0.85);
}
.controls td { padding: 3px 14px; text-align: left; }
.controls td:last-child { color: #9fd1ff; font-weight: 600; text-align: right; }

/* --- loading bar --- */
.bar {
  width: 280px;
  height: 10px;
  margin: 18px auto 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
}
#loading-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #58a6e8, #7ec8ff);
  transition: width 0.15s;
}
#loading-label { font-size: 13px; color: rgba(238, 244, 250, 0.7); }
