/* Retro Jump: 8-Bit Platformer Rush */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0f19;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #fff;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #5c94fc;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* --- Top HUD --- */
#game-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 20;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hud-pill .label {
  color: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.hud-pill .value {
  color: #fff;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.world-pill .value {
  color: #facc15;
}

.coins-pill .value {
  color: #fde047;
}

.lives-pill .value {
  color: #f87171;
}

.score-pill .value {
  color: #ffffff;
  font-size: 14px;
}

.icon-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(30, 41, 59, 0.95);
}

.icon-btn:active {
  transform: scale(0.92);
}

/* --- Virtual Mobile Controls --- */
#controls-mobile {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

.dpad-left, .action-right {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.vpad-btn {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 50%;
  width: 58px;
  height: 58px;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s, background 0.15s;
}

.vpad-btn:active {
  transform: scale(0.92);
  background: rgba(229, 37, 33, 0.8);
}

.jump-btn {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #e52521, #b91c1c);
  border-color: #facc15;
  font-size: 13px;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 20px rgba(229, 37, 33, 0.5);
}

/* --- Overlays & Modals --- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 32px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 40px rgba(229, 37, 33, 0.15);
}

.card-badge {
  display: inline-block;
  background: rgba(229, 37, 33, 0.15);
  color: #f87171;
  border: 1px solid rgba(229, 37, 33, 0.4);
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.defeat-badge {
  display: inline-block;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.victory-ribbon {
  display: inline-block;
  background: linear-gradient(90deg, #facc15, #e52521);
  color: #0f172a;
  padding: 4px 18px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.instructions-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instruction-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: #cbd5e1;
}

.instruction-row .row-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.instruction-row strong {
  color: #fff;
}

.checkpoint-notice {
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 18px 0;
  font-size: 13px;
  color: #fef08a;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0 28px 0;
}

.stat-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-box.highlight {
  border-color: rgba(229, 37, 33, 0.4);
  background: rgba(229, 37, 33, 0.1);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.stat-box.highlight .stat-value {
  color: #f87171;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #e52521, #b91c1c);
  border: none;
  outline: none;
  color: #fff;
  padding: 14px 20px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(229, 37, 33, 0.4);
  transition: transform 0.1s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 37, 33, 0.6);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  outline: none;
  color: #cbd5e1;
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

@media (max-width: 600px) {
  .card {
    padding: 24px 18px;
  }
  .card-title {
    font-size: 24px;
  }
}
