/* style.css - Design de interface celestial & cyberpunk com glassmorphism */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --primary: #06b6d4;
  --primary-glow: rgba(6, 182, 212, 0.45);
  --accent: #38bdf8;
  --gold: #facc15;
  --gold-glow: rgba(250, 204, 21, 0.4);
  --danger: #f43f5e;
  --surface: rgba(15, 23, 42, 0.78);
  --surface-border: rgba(56, 189, 248, 0.28);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #020617;
  color: var(--text-main);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container do Jogo */
#game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 860px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--primary-glow);
}

@media (min-width: 500px) and (min-height: 800px) {
  #game-wrapper {
    border-radius: 20px;
    border: 1px solid var(--surface-border);
  }
}

canvas#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

/* Camada de UI Sobreposta */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

/* HUD Superior no Jogo */
.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  transition: opacity 0.25s ease;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-pill {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.star-icon {
  color: var(--gold);
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

.hud-center {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-score {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 0 16px var(--primary-glow), 0 4px 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.12s ease;
}

.hud-score.pulse {
  transform: scale(1.22);
}

.hud-combo {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: linear-gradient(90deg, #06b6d4, #8b5cf6);
  color: #fff;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.hud-combo.active {
  opacity: 1;
  transform: translateY(0);
}

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

.hud-btn {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  font-size: 1.05rem;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent);
  transform: scale(1.08);
}

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

/* Modais e Telas (Telas de Início, Fim de Jogo, Pause, Hangar, etc.) */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
  z-index: 30;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

/* Tela de Título */
.title-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.game-logo {
  margin-bottom: 24px;
}

.logo-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 700;
  text-shadow: 0 0 10px var(--primary-glow);
}

.logo-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #38bdf8 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px var(--primary-glow));
}

.logo-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 6px;
  font-weight: 500;
}

.title-record {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--surface-border);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.title-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 260px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  border: 1px solid #38bdf8;
  color: #ffffff;
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  border-radius: 14px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 6px 20px var(--primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 28px rgba(6, 182, 212, 0.6);
}

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

.btn-secondary {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.title-hint {
  margin-top: 26px;
  font-size: 0.82rem;
  color: var(--text-muted);
  animation: pulseOpacity 2s infinite ease-in-out;
}

/* Card do Fim de Jogo (Game Over) */
.gameover-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(6, 182, 212, 0.2);
  text-align: center;
  animation: slideUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gameover-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  margin-bottom: 16px;
  text-shadow: 0 0 12px rgba(244, 63, 94, 0.5);
}

.medal-badge-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}

.medal-icon {
  font-size: 2rem;
}

.medal-name {
  font-weight: 800;
  font-size: 1.1rem;
}

.scores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.score-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px;
}

.score-box-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 4px;
}

.score-box-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
}

.new-record-badge {
  display: inline-block;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
  box-shadow: 0 0 12px var(--gold-glow);
  animation: bounce 1.2s infinite;
}

.stars-collected-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 18px;
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Modais Especiais (Hangar de Skins, Conquistas, Como Jogar) */
.modal-dialog {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: all 0.25s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.3);
  color: var(--danger);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Itens do Hangar de Skins */
.skin-preview-stage {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

canvas#skin-preview-canvas {
  width: 140px;
  height: 90px;
}

.skins-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skin-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.skin-card.selected {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 14px var(--primary-glow);
}

.skin-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.skin-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skin-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.skin-btn {
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.15s ease;
}

.skin-btn.equip {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid var(--accent);
  color: #fff;
}

.skin-btn.equipped {
  background: var(--primary);
  color: #000;
  cursor: default;
}

.skin-btn.unlock {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.skin-btn.locked {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: not-allowed;
}

.ui-icon-gold {
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

/* Conquistas */
.achievement-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  text-align: left;
}

.achievement-card.unlocked {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.achievement-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.4;
}

.achievement-card.unlocked .achievement-icon {
  color: var(--gold);
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.achievement-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
}

.achievement-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Como Jogar */
.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.instruction-item {
  display: flex;
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.instruction-icon {
  font-size: 1.5rem;
}

.instruction-text h4 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.instruction-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Menu de Pause */
.pause-card {
  width: 100%;
  max-width: 280px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.2s ease;
}

.pause-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: #fff;
}

/* Toast de Conquista Desbloqueada */
.achievement-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  box-shadow: 0 8px 24px var(--gold-glow);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.2rem;
}

.toast-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

/* Animações Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(25px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
