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

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  font-family: "Orbitron", "Arial", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Animated Cosmic Background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at top, #1e3a8a 0%, #0f172a 50%, #000000 100%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15), transparent 50%);
  z-index: -2;
}

/* Starfield Effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 50%, white, transparent),
    radial-gradient(2px 2px at 79% 53%, white, transparent);
  background-size: 200px 200px, 300px 300px, 150px 150px, 250px 250px, 350px 350px, 180px 180px, 220px 220px;
  background-position: 0 0, 40px 60px, 130px 270px, 70px 100px, 150px 50px, 90px 150px, 200px 80px;
  animation: stars 50s linear infinite;
  pointer-events: none;
  opacity: 0.6;
  z-index: -1;
}

@keyframes stars {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-200px);
  }
}

/* Game Container */
.game-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 3px solid;
  border-image: linear-gradient(135deg, #8b5cf6, #3b82f6, #ec4899) 1;
  border-radius: 25px;
  will-change: transform;
}

/* Game Area */
.game-area {
  position: relative;
  width: 90vw;
  height: 80vh;
  max-width: 800px;
  max-height: 600px;
  background:
    linear-gradient(180deg, rgba(30, 58, 138, 0.3) 0%, rgba(17, 24, 39, 0.8) 100%),
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1), transparent 70%);
  border-radius: 20px;
  border: 3px solid;
  border-image: linear-gradient(135deg, #ec4899, #8b5cf6, #3b82f6) 1;
  overflow: hidden;
  will-change: transform;
  box-shadow:
    inset 0 0 80px rgba(139, 92, 246, 0.15),
    0 10px 60px rgba(0, 0, 0, 0.6);
}

/* Animated Grid Overlay */
.game-area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridSlide 3s linear infinite;
  pointer-events: none;
}

@keyframes gridSlide {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(50px, 50px);
  }
}

/* Bricks Container */
.bricks-container {
  position: relative;
  display: block;
}

/* Brick Styles */
.brick {
  position: absolute;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s;
  will-change: transform;
  box-shadow:
    0 5px 20px rgba(0, 0, 0, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px currentColor;
  animation: brickGlow 2s ease-in-out infinite alternate;
}

@keyframes brickGlow {
  0% {
    filter: brightness(1);
  }

  100% {
    filter: brightness(1.15);
  }
}

.brick::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), transparent);
  border-radius: 6px 6px 0 0;
}

.brick::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0 0 6px 6px;
  filter: blur(2px);
}

/* Brick Colors */
.brick-red {
  background: linear-gradient(135deg, #ff0066, #cc0052, #990033);
  color: #ff0066;
  box-shadow:
    0 5px 20px rgba(255, 0, 102, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(255, 0, 102, 0.6);
}

.brick-orange {
  background: linear-gradient(135deg, #ff6b35, #f7931e, #d97210);
  color: #ff6b35;
  box-shadow:
    0 5px 20px rgba(255, 107, 53, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(255, 107, 53, 0.6);
}

.brick-yellow {
  background: linear-gradient(135deg, #ffd700, #ffed4e, #ffba08);
  color: #ffd700;
  box-shadow:
    0 5px 20px rgba(255, 215, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(255, 215, 0, 0.6);
}

.brick-green {
  background: linear-gradient(135deg, #00ff88, #00cc6a, #00994d);
  color: #00ff88;
  box-shadow:
    0 5px 20px rgba(0, 255, 136, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(0, 255, 136, 0.6);
}

.brick-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb, #1d4ed8);
  color: #3b82f6;
  box-shadow:
    0 5px 20px rgba(59, 130, 246, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(59, 130, 246, 0.6);
}

.brick-purple {
  background: linear-gradient(135deg, #a855f7, #9333ea, #7e22ce);
  color: #a855f7;
  box-shadow:
    0 5px 20px rgba(168, 85, 247, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 0 30px rgba(168, 85, 247, 0.6);
}

/* Ball */
.ball {
  position: absolute;
  width: 2.5vw;
  height: 2.5vw;
  max-width: 20px;
  max-height: 20px;
  background:
    radial-gradient(circle at 30% 30%, #ffffff, #ffd700 40%, #ff6b35 60%, #8b5cf6 80%);
  box-shadow:
    0 0 25px rgba(255, 215, 0, 0.9),
    0 0 50px rgba(255, 107, 53, 0.7),
    0 0 75px rgba(139, 92, 246, 0.5),
    inset -5px -5px 10px rgba(0, 0, 0, 0.3),
    inset 5px 5px 10px rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}


/* Paddle */
.paddle {
  position: absolute;
  background: linear-gradient(135deg, #00f5ff 0%, #00bfff 50%, #0080ff 100%);
  border-radius: 12px;
  border: 3px solid #00f5ff;
  box-shadow:
    0 0 40px rgba(0, 245, 255, 0.9),
    0 8px 25px rgba(0, 0, 0, 0.6),
    inset 0 2px 15px rgba(255, 255, 255, 0.6),
    inset 0 -2px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
}

.paddle::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: paddleShine 1.5s infinite;
}

@keyframes paddleShine {
  0% {
    left: -100%;
  }

  100% {
    left: 200%;
  }
}

/* Game Title */
.game-title {
  text-align: center;
  font-size: clamp(20px, 5vw, 38px);
  background: linear-gradient(135deg, #00f5ff, #8b5cf6, #ec4899, #00f5ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  margin-bottom: 20px;
  letter-spacing: 5px;
  animation: titleFlow 4s ease infinite;
  will-change: transform;
  filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.7));
  text-transform: uppercase;
}

@keyframes titleFlow {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* Score and Lives */
.score-lives {
  margin-bottom: 20px;
  padding: 15px 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border-radius: 18px;
  border: 2px solid;
  border-image: linear-gradient(135deg, #8b5cf6, #ec4899) 1;
  display: flex;
  justify-content: space-between;
  color: #fff;
  font-size: clamp(10px, 1vw, 20px);
  font-weight: bold;
  will-change: transform;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 30px rgba(139, 92, 246, 0.1);
  backdrop-filter: blur(10px);
}

.score,
.lives {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.score-value,
.lives-value,
.time-value {
  background: linear-gradient(135deg, #ffd700, #ff6b35);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  font-size: 1.1em;
  will-change: transform;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}

.controls {
  display: flex;
  gap: 15px;
}

/* Heart Icon */
.heart {
  color: #ff0066;
  font-size: clamp(15px, 2vw, 20px);
  animation: heartbeat 1.2s ease-in-out infinite;
  will-change: transform;

  filter: drop-shadow(0 0 10px #ff0066);
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1);
  }

  10% {
    transform: scale(1.2);
  }

  20% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.2);
  }

  40% {
    transform: scale(1);
  }
}

/* Trophy Icon */
.trophy {
  color: #ffd700;
  font-size: clamp(15px, 2vw, 20px);
  animation: trophySpin 3s ease-in-out infinite;
  filter: drop-shadow(0 0 10px #ffd700);
}

@keyframes trophySpin {

  0%,
  100% {
    transform: rotate(-10deg) scale(1);
  }

  50% {
    transform: rotate(10deg) scale(1.1);
  }
}

/* Game Message */
.game-message {
  padding: 30px;
  position: absolute;
  color: white;
  width: 320px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.9);
  will-change: transform;
  z-index: 10;
  display: none;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
  backdrop-filter: blur(30px);
  border-radius: 25px;
  border: 3px solid;
  border-image: linear-gradient(135deg, #8b5cf6, #ec4899) 1;
  box-shadow:
    0 0 80px rgba(139, 92, 246, 0.5),
    0 20px 60px rgba(0, 0, 0, 0.8);
}

.start-message {
  font-size: 18px;
  color: #ffd700;
  margin-top: 10px;
  animation: blink 1.5s infinite;
}

@keyframes floatDown {
  from {
    transform: translateY(-10px);
  }

  to {
    transform: translateY(50vh);
  }
}

/* Hidden Class */
.hidden {
  display: none;
}

/* Image/Modal */
.image {
  text-align: center;
  padding: 30px;
  position: absolute;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.98));
  backdrop-filter: blur(30px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  border-radius: 20px;
  border: 3px solid;
  border-image: linear-gradient(135deg, #8b5cf6, #3b82f6) 1;
  z-index: 500;
  will-change: transform;
}

h1 {
  font-size: 30px;
  background: linear-gradient(135deg, #00f5ff, #ffd700, #ff6b35);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

h1 span {
  margin: 0 10px;
}

p {
  font-size: 24px;
  font-weight: bold;
  margin: 20px 0;
  color: #e2e8f0;
}

.space-text {
  font-size: 28px;
  color: #ffd700;
  margin-top: 40px;
  animation: blink 1.5s infinite;
}

/* Buttons */
#continueBtn,
#restartBtn {
  font-size: 18px;
  cursor: pointer;
  margin: 8px 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(236, 72, 153, 0.9));
  color: white;
  border-radius: 15px;
  border: 2px solid rgba(139, 92, 246, 0.8);
  width: 150px;
  padding: 12px;
  font-weight: 700;
  font-family: "Orbitron", "Arial", sans-serif;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow:
    0 5px 25px rgba(139, 92, 246, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

#continueBtn::before,
#restartBtn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

#continueBtn:hover::before,
#restartBtn:hover::before {
  left: 100%;
}

#continueBtn:hover,
#restartBtn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 8px 35px rgba(139, 92, 246, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, rgba(139, 92, 246, 1), rgba(236, 72, 153, 1));
}

#continueBtn:active,
#restartBtn:active {
  transform: translateY(0) scale(1);
}

/* Intro Screen */
.intro-screen {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(40px);
  color: #f0f0f0;
  text-align: center;
  padding: 30px;
  border-radius: 25px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  margin: auto;
  border: 3px solid;
  border-image: linear-gradient(135deg, #8b5cf6, #3b82f6, #ec4899) 1;
  z-index: 1;
  font-family: "Trebuchet MS", "Arial", sans-serif;
}

.intro-screen::-webkit-scrollbar {
  width: 10px;
}

.intro-screen::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 10px;
}

.intro-screen::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border-radius: 10px;
}

.intro-screen::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #a855f7, #f472b6);
}

.title {
  font-size: clamp(1rem, 5vw, 2rem);
  background: linear-gradient(135deg, #00f5ff, #8b5cf6, #ec4899, #00f5ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleFlow 4s ease infinite;
  margin-bottom: 25px;
  font-weight: 900;
  letter-spacing: 3px;
  filter: drop-shadow(0 0 25px rgba(139, 92, 246, 0.8));
  line-height: 1.3;
}

.story-box {
  background: rgba(30, 41, 59, 0.7);
  border: 2px solid rgba(139, 92, 246, 0.5);
  padding: 25px;
  border-radius: 20px;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  line-height: 1.9rem;
  margin-bottom: 25px;
  text-align: center;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 0 30px rgba(139, 92, 246, 0.1);
}

.story-box p {
  font-size: clamp(0.65rem, 2vw, 1.05rem);
  margin: 12px 0;
  color: #cbd5e1;
}

.highlight {
  background: linear-gradient(135deg, #ffd700, #ff6b35);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.7));
}

.instructions {
  margin: 25px 0;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
}

.instructions p {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  margin: 10px 0;
  color: #e2e8f0;
}

.start {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  margin-top: 30px;
  color: #fff;
  font-weight: 900;
  filter: drop-shadow(0 0 20px rgba(0, 245, 255, 0.8));
  animation: blink 1.2s infinite;
}

.space {
  background: linear-gradient(135deg, #00f5ff, #0099ff);
  color: #0a0e27;
  padding: 5px 14px;
  border-radius: 8px;
  font-weight: 900;
  box-shadow:
    0 0 25px rgba(0, 245, 255, 0.7),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
  display: inline-block;
}

@keyframes blink {

  0%,
  50%,
  100% {
    opacity: 1;
  }

  25%,
  75% {
    opacity: 0.3;
  }
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .image {
    width: 70%;
  }

  .intro-screen {
    width: 85%;
    padding: 25px;
  }

  h1 {
    font-size: 26px;
  }

  .game-container {
    padding: 15px;
  }
}

@media (max-height: 700px) {
  .intro-screen {
    padding: 20px;
    max-height: 85vh;
  }

  .story-box {
    padding: 18px;
    margin-bottom: 18px;
  }

  .instructions {
    margin: 18px 0;
  }

  .title {
    margin-bottom: 18px;
  }
}

@media (max-width: 500px) {
  h1 {
    font-size: 22px;
  }

  .intro-screen {
    width: 95%;
    padding: 20px;
  }

  .story-box {
    padding: 18px;
  }

  .game-container {
    padding: 10px;
  }

  .score-lives {
    padding: 12px 15px;
  }
}

@media (max-width: 400px) {
  h1 {
    font-size: 18px;
  }

  .intro-screen {
    padding: 15px;
  }

  .story-box {
    padding: 15px;
  }

  .game-message {
    width: 280px;
    padding: 20px;
  }
}

/* Story Container */
.story {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
  backdrop-filter: blur(20px);
  color: #f0f0f0;
  padding: 15px 25px;
  border-radius: 20px;
  border: 2px solid rgba(139, 92, 246, 0.5);
  box-shadow:
    0 0 60px rgba(139, 92, 246, 0.4),
    inset 0 0 30px rgba(139, 92, 246, 0.1);
  font-size: clamp(14px, 2vw, 18px);
  font-weight: bold;
  text-align: center;
  z-index: 100;
  display: none;
}