* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: 'Segoe UI', Arial, sans-serif; color: #fff; user-select: none; }
#game canvas { display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#biome-label {
  position: absolute; top: 8px; left: 10px;
  font: bold 13px monospace; color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,.6);
}
#crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 22px; color: rgba(255,255,255,.85); text-shadow: 0 0 2px #000;
}
#hotbar {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 3px; padding: 3px; background: rgba(0,0,0,.45);
  border: 2px solid #222; border-radius: 4px;
}
.slot {
  width: 46px; height: 46px; background: rgba(140,140,140,.25);
  border: 2px solid #555; border-radius: 3px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.slot.selected { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,.7); }
.slot img { width: 36px; height: 36px; image-rendering: pixelated; }
.slot .count {
  position: absolute; right: 2px; bottom: 0; font-size: 14px; font-weight: bold;
  text-shadow: 1px 1px 1px #000;
}
.slot .durab { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 3px; background: #0c0; }

#status-bars {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  width: 440px; display: flex; justify-content: space-between;
  font-size: 18px; text-shadow: 1px 1px 1px #000; letter-spacing: 1px;
}
#hearts { color: #f33; } #hunger { color: #c80; }

#messages {
  position: absolute; left: 12px; bottom: 130px; max-width: 480px;
  display: flex; flex-direction: column; gap: 4px; font-size: 15px;
}
#messages .msg {
  background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 4px;
  animation: fadeout 7s forwards;
}
@keyframes fadeout { 0%,80% { opacity: 1; } 100% { opacity: 0; } }

#bossbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 480px; text-align: center; }
#bossbar-label { font-size: 16px; color: #e6a8ff; text-shadow: 1px 1px 2px #000; margin-bottom: 4px; }
#bossbar-track { height: 12px; background: rgba(0,0,0,.6); border: 1px solid #a0a; border-radius: 6px; overflow: hidden; }
#bossbar-fill { height: 100%; width: 100%; background: linear-gradient(#f5f,#a0a); transition: width .2s; }

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,20,.78); z-index: 10; overflow-y: auto;
}
.panel {
  background: #2a2a2e; border: 3px solid #555; border-radius: 8px;
  padding: 22px 30px; max-width: 680px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.8);
}
.panel.center { text-align: center; }
.panel.red { border-color: #a22; background: #3a1a1a; }
.panel.gold { border-color: #ca0; background: #2e2a14; }
.panel h1 { margin-bottom: 10px; font-size: 30px; }
.panel h2 { margin: 12px 0 8px; font-size: 20px; color: #ddd; }
.panel .subtitle { color: #aaa; margin-bottom: 16px; }
.panel button {
  display: block; width: 100%; margin: 8px 0; padding: 12px;
  font-size: 18px; font-weight: bold; color: #fff; cursor: pointer;
  background: #4a7a3a; border: 2px solid #2d4d24; border-radius: 5px;
}
.panel button:hover { background: #5c9648; }
.panel button.danger { background: #6a3030; border-color: #4d2424; font-size: 14px; padding: 8px; }
.panel button.danger:hover { background: #8a4040; }
.hint { color: #999; font-size: 13px; margin-top: 10px; }

.controls-help { text-align: left; margin-top: 18px; background: rgba(0,0,0,.25); padding: 12px 16px; border-radius: 6px; }
.controls-help h3 { margin-bottom: 8px; color: #cfc; }
.controls-help table td { padding: 2px 14px 2px 0; font-size: 14px; color: #ccc; }
.controls-help td:first-child { color: #fff; font-weight: bold; white-space: nowrap; }
.controls-help ol { margin-left: 20px; font-size: 14px; color: #ccc; line-height: 1.55; }

/* ---------- Inventar ---------- */
#inventory-screen .panel { width: 640px; }
#inv-grid { display: grid; grid-template-columns: repeat(9, 52px); gap: 4px; justify-content: center; }
#inv-grid .slot { cursor: pointer; pointer-events: auto; }
#inv-grid .slot.hotbar-row { border-color: #887; }
#craft-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.recipe {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  background: rgba(0,0,0,.3); border: 1px solid #444; border-radius: 4px;
  cursor: pointer; font-size: 14px;
}
.recipe:hover { background: rgba(80,120,60,.35); }
.recipe.unavailable { opacity: .42; cursor: not-allowed; }
.recipe img { width: 28px; height: 28px; image-rendering: pixelated; }
.recipe .rname { font-weight: bold; min-width: 170px; }
.recipe .rneeds { color: #aaa; flex: 1; }
.recipe .station-need { color: #e90; }
#station-hint { font-size: 13px; color: #8c8; font-weight: normal; }

#held-item {
  position: fixed; pointer-events: none; z-index: 100; width: 36px; height: 36px;
}
#held-item img { width: 36px; height: 36px; image-rendering: pixelated; }
#held-item .count { position: absolute; right: 0; bottom: -4px; font-size: 14px; font-weight: bold; text-shadow: 1px 1px 1px #000; }
