@import url(https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&display=swap);
body {
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  background-color: #0f172a;
  touch-action: none;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.interactive-layer {
  pointer-events: auto;
}
.shake {
  animation: 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both shake;
}
@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}
.pulse-text {
  animation: 1.5s infinite pulse-gold;
}
@keyframes pulse-gold {
  0%,
  100% {
    text-shadow: 0 0 0 rgba(250, 204, 21, 0);
  }
  50% {
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.8);
    transform: scale(1.05);
  }
}
.scanlines {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.1)
  );
  background-size: 100% 4px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

/* 3DIMLI order rush enhancement */
body {
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 28%),
    linear-gradient(180deg, #020617 0%, #0f172a 58%, #050816 100%);
}

#game-container {
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent 38%),
    linear-gradient(180deg, #0f172a 0%, #060c1b 60%, #020617 100%);
}

#game-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(56, 189, 248, 0.12), transparent 26%),
    radial-gradient(circle at 84% 16%, rgba(139, 92, 246, 0.14), transparent 24%);
  pointer-events: none;
}

#game-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.08;
  pointer-events: none;
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: -0.5rem 0 1.2rem;
}

.store-badges span {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  background: rgba(15, 23, 42, 0.6);
  color: #dbeafe;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#start-screen > div {
  background: linear-gradient(180deg, rgba(9, 16, 34, 0.92), rgba(5, 10, 22, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 30px;
  box-shadow:
    0 36px 90px rgba(2, 6, 23, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 2rem;
}

#start-screen h1 {
  letter-spacing: -0.08em;
  text-shadow: 0 0 30px rgba(96, 165, 250, 0.22);
}

#game-over-screen .bg-white {
  box-shadow:
    0 34px 90px rgba(2, 6, 23, 0.58),
    0 0 0 1px rgba(15, 23, 42, 0.08);
}

#controls-ui button {
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px), (pointer: coarse) {
  /* Make the start / game-over overlays scroll when content is taller than viewport */
  #start-screen,
  #game-over-screen {
    justify-content: flex-start !important;
    overflow-y: auto;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Dialog card: let it grow with content and scroll inside the screen */
  #start-screen > div {
    padding: 1.1rem 1.1rem 1.25rem !important;
    border-radius: 20px;
    max-width: 100%;
    margin: auto 0;
  }

  /* Shrink hero */
  #start-screen > div > div:first-child {
    width: 52px !important;
    height: 52px !important;
    margin-bottom: 0.75rem !important;
  }
  #start-screen > div > div:first-child img {
    width: 26px !important;
    height: 26px !important;
  }
  #start-screen h1 {
    font-size: 1.65rem !important;
    margin-bottom: 0.35rem !important;
  }
  #start-screen > div > p:first-of-type {
    font-size: 0.78rem !important;
    line-height: 1.4;
    margin-bottom: 0.9rem !important;
  }

  /* Compact the "How to play" panel and hide step 4 on mobile to save space */
  #start-screen .rounded-xl.bg-slate-800\/50 {
    padding: 0.85rem !important;
    margin-bottom: 0.85rem !important;
  }
  #start-screen .rounded-xl.bg-slate-800\/50 > div:first-child {
    margin-bottom: 0.55rem !important;
    font-size: 0.6rem !important;
    letter-spacing: 0.1em !important;
  }
  #start-screen ol li {
    font-size: 0.76rem !important;
    line-height: 1.35;
  }
  #start-screen ol {
    gap: 0.4rem;
  }
  #start-screen ol > li + li {
    margin-top: 0.4rem !important;
  }
  /* Drop the fourth how-to-play bullet on mobile for height savings */
  #start-screen ol > li:nth-child(4) {
    display: none !important;
  }

  /* Controls legend: slimmer */
  #start-screen .grid.grid-cols-3 {
    gap: 0.35rem !important;
    margin-bottom: 0.9rem !important;
  }
  #start-screen .grid.grid-cols-3 > div {
    padding: 0.35rem 0.25rem !important;
    font-size: 0.6rem !important;
  }
  #start-screen .grid.grid-cols-3 > div > div:first-child {
    font-size: 0.95rem !important;
  }

  /* Drop the decorative power-up banner on mobile */
  #start-screen .rounded-lg.bg-yellow-500\/10 {
    display: none !important;
  }

  #start-screen button {
    padding: 0.85rem !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.08em;
  }

  /* Game-over dialog: keep receipt visible without overflow */
  #game-over-screen h2 {
    font-size: clamp(1.8rem, 8vw, 2.4rem) !important;
    margin-bottom: 0.35rem !important;
    letter-spacing: -0.02em;
    text-align: center;
  }
  #game-over-screen > p {
    font-size: 0.95rem !important;
    margin-bottom: 1rem !important;
  }
  #game-over-screen .bg-white {
    padding: 1.25rem !important;
    max-width: calc(100% - 24px) !important;
    transform: rotate(-1deg);
    margin-bottom: 1.1rem !important;
  }
  #game-over-screen .bg-white img.h-10 {
    height: 1.75rem !important;
    margin-bottom: 0.3rem;
  }
  #game-over-screen .bg-white .text-xl {
    font-size: 0.95rem !important;
  }
  #game-over-screen .bg-white .text-xs {
    font-size: 0.65rem !important;
  }
  #game-over-screen .bg-white .border-b-2 {
    padding-bottom: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }
  #game-over-screen button {
    padding: 0.75rem 1.5rem !important;
    font-size: 0.95rem !important;
  }

  /* Top HUD readability on small screens */
  #game-container .ui-layer > div:first-child {
    gap: 0.35rem;
  }
  #game-container .ui-layer > div:first-child > div {
    padding: 0.45rem 0.55rem !important;
    min-width: 0 !important;
  }
  #game-container .ui-layer > div:first-child .text-2xl {
    font-size: 1.1rem !important;
  }
  #game-container .ui-layer > div:first-child .text-xs {
    font-size: 0.55rem !important;
    letter-spacing: 0.06em !important;
  }
}
