/* press-start-2p-regular - cyrillic-ext_cyrillic_greek_latin-ext_latin */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  src: local('Press Start 2P Regular'), local('PressStart2P-Regular'),
       url('./fonts/press-start-2p-v6-cyrillic-ext_cyrillic_greek_latin-ext_latin-regular.woff2') format('woff2');
}

html, body{
    margin: 0;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: black;
    font-family: 'Press Start 2P', sans-serif;
    color: white;
}

.noselect {
  -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome and Opera */
}

.hidden{
  display: none;
}

.startButton{
  position: absolute;
  width: 200px;
  height: 60px;
  bottom: 150px;
  left: calc(50vw - 100px);
  padding: 0;
  line-height: 60px;
  text-align: center;
  font: 32px 'Press Start 2P', sans-serif;
  color: white;
  border: 2px solid white;
  cursor: pointer;
  background-color: rgba(0, 0, 0, .5);
}

.startButton:hover,
.startButton:focus-visible{
  border-color: #FFCC33;
  color: #FFCC33;
  outline: none;
}

canvas{
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
}

/* HUD: wave, score and combo meter, centred between the corner buttons. */
.hud{
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(60vw, 420px);
  text-align: center;
  font-size: 12px;
  pointer-events: none;
  z-index: 2;
}

.hud-line{
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
  white-space: nowrap;
}

#score{
  color: #FFCC33;
}

.combo{
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.combo-bar{
  flex: 1;
  height: 8px;
  border: 1px solid #2121DE;
  background: rgba(0, 0, 0, .6);
}

.combo-fill{
  display: block;
  width: 0;
  height: 100%;
  background: #2DE5E5;
  transition: width 120ms linear;
}

/* Narrow portrait screens: drop the HUD below the corner buttons. */
@media (max-width: 640px) and (orientation: portrait){
  .hud{
    top: max(62px, calc(env(safe-area-inset-top) + 54px));
    width: calc(100vw - 32px);
  }
}

.hud.is-hot .combo-fill{
  background: #FFCC33;
}

.hud.is-hot .combo-value{
  color: #FFCC33;
}

.corner-buttons{
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  display: flex;
  gap: 6px;
  z-index: 3;
}

.icon-button{
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #2121DE;
  border-radius: 6px;
  background: rgba(0, 0, 0, .6);
  color: white;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-button:hover,
.icon-button:focus-visible{
  border-color: #FFCC33;
  outline: none;
}

.icon-button svg{
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-button .icon-off,
.icon-button.is-off .icon-on{
  display: none;
}

.icon-button.is-off .icon-off{
  display: block;
}

.icon-button.hidden{
  display: none;
}

.banner{
  position: absolute;
  top: 22vh;
  left: 50%;
  width: min(86vw, 520px);
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  background-color: rgba(0, 0, 0, .7);
  border: 2px solid #2121DE;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 250ms ease, transform 250ms ease;
}

.banner.is-showing{
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner p{
  margin: 6px 0;
}

.banner .big{
  color: #FFCC33;
}

.banner-icon{
  position: static;
  display: block;
  width: 48px;
  height: 48px;
  margin: 4px auto;
  image-rendering: pixelated;
}

.overlay{
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: rgba(0, 0, 0, .75);
}

.overlay.hidden{
  display: none;
}

.overlay .startButton{
  position: static;
}

@media (prefers-reduced-motion: reduce){
  .banner, .combo-fill{
    transition: none;
  }
}

.textBlock{
  position: absolute;
  width: 80vw;
  left: 10vw;
  text-align: center;
  height: auto;
  background-color: rgba(0, 0, 0, .5);
}

#text{
  top: 5vh;
}

@media only screen and (min-height: 550px){
#text{
  top: 15vh;
}
}

@media only screen and (min-height: 700px){
#text{
  top: 30vh;
}
}

#credits{
  bottom: max(50px, calc(env(safe-area-inset-bottom) + 16px));
}

/* A finger-sized target without moving the line. */
#credits a{
  display: inline-block;
  padding: 14px 6px;
  margin: -14px 0;
}

/* Short screens (landscape phones): text at the top, Start and credits below it. */
@media (max-height: 500px){
  #text{
    top: max(8px, env(safe-area-inset-top));
    font-size: 12px;
  }

  #text .big{
    font-size: 20px;
    line-height: 20px;
  }

  .startButton{
    bottom: max(48px, calc(env(safe-area-inset-bottom) + 40px));
    height: 52px;
    line-height: 52px;
    font-size: 28px;
  }

  #credits{
    bottom: max(20px, env(safe-area-inset-bottom));
  }
}

.big{
  line-height: 24px;
  font-size: 24px;
}

a{
  color: white;
}