@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@600;700&family=Rajdhani:wght@600;700&family=Orbitron:wght@700;900&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: #5bb3e8;
  font-family: 'Fredoka', '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 SUPERIOR ================= */
#hud {
  position: absolute;
  top: env(safe-area-inset-top, 14px);
  padding: 10px 16px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-card {
  background: rgba(15, 25, 45, 0.78);
  border: 2px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35), inset 0 0 10px rgba(255, 215, 0, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-icon {
  font-size: 1.25rem;
}

.hud-value {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.ring-indicator {
  border-color: #ff3388;
  box-shadow: 0 0 15px rgba(255, 51, 136, 0.5);
  animation: ringPulse 1.5s infinite alternate;
}

@keyframes ringPulse {
  from { transform: scale(0.97); box-shadow: 0 0 10px rgba(255, 51, 136, 0.4); }
  to { transform: scale(1.03); box-shadow: 0 0 20px rgba(255, 51, 136, 0.8); }
}

.hud-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffdd88;
  letter-spacing: 1px;
}

.hud-btn {
  pointer-events: auto;
  background: rgba(20, 30, 50, 0.85);
  border: 2px solid #ffd700;
  color: #fff;
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}

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

/* ================= CONTROLES VIRTUAIS MOBILE ================= */
#mobile-controls {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 16px);
  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: 12px;
  pointer-events: auto;
}

.m-actions {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.m-touch-btn {
  background: rgba(15, 25, 45, 0.82);
  border: 3px solid rgba(255, 215, 0, 0.8);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 0 10px rgba(255, 215, 0, 0.3);
  color: #ffd700;
  border-radius: 50%;
  width: 68px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.1s ease, background 0.1s ease;
}

.m-touch-btn span {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: -3px;
  letter-spacing: 0.5px;
}

.m-touch-btn:active, .m-touch-btn.active {
  transform: scale(0.88);
  background: rgba(255, 215, 0, 0.45);
  color: #fff;
  border-color: #ffffff;
}

.m-touch-btn.m-btn-jump {
  border-color: #ff3388;
  color: #ff3388;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 0 10px rgba(255, 51, 136, 0.3);
  width: 76px;
  height: 76px;
}

.m-touch-btn.m-btn-jump:active, .m-touch-btn.m-btn-jump.active {
  background: rgba(255, 51, 136, 0.45);
  border-color: #fff;
  color: #fff;
}

.m-touch-btn.m-btn-pound {
  border-color: #00e5ff;
  color: #00e5ff;
}

/* ================= TELAS & MODAIS ================= */
.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(10, 25, 50, 0.8) 0%, rgba(5, 10, 25, 0.94) 100%);
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.screen-card {
  background: linear-gradient(145deg, rgba(25, 35, 60, 0.92) 0%, rgba(15, 20, 40, 0.96) 100%);
  border: 3px solid #ffd700;
  box-shadow: 0 10px 35px rgba(0,0,0,0.6), inset 0 0 20px rgba(255, 215, 0, 0.2);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  animation: bounceIn 0.4s ease-out;
}

@keyframes bounceIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.title-decor {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: #ffdd44;
  margin-bottom: 6px;
  font-weight: 700;
}

.game-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.3rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 4px 15px rgba(255, 150, 0, 0.6);
  margin-bottom: 8px;
  line-height: 1.15;
}

.game-title .highlight {
  color: #ff9900;
  text-shadow: 0 4px 15px rgba(255, 50, 0, 0.8);
}

.game-subtitle {
  color: #d0e0f5;
  font-size: 1.05rem;
  margin-bottom: 18px;
}

.story-box {
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.95rem;
  color: #e5f0ff;
  line-height: 1.45;
  margin-bottom: 18px;
  text-align: left;
}

.controls-guide {
  background: rgba(8, 14, 28, 0.8);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
  text-align: left;
}

.guide-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #c0d8f0;
}

kbd {
  background: #1e2942;
  border: 1px solid #ffcc00;
  box-shadow: 0 2px 0 #997700;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #ffdd44;
  font-weight: bold;
}

/* ================= BOTÕES PRINCIPAIS ================= */
.primary-btn {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 15px 30px;
  background: linear-gradient(135deg, #ff7700 0%, #ff0077 100%);
  border: 2px solid #ffea77;
  border-radius: 35px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(255, 100, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
  width: 100%;
  display: inline-block;
  text-decoration: none;
}

.primary-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(255, 100, 0, 0.8), inset 0 2px 6px rgba(255, 255, 255, 0.6);
}

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

.secondary-btn {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #9cb8d8;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  transition: color 0.2s ease;
}

.secondary-btn:hover {
  color: #fff;
  text-decoration: underline;
}

/* ================= DIÁLOGO CINEMATOGRÁFICO DA PROPOSTA ================= */
.dialog-container {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  z-index: 25;
  animation: slideUp 0.35s ease-out;
}

@keyframes slideUp {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.dialog-content {
  background: rgba(15, 22, 45, 0.92);
  border: 3px solid #ffd700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 215, 0, 0.3);
  border-radius: 20px;
  padding: 22px 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-portrait {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ff5588;
  border: 2px solid #ffd700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.dialog-speaker {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffdd44;
}

.dialog-text {
  font-size: 1.05rem;
  line-height: 1.5;
  color: #ffffff;
  margin-bottom: 18px;
  min-height: 50px;
}

.proposal-btn {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 24px;
  background: linear-gradient(135deg, #ff0077 0%, #ff5500 100%);
  border: 2px solid #ffd700;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(255, 0, 119, 0.6);
  width: 100%;
  animation: heartThrob 1.2s infinite;
}

@keyframes heartThrob {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ================= VITÓRIA ================= */
.victory-card {
  border-color: #ff3388;
  box-shadow: 0 0 40px rgba(255, 51, 136, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.3);
}

.victory-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
}

.victory-title {
  font-size: 2.4rem;
  color: #ffd700;
  text-shadow: 0 4px 20px rgba(255, 215, 0, 0.8);
  margin-bottom: 8px;
}

.victory-subtitle {
  color: #ff99cc;
  font-size: 1.15rem;
  margin-bottom: 20px;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-pill {
  background: rgba(10, 15, 30, 0.8);
  border: 1px solid rgba(255, 215, 0, 0.4);
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #bbb;
}

.stat-pill strong {
  font-size: 1.2rem;
  color: #fff;
  margin-top: 2px;
}

.blessing-text {
  font-style: italic;
  color: #ffe6aa;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.victory-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================= GAME OVER ================= */
.gameover-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.gameover-title {
  color: #ff4466;
  font-size: 2rem;
  margin-bottom: 6px;
}

.gameover-subtitle {
  color: #b0c8e0;
  margin-bottom: 20px;
}

/* ================= RESPONSIVIDADE MOBILE ================= */
@media (max-width: 600px) {
  #hud {
    padding: 8px 12px;
  }
  .hud-card {
    padding: 4px 10px;
    gap: 6px;
  }
  .hud-value {
    font-size: 1rem;
  }
  .hud-label {
    display: none;
  }
  .screen-card {
    padding: 24px 18px;
  }
  .game-title {
    font-size: 1.85rem;
  }
  .primary-btn {
    font-size: 1rem;
    padding: 12px 20px;
  }
  .m-touch-btn {
    width: 60px;
    height: 60px;
  }
  .m-touch-btn.m-btn-jump {
    width: 68px;
    height: 68px;
  }
  .dialog-container {
    bottom: 20px;
    width: 95%;
  }
  .dialog-content {
    padding: 16px 18px;
  }
  .dialog-text {
    font-size: 0.95rem;
  }
}
