@font-face {
  font-family: "Game Open Sans";
  src: url("../assets/fonts/OpenSans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Game Comico";
  src: url("../assets/fonts/Comico-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  background: #fff;
  font-family: "Game Open Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #fff;
}

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 180ms linear;
}

#game-shell.is-game-over {
  background: #141514;
}

#game-shell.is-start-screen #pause-button,
#game-shell.is-attacking #pause-button,
#game-shell.is-game-over #pause-button {
  opacity: 0;
  pointer-events: none;
}

#game-shell.is-start-screen #game-canvas {
  cursor: pointer;
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  cursor: none;
  touch-action: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #141514;
  color: #ddd;
  font-size: clamp(14px, 4cqw, 20px);
  transition: opacity 180ms ease;
  z-index: 40;
}

#pause-button {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 60;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 50%;
  background: rgb(20 21 20 / 66%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 20%);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: opacity 150ms ease, transform 150ms ease, background-color 150ms ease;
}

#pause-button:hover {
  background: rgb(20 21 20 / 80%);
}

#pause-button:active {
  transform: scale(0.94);
}

#pause-button:focus-visible {
  outline: 3px solid #b73829;
  outline-offset: 3px;
}

#pause-button:disabled {
  pointer-events: none;
  opacity: 0;
}

.pause-icon,
.pause-icon::before,
.pause-icon::after {
  display: block;
}

.pause-icon {
  position: relative;
  width: 16px;
  height: 20px;
}

.pause-icon::before,
.pause-icon::after {
  position: absolute;
  top: 0;
  width: 5px;
  height: 20px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.pause-icon::before {
  left: 0;
}

.pause-icon::after {
  right: 0;
}

#pause-button.is-paused .pause-icon {
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid currentColor;
  transform: translateX(2px);
}

#pause-button.is-paused .pause-icon::before,
#pause-button.is-paused .pause-icon::after {
  display: none;
}

#pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: rgb(20 21 20 / 72%);
  color: #fff;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#pause-overlay.is-visible {
  pointer-events: auto;
  opacity: 1;
}

#pause-title {
  font-family: "Game Comico", "Game Open Sans", sans-serif;
  font-size: clamp(34px, 11vw, 68px);
  font-weight: 400;
  color: #b73829;
}

#pause-hint {
  max-width: 32rem;
  font-size: clamp(14px, 4vw, 18px);
  color: #ddd;
}

#loading.is-hidden {
  pointer-events: none;
  opacity: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  #loading,
  #game-shell,
  #pause-button,
  #pause-overlay {
    transition: none;
  }
}
