/* ================================================================
   SHARED GAME OVERLAY SYSTEM — used on Skills, Projects, Experience
================================================================ */

/* Floating Game Button */
.game-launcher {
  position: fixed;
  bottom: 3rem;
  left: 3rem;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  color: #040814;
  border: none;
  border-radius: 5rem;
  padding: 1.2rem 2rem;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  box-shadow: 0 5px 30px rgba(0, 242, 254, 0.5);
  animation: game-pulse 2.5s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  outline: none;
  user-select: none;
}
.game-launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 40px rgba(0, 242, 254, 0.7);
}
.game-launcher .game-icon { font-size: 2rem; }
@keyframes game-pulse {
  0%, 100% { box-shadow: 0 5px 30px rgba(0, 242, 254, 0.5); }
  50%       { box-shadow: 0 5px 45px rgba(0, 242, 254, 0.85); }
}

/* Game Overlay */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 6, 23, 0.97);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.game-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Close button */
.game-close {
  position: absolute;
  top: 2rem; right: 2.5rem;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: #00f2fe;
  width: 4.5rem; height: 4.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.game-close:hover {
  background: rgba(0, 242, 254, 0.2);
  transform: rotate(90deg) scale(1.1);
}

/* Game title bar */
.game-title-bar {
  text-align: center;
  margin-bottom: 2.5rem;
}
.game-title-bar h2 {
  font-size: 3rem;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}
.game-title-bar p {
  font-size: 1.4rem;
  color: #94a3b8;
}

/* Score / stat bar */
.game-stat-bar {
  display: flex;
  gap: 3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}
.game-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 242, 254, 0.05);
  border: 1px solid rgba(0, 242, 254, 0.15);
  border-radius: 1.2rem;
  padding: 1rem 2.5rem;
  min-width: 10rem;
}
.game-stat-value {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.game-stat-label {
  font-size: 1.1rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* Start / Restart buttons */
.game-btn {
  padding: 1.2rem 3rem;
  border-radius: 5rem;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  margin: 0.5rem;
  outline: none;
}
.game-btn.primary {
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  color: #040814;
  box-shadow: 0 5px 20px rgba(0, 242, 254, 0.4);
}
.game-btn.primary:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0, 242, 254, 0.6); }
.game-btn.secondary {
  background: rgba(0, 242, 254, 0.07);
  color: #00f2fe;
  border: 1px solid rgba(0, 242, 254, 0.25);
}
.game-btn.secondary:hover { background: rgba(0, 242, 254, 0.13); transform: translateY(-2px); }

/* Game result screen */
.game-result {
  text-align: center;
  padding: 3rem;
}
.game-result .result-score {
  font-size: 6rem;
  font-weight: 800;
  font-family: "Outfit",sans-serif;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.game-result h3 { font-size: 2.5rem; font-family: "Outfit",sans-serif; color: #f8fafc; margin: 1rem 0 0.5rem; }
.game-result p  { font-size: 1.5rem; color: #94a3b8; margin-bottom: 2rem; }

/* ==================  SKILLS — TECH MEMORY MATCH  ================== */
#memory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  max-width: 700px;
  width: 100%;
  margin: 0 auto 2rem;
}
.mem-card {
  aspect-ratio: 1;
  perspective: 600px;
  cursor: pointer;
  border-radius: 1rem;
}
.mem-card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4,0,0.2,1);
  border-radius: 1rem;
}
.mem-card.flipped .mem-card-inner { transform: rotateY(180deg); }
.mem-card-front, .mem-card-back {
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mem-card-front {
  background: rgba(0, 242, 254, 0.06);
  border: 2px solid rgba(0, 242, 254, 0.18);
  font-size: 2.4rem;
  color: rgba(0, 242, 254, 0.3);
}
.mem-card-back {
  background: rgba(0, 242, 254, 0.1);
  border: 2px solid rgba(0, 242, 254, 0.4);
  transform: rotateY(180deg);
  font-size: 2.8rem;
  flex-direction: column;
  gap: 0.3rem;
}
.mem-card.matched .mem-card-front, .mem-card.matched .mem-card-back {
  border-color: rgba(0, 242, 254, 0.8);
  background: rgba(0, 242, 254, 0.15);
  box-shadow: 0 0 15px rgba(0,242,254,0.35);
}
.mem-card-back small { font-size: 0.9rem; color: #94a3b8; font-family: "Inter",sans-serif; font-weight: 600; }

/* ==================  PROJECTS — BUG BLASTER  ================== */
#bug-arena {
  width: min(65rem, 90vw);
  height: min(40rem, 50vh);
  background: rgba(0, 242, 254, 0.02);
  border: 2px solid rgba(0, 242, 254, 0.15);
  border-radius: 1.5rem;
  position: relative;
  overflow: hidden;
  margin: 0 auto 2rem;
  cursor: crosshair;
}
#bug-arena::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0,242,254,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,242,254,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bug-sprite {
  position: absolute;
  font-size: 2.8rem;
  cursor: pointer;
  transition: transform 0.1s;
  user-select: none;
  animation: bug-wiggle 0.4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(0,242,254,0.4));
}
.bug-sprite:hover { transform: scale(1.2); }
.bug-sprite.squashed {
  animation: squash-anim 0.3s ease forwards;
  pointer-events: none;
}
@keyframes bug-wiggle { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(8deg) scale(1.05); } }
@keyframes squash-anim { 0%{transform:scale(1.5);opacity:1} 100%{transform:scale(0);opacity:0} }

.hit-splash {
  position: absolute;
  font-size: 1.6rem;
  font-weight: 800;
  font-family: "Outfit",sans-serif;
  color: #00f2fe;
  pointer-events: none;
  animation: splash-up 0.7s ease forwards;
}
@keyframes splash-up { 0%{opacity:1;transform:translateY(0) scale(1)} 100%{opacity:0;transform:translateY(-40px) scale(1.3)} }

#bug-arena .arena-countdown {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8rem;
  font-family: "Outfit",sans-serif;
  font-weight: 800;
  color: #00f2fe;
  text-shadow: 0 0 30px rgba(0,242,254,0.8);
  opacity: 0;
  pointer-events: none;
}

/* ==================  EXPERIENCE — CODE SPRINT  ================== */
#code-sprint-wrap {
  width: min(70rem, 92vw);
  margin: 0 auto;
}
.sprint-prompt {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 1rem;
  padding: 2rem 2.5rem;
  font-family: "Courier New", monospace;
  font-size: 1.6rem;
  line-height: 1.8;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  position: relative;
  min-height: 8rem;
  letter-spacing: 0.03em;
}
.sprint-prompt .char { position: relative; }
.sprint-prompt .char.correct { color: #00f2fe; }
.sprint-prompt .char.wrong   { color: #f43f5e; background: rgba(244,63,94,0.15); border-radius: 3px; }
.sprint-prompt .char.cursor::after {
  content: '|';
  color: #00f2fe;
  animation: blink 0.7s step-end infinite;
  font-weight: 100;
  margin-left: 1px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.sprint-input-wrap {
  position: relative;
}
#sprint-input {
  width: 100%;
  background: rgba(0, 242, 254, 0.04);
  border: 2px solid rgba(0, 242, 254, 0.2);
  border-radius: 1rem;
  padding: 1.4rem 2rem;
  font-family: "Courier New", monospace;
  font-size: 1.6rem;
  color: #f8fafc;
  outline: none;
  caret-color: #00f2fe;
  transition: border-color 0.3s;
}
#sprint-input:focus { border-color: rgba(0, 242, 254, 0.5); box-shadow: 0 0 20px rgba(0,242,254,0.1); }
.sprint-progress {
  height: 4px;
  background: rgba(0, 242, 254, 0.1);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}
.sprint-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s ease;
  box-shadow: 0 0 10px rgba(0,242,254,0.5);
}

/* ==================  MOBILE ADJUSTMENTS  ================== */
@media (max-width: 600px) {
  #memory-grid { grid-template-columns: repeat(4, 1fr); max-width: 320px; }
  .game-launcher { bottom: 2rem; left: 2rem; padding: 1rem 1.5rem; font-size: 1.3rem; }
  .game-title-bar h2 { font-size: 2.4rem; }
  #bug-arena { height: min(30rem, 45vh); }
  .sprint-prompt, #sprint-input { font-size: 1.4rem; }
}
