/* === Game Screen === */
#screenGame {
  padding: 0;
  background: #000;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Wrapper sized by engine._resize() to the scaled canvas dimensions */
#gameArea {
  position: relative;
  flex-shrink: 0;
}

#gameCanvas {
  display: block;
  touch-action: none;
  /* width/height set by JS in engine._resize() */
}

/* === FPS counter (opt-in, bottom-left) === */
#fpsCounter {
  position: absolute;
  left: 6px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  z-index: 11;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #5DCAA5;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 7px;
  border-radius: 6px;
  pointer-events: none;
  text-shadow: 0 1px 4px #000;
}
#fpsCounter.hidden { display: none; }

/* === HUD === */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: max(10px, calc(env(safe-area-inset-top, 0px) + 4px)) 14px 10px;
  pointer-events: none;
  z-index: 10;
}

#hudLeft {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e8e5df;
  text-shadow: 0 1px 6px #000;
}

#hudRight {
  display: flex;
  gap: 8px;
  pointer-events: all;
}

/* Pause button */
.hud-pause-btn {
  background: rgba(0, 0, 0, 0.45);
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.hud-pause-btn:hover  { background: rgba(0, 0, 0, 0.65); }
.hud-pause-btn:active { transform: scale(0.88); }

/* === Overlays (positioned relative to #gameArea) === */
/* Ensure overlay buttons are large enough for touch */
.overlay .btn-primary,
.overlay .btn-secondary {
  min-width: 180px;
  min-height: 48px;
}

/* === Landscape warning === */
#landscapeWarning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
#landscapeWarning .lw-icon { font-size: 2.2rem; }
#landscapeWarning .lw-text {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  line-height: 1.9;
}

/* Show warning only on small landscape screens (mobile in landscape) */
@media (orientation: landscape) and (max-height: 500px) {
  #landscapeWarning { display: flex; }
}

/* === Level-Complete overlay === */
.lc-stars {
  font-size: 2.4rem;
  letter-spacing: 0.18em;
  color: #f7c94f;
  text-shadow: 0 0 22px rgba(247,201,79,0.55);
  margin-bottom: 4px;
}
.lc-level-name {
  color: #e8e5df;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.lc-coins {
  color: #f7c94f;
  font-size: 13px;
  letter-spacing: 0.12em;
  margin: 6px 0 2px;
}
.lc-coins.hidden { display: none; }

/* EXP summary rows in level-complete overlay */
.lc-exp-section {
  width: 100%;
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.lc-exp-section.hidden { display: none; }
.lc-exp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(192,132,252,0.07);
  border: 0.5px solid rgba(192,132,252,0.18);
  border-radius: 8px;
  font-size: 12px;
}
.lc-exp-avatar {
  width: 24px; height: 24px;
  border-radius: 5px;
  flex-shrink: 0;
}
.lc-exp-name {
  flex: 1;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-exp-gained { color: #c084fc; font-weight: 700; white-space: nowrap; }
.lc-exp-zero   { color: rgba(255,255,255,0.25); }
.lc-exp-lvlup  { color: #4ade80; font-size: 11px; white-space: nowrap; margin-left: 4px; }
/* Per-hero "level up possible" badge (unspent stat points) */
.lc-exp-levelup {
  color: #4ade80;
  font-weight: 800;
  font-size: 11px;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(74,222,128,0.14);
  border: 0.5px solid rgba(74,222,128,0.45);
  animation: lcExpLevelUpPulse 1.4s ease-in-out infinite;
}
@keyframes lcExpLevelUpPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(74,222,128,0); }
  50%      { box-shadow: 0 0 10px rgba(74,222,128,0.4); }
}

/* "Helden leveln" shortcut — only shown on a level-up, tinted in the EXP color */
#btnLevelHeroes {
  border-color: rgba(192,132,252,0.5);
  color: #c084fc;
}
#btnLevelHeroes:hover {
  border-color: #c084fc;
  color: #d8b4fe;
  background: rgba(192,132,252,0.09);
  box-shadow: 0 0 20px rgba(192,132,252,0.12);
}
#btnLevelHeroes::before { content: "⬆"; margin-right: 8px; }
#btnLevelHeroes.hidden { display: none; }

.lc-heal-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}
.lc-heal-section.hidden { display: none; }
.lc-coin-balance {
  color: #f7c94f;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex: 1;
}
.lc-heal-btn {
  font-size: 12px !important;
  padding: 6px 12px !important;
  white-space: nowrap;
}

/* === Level title banner (fades in at start of each level) === */
.level-title-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #e8e5df;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(93,202,165,0.6);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.6s ease;
}
.level-title-banner.hidden   { display: none; }
.level-title-banner.fade-out { opacity: 0; transition: opacity 0.6s ease; }

/* === Level grid (campaign level select) === */
.level-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}
.level-btn:active { transform: scale(0.92); }
.level-btn.locked    { background: #1a1917; border-color: #2a2a28; color: #444; cursor: default; }
.level-btn.unlocked  { background: #1e1e1c; border-color: #3a3a38; color: #e8e5df; }
.level-btn.unlocked:hover { border-color: #5DCAA5; }
.level-btn.completed { background: #1a2920; border-color: rgba(93,202,165,0.45); color: #5DCAA5; }
.level-btn.completed:hover { border-color: #5DCAA5; }
.level-num   { line-height: 1; }
.level-stars { font-size: 9px; letter-spacing: 0.06em; color: #f7c94f; margin-top: 3px; }

/* TODO: add animations for:
   - enemy entry (slide-in from top)
   - projectile impact flash
   - hero death fade-out
*/

/* Game-Over headline: score + wave, the two numbers the run is judged by */
.go-headline {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 28px;
  margin: 10px 0 6px;
}
.go-headline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.go-headline-item.hidden { display: none; }

.go-headline-label {
  font-size: 10px;
  color: #888;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.go-headline-value {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  color: #e8e5df;
  font-variant-numeric: tabular-nums;
}
.go-headline-score {
  font-size: 38px;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(93, 202, 165, 0.35);
}

@media (max-width: 480px) {
  .go-headline { gap: 20px; }
  .go-headline-value { font-size: 24px; }
  .go-headline-score { font-size: 30px; }
}

/* Game-Over summary (endless mode) */
.go-summary {
  width: 100%;
  margin: 8px 0 12px;
}
.go-summary.hidden { display: none; }

.go-newbest {
  color: #f7c94f;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 0 0 8px;
}
.go-newbest.hidden { display: none; }

.go-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.go-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 6px 10px;
}

.go-stat span {
  font-size: 10px;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.go-stat strong {
  font-size: 16px;
  color: #e8e5df;
  font-weight: 700;
}
