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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Lucida Console", Monaco, monospace;
  user-select: none;
  -webkit-user-select: none;
}

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

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

#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: ""; position: absolute; background: #fff;
}
#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%); }

#water-overlay {
  position: absolute; inset: 0;
  background: rgba(18, 60, 140, 0.28);
  opacity: 0; transition: opacity .15s;
}
#water-overlay.on { opacity: 1; }

#hotbar {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  display: flex; gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}
.slot {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  background: rgba(20, 20, 20, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  position: relative;
}
.slot canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.slot .num {
  position: absolute; top: 1px; left: 3px;
  font-size: 9px; color: rgba(255, 255, 255, 0.6);
}
.slot.sel {
  border-color: #fff;
  background: rgba(70, 70, 70, 0.7);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

#toast {
  position: absolute; left: 50%; bottom: 84px;
  transform: translateX(-50%);
  color: #fff; font-size: 15px; font-weight: bold;
  text-shadow: 2px 2px 0 #000;
  opacity: 0; transition: opacity .4s;
}
#toast.show { opacity: 1; transition: opacity .05s; }

#info {
  position: absolute; top: 8px; left: 10px;
  color: #fff; font-size: 12px;
  text-shadow: 1px 1px 0 #000;
  opacity: 0.85;
  white-space: pre;
}

/* ---------- start / pause overlay ---------- */
#overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(70, 120, 200, 0.28), transparent 65%),
    linear-gradient(#101820, #0a0e14);
  z-index: 10;
}
#overlay.hidden { display: none; }

#panel { text-align: center; color: #dfe8f0; max-width: 560px; padding: 24px; }

#panel h1 {
  font-size: 54px; letter-spacing: 4px; color: #fff;
  text-shadow: 0 4px 0 #2a4d1e, 0 8px 18px rgba(0,0,0,.8);
}
#panel h1 span { color: #7ec850; }
#panel .sub { margin: 10px 0 24px; color: #9fb2c4; font-size: 14px; }

.btnrow { display: flex; gap: 12px; justify-content: center; margin-bottom: 26px; }
#panel button {
  font-family: inherit; font-size: 17px; font-weight: bold;
  padding: 12px 26px;
  color: #fff; background: #3f7d2c;
  border: 2px solid #245214; border-bottom-width: 5px;
  border-radius: 6px; cursor: pointer;
}
#panel button:hover { background: #4c9636; }
#panel button:active { transform: translateY(2px); border-bottom-width: 3px; }
#newBtn { background: #555f6b !important; border-color: #333a42 !important; }
#newBtn:hover { background: #67727f !important; }

#ctrl {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px 24px; text-align: left;
  font-size: 13px; color: #aebdcc;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px; padding: 14px 18px;
  margin-bottom: 16px;
}
#ctrl b { color: #fff; }

#seedline { font-size: 12px; color: #7f909f; }
.hint { font-size: 11px; color: #62707d; margin-top: 6px; }

#err {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #7a1010; color: #fff;
  font-size: 13px; padding: 8px 12px;
  z-index: 99; white-space: pre-wrap;
}
