html, body { margin: 0; height: 100%; overflow: hidden; background: #cdeaf5; }
canvas { display: block; }
#overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start;
  flex-direction: column; color: white; font-family: sans-serif; text-align: center;
  background: rgba(0,0,0,0.5); cursor: pointer;
  overflow-y: auto; padding: 28px 16px; box-sizing: border-box;   /* always starts at the top, and scrolls on small screens */
}
#overlay h1 { margin: 0 0 12px; }
#overlay p { font-size: 14px; }
#difficulty { display: flex; gap: 16px; margin: 4px 0 18px; }
#difficulty button {
  width: 210px; padding: 16px 14px; border-radius: 16px; border: 3px solid rgba(255,255,255,0.35);
  background: rgba(20, 35, 45, 0.85); color: white; font-family: sans-serif; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform 0.12s, border-color 0.12s;
}
#difficulty button span { font-size: 40px; }
#difficulty button b { font-size: 22px; }
#difficulty button small { font-size: 13px; opacity: 0.85; line-height: 1.35; }
#difficulty button:hover { transform: scale(1.06); border-color: #ffd54a; }
#difficulty button[data-mode="insane"]:hover { border-color: #ff5a4a; }
#overlay p { margin: 4px; }
#overlay .small { opacity: 0.7; font-size: 14px; margin-top: 10px; }
#crosshair {
  position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px;
  background: white; border-radius: 50%; opacity: 0.9; pointer-events: none; display: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}
#prompt {
  position: fixed; left: 50%; top: 54%; transform: translateX(-50%);
  color: white; font-family: sans-serif; font-size: 16px; font-weight: bold; text-align: center;
  white-space: pre-line; text-shadow: 0 2px 4px rgba(0,0,0,0.8); pointer-events: none; display: none;
}
#toast {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%);
  color: #fff; background: rgba(200, 60, 40, 0.85); font-family: sans-serif; font-weight: bold;
  padding: 8px 16px; border-radius: 10px; pointer-events: none; opacity: 0; transition: opacity 0.2s;
  text-align: center;
}
#hud {
  position: fixed; left: 16px; top: 16px; color: white; font-family: sans-serif;
  font-size: 20px; font-weight: bold; pointer-events: none; display: none;
  background: rgba(30, 50, 60, 0.45); padding: 10px 16px; border-radius: 14px;
}
#hud div { margin: 4px 0; }
#clock {
  position: fixed; right: 16px; top: 16px; color: white; font-family: sans-serif;
  font-size: 20px; font-weight: bold; pointer-events: none; display: none;
  background: rgba(30, 50, 60, 0.45); padding: 10px 16px; border-radius: 14px;
}
#levelup {
  position: fixed; left: 50%; top: 35%; transform: translate(-50%, -50%) scale(0.8);
  color: #ffe27a; font-family: sans-serif; font-size: 64px; font-weight: 900; text-align: center;
  text-shadow: 0 4px 12px rgba(0,0,0,0.6); pointer-events: none; opacity: 0;
  transition: opacity 0.6s, transform 0.6s;
}
#levelup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(10,30,45,0.30) 100%);
}
#hurt {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,0,0,0) 35%, rgba(200,0,0,0.6) 100%);
}
#hp {
  position: fixed; left: 18px; bottom: 18px; width: 230px; height: 24px; display: none;
  background: rgba(0,0,0,0.5); border-radius: 12px; overflow: hidden; font-family: sans-serif; color: white;
}
#hpFill { height: 100%; width: 100%; background: linear-gradient(#ff7a7a, #d63a3a); transition: width 0.15s; }
#hpText { position: absolute; inset: 0; text-align: center; line-height: 24px; font-size: 13px; font-weight: bold; text-shadow: 0 1px 2px #000; }
#crafting {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); display: none;
  background: rgba(30, 50, 60, 0.94); color: white; font-family: sans-serif;
  padding: 16px 22px; border-radius: 16px; min-width: 500px;
}
#crafting h3 { margin: 0 0 10px; }
#crafting small { display: block; opacity: 0.75; font-weight: normal; }
.recipe { display: flex; justify-content: space-between; gap: 24px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,0.15); }
.recipe.locked { opacity: 0.4; }
.recipe.cant { opacity: 0.7; }
#crafting .hint { margin-top: 10px; opacity: 0.7; font-size: 13px; }
#minimap {
  position: fixed; right: 16px; top: 78px; width: 190px; height: 190px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.65); box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  pointer-events: none; display: none;
}
#hotbar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: none; gap: 6px; font-family: sans-serif; color: white; pointer-events: none;
}
.slot {
  background: rgba(30, 50, 60, 0.5); border: 3px solid transparent; border-radius: 12px;
  padding: 5px 5px; font-weight: bold; font-size: 11px; text-align: center; min-width: 62px;
}
#material {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); display: none;
  color: white; font-family: sans-serif; font-weight: bold; font-size: 16px; pointer-events: none;
  background: rgba(30, 50, 60, 0.6); padding: 6px 14px; border-radius: 10px;
}
.slot.selected { border-color: #ffd54a; background: rgba(30, 50, 60, 0.75); }
#core {
  position: fixed; left: 18px; bottom: 50px; width: 230px; height: 20px; display: none;
  background: rgba(0,0,0,0.5); border-radius: 10px; overflow: hidden; font-family: sans-serif; color: white;
}
#coreFill { height: 100%; width: 100%; background: linear-gradient(#8ff0ff, #2bb5d6); transition: width 0.15s; }
#coreText { position: absolute; inset: 0; text-align: center; line-height: 20px; font-size: 12px; font-weight: bold; text-shadow: 0 1px 2px #000; }
#core.flash { box-shadow: 0 0 0 3px #ff3b30, 0 0 18px #ff3b30; }
#bossbar {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); width: 420px; display: none;
  font-family: sans-serif; color: #ffe27a; text-align: center; font-weight: 900; font-size: 18px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9); pointer-events: none;
}
#bossbar .track { height: 16px; margin-top: 4px; background: rgba(0,0,0,0.6); border: 2px solid #ffe27a; border-radius: 9px; overflow: hidden; }
#bossFill { height: 100%; width: 100%; background: linear-gradient(#ff7a5c, #c8261a); }
#hitArrows { position: fixed; inset: 0; pointer-events: none; }
.hitArrow {
  position: absolute; width: 0; height: 0; display: none;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 30px solid rgba(255, 45, 35, 0.9);
  filter: drop-shadow(0 0 6px rgba(255,0,0,0.9)); margin: -15px 0 0 -16px;
}
#gameover {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column;
  background: rgba(40, 0, 0, 0.75); color: white; font-family: sans-serif; text-align: center; cursor: pointer; z-index: 5;
}
#gameover h1 { font-size: 56px; margin: 0 0 10px; color: #ff8a7a; }
.slot small { display: block; font-weight: normal; opacity: 0.8; }

/* ----- Start screen: easy-to-read control cards ----- */
#overlay .goal { font-size: 16px; margin: 0 0 14px; background: rgba(95, 230, 255, 0.15); border: 2px solid rgba(95, 230, 255, 0.5); padding: 8px 16px; border-radius: 12px; }
#help { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 1100px; }
.helpCard { background: rgba(20, 35, 45, 0.85); border-radius: 14px; padding: 10px 14px 12px; width: 250px; box-sizing: border-box; text-align: left; }
.helpCard h3 { margin: 0 0 8px; font-size: 16px; }
.helpCard .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 5px 0; font-size: 14px; }
.helpCard .keys { white-space: nowrap; }
.k { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #f2f4f7; color: #1d2a33; font-weight: bold; font-size: 12px; box-shadow: 0 2px 0 #8a96a3; margin: 0 1px; }
#overlay details { margin-top: 14px; cursor: default; }
#overlay details summary { cursor: pointer; }

/* ----- The build wheel (hold B) ----- */
#buildWheel { position: fixed; inset: 0; display: none; z-index: 4; pointer-events: none; font-family: sans-serif; color: white;
  background: radial-gradient(circle at center, rgba(10,20,30,0.28) 0%, rgba(10,20,30,0.12) 40%, rgba(0,0,0,0) 62%);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9); }   /* see-through: you can still watch the game behind it (and it never pauses) */
.wheelItem { position: absolute; width: 86px; margin: -40px 0 0 -43px; text-align: center; padding: 6px 4px; border-radius: 14px;
  background: rgba(30, 50, 60, 0.5); border: 3px solid transparent; transition: transform 0.08s; }
.wheelItem span { display: block; font-size: 26px; }
.wheelItem b { display: block; font-size: 12px; }
.wheelItem small { display: block; font-size: 10px; opacity: 0.8; }
.wheelItem.cant { opacity: 0.45; filter: grayscale(1); }
.wheelItem.current { border-color: rgba(255,255,255,0.45); }
.wheelItem.hover { border-color: #ffd54a; transform: scale(1.18); opacity: 1; background: rgba(40, 70, 85, 0.75); }
.wheelCenter { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 230px; text-align: center;
  background: rgba(15, 28, 36, 0.45); border-radius: 18px; padding: 10px 8px; }
.wheelCenter .name { font-size: 20px; font-weight: bold; }
.wheelCenter .cost { font-size: 13px; margin-top: 3px; }
.wheelCenter .mat { margin: 10px 0 8px; display: flex; gap: 6px; justify-content: center; }
.wheelCenter .mat span { padding: 3px 8px; border-radius: 8px; background: rgba(255,255,255,0.12); font-size: 13px; opacity: 0.6; }
.wheelCenter .mat span.on { background: #ffd54a; color: #1d2a33; font-weight: bold; opacity: 1; }
.wheelCenter .hint { font-size: 11px; opacity: 0.75; line-height: 1.4; }
.wheelPointer { position: absolute; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: #ffd54a; box-shadow: 0 0 8px #ffd54a; }

/* ----- Play with friends (start screen) ----- */
#party { background: rgba(20, 35, 45, 0.85); border-radius: 14px; padding: 10px 16px 12px; margin: 0 0 14px; cursor: default; }
#party .partyTitle { font-weight: bold; font-size: 16px; margin-bottom: 8px; }
#party .partyRow { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
#party input { padding: 7px 10px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.95); color: #1d2a33; font-size: 14px; font-weight: bold; width: 140px; }
#party button { padding: 8px 14px; border-radius: 10px; border: none; background: #ffd54a; color: #1d2a33; font-weight: bold; font-size: 14px; cursor: pointer; }
#party button:hover { filter: brightness(1.1); }
#party .or { opacity: 0.7; font-size: 13px; }
#partyStatus { font-size: 13px; opacity: 0.9; margin-top: 8px; }
