:root {
  --brand-lime: #2563eb;
  --brand-dark: #111111;
  --brand-gray: #222222;
  --ui-font: 'Courier New', Courier, monospace;
}
body {
  margin: 0;
  overflow: hidden;
  background-color: var(--brand-dark);
  color: #fff;
  font-family: var(--ui-font);
  touch-action: none;
}
canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}
.screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  transition: opacity 0.3s;
}
.screen-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 560px;
  padding: 40px 36px;
  background: linear-gradient(135deg, rgba(17, 17, 17, 0.96) 0, rgba(10, 10, 10, 0.96) 100%);
  border: 2px solid var(--brand-lime);
  border-radius: 16px;
  box-shadow:
    0 0 40px rgba(37, 99, 235, 0.45),
    0 20px 60px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  max-height: calc(100% - 20px);
  overflow-y: auto;
}
.hidden {
  display: none !important;
}
h1 {
  font-size: 3rem;
  margin: 0 0 10px;
  color: var(--brand-lime);
  text-shadow: 0 0 10px var(--brand-lime);
}
p {
  font-size: 1.2rem;
  max-width: 600px;
  line-height: 1.5;
}
.btn {
  margin-top: 20px;
  padding: 15px 40px;
  font-size: 1.5rem;
  background: var(--brand-lime);
  color: #000;
  border: none;
  cursor: pointer;
  font-family: var(--ui-font);
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 0 15px var(--brand-lime);
  transition: transform 0.1s;
}
.btn:active {
  transform: scale(0.95);
}
.btn:hover {
  background: #fff;
}
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
  text-shadow: 1px 1px 0 #000;
}
.stat-box {
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border: 1px solid var(--brand-lime);
  border-radius: 4px;
}
#upgrade-menu {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}
.upgrade-btn {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #555;
  color: #fff;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  font-family: var(--ui-font);
  width: 100px;
  pointer-events: auto;
  transition: 0.2s;
}
.upgrade-btn.affordable {
  border-color: var(--brand-lime);
  color: var(--brand-lime);
}
.upgrade-btn:active {
  background: #333;
}
.upgrade-cost {
  display: block;
  font-size: 0.8rem;
  margin-top: 5px;
  color: #888;
}
.upgrade-btn.affordable .upgrade-cost {
  color: #fff;
}
#watermark {
  position: absolute;
  bottom: 10px;
  right: 10px;
  opacity: 0.5;
  width: 50px;
  z-index: 2;
}

@media (max-width: 768px), (pointer: coarse) {
  #hud {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: max(10px, env(safe-area-inset-top)) 10px 10px max(10px, env(safe-area-inset-left));
    font-size: 0.8rem;
  }
  .stat-box {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  #upgrade-menu {
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    right: 10px;
    transform: none;
    gap: 6px;
    justify-content: space-between;
  }
  .upgrade-btn {
    flex: 1;
    width: auto;
    padding: 10px 4px;
    font-size: 0.85rem;
    min-height: 56px;
  }
  .upgrade-cost {
    font-size: 0.7rem;
    margin-top: 3px;
  }
  h1 {
    font-size: 2rem;
    text-shadow: 0 0 6px var(--brand-lime);
  }
  h2 {
    font-size: 1.25rem;
  }
  p {
    font-size: 1rem;
  }
  .btn {
    padding: 14px 32px;
    font-size: 1.2rem;
    min-height: 48px;
  }
  .screen {
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  }
  .screen-dialog {
    padding: 28px 20px;
    max-width: calc(100% - 24px);
    max-height: calc(100svh - 32px);
    border-radius: 12px;
  }
}
