* {
  box-sizing: border-box;
}
.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0d0d1a;
  color: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
  gap: 12px;
}

.game-wrap {
  position: relative;
}

canvas {
  border: 2px solid #35d0ba;
  background: linear-gradient(#101830, #090d18 70%);
  width: min(95vw, 95vh * (1280 / 640));
  height: auto;
}

#status {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(5, 10, 30, 0.55);
  color: #35d0ba;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  pointer-events: none;
}

.hud {
  text-align: center;
  max-width: 1280px;
}

button {
  margin-top: 8px;
  padding: 6px 16px;
  border: 1px solid #35d0ba;
  background: transparent;
  color: #35d0ba;
  cursor: pointer;
}

button:hover {
  background: rgba(53, 208, 186, 0.15);
}

.shop,
.pause-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shop.visible,
.pause-screen.visible {
  pointer-events: auto;
  opacity: 1;
}

.shop-content,
.pause-content {
  border: 2px solid #35d0ba;
  padding: 20px;
  max-width: 480px;
  width: min(90vw, 480px);
  color: #d9fef9;
  font-family: Arial, sans-serif;
  background: rgba(7, 12, 28, 0.94);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.shop-intro {
  margin-bottom: 12px;
  text-align: center;
  color: #9eddd1;
}

.shop-message {
  min-height: 18px;
  margin: 0 0 14px;
  text-align: center;
  font-size: 14px;
  color: #b2f5e7;
}

.shop-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.shop-refresh {
  min-width: 150px;
  border-radius: 20px;
  background: #0f1c2f;
  border: 1px solid #35d0ba;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.shop-refresh:hover {
  background: #162947;
  transform: translateY(-2px);
}

.shop-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
}

.movement-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #9ee7ff;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
  z-index: 999;
}

.movement-overlay.hidden {
  display: none;
}

.movement-panel {
  background: rgba(5, 10, 20, 0.9);
  border: 1px solid #35d0ba;
  border-radius: 10px;
  padding: 20px 30px;
  min-width: 320px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.movement-panel h4 {
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#movementStats {
  margin: 0;
  padding: 0;
  list-style: none;
}

#movementStats li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(158, 231, 255, 0.3);
  font-size: 14px;
}

#movementStats li:last-child {
  border-bottom: none;
}


.level-complete {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.level-complete.hidden {
  display: none;
}

.level-complete__panel {
  width: min(90vw, 420px);
  border: 2px solid #35d0ba;
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  color: #d9fef9;
  background: radial-gradient(circle at top, rgba(78, 255, 218, 0.2), rgba(3, 8, 18, 0.95));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
}

.level-complete__badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(53, 208, 186, 0.15);
  border: 1px solid rgba(53, 208, 186, 0.4);
  color: #35d0ba;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.level-complete__panel button {
  margin-top: 18px;
  width: 100%;
  padding: 12px 0;
  font-size: 16px;
  border-radius: 999px;
}

.debug-menu {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 950;
}

.debug-menu.hidden {
  display: none;
}

.debug-menu__panel {
  width: min(90vw, 360px);
  padding: 20px 24px;
  border-radius: 14px;
  border: 2px solid rgba(53, 208, 186, 0.6);
  background: rgba(5, 10, 22, 0.95);
  color: #d9fef9;
  text-align: center;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.55);
}

.debug-menu__panel h4 {
  margin: 0 0 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9aeedc;
}

.debug-menu__buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.debug-menu__buttons button {
  width: 100%;
  border-radius: 999px;
  padding: 10px 0;
  font-weight: 600;
  color: #35d0ba;
}

.debug-menu__hint {
  margin-top: 14px;
  font-size: 12px;
  color: #7fdccc;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.shop-tile {
  background: #141f34;
  border: 1px solid #35d0ba;
  border-radius: 6px;
  padding: 14px;
  width: 110px;
  flex: 0 0 155px;
  min-width: 155px;
  max-width: 155px;
  text-align: center;
  color: #d8fff5;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shop-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  background: #141f34;
}

.shop-tile h4 {
  margin: 8px 0 6px;
  font-size: 15px;
}

.shop-tile .cost {
  font-size: 13px;
  color: #89f6d8;
  margin: 4px 0;
}

.shop-tile .desc {
  font-size: 12px;
  color: #9bb0c5;
  margin: 0;
}

.tile-art {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.tile-art--regen {
  background: radial-gradient(circle at 30% 30%, #5dffba, #179a6f);
}

.tile-art--coins {
  background: radial-gradient(circle at 60% 40%, #ffd25d, #b87400);
}

.tile-art--maxhp {
  background: radial-gradient(circle at 40% 40%, #ff9ad7, #8340a8);
}

.tile-art::after,
.tile-art::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.game-over-controls {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, 0);
  width: min(70%, 520px);
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2vw, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.game-over-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

.game-over-controls button {
  flex: 1 1 auto;
  padding: clamp(10px, 1.8vw, 14px) clamp(18px, 3vw, 28px);
  font-size: clamp(16px, 2vw, 20px);
  border-radius: 12px;
  border: 2px solid #35d0ba;
  background: rgba(9, 16, 31, 0.92);
  color: #d9fef9;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.game-over-controls button:hover {
  background: rgba(53, 208, 186, 0.25);
}

.home-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #04070f 0%, #081226 40%, #04111f 70%, #02070f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.25s ease;
  overflow: hidden;
}

.home-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.home-screen::before {
  content: '';
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle at center, rgba(4, 7, 15, 0) 0%, rgba(4, 7, 15, 0) 40%, rgba(2, 4, 9, 0.4) 70%, rgba(0, 0, 0, 0.78) 100%);
  pointer-events: none;
}

.home-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  filter: drop-shadow(0 0 18px rgba(93, 255, 186, 0.35));
}

.home-art svg {
  width: 100%;
  height: 100%;
}

.home-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  mix-blend-mode: screen;
  animation: driftStars 60s linear infinite;
}

.home-stars::before,
.home-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  background-size: 280px 280px;
  opacity: 0.6;
  animation: twinkle 4s ease-in-out infinite alternate;
}

.home-stars::before {
  background-image: radial-gradient(circle, rgba(93, 255, 186, 0.9) 2px, transparent 3px);
}

.home-stars::after {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.85) 1.5px, transparent 3px);
  animation-duration: 5.5s;
  animation-delay: 1s;
}

.home-stars--fast {
  opacity: 0.35;
  animation-duration: 35s;
}

.home-stars--slow {
  opacity: 0.45;
  animation-duration: 65s;
}

.home-stars--fast::before,
.home-stars--fast::after {
  background-size: 180px 180px;
}

@keyframes driftStars {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-200px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
}

.home-panel {
  width: min(90vw, 720px);
  border: 3px solid #35d0ba;
  border-radius: 22px;
  padding: 38px 32px 40px;
  background: linear-gradient(180deg, #060c1a 0%, #040812 60%, #04070e 100%);
  color: #d9fef9;
  box-shadow: 0 30px 80px rgba(2, 7, 15, 0.95);
  text-align: center;
  font-family: 'Arial', sans-serif;
  position: relative;
  overflow: hidden;
}

.home-panel h1 {
  margin: 0 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: 0.08em;
  color: #5dffba;
  display: inline-flex;
  gap: 4px;
}

.home-panel h1 .letter {
  display: inline-block;
  position: relative;
  animation: floatLetter 3.5s ease-in-out infinite;
}

.home-panel h1 .letter:nth-child(odd) {
  animation-delay: 0.4s;
}

.home-panel h1 .letter:nth-child(even) {
  animation-delay: 0.8s;
}

.letter--space {
  width: 0.6em;
}

.letter--drip::after {
  content: '';
  position: absolute;
  top: 110%;
  left: 50%;
  width: 10px;
  height: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.9), rgba(93, 255, 186, 0.9));
  border-radius: 50% 50% 60% 60%;
  transform: translate(-50%, 0);
  animation: oozeDrop 3s ease-in-out infinite;
}

.home-subtitle .subtitle-target {
  position: relative;
  display: inline-block;
}

.home-subtitle .subtitle-target::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 16px;
  height: 6px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(93, 255, 186, 0.8), rgba(93, 255, 186, 0));
  border-radius: 50%;
  opacity: 0;
  animation: splatPulse 3s ease-in-out infinite;
}

@keyframes floatLetter {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes oozeDrop {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px) scaleY(0.7);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, 0) scaleY(0.9);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, 90px);
  }
  80% {
    opacity: 0;
    transform: translate(-50%, 110px) scaleY(0.6);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -10px) scaleY(0.7);
  }
}

@keyframes splatPulse {
  0%,
  65% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.5);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
}

.home-subtitle {
  margin: -6px 0 18px;
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0.12em;
  color: #9eddd1;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  position: relative;
}

.home-subtitle::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 60%;
  height: 8px;
  background: radial-gradient(circle, rgba(93, 255, 186, 0.8), rgba(93, 255, 186, 0));
  border-radius: 50%;
  opacity: 0.7;
  animation: drip 2.4s ease-in-out infinite;
}

@keyframes drip {
  0% {
    transform: translate(-50%, 0) scaleY(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, 4px) scaleY(1.2);
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, 0) scaleY(1);
    opacity: 0.8;
  }
}

.home-panel p {
  margin: 0 0 24px;
  color: #9eddd1;
  font-size: clamp(14px, 1.6vw, 18px);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}

.home-actions button {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 2px solid #35d0ba;
  background: rgba(11, 26, 34, 0.85);
  color: #d9fef9;
  font-size: clamp(16px, 2vw, 20px);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.home-actions button:hover {
  background: rgba(53, 208, 186, 0.2);
}

.home-info {
  border: 1px solid rgba(53, 208, 186, 0.4);
  border-radius: 12px;
  padding: 16px 20px;
  background: rgba(4, 10, 18, 0.8);
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
  color: #c4f8f1;
  min-height: 120px;
}

.home-info h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #5dffba;
  letter-spacing: 0.05em;
}

.game-version {
  position: fixed;
  bottom: 0.5em;
  left: 0.5em;
  font-size: 12px;
  color: rgba(53, 208, 186, 0.5);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
  opacity: 0.8;
  z-index: 1000;
}

.pause-abilities {
  text-align: center;
  margin-bottom: 16px;
  color: #9eddd1;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(53, 208, 186, 0.35);
  width: 100%;
}

.pause-abilities h4 {
  margin: 0 0 6px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d9fef9;
}

.pause-abilities ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  width: 100%;
}

.pause-abilities li {
  background: rgba(13, 24, 44, 0.95);
  border: 2px solid rgba(53, 208, 186, 0.45);
  border-radius: 12px;
  flex: 1 1 calc(25% - 16px);
  max-width: 280px;
  min-width: 200px;
  min-height: 120px;
  padding: 14px;
  font-size: 13px;
  color: #c4f8f1;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 18px 35px rgba(2, 7, 15, 0.45);
}

.pause-abilities li strong {
  font-size: 15px;
  color: #5dffba;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pause-abilities li small {
  margin-top: 6px;
  opacity: 0.9;
  font-size: 12px;
  color: #d1f3ef;
}

.pause-content {
  width: min(95vw, 95vh * (1280 / 640));
  max-width: 1280px;
}
