* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #0b0e14;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, #1a2332 0%, #141c28 100%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  direction: ltr;
}

.hud-box {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 6px 14px;
  text-align: center;
  color: #fff;
  min-width: 78px;
  backdrop-filter: blur(4px);
}

.hud-box .hud-label {
  display: block;
  font-size: 11px;
  color: #9fb3c8;
  margin-bottom: 2px;
}

.hud-box span:last-child {
  font-size: 20px;
  font-weight: 700;
  color: #ffd93d;
}

#speed {
  color: #6ee7b7 !important;
}

/* ===== Screens ===== */
#start-screen,
#game-over-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 20;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(6px);
  text-align: center;
  padding: 20px;
}

#start-screen h1 {
  font-size: 42px;
  color: #ffd93d;
  text-shadow: 0 4px 0 #b8860b, 0 6px 20px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

#start-screen p {
  color: #dbe6f1;
  font-size: 16px;
}

.controls-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #9fb3c8;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 22px;
}

#game-over-screen h2 {
  font-size: 34px;
  color: #ff6b6b;
  text-shadow: 0 4px 0 #8b0000;
}

#final-score {
  font-size: 22px;
  color: #fff;
}

#new-best {
  font-size: 18px;
  color: #ffd93d;
  font-weight: 700;
}

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  padding: 14px 42px;
  border-radius: 40px;
  color: #1a2332;
  background: linear-gradient(180deg, #ffd93d, #f0a500);
  box-shadow: 0 6px 0 #a36c00, 0 10px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #a36c00;
}

.hidden {
  display: none !important;
}

/* ===== Touch controls ===== */
#touch-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 15;
  direction: ltr;
}

.touch-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  font-size: 30px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.touch-btn:active {
  transform: scale(0.92);
  background: rgba(255, 217, 61, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

@media (max-width: 480px) {
  .touch-btn {
    width: 66px;
    height: 66px;
  }
}

@media (min-width: 768px) {
  #touch-controls {
    display: none;
  }
}
