@font-face {
  font-family: 'VT323';
  font-display: block;
  src: url('../vendor/fonts/vt323-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Pixelify Sans';
  font-display: swap;
  src: url('../vendor/fonts/pixelify-sans-latin-400-normal.woff2') format('woff2');
}

canvas {
  background-image: linear-gradient(to right top, #221f21, #1d1b1c, #181617, #131112, #0c0b0b, #0b0a0b, #0b0a0a, #0a090a, #0f0f11, #131416, #15191a, #181d1d);
  padding-left: 0;
  padding-right: 0;
  margin-left: auto;
  margin-right: auto;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
body {
  background-image: radial-gradient(circle, #000000, #060405, #0c080c, #0f0c11, #101016);
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  touch-action: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  position: fixed;
  width: 100%;
  height: 100%;
}

html {
  overflow: hidden !important;
  touch-action: none;
  width: 100%;
  height: 100%;
  position: fixed;
}

.github-link {
  position: fixed;
  bottom: 10px;
  right: 10px;
  text-decoration: none;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.github-link:hover {
  transform: scale(1.2) rotate(10deg);
  opacity: 1;
  filter: drop-shadow(0 0 10px #990099);
}

.github-link img {
  filter: invert(86%) sepia(87%) saturate(2337%) hue-rotate(124deg) brightness(102%) contrast(99%);
}

.github-link:hover img {
  filter: invert(100%);
}

.creepy-ui {
  font-family: 'VT323', monospace;
  background-color: rgba(0, 0, 0, 0.8);
  border: 2px solid #990099;
  color: white;
  pointer-events: auto;
}

#ui-menu {
  position: fixed;
  top: 0;
  right: 0;
  padding: 15px;
  z-index: 900;
  font-size: 24px;
  min-width: 280px;
}

.header-accent {
  background: linear-gradient(90deg, #990099, transparent);
  padding: 5px 15px;
  color: #05f2db;
  font-size: 28px;
  margin: 10px -15px 10px 0;
  border-left: 4px solid #05f2db;
  letter-spacing: 1px;
}

#ui-menu p {
  margin: 5px 0;
  padding-left: 10px;
}

.menu-section {
  margin-bottom: 20px;
}

.intro-overlay {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  z-index: 1500;
  pointer-events: none;
}

.level-select {
  width: 100%;
  padding: 0 15px 10px;
  font-size: 22px;
}

.level-select .header-accent {
  margin: 0 -15px 10px;
  text-align: left;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}

.level-grid button {
  min-height: 44px;
  border: 2px solid #990099;
  background: rgba(153, 0, 153, 0.15);
  color: white;
  font: 26px 'VT323', monospace;
  cursor: pointer;
}

.level-grid button.cleared {
  border-color: #05f2db;
}

.level-grid button.selected,
.level-grid button:focus-visible {
  background: #990099;
  outline: 2px solid #05f2db;
  outline-offset: 1px;
}

.level-grid button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.level-info {
  margin: 10px 0 0;
  min-height: 1.2em;
  color: #05f2db;
}

.pulse-text {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: clamp(22px, 6vw, 42px);
  color: white;
  text-shadow: 0 0 10px #990099;
  animation: pulse 1.5s infinite ease-in-out;
  letter-spacing: 2px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

.pause-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.pause-content {
  padding: 30px;
  text-align: center;
  min-width: 300px;
}

.pause-content h2 {
  margin-top: 0;
  font-size: 56px;
  color: #05f2db;
}

.pause-content button {
  display: block;
  width: 100%;
  min-height: 48px;
  background-color: #990099;
  border: none;
  color: white;
  padding: 10px 25px;
  font-family: 'VT323', monospace;
  font-size: 36px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: 10px;
}

.pause-content button.secondary {
  font-size: 26px;
  background-color: transparent;
  border: 2px solid #990099;
}

.pause-content button:hover,
.pause-content button:focus-visible {
  background-color: #05f2db;
  color: black;
}

/* The controls card only fits beside the play area on wide screens. */
@media (max-width: 1699px), (max-height: 560px) {
  #ui-menu {
    display: none;
  }
}

/* Touch pad: the hero only goes left and right, so the pad is one row of two. */
.gk-touch .gk-dpad {
  grid-template-columns: repeat(2, 60px);
  grid-template-rows: 60px;
  gap: 8px;
}

.gk-touch .gk-dpad button {
  grid-area: auto;
}

.gk-touch .gk-btn {
  width: 68px;
  height: 68px;
}

/* Portrait: Jump and Soul side by side, Reset and Pause above them. */
@media (orientation: portrait) {
  .gk-touch .gk-buttons {
    max-width: 150px;
    gap: 8px 10px;
  }
}

/* Landscape: the buttons form one column at the right edge, Jump at the bottom,
   so the play area keeps most of the width. */
@media (orientation: landscape) {
  .gk-touch .gk-buttons {
    flex-direction: column-reverse;
    flex-wrap: nowrap;
    align-items: stretch;
    max-width: none;
    gap: 8px;
  }

  .gk-touch .gk-btn--small {
    width: 68px;
    padding: 0;
  }
}

/* The touch pad covers the corners, where the GitHub link would sit. */
.gk-has-touch .github-link {
  display: none;
}

@media (max-height: 560px) {
  .intro-overlay {
    bottom: 8px;
    gap: 6px;
  }

  .level-select .header-accent {
    display: none;
  }

  .level-select {
    padding-top: 8px;
  }
}

.hidden {
  display: none !important;
}
