@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Rajdhani:wght@500;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body, html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: #050510;
  font-family: 'Rajdhani', sans-serif;
  color: #ffffff;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
}

/* ================= HUD ================= */
#hud {
  position: absolute;
  top: env(safe-area-inset-top, 16px);
  padding-top: 12px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  z-index: 10;
  pointer-events: none;
  padding-left: 12px;
  padding-right: 12px;
}

.hud-box {
  background: rgba(10, 15, 30, 0.78);
  border: 1px solid rgba(0, 240, 255, 0.45);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2), inset 0 0 10px rgba(0, 240, 255, 0.1);
  padding: 6px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: #00f0ff;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.hud-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.hud-btn {
  pointer-events: auto;
  background: rgba(15, 20, 40, 0.85);
  border: 1px solid rgba(255, 0, 128, 0.5);
  box-shadow: 0 0 10px rgba(255, 0, 128, 0.2);
  color: #fff;
  font-size: 1.2rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.hud-btn:hover, .hud-btn:active {
  transform: scale(1.1);
  border-color: #ff007f;
  box-shadow: 0 0 18px rgba(255, 0, 128, 0.6);
}

/* ================= CONTROLES VIRTUAIS MOBILE ================= */
#mobile-controls {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 20px);
  margin-bottom: 12px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px;
  z-index: 15;
  pointer-events: none;
}

.m-dpad {
  display: flex;
  gap: 14px;
  pointer-events: auto;
}

.m-actions {
  pointer-events: auto;
}

.m-touch-btn {
  background: rgba(12, 18, 38, 0.8);
  border: 2px solid rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25), inset 0 0 12px rgba(0, 240, 255, 0.15);
  color: #00f0ff;
  border-radius: 18px;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.1s ease, background 0.1s ease, border-color 0.1s ease;
}

.m-touch-btn:active, .m-touch-btn.active {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.35);
  border-color: #00ffff;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.8), inset 0 0 15px #00f0ff;
  color: #ffffff;
}

.m-touch-btn.m-btn-jump {
  width: 110px;
  height: 68px;
  border-color: rgba(255, 0, 128, 0.7);
  box-shadow: 0 0 16px rgba(255, 0, 128, 0.3), inset 0 0 12px rgba(255, 0, 128, 0.15);
  color: #ff007f;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.m-touch-btn.m-btn-jump:active, .m-touch-btn.m-btn-jump.active {
  background: rgba(255, 0, 128, 0.4);
  border-color: #ff0099;
  box-shadow: 0 0 28px rgba(255, 0, 128, 0.9), inset 0 0 15px #ff007f;
  color: #ffffff;
}

/* ================= TELAS & OVERLAYS ================= */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, rgba(15, 12, 35, 0.88) 0%, rgba(5, 5, 15, 0.96) 100%);
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 16px;
}

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

.screen-content {
  background: rgba(15, 20, 40, 0.75);
  border: 2px solid rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.25), inset 0 0 20px rgba(0, 240, 255, 0.1);
  padding: 32px 24px;
  border-radius: 16px;
  text-align: center;
  max-width: 460px;
  width: 100%;
  animation: floatIn 0.35s ease-out;
}

@keyframes floatIn {
  from {
    transform: translateY(18px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.8), 0 0 30px rgba(0, 240, 255, 0.4);
  margin-bottom: 6px;
}

.game-title .highlight {
  color: #ff007f;
  text-shadow: 0 0 15px rgba(255, 0, 127, 0.8), 0 0 30px rgba(255, 0, 127, 0.4);
}

.game-subtitle {
  color: #9ab4d0;
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ================= GUIA DE CONTROLES ================= */
.controls-guide {
  background: rgba(5, 8, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: #d0e0f0;
}

.key {
  background: #1a2238;
  border: 1px solid #00f0ff;
  box-shadow: 0 2px 0 #0088aa;
  padding: 3px 7px;
  border-radius: 4px;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  color: #00f0ff;
  font-weight: bold;
}

.mouse-icon {
  font-size: 1rem;
  font-weight: bold;
}

/* ================= BOTÕES ================= */
.primary-btn {
  font-family: 'Orbitron', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #ff007f 0%, #aa00ff 100%);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
  width: 100%;
  touch-action: manipulation;
}

.primary-btn:hover, .primary-btn:active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(255, 0, 128, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.5);
}

.high-score-display {
  margin-top: 14px;
  font-size: 0.95rem;
  color: #ffe600;
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
}

/* ================= GAME OVER ================= */
.gameover-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  color: #ff3344;
  text-shadow: 0 0 20px rgba(255, 51, 68, 0.8);
  margin-bottom: 4px;
}

.gameover-subtitle {
  color: #8c9cb0;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.result-card {
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.result-card.full-width {
  grid-column: span 2;
}

.result-label {
  font-size: 0.75rem;
  color: #8c9cb0;
  margin-bottom: 2px;
}

.result-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.result-value.highlight {
  font-size: 1.7rem;
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.record-card {
  background: rgba(255, 230, 0, 0.15);
  border: 1px solid #ffe600;
  color: #ffe600;
  font-family: 'Orbitron', monospace;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 8px;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.8; }
  to { opacity: 1; text-shadow: 0 0 10px #ffe600; }
}

/* ================= RESPONSIVIDADE MOBILE ================= */
@media (max-width: 600px) {
  #hud {
    gap: 8px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .hud-box {
    padding: 5px 10px;
  }
  .hud-label {
    font-size: 0.55rem;
    letter-spacing: 1px;
  }
  .hud-value {
    font-size: 1.05rem;
  }
  .hud-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .screen-content {
    padding: 22px 18px;
  }
  .game-title {
    font-size: 1.9rem;
    letter-spacing: 2px;
  }
  .game-subtitle {
    font-size: 0.9rem;
    margin-bottom: 15px;
  }
  .controls-guide {
    padding: 10px 12px;
    gap: 8px;
  }
  .control-item {
    font-size: 0.85rem;
  }
  .primary-btn {
    font-size: 1rem;
    padding: 12px 20px;
  }

  /* Botões de toque menores para telas estreitas */
  .m-touch-btn {
    width: 60px;
    height: 60px;
  }
  .m-touch-btn.m-btn-jump {
    width: 95px;
    height: 60px;
    font-size: 0.78rem;
  }
  #mobile-controls {
    padding: 0 12px;
  }
}
