* { 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;
}

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

/* ---------- HUD ---------- */

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

#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: ""; position: absolute; background: #ddd;
}
#crosshair::before { left: 9px; top: 0; width: 2px; height: 20px; }
#crosshair::after { left: 0; top: 9px; width: 20px; height: 2px; }

#hotbar {
  position: absolute; bottom: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 2px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px; border-radius: 4px;
}
#hotbar .slot {
  width: 46px; height: 46px;
  border: 2px solid #555;
  background: rgba(30, 30, 30, 0.6);
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
#hotbar .slot.sel { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
#hotbar .slot canvas { image-rendering: pixelated; }
#hotbar .slot span {
  position: absolute; top: 1px; left: 3px;
  font-size: 10px; color: #ccc; text-shadow: 1px 1px 0 #000;
}

#hearts {
  position: absolute; bottom: 68px; left: 50%;
  transform: translateX(-50%);
  font-size: 21px; letter-spacing: 2px;
  text-shadow: 1px 1px 0 #000;
}
#hearts .full { color: #e02020; }
#hearts .half { color: #e08080; }
#hearts .empty { color: #3a3a3a; }

#blockname {
  position: absolute; bottom: 110px; left: 50%;
  transform: translateX(-50%);
  color: #fff; font-size: 15px; font-weight: bold;
  text-shadow: 1px 1px 0 #000;
  opacity: 0; transition: opacity 0.4s;
}

#debug {
  position: absolute; top: 8px; left: 8px;
  color: #fff; font-size: 12px; line-height: 1.5;
  text-shadow: 1px 1px 0 #000;
  white-space: pre; display: none;
}
#debug.show { display: block; }

#vignette-damage {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(200,0,0,0.15) 0%, rgba(160,0,0,0.75) 100%);
  opacity: 0;
}

#underwater {
  position: absolute; inset: 0;
  background: rgba(20, 50, 140, 0.5);
  opacity: 0; transition: opacity 0.2s;
}

/* ---------- Overlays ---------- */

#overlay, #deathScreen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 14, 0.62);
  z-index: 10;
}
#overlay.hidden { display: none; }
#deathScreen { display: none; background: rgba(110, 0, 0, 0.45); }
#deathScreen.show { display: flex; }

.panel {
  text-align: center;
  color: #fff;
  padding: 34px 46px;
  background: rgba(20, 20, 26, 0.85);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #5a5a5a, 0 10px 40px rgba(0,0,0,0.6);
  max-width: 560px;
}
.panel h1 {
  font-size: 44px; letter-spacing: 6px;
  color: #dedede;
  text-shadow: 3px 3px 0 #3f3f3f, 6px 6px 0 rgba(0,0,0,0.5);
  margin-bottom: 4px;
}
.panel .sub { color: #9a9a9a; margin-bottom: 22px; font-size: 13px; }

.mc-btn {
  display: block;
  width: 260px; margin: 8px auto;
  padding: 12px 0;
  font-family: inherit; font-size: 16px; font-weight: bold;
  color: #fff; cursor: pointer;
  background: linear-gradient(#7d7d7d, #5e5e5e);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.35), inset -2px -2px 0 rgba(0,0,0,0.35);
}
.mc-btn:hover { background: linear-gradient(#8f9bd6, #6577c0); }
.mc-btn:active { box-shadow: inset -2px -2px 0 rgba(255,255,255,0.2), inset 2px 2px 0 rgba(0,0,0,0.4); }

.controls {
  margin-top: 20px; font-size: 12.5px; line-height: 2;
  color: #c9c9c9;
}
.controls b { color: #ffd76e; }

.seed { margin-top: 14px; font-size: 11px; color: #777; }
.hint { margin-top: 6px; font-size: 11px; color: #6f8f6f; }

/* ---------- Inventory & crafting ---------- */

#invScreen {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(10, 10, 14, 0.55);
  z-index: 9;
}
#invScreen.show { display: flex; }

.inv-panel {
  display: flex; flex-wrap: wrap; gap: 26px;
  position: relative;
  color: #eee;
  padding: 26px 30px 60px;
  background: rgba(28, 28, 34, 0.96);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #5a5a5a, 0 10px 40px rgba(0,0,0,0.6);
  max-width: 820px; max-height: 82vh;
}
.inv-col { min-width: 300px; flex: 1; overflow-y: auto; max-height: calc(82vh - 100px); }
.inv-col h2 { font-size: 15px; margin: 10px 0 8px; color: #ffd76e; text-shadow: 1px 1px 0 #000; }
.inv-col .tip { font-size: 10px; color: #999; font-weight: normal; margin-left: 6px; }

#invGrid, #invHotbar { display: flex; flex-wrap: wrap; gap: 4px; min-height: 48px; }
.inv-item, .inv-slot {
  width: 46px; height: 46px;
  border: 2px solid #555;
  background: rgba(15, 15, 18, 0.8);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.inv-item:hover, .inv-slot:hover { border-color: #fff; }
.inv-item canvas, .inv-slot canvas { image-rendering: pixelated; }
.inv-item .cnt, .inv-slot .cnt, #hotbar .slot .cnt {
  position: absolute; bottom: 1px; right: 3px;
  font-size: 11px; font-weight: bold; color: #fff;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}
.inv-slot.empty { opacity: 0.45; cursor: default; }
.inv-empty-note { font-size: 11px; color: #888; padding: 8px 2px; }

.craft-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; margin-bottom: 3px;
  border: 2px solid #444;
  background: rgba(15, 15, 18, 0.7);
  cursor: pointer;
}
.craft-row:hover { border-color: #9ad06a; }
.craft-row.locked { opacity: 0.42; cursor: default; }
.craft-row.locked:hover { border-color: #444; }
.craft-row canvas { image-rendering: pixelated; flex-shrink: 0; }
.craft-row .c-name { font-size: 12px; font-weight: bold; min-width: 110px; }
.craft-row .c-in { font-size: 10.5px; color: #aaa; margin-left: auto; text-align: right; }
.craft-row .c-in .have { color: #9ad06a; }
.craft-row .c-in .miss { color: #d06a6a; }

.mc-btn.small { width: 150px; padding: 8px 0; font-size: 13px; position: absolute; bottom: 12px; right: 16px; margin: 0; }
