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

:root {
  --bg: #0a0a1a;
  --accent: #00f0ff;
  --accent-glow: rgba(0, 240, 255, 0.4);
  --text: #e8e8f0;
  --text-dim: #8888aa;
  --btn-bg: linear-gradient(135deg, #00f0ff 0%, #7b2fff 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) 0 var(--safe-bottom);
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  height: 100%;
  max-height: 100dvh;
  padding: 8px 12px;
  gap: 8px;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  flex-shrink: 0;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 70px;
}

.hud-center {
  align-items: center;
}

.hud-right {
  align-items: flex-end;
}

.hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.hud-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}

#canvas-container {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 60px rgba(0, 240, 255, 0.03);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d0d20;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  transition: opacity 0.3s ease;
}

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

.overlay-content {
  text-align: center;
  padding: 24px;
  max-width: 90%;
}

.overlay-content h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  background: var(--btn-bg);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.overlay-content p {
  color: var(--text-dim);
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn {
  display: inline-block;
  padding: 14px 48px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0a0a1a;
  background: var(--btn-bg);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 24px rgba(0, 240, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 48px;
  min-width: 140px;
}

.btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(0, 240, 255, 0.25);
}

.controls-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-shrink: 0;
  padding-bottom: 4px;
}

.desktop-hint {
  display: none;
}

.mobile-hint {
  display: inline;
}

@media (min-width: 600px) {
  .desktop-hint {
    display: inline;
  }

  .mobile-hint {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #app {
    padding: 4px 8px;
    gap: 4px;
  }

  .hud {
    padding: 2px 4px;
  }

  .hud-value {
    font-size: 0.95rem;
  }

  .controls-hint {
    display: none;
  }
}
