:root{
  --bg: #0f0f10;
  --hud: #ffffff;
  --accent: #4caf50;
  --danger: #ff4d4d;
  --road: #222;
  --line: #fff;
  --btn: #e91e63;
  --card: #1e1f24;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--hud);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow:hidden;
}

/* Título */
.title{
  position:fixed;
  top:8px; left:50%;
  transform:translateX(-50%);
  margin:0;
  font-weight:800;
  letter-spacing:.5px;
  text-shadow:2px 2px 0 #000;
  z-index:30;
}

/* HUD */
#hud{
  position:fixed;
  top:56px; left:10px;
  z-index:20;
  display:flex;
  flex-direction:column;
  gap:6px;
  user-select:none;
}
#hud p{
  margin:0;
  font-size:16px;
  text-shadow:2px 2px 4px #000;
}
#stage{ opacity:.9 }

#healthWrap{
  width:220px; height:16px; border-radius:12px;
  background:#0008; border:1px solid #fff4;
  overflow:hidden; box-shadow: var(--shadow);
}
#healthBar{
  width:100%; height:100%;
  background:linear-gradient(90deg, #2ecc71, #27ae60);
  transition:width .2s ease, background .3s ease;
}

/* Botão de saque */
#withdrawBtn{
  margin-top:6px;
  align-self:flex-start;
  background:var(--accent);
  color:#fff; border:none; border-radius:10px;
  padding:8px 12px; font-weight:700; cursor:pointer;
  box-shadow: var(--shadow);
}

/* Canvas */
#canvasWrap{ width:100vw; height:100vh; }
#gameCanvas{
  display:block;
  margin:0 auto;
  width:100vw; height:100vh;
  background:var(--road);
}

/* Fullscreen */
#fullscreenBtn{
  position:fixed; bottom:20px; right:20px;
  background:var(--btn);
  color:#fff; font-size:26px; padding:16px;
  border-radius:50%; border:none; box-shadow: var(--shadow);
  cursor:pointer; z-index:20;
}

/* Start button */
#startBtn{
  position:fixed; top:50%; left:50%;
  transform:translate(-50%,-50%);
  font-size:28px; padding:18px 36px;
  background:var(--accent); color:#fff; border:none; border-radius:14px;
  box-shadow: var(--shadow); cursor:pointer; z-index:25;
}
.pulse{ animation:pulse 1.8s ease-in-out infinite; }
@keyframes pulse{
  0%{transform:translate(-50%,-50%) scale(1)}
  50%{transform:translate(-50%,-50%) scale(1.05); box-shadow:0 0 30px #4caf5080}
  100%{transform:translate(-50%,-50%) scale(1)}
}

/* Overlay & Modais */
#overlay{ 
  position:fixed; inset:0; 
  background:#0008; z-index:40; 
  display:none;
}
.hidden{ display:none !important; }

.modal{
  position:fixed; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:min(600px, 92vw);
  background:#121318;
  border:1px solid #ffffff20;
  border-radius:18px;
  box-shadow: var(--shadow);
  z-index:50;
  overflow:hidden;
  max-height:90vh;
  overflow-y:auto;
}
.modalHeader{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; background:#0b0c10;
  border-bottom:1px solid #ffffff12;
}
.modalHeader h2{ margin:0; }
.closeBtn{
  background:#ffffff10; color:#fff; border:1px solid #ffffff20;
  border-radius:10px; padding:6px 10px; cursor:pointer;
}
.closeBtn:hover{ background:#ffffff25; }
.closeBtn:active{ transform:scale(0.95); }
.modalBody{ padding:18px; }

/* Inputs no modal */
.modalBody input{
  width:100%;
  padding:10px;
  margin:6px 0 12px 0;
  border-radius:10px;
  border:1px solid #555;
  background:#1e1f24;
  color:#fff;
}
#confirmWithdraw{
  width:100%;
  background:#4caf50;
  color:#fff; border:none; border-radius:10px;
  padding:10px; font-weight:700; cursor:pointer;
  box-shadow: var(--shadow);
}

/* Game Over modal */
#gameOverModal .actions{ display:flex; gap:10px; margin-top:12px; }
#againBtn{
  background:#2196f3; color:#fff; border:none; border-radius:10px; padding:10px 14px; cursor:pointer;
}

/* Partículas e tremida */
.shake{ animation:shake .35s linear; }
@keyframes shake{
  0%{ transform:translateX(0) }
  20%{ transform:translateX(-8px) }
  40%{ transform:translateX(8px) }
  60%{ transform:translateX(-6px) }
  80%{ transform:translateX(6px) }
  100%{ transform:translateX(0) }
}

/* Hover global */
button:hover{ filter:brightness(1.1); }
button:active{ transform:scale(0.96); }

/* Responsivo */
@media (max-width:600px){
  #healthWrap{ width:180px }
  #hud{ top:52px }
  #fullscreenBtn{ font-size:20px; padding:12px; }
}
@media (max-width:360px){
  #hud p{ font-size:13px }
}