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

body {
  overflow: hidden;
  background: #0a0a12;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e8eaf0;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
}

/* ─── HUD ─── */
#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  pointer-events: none;
}
.hud-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 6px;
}
.hud-info {
  font-size: 13px;
  opacity: .8;
  gap: 14px;
}
.stat-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-icon { font-size: 16px; }
.bar-outer {
  width: 160px;
  height: 14px;
  background: rgba(255,255,255,.08);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}
.bar-inner {
  height: 100%;
  border-radius: 7px;
  transition: width .25s ease;
}
.bar-hp {
  background: linear-gradient(90deg, #ff4d4d, #ff1a1a);
  width: 100%;
}
.bar-stamina {
  background: linear-gradient(90deg, #ffd700, #ffaa00);
  width: 100%;
}
.stat-text {
  font-size: 12px;
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}

/* ─── Overlays ─── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 15, .92);
  backdrop-filter: blur(6px);
}
.overlay.hidden { display: none; }

.overlay-content {
  text-align: center;
  max-width: 600px;
  padding: 2rem;
}
.overlay-content h1 {
  font-size: 2.4rem;
  margin-bottom: .3rem;
  text-shadow: 0 0 24px rgba(200,160,255,.35);
}
.overlay-content h2 {
  font-size: 1.7rem;
  margin-bottom: .3rem;
  color: #c8a0ff;
}
.subtitle {
  color: #ff0000;
  margin-bottom: 0.5rem;
  font-size: 2rem;
  text-shadow: 0 0 30px #5aec00;
}

.controls-info {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: .9rem;
  line-height: 1.8;
}

/* ─── Buttons ─── */
.btn-glow {
  padding: 12px 36px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #7c5cbf, #b06ab3);
  box-shadow: 0 0 20px rgba(160,100,200,.4);
  transition: transform .15s, box-shadow .15s;
}
.btn-glow:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(160,100,200,.6);
}

/* ─── Ability Cards ─── */
.cards-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.ability-card, .stat-card {
  width: 170px;
  padding: 20px 14px;
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  transition: transform .18s, box-shadow .18s;
  border: 2px solid rgba(255,255,255,.1);
}
.ability-card:hover, .stat-card:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 8px 32px rgba(160,100,200,.4);
}
.ability-card .card-icon, .stat-card .card-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
}
.ability-card .card-name, .stat-card .card-name {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 6px;
}
.ability-card .card-desc, .stat-card .card-desc {
  font-size: .78rem;
  color: #b0b0cc;
  line-height: 1.4;
}

.card-fire   { background: linear-gradient(160deg, #2a1515, #3d1a1a); }
.card-ice    { background: linear-gradient(160deg, #0f1a2a, #152538); }
.card-light  { background: linear-gradient(160deg, #2a2a0f, #3d3a15); }
.card-nature { background: linear-gradient(160deg, #0f2a15, #1a3d20); }
.card-dark   { background: linear-gradient(160deg, #1a0f2a, #251538); }
.card-holy   { background: linear-gradient(160deg, #2a251a, #3d351f); }
.card-wind   { background: linear-gradient(160deg, #152a2a, #1a3d3d); }
.card-blood  { background: linear-gradient(160deg, #2a0f1a, #3d1525); }

.stat-card-hp     { background: linear-gradient(160deg, #2a1515, #3d1a1a); }
.stat-card-sta    { background: linear-gradient(160deg, #2a2a0f, #3d3a15); }
.stat-card-atk    { background: linear-gradient(160deg, #2a0f0f, #3d1515); }
.stat-card-spd    { background: linear-gradient(160deg, #0f2a2a, #153d3d); }
.stat-card-def    { background: linear-gradient(160deg, #15152a, #1a1a3d); }
.stat-card-regen  { background: linear-gradient(160deg, #0f2a15, #1a3d20); }

.death h1 { font-size: 3rem; }

/* ─── Damage number (canvas overlay) ─── */
