/* =========================================
   GAME RESET
========================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Arial, sans-serif;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;

  background: #0a0e1a;

  color: white;

  /* Do NOT use flex on body */
  padding: 25px 15px 40px;

  overflow-x: hidden;
}


/* =========================================
   MAIN GAME CONTAINER
========================================= */

.container {
  width: 100%;

  /*
     Increased from 500px.
     This prevents the game from feeling squeezed.
  */
  max-width: 900px;

  margin: 0 auto;

  background: rgba(255, 255, 255, 0.03);

  border-radius: 20px;

  padding: 25px;

  border:
    1px solid rgba(255, 255, 255, 0.05);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


/* =========================================
   TITLE
========================================= */

.container h1 {
  color: #4fc3f7;

  font-size: clamp(1.7rem, 4vw, 2.2rem);

  text-align: center;

  margin-bottom: 10px;

  font-weight: 700;

  line-height: 1.2;
}


/* =========================================
   SUBTITLE
========================================= */

.subtitle {
  color: #8892b0;

  text-align: center;

  font-size: clamp(.85rem, 2vw, 1rem);

  margin-bottom: 20px;

  line-height: 1.5;
}


/* =========================================
   STATS
========================================= */

.stats {
  width: 100%;

  display: flex;

  justify-content: space-between;

  align-items: center;

  flex-wrap: wrap;

  gap: 8px;

  color: #8892b0;

  padding: 12px 15px;

  background:
    rgba(255, 255, 255, 0.03);

  border-radius: 12px;

  margin-bottom: 15px;

  border:
    1px solid rgba(255, 255, 255, 0.05);

  font-size: .9rem;
}

.stats span {
  color: #4fc3f7;

  font-weight: bold;
}


/* =========================================
   GAME AREA
========================================= */

.game-area {
  position: relative;

  width: 100%;

  /*
     Keeps the game large and proportional.
  */
  aspect-ratio: 16 / 10;

  min-height: 320px;

  max-height: 600px;

  margin: 0 auto 15px;

  border-radius: 15px;

  overflow: hidden;

  background:
    rgba(0, 0, 0, 0.3);

  border:
    1px solid rgba(79, 195, 247, 0.15);

  box-shadow:
    0 0 25px rgba(79, 195, 247, 0.08);
}


/* =========================================
   CANVAS
========================================= */

canvas {
  display: block;

  width: 100% !important;

  height: 100% !important;

  max-width: 100%;

  cursor: pointer;

  touch-action: none;
}


/* =========================================
   MESSAGE
========================================= */

.message {
  width: 100%;

  text-align: center;

  color: #4fc3f7;

  padding: 10px;

  min-height: 50px;

  font-size: 1rem;

  font-weight: 500;

  line-height: 1.5;

  transition:
    all .3s ease;
}

.message.success {
  color: #4caf50;
}

.message.fail {
  color: #ff6b6b;
}


/* =========================================
   MAIN CONTROLS
========================================= */

.controls {
  width: 100%;

  display: flex;

  gap: 10px;

  justify-content: center;

  align-items: center;

  flex-wrap: wrap;

  margin-top: 10px;
}


.btn {
  padding: 12px 25px;

  background:
    linear-gradient(
      135deg,
      #4fc3f7,
      #7c4dff
    );

  color: white;

  border: none;

  border-radius: 50px;

  font-size: .95rem;

  font-weight: 600;

  cursor: pointer;

  transition:
    transform .2s ease,
    box-shadow .2s ease;

  /*
     Prevent buttons from becoming tiny.
  */
  flex: 0 1 180px;

  min-width: 120px;
}

.btn:hover {
  transform: translateY(-2px);

  box-shadow:
    0 5px 20px rgba(79, 195, 247, .25);
}

.btn:active {
  transform: scale(.95);
}


/* =========================================
   SECONDARY BUTTON
========================================= */

.btn-secondary {
  background:
    rgba(255, 255, 255, .05);

  border:
    1px solid rgba(255, 255, 255, .08);

  color: #8892b0;
}

.btn-secondary:active {
  background:
    rgba(255, 255, 255, .1);
}


/* =========================================
   DIFFICULTY
========================================= */

.difficulty {
  width: 100%;

  display: flex;

  gap: 8px;

  justify-content: center;

  align-items: center;

  flex-wrap: wrap;

  margin: 15px 0;
}


.difficulty button {
  padding: 7px 17px;

  border-radius: 20px;

  border:
    1px solid rgba(255, 255, 255, .05);

  background:
    rgba(255, 255, 255, .03);

  color: #8892b0;

  cursor: pointer;

  font-size: .8rem;

  font-weight: 500;

  transition:
    all .2s ease;
}


.difficulty button.active {
  border-color: #4fc3f7;

  color: #4fc3f7;

  background:
    rgba(79, 195, 247, .1);
}


.difficulty button:hover {
  border-color: #4fc3f7;

  color: #4fc3f7;
}


.difficulty button:active {
  transform: scale(.95);
}


.difficulty-label {
  color: #8892b0;

  font-size: .8rem;

  display: flex;

  align-items: center;

  margin-right: 5px;
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 768px) {

  body {
    padding: 20px 10px 35px;
  }

  .container {
    max-width: 100%;

    padding: 20px;
  }

  .game-area {
    aspect-ratio: 16 / 10;

    min-height: 300px;
  }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 480px) {

  body {
    padding: 12px 7px 30px;
  }

  .container {
    width: 100%;

    padding: 15px;

    border-radius: 16px;
  }

  .container h1 {
    font-size: 1.45rem;
  }

  .subtitle {
    font-size: .85rem;

    margin-bottom: 15px;
  }


  /* STATS */

  .stats {
    font-size: .75rem;

    padding: 9px 10px;

    gap: 5px;

    justify-content: space-around;
  }


  /* GAME */

  .game-area {
    width: 100%;

    /*
       Bigger mobile game area.
    */
    aspect-ratio: 4 / 3;

    min-height: 280px;

    max-height: none;

    border-radius: 12px;
  }


  /* MESSAGE */

  .message {
    font-size: .9rem;

    min-height: 45px;

    padding: 8px;
  }


  /* BUTTONS */

  .controls {
    gap: 8px;
  }

  .btn {
    flex: 1 1 130px;

    min-width: 0;

    padding: 11px 15px;

    font-size: .85rem;
  }


  /* DIFFICULTY */

  .difficulty {
    gap: 6px;

    margin: 12px 0;
  }

  .difficulty button {
    padding: 6px 12px;

    font-size: .72rem;
  }

  .difficulty-label {
    font-size: .72rem;
  }
}


/* =========================================
   VERY SMALL PHONES
========================================= */

@media (max-width: 380px) {

  .container {
    padding: 10px;
  }

  .stats {
    font-size: .65rem;

    padding: 7px 8px;
  }

  .game-area {
    min-height: 260px;
  }

  .btn {
    flex: 1 1 110px;

    padding: 9px 12px;

    font-size: .8rem;
  }

  .difficulty button {
    padding: 5px 10px;

    font-size: .68rem;
  }
}
