/* CUBEWILDS HUD — dark glass, low-poly chunky */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1026; }
body { font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
canvas { display: block; }

/* soft vignette for the diorama look */
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(8, 10, 24, 0.38) 100%); }

#damage-flash { position: fixed; inset: 0; pointer-events: none; z-index: 6; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(210,40,40,0.12) 40%, rgba(210,40,40,0.5) 100%);
  transition: opacity 0.25s ease-out; }

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

/* hearts */
#hearts { position: absolute; top: 14px; left: 16px; display: flex; gap: 3px; }
.heart { width: 18px; height: 18px; position: relative; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.heart::before { content: '♥'; font-size: 19px; line-height: 18px; position: absolute; color: #3a2030; }
.heart.full::before { color: #ff4d6d; }
.heart.half::before { color: #ff4d6d; content: '♥'; clip-path: inset(0 50% 0 0); }
.heart.half::after { content: '♥'; font-size: 19px; line-height: 18px; position: absolute; left: 0; color: #3a2030; clip-path: inset(0 0 0 50%); }

/* clock */
#clock { position: absolute; top: 12px; right: 16px; display: flex; align-items: center; gap: 8px;
  background: rgba(14, 18, 36, 0.55); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 6px 12px; color: #eef2ff; font-weight: 600; font-size: 14px; backdrop-filter: blur(6px); }
#clock-icon { display: inline-block; font-size: 17px; transition: transform 0.4s linear; }

/* crosshair (fps mode) */
#crosshair { display: none; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px;
  margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,0.9);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35); }

/* mine progress */
#minebar { position: absolute; left: 50%; bottom: 108px; width: 130px; height: 7px; margin-left: -65px;
  background: rgba(10, 12, 26, 0.65); border-radius: 4px; opacity: 0; transition: opacity 0.15s;
  border: 1px solid rgba(255,255,255,0.18); overflow: hidden; }
#minefill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd75e, #ffb03a); border-radius: 4px; }

/* hotbar */
#hotbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 6px; pointer-events: auto; }
.slot { width: 62px; height: 62px; border-radius: 12px; position: relative; cursor: pointer;
  background: rgba(14, 18, 36, 0.6); border: 2px solid rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
  transition: transform 0.1s, border-color 0.1s; }
.slot.sel { border-color: #fff; transform: translateY(-5px) scale(1.06); box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
.block-icon { width: 30px; height: 30px; border-radius: 6px; box-shadow: inset 0 -3px 6px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.4); }
.tool-icon { font-size: 27px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); }
.slot-count { position: absolute; right: 5px; bottom: 3px; color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot-name { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; color: rgba(255,255,255,0.0); font-size: 11px; font-weight: 600; transition: color .12s; white-space: nowrap; }
.slot.sel .slot-name { color: rgba(255,255,255,0.95); text-shadow: 0 1px 3px #000; }
.slot-key { position: absolute; left: 6px; top: 3px; color: rgba(255,255,255,0.45); font-size: 10px; font-weight: 700; }

/* toasts */
#toasts { position: absolute; right: 18px; bottom: 100px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.toast { background: rgba(14, 18, 36, 0.7); border: 1px solid rgba(255,255,255,0.14); color: #eef2ff;
  padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  opacity: 0; transform: translateY(8px); transition: all 0.25s; backdrop-filter: blur(6px); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.big { background: rgba(120, 84, 10, 0.85); border-color: #ffd75e; color: #ffe9a8; font-size: 15px; }

#hint { position: absolute; left: 16px; bottom: 16px; color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 600;
  background: rgba(14,18,36,0.45); padding: 6px 10px; border-radius: 8px; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(7, 9, 20, 0.72); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.overlay.visible { opacity: 1; pointer-events: auto; }
.panel { text-align: center; color: #eef2ff; max-width: 620px; padding: 40px 48px;
  background: rgba(16, 20, 40, 0.85); border: 1px solid rgba(255,255,255,0.12); border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5); }
.panel h1 { font-size: 54px; letter-spacing: 6px; font-weight: 800;
  background: linear-gradient(180deg, #aef27a, #4ea83c); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 24px rgba(120, 220, 90, 0.25); }
.panel h2 { font-size: 30px; margin-bottom: 14px; }
.panel h1.dead-title { background: linear-gradient(180deg, #ff8a8a, #c23030); -webkit-background-clip: text; background-clip: text; }
.tagline { color: rgba(238,242,255,0.65); margin: 8px 0 18px; font-size: 15px; line-height: 1.55; }
#loadbar { width: 320px; height: 8px; margin: 0 auto 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
#loadfill { height: 100%; width: 0; background: linear-gradient(90deg, #7fc24a, #aef27a); transition: width 0.2s; }
#load-label { font-size: 12px; color: rgba(238,242,255,0.5); margin-bottom: 14px; }
#seed-label { margin-top: 14px; font-size: 12px; color: rgba(238,242,255,0.4); }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 22px; margin: 10px auto 20px; text-align: left;
  font-size: 13.5px; color: rgba(238,242,255,0.82); max-width: 460px; }
.controls-grid b { color: #aef27a; }
.btn-row { display: flex; gap: 12px; justify-content: center; }
button { font: inherit; font-weight: 700; font-size: 17px; letter-spacing: 1px; cursor: pointer;
  padding: 12px 34px; border-radius: 14px; border: none; color: #0d1a08;
  background: linear-gradient(180deg, #aef27a, #63bb3f); box-shadow: 0 6px 20px rgba(110, 210, 80, 0.35);
  transition: transform 0.12s, box-shadow 0.12s; }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(110, 210, 80, 0.5); }
button:disabled { opacity: 0.35; cursor: default; }
#new-btn { background: linear-gradient(180deg, #8fb4e8, #5a7fc0); color: #0a1226; box-shadow: 0 6px 20px rgba(90, 130, 210, 0.35); }
#respawn-btn { background: linear-gradient(180deg, #ffb3b3, #e86a6a); color: #2a0808; box-shadow: 0 6px 20px rgba(220, 90, 90, 0.35); }
#help-stats { margin-top: 12px; font-size: 12px; color: rgba(238,242,255,0.45); font-family: ui-monospace, monospace; }

/* crafting */
#craft-list { display: flex; flex-direction: column; gap: 8px; margin: 6px auto 10px; max-width: 420px; }
.recipe { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 8px 12px; text-align: left; }
.recipe .block-icon { width: 34px; height: 34px; flex: none; }
.recipe-info { flex: 1; font-size: 14px; }
.recipe-cost { display: flex; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.cost { font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.cost.ok { background: rgba(120, 220, 90, 0.18); color: #aef27a; }
.cost.lack { background: rgba(220, 90, 90, 0.18); color: #ff9a9a; }
.recipe button { font-size: 13px; padding: 7px 16px; border-radius: 9px; }
