
* { margin:0; padding:0; box-sizing:border-box; }
body {
  background:#141018;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  min-height:100vh;
  font-family:'Segoe UI',sans-serif;
  overflow:hidden; user-select:none;
  touch-action:none;
}
/* Ancho responsivo: grande en desktop, se achica solo en mobile.
   Topes: 94vw (mobile), 800px (máx desktop) y 76vh*4/3 para que — con el alto 4:3 del
   canvas + los controles debajo — nunca desborde verticalmente en laptops bajas. */
#wrap { position:relative; width:min(94vw, 800px, calc(76vh * 4 / 3)); }
#gameCanvas {
  display:block; width:100%;
  border-radius:10px;
  border:3px solid #1D9E75;
  box-shadow:0 0 30px rgba(29,158,117,0.5);
  background:#2a2030;
}
#hud {
  position:absolute; top:8px; left:0; right:0;
  display:flex; justify-content:space-between; align-items:center;
  padding:0 10px; pointer-events:none; z-index:10;
}
.hud-box {
  background:rgba(0,0,0,0.7);
  border:2px solid rgba(29,158,117,0.6);
  border-radius:8px; padding:4px 10px;
  color:#fff; font-size:12px; font-weight:700;
  text-align:center; min-width:78px;
}
.hud-box .name { font-size:10px; color:#9fe3cc; }
.hud-box .hearts { font-size:14px; letter-spacing:1px; }
#timerBox {
  background:rgba(0,0,0,0.7);
  border:2px solid #ffd700;
  border-radius:8px; padding:4px 14px;
  color:#ffd700; font-size:18px; font-weight:900;
}
#timerBox.panic { border-color:#e74c3c; color:#ff6b6b; animation:blink .4s steps(2) infinite; }
@keyframes blink { 50% { opacity:.4; } }
/* Barra de teclas: solo en desktop (pantallas anchas). En mobile se juega con los
   botones táctiles, así que se oculta para no ocupar lugar. */
#keyHints { display:none; margin-top:8px; text-align:center; color:#9fe3cc; font-size:13px; line-height:1.9; }
#keyHints .kb {
  display:inline-block; min-width:20px; padding:2px 7px; margin:0 2px;
  background:#1c2b25; border:1px solid #1D9E75; border-bottom-width:3px;
  border-radius:6px; color:#fff; font-weight:700; font-size:12px;
}
#keyHints .sep { color:#5a6b64; margin:0 8px; }
@media (min-width:760px) { #keyHints { display:block; } }
#mobileControls { display:flex; justify-content:space-between; margin-top:8px; gap:6px; }
.ctrl-row { display:flex; gap:6px; flex:1; }
.ctrl-btn {
  flex:1; padding:14px 0;
  background:rgba(29,158,117,0.2);
  border:2px solid #1D9E75;
  border-radius:10px; color:#fff;
  font-size:20px; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:none; text-align:center;
  transition:background .1s;
}
.ctrl-btn:active,.ctrl-btn.pressed { background:rgba(29,158,117,0.55); }
.act-btn {
  padding:14px 0; min-width:78px;
  border-radius:10px; color:#fff; font-size:15px; font-weight:700;
  -webkit-tap-highlight-color:transparent; touch-action:none;
  text-align:center; cursor:pointer; transition:background .1s;
}
#kickBtn { background:rgba(255,100,0,0.25); border:2px solid #ff6400; }
#kickBtn:active { background:rgba(255,100,0,0.6); }
#knifeBtn { background:rgba(74,158,255,0.25); border:2px solid #4a9eff; }
#knifeBtn:active { background:rgba(74,158,255,0.6); }
#overlay {
  position:absolute; inset:0;
  background:rgba(0,0,0,0.9);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  border-radius:8px; z-index:20; gap:8px; padding:20px;
}
#overlay h1 { color:#ffd700; font-size:24px; text-align:center; text-shadow:0 0 12px #1D9E75; }
#overlay p { color:#cfc7d6; font-size:12.5px; text-align:center; line-height:1.7; }
#startBtn {
  margin-top:6px; padding:13px 34px;
  background:linear-gradient(135deg,#1D9E75,#ffd700);
  border:none; border-radius:30px;
  color:#10241d; font-size:16px; font-weight:900;
  cursor:pointer; box-shadow:0 4px 18px rgba(29,158,117,0.5);
}
#startBtn:active { transform:scale(0.96); }
.emoji-big { font-size:44px; }
#gameCredit {
 margin-top:10px; text-align:center; font-size:12px; color:#888; line-height:1.6; }
#gameCredit a { color:#1D9E75; text-decoration:none; font-weight:600; }
#gameCredit a:hover { text-decoration:underline; }
/* Cartel "girá el teléfono": el juego (canvas 4:3) no entra con los controles en horizontal
   en pantallas bajas. En vez de romper el layout, pedimos orientación vertical. Solo en
   celus/tablets (pointer:coarse) apaisados y de poca altura — desktop nunca lo ve. */
#rotateNotice {
  display:none; position:fixed; inset:0; z-index:9999;
  background:#141018; color:#fff;
  flex-direction:column; align-items:center; justify-content:center;
  text-align:center; gap:16px; padding:24px;
}
#rotateNotice .rot-emoji { font-size:64px; animation:rot 1.6s ease-in-out infinite; }
#rotateNotice p { font-size:17px; line-height:1.6; color:#cfc7d6; }
#rotateNotice strong { color:#1D9E75; }
@keyframes rot { 0%,55%{ transform:rotate(0); } 80%,100%{ transform:rotate(-90deg); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotateNotice { display:flex; }
}

/* Long instructions remain reachable on small screens; the return link is outside the overlay. */
#overlay { overflow-y: auto; justify-content: safe center; touch-action: pan-y; }
#overlay > * { flex-shrink: 0; }
