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

/* Base styles */
ion-content.home-content {
  --background: #000;
  font-family: "Orbitron", sans-serif;
  position: fixed;
  overflow: hidden;
  height: 100vh !important; /* Force full height */
}

body {
  margin: 0;
  padding: 0;
  background-color: #000;
  color: #fff;
  font-family: "Orbitron", sans-serif;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Game wrapper - main container for all pages */
.game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 0.3vh solid #0ff;
  border-radius: 1.5vh;
  box-shadow: 0 0 2vh #0ff, 0 0 4vh rgba(0, 255, 255, 0.3);
  background-color: rgba(0, 0, 0, 0.9);
}

/* Canvas background for floating spots - FIXED positioning */
.background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none; /* Allow interaction with elements below */
  display: block; /* Ensure it's displayed */
}

/* Main container */
.home-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 5vh 0;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  will-change: transform; /* Hardware acceleration */
}

/* Score container */
.score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1vh;
  margin-top: auto;
  margin-bottom: 3vh;
}

/* Play button styles */
ion-button.play-button, 
.play-button {
  --background: transparent;
  --background-hover: rgba(0, 255, 255, 0.1);
  --background-activated: rgba(0, 255, 255, 0.2);
  --border-color: #0ff;
  --border-style: solid;
  --border-width: 0.3vh;
  --border-radius: 1vh;
  --box-shadow: 0 0 1.5vh #0ff, 0 0 3vh rgba(0, 255, 255, 0.5);
  --color: #0ff;
  --padding-top: 1.5vh;
  --padding-bottom: 1.5vh;
  font-size: 2.4vh;
  letter-spacing: 0.3vh;
  position: relative;
  text-transform: uppercase;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 10;
  font-family: 'Orbitron', sans-serif;
  height: auto;
  will-change: transform, opacity; /* Hardware acceleration */
  
  /* Non-ionic button styles */
  background: transparent;
  color: #0ff;
  border: 0.3vh solid #0ff;
  box-shadow: 0 0 1.5vh #0ff, 0 0 3vh rgba(0, 255, 255, 0.5);
  padding: 1.5vh 4vh;
  border-radius: 1vh;
  cursor: pointer;
  display: block;
  width: 30vh;
  margin: 0 auto;
}

/* Ensure button has correct style */
ion-button.play-button::part(native) {
  border: 0.3vh solid #0ff;
  box-shadow: 0 0 1.5vh #0ff, 0 0 3vh rgba(0, 255, 255, 0.5);
  background: transparent;
  color: #0ff;
  padding: 1.5vh 4vh;
  border-radius: 1vh;
  will-change: transform, opacity; /* Hardware acceleration */
}

.play-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 2vh #0ff, 0 0 4vh rgba(0, 255, 255, 0.6);
}

/* Highscore text with neon effect */
.highscore {
  color: #0f8;
  font-size: 2vh;
  font-weight: bold;
  letter-spacing: 0.1vh;
  text-align: center;
  text-shadow: 0 0 0.8vh #0f8, 0 0 1.5vh rgba(0, 255, 128, 0.5);
  z-index: 10;
  position: relative;
  margin: 0;
  will-change: transform, opacity; /* Hardware acceleration */
}

.highscoreCh {
  color: rgb(238, 93, 238);
  font-size: 2vh;
  font-weight: bold;
  letter-spacing: 0.1vh;
  text-align: center;
  text-shadow: 0 0 0.8vh #0f8, 0 0 1.5vh rgba(0, 255, 128, 0.5);
  z-index: 10;
  position: relative;
  margin: 0;
  will-change: transform, opacity; /* Hardware acceleration */
}

/* Title styling - insane neon version */
.title {
  --main-color: #0ff;
  --secondary-color: #0f8;
  --highlight-color: #f0f;

  color: transparent;
  font-size: 8vh;
  font-weight: bold;
  letter-spacing: 0.2vh;
  text-align: center;
  z-index: 10;
  position: relative;
  font-family: 'Orbitron', sans-serif;
  will-change: transform, opacity, filter; /* Hardware acceleration */
  margin-top: 6vh;
  margin-bottom: auto;

  /* Gradient text */
  background: linear-gradient(to bottom, var(--main-color) 0%, var(--secondary-color) 50%, var(--main-color) 100%);
  background-clip: text;
  -webkit-background-clip: text;

  /* Text outline */
  -webkit-text-stroke: 0.2vh rgba(0, 255, 255, 0.8);

  /* Multiple layered text shadows for intense glow */
  text-shadow:
    0 0 0.5vh var(--main-color),
    0 0 1vh var(--main-color),
    0 0 1.5vh var(--main-color),
    0 0 2vh var(--main-color),
    0 0 2.5vh var(--main-color),
    0 0 3vh var(--secondary-color),
    0 0 3.5vh var(--secondary-color),
    0 0 4vh var(--highlight-color),
    0 0 0.2vh #fff;

  /* Animations */
  animation: titlePulse 2s infinite alternate, titleFlicker 6s infinite, titleHue 10s infinite;

  /* 3D effect */
  transform: perspective(50vh) rotateX(5deg);
  transform-style: preserve-3d;
}

.subtitle {
  --main-color: #f0f;
  --secondary-color: #0ff;
  --highlight-color: #0f8;

  color: transparent;
  font-size: 4vh;
  font-weight: bold;
  letter-spacing: 0.2vh;
  text-align: center;
  z-index: 10;
  position: relative;
  font-family: 'Orbitron', sans-serif;
  will-change: transform, opacity, filter; /* Hardware acceleration */
  margin-top: 0vh;
  margin-bottom: auto;

  /* Gradient text */
  background: linear-gradient(to bottom, var(--main-color) 0%, var(--secondary-color) 50%, var(--main-color) 100%);
  background-clip: text;
  -webkit-background-clip: text;

  /* Text outline */
  -webkit-text-stroke: 0.2vh #f0f;

  /* Multiple layered text shadows for intense glow */
  text-shadow:
    0 0 0.5vh var(--main-color),
    0 0 1vh var(--main-color),
    0 0 1.5vh var(--main-color),
    0 0 2vh var(--main-color),
    0 0 2.5vh var(--main-color),
    0 0 3vh var(--secondary-color),
    0 0 3.5vh var(--secondary-color),
    0 0 4vh var(--highlight-color),
    0 0 0.2vh #fff;

  /* Animations */
  animation: titlePulse 2s infinite alternate, titleFlicker 6s infinite, titleHue 10s infinite;

  /* 3D effect */
  transform: perspective(50vh) rotateX(5deg);
  transform-style: preserve-3d;
}

/* Title animations */
@keyframes titlePulse {
  0% {
    text-shadow:
      0 0 0.5vh rgba(0, 255, 204, 0.6),
      0 0 1vh rgba(0, 255, 204, 0.5),
      0 0 1.5vh rgba(0, 204, 255, 0.4), 
      0 0 2vh rgba(0, 204, 255, 0.3),
      0 0 2.5vh rgba(0, 204, 255, 0.2), 
      0 0 3vh rgba(0, 204, 255, 0.1); 
    transform: perspective(50vh) rotateX(5deg) scale(1);
  }
  100% {
    text-shadow:
      0 0 1vh rgba(0, 255, 204, 0.5),
      0 0 1.5vh rgba(0, 255, 204, 0.4),
      0 0 2vh rgba(0, 204, 255, 0.3),
      0 0 2.5vh rgba(0, 204, 255, 0.2),
      0 0 3vh rgba(0, 204, 255, 0.1);
    transform: perspective(50vh) rotateX(5deg) scale(1.03);
  }
}

@keyframes titleFlicker {
  0%,
  19.999%,
  22%,
  62.999%,
  64%,
  64.999%,
  70%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 1.5vh var(--main-color));
  }
  20%,
  21.999%,
  63%,
  63.999%,
  65%,
  69.999% {
    opacity: 0.8;
    filter: drop-shadow(0 0 0.5vh var(--main-color));
  }
}

@keyframes titleHue {
  0% {
    filter: hue-rotate(0deg);
  }
  50% {
    filter: hue-rotate(30deg);
  }
  100% {
    filter: hue-rotate(0deg);
  }
}

/* Add a glitch effect for extra insanity */
.title::before,
.title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  z-index: -1;
  will-change: transform, clip-path; /* Hardware acceleration */
}

.title::before {
  transform: translateX(-0.2vh); /* Use transform instead of left */
  text-shadow: 0.2vh 0 var(--highlight-color);
  animation: titleGlitch 2s infinite linear alternate-reverse;
}

.title::after {
  transform: translateX(0.2vh); /* Use transform instead of left */
  text-shadow: -0.2vh 0 var(--secondary-color);
  animation: titleGlitch 3s infinite linear alternate-reverse;
}

@keyframes titleGlitch {
  0% {
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-0.04em, 0);
  }
  20% {
    clip-path: polygon(0 15%, 100% 15%, 100% 30%, 0 30%);
    transform: translate(-0.04em, 0.04em);
  }
  40% {
    clip-path: polygon(0 45%, 100% 45%, 100% 65%, 0 65%);
    transform: translate(0.04em, -0.04em);
  }
  60% {
    clip-path: polygon(0 60%, 100% 60%, 100% 75%, 0 75%);
    transform: translate(0.04em, 0.04em);
  }
  80% {
    clip-path: polygon(0 75%, 100% 75%, 100% 90%, 0 90%);
    transform: translate(-0.04em, -0.04em);
  }
  100% {
    clip-path: polygon(0 85%, 100% 85%, 100% 100%, 0 100%);
    transform: translate(0, 0);
  }
}

/* Main container styles */
.main-container {
  width: 300vh;
  min-height: 100vh;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* Game container styles */
.game-container {
  display: flex;
  flex-wrap: wrap;
  width: 40vh;
  height: 40vh;
  margin: 2vh auto;
  position: relative;
  border: 0.2vh solid #0ff;
  border-radius: 1vh;
  box-shadow: 0 0 1.5vh #0ff, 0 0 2.5vh rgba(0, 255, 255, 0.5);
  background-color: rgba(0, 0, 0, 0.8);
  align-content: center;
  justify-content: center;
  padding: 2vh;
  overflow: hidden;
}

.level-indicator {
  position: absolute;
  top: 1vh;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 0.5vh 1.5vh;
  border-radius: 2vh;
  box-shadow: 0 0 0.8vh #0f8;
  font-size: 1.8vh;
  font-weight: bold;
  color: #0ff;
  border: 0.2vh solid #0f8;
  text-shadow: 0 0 0.5vh #0f8;
  z-index: 10;
}

#squares-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.square {
  display: flex;
  align-self: center;
  width: 7vh;
  height: 7vh;
  margin: 0.5vh;
  background-color: #000 !important;
  border: 0.2vh solid #0ff;
  border-radius: 1vh;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  position: relative;
  z-index: 5;
}

.square:hover {
  transform: scale(1.1);
  box-shadow: 0 0 1vh #0ff, 0 0 2vh rgba(0, 255, 255, 0.4);
}

/* Estilos para los cuadrados según su color */
.square.green {
  background-color: #0f8 !important;
  box-shadow: 0 0 1vh #0f8, 0 0 2vh rgba(0, 255, 128, 0.6);
}

.square.red {
  background-color: #f55 !important;
  box-shadow: 0 0 1vh #f55, 0 0 2vh rgba(255, 85, 85, 0.6);
}

.lose-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.9);
  padding: 2vh;
  border: 0.2vh solid #f55;
  border-radius: 1vh;
  box-shadow: 0 0 1.5vh #f55, 0 0 2.5vh rgba(255, 85, 85, 0.5);
  text-align: center;
  z-index: 20;
  min-width: 27vh;
}

.lose-menu h2 {
  color: #f55;
  margin-bottom: 1vh;
  text-shadow: 0 0 0.5vh #f55;
}

.lose-menu p {
  color: #fff;
  margin-bottom: 2vh;
}

.lose-menu button {
  background-color: transparent;
  color: #0ff;
  border: 0.2vh solid #0ff;
  border-radius: 0.5vh;
  padding: 1vh 2vh;
  font-size: 1.6vh;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 0.2vh #0ff;
  box-shadow: 0 0 0.5vh #0ff;
}

.lose-menu button:hover {
  background-color: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 1vh #0ff, 0 0 2vh rgba(0, 255, 255, 0.4);
  transform: scale(1.05);
}

/* Floating spots container */
.floating-spots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

/* Dark overlay for game container spots */
.floating-spots.dark .spot {
  opacity: 0.4;
  filter: brightness(0.7) blur(0.8vh);
}

/* Spot styles */
.spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.8vh);
  opacity: 0.6;
  will-change: transform, opacity;
}

.spot:nth-child(1) {
  width: 8vh;
  height: 8vh;
  background: rgba(0, 255, 255, 0.4);
  top: 20%;
  left: 10%;
  animation: float1 25s infinite ease-in-out;
}

.spot:nth-child(2) {
  width: 6vh;
  height: 6vh;
  background: rgba(0, 255, 128, 0.4);
  top: 60%;
  left: 75%;
  animation: float2 20s infinite ease-in-out;
}

.spot:nth-child(3) {
  width: 10vh;
  height: 10vh;
  background: rgba(128, 0, 255, 0.3);
  top: 40%;
  left: 40%;
  animation: float3 30s infinite ease-in-out;
}

.spot:nth-child(4) {
  width: 5vh;
  height: 5vh;
  background: rgba(0, 255, 255, 0.5);
  top: 80%;
  left: 20%;
  animation: float4 22s infinite ease-in-out;
}

.spot:nth-child(5) {
  width: 7vh;
  height: 7vh;
  background: rgba(0, 255, 128, 0.4);
  top: 10%;
  left: 80%;
  animation: float2 28s infinite ease-in-out reverse;
}

.spot:nth-child(6) {
  width: 9vh;
  height: 9vh;
  background: rgba(0, 255, 255, 0.3);
  top: 70%;
  left: 50%;
  animation: float3 35s infinite ease-in-out;
}

.spot:nth-child(7) {
  width: 4vh;
  height: 4vh;
  background: rgba(128, 0, 255, 0.5);
  top: 30%;
  left: 60%;
  animation: float1 18s infinite ease-in-out reverse;
}

.spot:nth-child(8) {
  width: 6.5vh;
  height: 6.5vh;
  background: rgba(0, 255, 255, 0.4);
  top: 50%;
  left: 30%;
  animation: float4 26s infinite ease-in-out;
}

/* Animations for floating spots */
@keyframes float1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(10vh, 5vh) scale(1.1);
  }
  50% {
    transform: translate(5vh, 10vh) scale(0.9);
  }
  75% {
    transform: translate(-5vh, 5vh) scale(1.05);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes float2 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    transform: translate(-8vh, 4vh) scale(1.15);
  }
  40% {
    transform: translate(-4vh, -6vh) scale(0.85);
  }
  60% {
    transform: translate(6vh, -4vh) scale(1.1);
  }
  80% {
    transform: translate(4vh, 8vh) scale(0.9);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes float3 {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
  33% {
    transform: translate(-7vh, -5vh) scale(1.2);
    opacity: 0.8;
  }
  66% {
    transform: translate(7vh, 6vh) scale(0.8);
    opacity: 0.7;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.6;
  }
}

@keyframes float4 {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(6vh, -3vh) rotate(90deg) scale(1.1);
  }
  50% {
    transform: translate(3vh, 6vh) rotate(180deg) scale(0.9);
  }
  75% {
    transform: translate(-6vh, 3vh) rotate(270deg) scale(1.05);
  }
  100% {
    transform: translate(0, 0) rotate(360deg) scale(1);
  }
}

/* Control buttons */
.menu-button, .sound-button, .config-button {
  width: 7vh;
  height: 7vh;
  background-color: transparent;
  border: 0.2vh solid #0ff;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 1vh rgba(0, 255, 255, 0.5);
  position: absolute;
  bottom: 2vh;
  z-index: 10;
}


.sound-button {
  right: 2vh;
}

.config-button {
  left: 2vh;
}

.menu-button {
  left: 2vh;
}

/* Update the control buttons positioning for the home screen */
.home-container .sound-button {
  position: absolute;
  bottom: 2vh;
  left: 2vh;
  right: auto;
}

.menu-button img, .sound-button img, .config-button img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  filter: drop-shadow(0 0 0.3vh #0ff);
}

.menu-button:hover, .sound-button:hover, .config-button:hover {
  transform: scale(1.1);
  box-shadow: 0 0 1.5vh rgba(0, 255, 255, 0.7);
}

/* Media queries for responsiveness */
@media (max-width: 450px) {
  .game-container {
    width: 80vh;
    height: 80vh;
    padding: 1vh;
  }

  .square {
    width: 15vh;
    height: 15vh;
    margin: 0.4vh;
  }

  .level-indicator {
    font-size: 3vh;
    padding: 0.4vh 1.2vh;
  }
  
  .title {
    font-size: 8vh;
  }
}

/* Aspect ratio handling */
@media (max-aspect-ratio: 1/1) {
  .game-wrapper {
    max-height: 95vh;
    max-width: 95vw;
  }
  
  .game-container {
    height: auto;
    aspect-ratio: 1/1;
  }
}

@media (min-aspect-ratio: 16/9) {
  .game-wrapper {
    max-width: 90vw;
    max-height: 80vh;
  }
}

/* Fix the Game Mode screen layout */
.modo-page .game-wrapper {
  display: flex;
  flex-direction: row;
  padding: 2vh;
  position: relative;
}

.modo-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modo-buttons {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  padding: 2vh;
  position: relative;
}

.modo-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 6vh;
  color: #0ff;
  text-shadow: 0 0 1vh #0ff, 0 0 2vh rgba(0, 255, 255, 0.5);
  font-weight: bold;
  padding-left: 5vh;
}

.modo-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2vh;
  padding-right: 5vh;
}

.modo-button {
  background-color: rgba(0, 0, 0, 0.7);
  border: 0.2vh solid #0ff;
  border-radius: 1.5vh;
  padding: 2vh;
  color: white;
  font-size: 1.8vh;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 1vh rgba(0, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.modo-button span {
  font-size: 2.4vh;
  font-weight: bold;
  margin-bottom: 1vh;
  color: white;
}

.modo-button:hover {
  background-color: rgba(0, 255, 255, 0.1);
  transform: translateY(-0.5vh);
  box-shadow: 0 0 1.5vh rgba(0, 255, 255, 0.7);
}

.modo-page .menu-button {
  position: absolute;
  bottom: 2vh;
  left: 2vh;
  z-index: 20;
}

.modo-page .sound-button {
  position: absolute;
  bottom: 2vh;
  right: 2vh;
  z-index: 20;
}

.game-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2vh;
  z-index: 10;
}

.game-header .title {
  font-size: 6vh;
  margin: 0;
}

/* Challenge game specific styles */
.challenge-container {
  width: 80%;
  max-width: 60vh;
  height: 80vh;
  padding: 6vh 2vh 2vh;
  background-color: rgba(0, 0, 0, 0.9);
  border: 0.2vh solid #0ff;
  border-radius: 1.5vh;
  box-shadow: 0 0 2vh #0ff, 0 0 4vh rgba(0, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

#squares-container {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 0.7vh;
  width: 100%;
  height: 100%;
  max-width: 50vh;
  max-height: 50vh;
  margin: 0 auto;
  padding: 1vh;
}

.challenge-square {
  width: 100%;
  height: 100%;
  margin: 0;
  background-color: transparent !important;
  border: 0.2vh solid #0ff;
  border-radius: 0.6vh;
  min-width: 0;
  min-height: 0;
  box-shadow: 0 0 0.5vh rgba(0, 255, 255, 0.5);
  transition: all 0.2s ease;
}

.challenge-square:hover {
  transform: scale(1.05);
  box-shadow: 0 0 1vh #0ff;
}

.challenge-square.green {
  background-color: #0f8 !important;
  border-color: #0f8;
  box-shadow: 0 0 1vh #0f8, 0 0 1.5vh rgba(0, 255, 128, 0.6);
}

.challenge-square.red {
  background-color: #f55 !important;
  border-color: #f55;
  box-shadow: 0 0 1vh #f55, 0 0 1.5vh rgba(255, 85, 85, 0.6);
}

.level-indicator {
  position: absolute;
  top: 1.5vh;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 0.5vh 2vh;
  border-radius: 2vh;
  box-shadow: 0 0 0.8vh #0ff;
  font-size: 1.6vh;
  font-weight: bold;
  color: #0ff;
  border: 0.2vh solid #0ff;
  text-shadow: 0 0 0.5vh #0ff;
  z-index: 10;
}

.probability-counter {
  position: absolute;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 0.5vh 2vh;
  border-radius: 2vh;
  box-shadow: 0 0 0.8vh #0f8;
  font-size: 1.8vh;
  font-weight: bold;
  color: #0ff;
  border: 0.2vh solid #0f8;
  text-shadow: 0 0 0.5vh #0f8;
  z-index: 10;
}

.win-menu {
  border: 0.2vh solid #0f8;
  box-shadow: 0 0 1.5vh #0f8, 0 0 2.5vh rgba(0, 255, 128, 0.5);
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
  .challenge-container {
    width: 90%;
    height: 75vh;
    min-height: 60vh;
  }
  
  #squares-container {
    gap: 0.4vh;
  }
  
  .modo-buttons {
    flex-direction: column;
  }
  
  .modo-title {
    flex: none;
    margin-bottom: 2vh;
  }
  
  .modo-options {
    flex: none;
  }
}

@media (max-width: 480px) {
  .challenge-container {
    width: 95%;
    height: 80vh;
    min-height: 25vh;
    padding: 3vh 1vh 2vh;
  }
  
  #squares-container {
    gap: 0.2vh;
    margin-top: 5vh;
  }
  
  .level-indicator, .probability-counter {
    font-size: 3vh;
    padding: 1vh 1.5vh;
  }
  
  .level-indicator {
    top: 0.2vh;
  }
  
  .probability-counter {
    top: 4vh;
  }
  
  .challenge-square {
    border-width: 0.15vh;
  }
}

@media (max-height: 700px) {
  .challenge-container {
    min-height: 50vh;
  }
  
  #squares-container {
    margin-top: 5vh;
  }
}

/* Custom game specific styles */
.custom-container {
  width: 80%;
  max-width: 60vh;
  height: 80vh;
  padding: 6vh 2vh 2vh;
  background-color: rgba(0, 0, 0, 0.9);
  border: 0.2vh solid #0ff;
  border-radius: 1.5vh;
  box-shadow: 0 0 2vh #0ff, 0 0 4vh rgba(0, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

#square-container {
  display: grid;
  gap: 1vh;
  width: 100%;
  height: 100%;
  max-width: 50vh;
  max-height: 50vh;
  margin: 0 auto;
  padding: 1vh;
  justify-content: center;
  align-content: center;
}

.custom-square {
  width: 100%;
  height: 100%;
  margin: 0;
  background-color: transparent !important;
  border: 0.2vh solid #0ff;
  border-radius: 0.6vh;
  min-width: 0;
  min-height: 0;
  max-width: 8vh;
  max-height: 8vh;
  box-shadow: 0 0 0.5vh rgba(0, 255, 255, 0.5);
  transition: all 0.2s ease;
  justify-self: center;
  align-self: center;
}

.custom-square:hover {
  transform: scale(1.05);
  box-shadow: 0 0 1vh #0ff;
  z-index: 5;
}

.custom-square.green {
  background-color: #0f8 !important;
  border-color: #0f8;
  box-shadow: 0 0 1vh #0f8, 0 0 1.5vh rgba(0, 255, 128, 0.6);
}

.custom-square.red {
  background-color: #f55 !important;
  border-color: #f55;
  box-shadow: 0 0 1vh #f55, 0 0 1.5vh rgba(255, 85, 85, 0.6);
}

.grid-size-indicator {
  position: absolute;
  top: 8.5vh;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 0.5vh 2vh;
  border-radius: 2vh;
  box-shadow: 0 0 0.8vh #0ff;
  font-size: 1.8vh;
  font-weight: bold;
  color: #0ff;
  border: 0.2vh solid #0ff;
  text-shadow: 0 0 0.5vh #0ff;
  z-index: 10;
}