/* Toy Turbo Grand Prix - style.css */

/* Betting the sky: radial gradient background */
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 50% 30%, #8fd3ff 0%, #dff0ff 100%);
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Canvas host fill */
#app {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
  pointer-events: none;
}

#hud-left,
#hud-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-card {
  background: rgba(255,255,255,0.92);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-weight: bold;
  color: #333;
  display: inline-block;
  white-space: nowrap;
}

/* Boost bar – a wide card underneath lap & pos */
#boost-bar {
  width: 220px;
  height: 14px;
  background: #ccc;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  margin-top: 4px;
}

#boost-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #42d0ff, #1b7cf2);
  transition: width 0.2s ease;
  border-radius: 7px;
}

/* ===== Overlay ===== */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#overlay.hidden {
  display: none !important;
}

.card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 30px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

#overlay-title {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 8px;
  color: #222;
}

#overlay-sub {
  font-size: 16px;
  color: #666;
  margin-bottom: 20px;
}

#start-btn {
  background: linear-gradient(90deg, #ff6a3d, #ff3d6a);
  color: white;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,80,60,0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  letter-spacing: 1px;
}

#start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255,80,60,0.5);
}

#start-btn:active {
  transform: scale(0.95);
}

/* ===== Toast ===== */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 24px;
  border-radius: 40px;
  font-size: 18px;
  font-weight: bold;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
}

/* ===== Touch Controls ===== */
/* Hidden by default, shown when body.touch */
#touch {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  pointer-events: none;
  z-index: 30;
  height: 0; /* no layout height, buttons are absolute */
}

body.touch #touch {
  display: block;
}

.pad {
  position: absolute;
  bottom: 16px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #fff, #ccc);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: #555;
  border: 2px solid rgba(255,255,255,0.8);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  pointer-events: auto;    /* allow taps, even with parent pointer-events none */
  transition: transform 0.1s ease;
}

.pad:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Left cluster: two buttons side by side */
#btn-left {
  left: 16px;
}

#btn-right {
  left: 104px;  /* 76+12+16 */
}

/* Right cluster: boost above gas */
#btn-boost {
  right: 16px;
  bottom: 104px; /* gas height + gap + 16 */
}

#btn-gas {
  right: 16px;
}

/* Optional hint text inside pads are fine, fonts set above */

/* Prevent any global scroll on touch */
html, body {
  touch-action: none;
  overscroll-behavior: none;
}
