:root{
  color-scheme: dark;
  --bg: #111;
  --panel: #1a1a1a;
  --text: #eaeaea;
  --muted: #9aa0a6;
  --accent: #ff8c42; /* player */
  --success: #39b36b; /* goal */
  --wall: #e7e7e7; /* walls on dark bg */
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  background-image: url("/fondo.png");
  background-repeat: repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  display:flex; flex-direction:column;
}

.topbar{
  display:flex; flex-direction:column; align-items:center; gap:12px;
  padding:16px;
  background-image: url("/fondo.png");
  border-bottom: 1px solid #222;
}
.title{ font-weight: 700; letter-spacing: .5px; font-size: 2rem; text-align:center; color:#000; margin-top: 8px; }
.stats{ display:flex; gap:16px; color: #fff; justify-content:center; }
.level-control{ display:flex; flex-direction:column; align-items:center; gap:10px; }
.actions{ margin-left:0; } /* center layout */
button{
  background:#222; color:var(--text); border:1px solid #2a2a2a;
  padding:8px 12px; border-radius:8px; cursor:pointer;
}
button:hover{ border-color:#3a3a3a; }

.stage{
  position:relative;
  display:grid;
  place-items:center;
  padding:12px;
  flex:1;
}
#game{
  width: min(90vw, 90vh);
  height: min(90vw, 90vh);
  background:#101010;
  border:1px solid #222;
  border-radius:12px;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
#hint{
  position:absolute;
  bottom:16px; left:50%; transform:translateX(-50%);
  font-size:.9rem; color: var(--muted);
  background: rgba(0,0,0,.35);
  padding:6px 10px; border-radius:8px;
  backdrop-filter: blur(2px);
}

.footer{
  display:flex; flex-direction:column; align-items:center; gap:8px; justify-content:center; padding:12px;
  background-image: url("/fondo.png");
  border-top: 1px solid #222;
}

#mobileControls{
  display: none !important;
  position:absolute;
  right: 12px;
  bottom: 72px;
}

@media (hover:none) and (pointer:coarse){
  #hint{ bottom: 82px; }
}

/* Win modal */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  padding: 16px;
  z-index: 1000;
}
.modal.show{ display: flex; }
.modal-content{
  background: var(--panel);
  color: var(--text);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.modal-content h2{
  margin: 0 0 12px 0;
  color: #d4af37;
}
.modal-body p{
  margin: 6px 0;
}
.modal-content button{
  margin-top: 12px;
  width: 50%;
  background: #d4af37;
  color: #000;
}