/* KARACHI AUTO 3D — styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #050912;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #e2e8f0;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }

/* ---------------- HUD ---------------- */
#hud3d {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-top-left {
  position: absolute; left: 18px; top: 14px;
}
#hud-cash {
  font-size: 23px; font-weight: 800; color: #f59e0b;
  text-shadow: 0 2px 10px rgba(0,0,0,.85);
  letter-spacing: .3px;
}
#hud-stats {
  margin-top: 3px;
  font-size: 11px; font-weight: 500; color: rgba(226,232,240,.66);
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
}
#hud-stars {
  margin-top: 5px;
  font-size: 19px; letter-spacing: 3px; color: #fbbf24;
  text-shadow: 0 0 12px rgba(251,191,36,.55), 0 2px 8px rgba(0,0,0,.9);
}
#hud-fines {
  margin-top: 2px;
  font-size: 11px; font-weight: 600; color: rgba(239,68,68,.9);
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
}

#hud-top-right {
  position: absolute; right: 18px; top: 14px;
  text-align: right;
}
#hud-district {
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  color: #f59e0b;
  text-shadow: 0 1px 8px rgba(0,0,0,.9);
}
#hud-speed {
  margin-top: 2px;
  font-size: 36px; font-weight: 800; color: #e2e8f0;
  line-height: 1;
  text-shadow: 0 3px 14px rgba(0,0,0,.9);
}
#hud-speed small {
  display: block;
  font-size: 10px; font-weight: 500; letter-spacing: 2px;
  color: rgba(226,232,240,.55);
  text-align: right;
}

#hud-mission {
  position: absolute; left: 50%; bottom: 74px;
  transform: translateX(-50%);
  padding: 9px 20px;
  background: rgba(8,12,20,.84);
  border: 1px solid rgba(245,158,11,.5);
  border-radius: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .6px;
  color: #f59e0b;
  white-space: nowrap;
  display: none;
}

#hud-toast {
  position: absolute; left: 50%; bottom: 122px;
  transform: translateX(-50%);
  padding: 9px 22px;
  background: rgba(8,12,20,.9);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 14px; font-weight: 700; color: #f8fafc;
  white-space: nowrap;
  transition: opacity .25s;
  display: none;
}

#hud-challans {
  position: absolute; left: 50%; top: 82px;
  transform: translateX(-50%);
  display: none;
  text-align: center;
}
#hud-challans .ch {
  margin-bottom: 6px;
  padding: 6px 16px;
  background: rgba(60,10,10,.92);
  border: 1px solid #ef4444;
  border-radius: 5px;
  font-size: 12px; font-weight: 700; color: #fecaca;
  white-space: nowrap;
}
#hud-challans .ch b { color: #fca5a5; }

#hud-controls {
  position: absolute; left: 18px; bottom: 14px;
  font-size: 11px; font-weight: 500;
  color: rgba(226,232,240,.42);
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
}

/* ---------------- title ---------------- */
#title3d {
  position: fixed; inset: 0;
  z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(5,9,18,.93) 0%, rgba(5,9,18,.66) 45%, rgba(5,9,18,.93) 100%);
  transition: opacity .6s;
  text-align: center;
  padding: 0 20px;
}
#title3d.gone { opacity: 0; pointer-events: none; }
.t-rule {
  width: 210px; height: 1.5px;
  background: rgba(245,158,11,.55);
  margin-bottom: 22px;
}
#title3d h1 {
  font-family: Oswald, Inter, sans-serif;
  font-size: clamp(38px, 10vw, 82px);
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 1px;
  line-height: 1;
}
.t-3d {
  display: inline-block;
  font-size: .46em;
  color: #0f172a;
  background: #f59e0b;
  padding: 2px 10px;
  border-radius: 5px;
  vertical-align: middle;
  margin-left: 8px;
  letter-spacing: 2px;
}
.t-sub {
  margin-top: 12px;
  font-size: 15px; color: #e2e8f0;
}
.t-cta {
  margin-top: 30px;
  font-size: 18px; font-weight: 700;
  color: rgba(245,158,11,.95);
  animation: pulse 1.7s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.55} 50%{opacity:1} }
.t-keys {
  margin-top: 30px;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12px; color: rgba(226,232,240,.58);
}
.t-hint {
  margin-top: 22px;
  font-size: 12px; font-weight: 600;
  color: rgba(245,158,11,.72);
}

/* ---------------- touch ---------------- */
#touch-pad {
  position: fixed; left: 0; bottom: 0;
  width: 190px; height: 190px;
  display: none;
  pointer-events: none;
  z-index: 20;
}
.tbtn {
  position: absolute;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 1.5px solid rgba(245,158,11,.45);
  background: rgba(10,15,24,.55);
  color: #f59e0b;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}
.tbtn:active { background: rgba(245,158,11,.28); }
.tbtn[data-key="w"] { left: 67px; top: 6px; }
.tbtn[data-key="a"] { left: 8px;  top: 67px; }
.tbtn[data-key="s"] { left: 67px; top: 128px; }
.tbtn[data-key="d"] { left: 126px; top: 67px; }
.tbtn.small { width: 42px; height: 42px; left: 150px; top: 150px; font-size: 14px; }

@media (max-width: 820px), (pointer: coarse) {
  #touch-pad { display: block; }
  #hud-controls { display: none; }
}
