:root {
  --void: #07060c;
  --panel: #12101a;
  --frite: #f0c43a;
  --mayo: #f5efd0;
  --crevette: #e85d4c;
  --laser: #b44dff;
  --ui: #efe6c8;
  --dim: #9a9078;
  --font-pixel: "Press Start 2P", monospace;
  --font-ui: "Oxanium", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184, 74, 40, 0.18), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(180, 77, 255, 0.12), transparent 45%),
    var(--void);
  color: var(--ui);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1rem 1rem 2rem;
}

#ui {
  width: min(480px, 96vw);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.ui-block {
  background: rgba(18, 16, 26, 0.85);
  border: 2px solid rgba(240, 196, 58, 0.35);
  padding: 0.55rem 0.4rem;
  text-align: center;
}

.ui-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 0.35rem;
}

#scoreValue,
#levelValue,
#livesValue {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: var(--frite);
}

#stage {
  position: relative;
  width: min(480px, 96vw);
  aspect-ratio: 480 / 640;
  box-shadow:
    0 0 0 3px rgba(240, 196, 58, 0.25),
    0 18px 50px rgba(0, 0, 0, 0.55);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  image-rendering: pixelated;
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  background: rgba(7, 6, 12, 0.82);
  z-index: 5;
}

#overlay.hidden {
  display: none;
}

.eyebrow {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--crevette);
}

#overlay h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 4.5vw, 1.45rem);
  line-height: 1.35;
  color: var(--frite);
  text-shadow: 0 0 18px rgba(240, 196, 58, 0.35);
}

.tagline {
  font-size: 0.95rem;
  color: var(--mayo);
}

#startBtn {
  appearance: none;
  margin: 0.4rem auto 0;
  border: 2px solid var(--frite);
  background: linear-gradient(180deg, #3a2e12, #1a1408);
  color: var(--frite);
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
}

#startBtn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.hint {
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.4;
}

#backHub {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#backHub:hover {
  color: var(--frite);
}

#mobileControls {
  display: none;
  width: min(480px, 96vw);
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  pointer-events: none;
  margin-top: 0.35rem;
}

.mobile-left,
.mobile-right {
  display: flex;
  gap: 0.65rem;
  pointer-events: auto;
  align-items: center;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(240, 196, 58, 0.45);
  border-radius: 12px;
  background: rgba(18, 16, 26, 0.88);
  color: var(--frite);
  font-family: var(--font-pixel);
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.touch-btn:active,
.touch-btn.is-active {
  transform: scale(0.96);
  background: rgba(240, 196, 58, 0.18);
  border-color: var(--frite);
}

.touch-btn-main {
  width: 68px;
  height: 68px;
  font-size: 1.35rem;
}

.touch-btn-small {
  width: 44px;
  height: 44px;
  font-size: 0.85rem;
}

@media (hover: none), (pointer: coarse), (max-width: 720px) {
  #mobileControls {
    display: flex;
  }

  #app {
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }

  .hint {
    font-size: 0.7rem;
  }
}
