:root{
  --game-width: 320px;
  --game-height: 560px;
}
*{box-sizing:border-box}
body{
  margin:0;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction: column;
  background:linear-gradient(#0b1220,#111827);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  color:#fff;
}

.container{
  width:var(--game-width);
  text-align:center;
  margin-bottom:20px;
}

.hud{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}
.panel{
  background:rgba(0,0,0,0.4);
  padding:6px 10px;
  border-radius:6px;
  font-weight:600;
  font-size:14px;
}

.game {
  width:var(--game-width);
  height:var(--game-height);
  margin:0 auto;
  background:#2d2d2d;
  border:6px solid #222;
  border-radius:10px;
  overflow:hidden;
  position:relative;
  box-shadow:0 8px 30px rgba(0,0,0,0.6), inset 0 4px 8px rgba(255,255,255,0.03);
}

/* Road */
.road {
  position:absolute;
  inset:0;
  background:linear-gradient(#3a3a3a 0 0) center/100% 100% no-repeat;
}
.lane-markings{
  position:absolute;
  inset:0;
  background-image: linear-gradient(transparent 0 40%, rgba(255,255,255,0.15) 40% 60%, transparent 60% 100%);
  background-size: 100% 80px;
  animation: roadMove linear infinite;
  opacity:0.6;
}
@keyframes roadMove { from { background-position-y: 0 } to { background-position-y: 80px } }

.side{
  position:absolute;
  top:0; bottom:0; width:36px;
  background:linear-gradient(#2b6a2b,#1f3e1f);
  left:0;
}
.side.right{ right:0; left:auto; }

.road-inner{
  position:absolute;
  left:36px; right:36px; top:0; bottom:0;
}

/* Player car */
.player{
  position:absolute;
  width:48px; height:80px;
  bottom:18px;
  left: calc(50% - 24px);
  background: linear-gradient(#e93b3b,#b21f1f);
  border-radius:8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
  transition:left 0.08s linear;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700;
}

/* Enemy */
.enemy{
  position:absolute;
  width:48px; height:80px;
  border-radius:8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700;
}

/* Controls */
.controls{
  display:flex;
  justify-content:center;
  gap:14px;
  margin-top:10px;
}
.btn{
  width:76px; height:48px;
  border-radius:10px; border:0;
  font-size:22px; font-weight:700;
  background:linear-gradient(#f3f3f3,#d9d9d9);
  color:#111;
  box-shadow:0 4px 8px rgba(0,0,0,0.4);
}

.message{
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%,-50%);
  background:rgba(0,0,0,0.6);
  padding:16px 18px;
  border-radius:12px;
  text-align:center;
  display:none;
}
.message.show{ display:block }
.message button{
  margin-top:10px; padding:8px 12px;
  border-radius:8px; border:0;
  background:#1f8ef1; color:#fff;
  font-weight:700;
}

/* Masofa hisoblash form */
input {
  padding: 10px;
  margin: 5px 0;
  width: 90%;
  border-radius: 10px;
  border: 1px solid #ccc;
}
button {
  padding: 10px 20px;
  margin-top: 10px;
  border: none;
  background: #4CAF50;
  color: white;
  border-radius: 10px;
  cursor: pointer;
}
button:hover {
  background: #45a049;
}
.result {
  margin-top: 15px;
  font-weight: bold;
  color: #333;
}