@font-face {
  font-family: 'Micro5';
  src: url('../assets/fonts/Micro5-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.cr-root {
  max-width: 960px;
  padding: 16px;
}

.cr-frame {
  position: relative;
  background: #020617;
  border-radius: 12px;
  border: 2px solid #1f2937;
  overflow: hidden-el;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
  width: 500px;

  canvas {
    border-radius: 12px;
  }
}



@media (min-width: 900px) {
  .cr-frame {
    transform: scale(1.3);
  }

  .cr-frame--block {
    width: 800px;
    transform: none;
  }
}

.cr-canvas {
  display: block;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0b1220;
  position: relative;
}

.cr-hud {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  padding: 4px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  text-shadow: 0 1px 0 #000;
  z-index: 10;
}

.cr-hud-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cr-hud-left {
  display: flex;
  flex-wrap: wrap;
  max-width: 250px;
  gap: 10px;
}

.cr-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 25px;
}

.cr-label--score {
  text-align: right;
  width: 100%;
}

.cr-value {
  font-size: 25px;
  color: #fff;
}

/* Overlay - Title & Game Over Screens */

.cr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  border-radius: 12px;
}

/* Hide the old overlay content */
.cr-overlay-inner {
  display: none;
}

/* Title Screen & Game Over Screen */
.title-screen,
.gameover-screen {
  text-align: center;
  color: white;
  max-width: 600px;
  width: 90%;
}

.game-title {
  color: #fff;
  font-family: 'Micro5', monospace;
  font-size: 58px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1;
  margin-bottom: 0px;
  margin-top: 20px;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.gameover-title {
  font-family: 'Micro5', monospace;
  font-size: 40px;
  color: #fff;
  margin-bottom: 0px;
  margin-top: 0px;
}

.instructions-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.instruction-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
}

.icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.instruction-icon {
  width: 90px;
  height: 60px;
  object-fit: cover;
  image-rendering: pixelated;
}

.instruction-text {
  font-family: 'Micro5', monospace;
  font-size: 35px;
  line-height: 42px;
  color: #fff;
}

.controls-text {
  font-family: 'Micro5', monospace;
  font-size: 20px;
  color: #e5f0ff;
  margin-bottom: 10px;
  line-height: 1.3;
}

.play-button-container {
  margin-top: 15px;
  opacity: 0;
  animation: fadeInElement 3s ease-in-out forwards;
}

.play-button {
  display: inline;
  padding: 4px 24px;
  background: #E07049;
  color: #1a1f3b;
  font-family: 'Micro5', monospace;
  font-size: 30px;
  font-weight: bold;
  border-radius: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: default;
  box-shadow: 0 4px 0 #a85d40;
  user-select: none;
  transition: transform 0.1s ease;
}

.play-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a85d40;
}

.cr-score-container {
  font-family: 'Micro5', monospace;
  font-size: 10px;
}

.score-display {
  font-family: 'Micro5', monospace;
  letter-spacing: 1.1px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px 30px;
  border-radius: 8px;
  margin-top: 5px;
  line-height: 1.5;
  max-width: 220px;
  margin-inline: auto;
}

.score-display__label {
  display: block;
  line-height: 13px;
  font-size: 25px;
}

.score-display__value {
  display: block;
  font-size: 30px;
}


.score-display span {
  font-weight: bold;
}

#cr-high-score {
  color: #fbb501;
}


.hidden-el {
  display: none !important;
}

.cr-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  animation-delay: 1s;
  animation: fadeOutOverlay 3s ease-in-out forwards;
  pointer-events: none;
}

.cr-sound-icon {
  position: absolute;
  top: 0px;
  right: 20px;
  width: 60px;
  height: 30px;
  z-index: 1000;
  pointer-events: auto;
  cursor: pointer;
}

.cr-sound-icon.hidden {
  display: none;
}

.cr-sound-icon img {
  width: 100%;
}



@keyframes fadeOutOverlay {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    visibility: hidden;
    /* Removes from layout after fading */
  }
}


@keyframes fadeInCanvas {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}