/* =============================================
   ShapeQuest — Styles
   ============================================= */

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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', 'Arial', sans-serif;
  background: #0a0014;
  color: #fff;
  cursor: default;
  user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

/* ---------- Loading Screen ---------- */
#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(135deg, #0a0014 0%, #1a0030 40%, #2d0050 70%, #0a0014 100%);
  transition: opacity 0.6s ease;
}

#loadingScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

#loadingScreen h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #c084fc, #e879f9, #a855f7);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: loadTitlePulse 2s ease-in-out infinite;
}

@keyframes loadTitlePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

#loadingBarContainer {
  width: 320px;
  height: 8px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

#loadingBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #c084fc, #e879f9);
  border-radius: 999px;
  transition: width 0.4s ease;
}

#loadingText {
  font-size: 0.85rem;
  color: rgba(192, 132, 252, 0.7);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---------- Game HUD ---------- */
#gameHUD {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 100;
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Score panel — top left */
.hud-score-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.hud-score {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(139, 92, 246, 0.6);
  line-height: 1;
}

.hud-score-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(192, 132, 252, 0.7);
}

/* Shape counter — top right */
.hud-shapes-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 0, 20, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 10px 18px;
  pointer-events: auto;
}

.hud-shape-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.hud-shape-icon {
  font-size: 1.1rem;
}

.hud-shape-count {
  color: #c084fc;
}

.hud-divider {
  width: 1px;
  height: 20px;
  background: rgba(139, 92, 246, 0.25);
}

/* ---------- Combo / Streak Display ---------- */
#comboDisplay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#comboDisplay.visible {
  opacity: 1;
}

.combo-text {
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #c084fc, #e879f9, #f0abfc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: comboPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes comboPopIn {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Collection Flash ---------- */
.collect-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  background: radial-gradient(circle at center, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
  opacity: 0;
  animation: collectFlashAnim 0.35s ease-out forwards;
}

@keyframes collectFlashAnim {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- Instructions Overlay ---------- */
#instructions {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(10, 0, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 14px;
  padding: 10px 22px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(192, 132, 252, 0.65);
  letter-spacing: 0.3px;
  transition: opacity 2s ease;
}

#instructions.fade {
  opacity: 0;
}

.instruction-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #c084fc;
  margin: 0 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  #gameHUD {
    padding: 14px 16px;
  }

  .hud-score {
    font-size: 1.6rem;
  }

  .hud-shapes-panel {
    padding: 8px 12px;
    gap: 8px;
  }

  .hud-shape-item {
    font-size: 0.8rem;
  }

  #instructions {
    padding: 8px 14px;
    font-size: 0.7rem;
    gap: 10px;
  }
}
