* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: radial-gradient(ellipse at center, #2a0a4e 0%, #0a0a1e 100%);
  font-family: 'Arial Black', Arial, sans-serif;
  overflow: hidden;
  width: 100vw; height: 100vh;
  /* respect notch / home-indicator safe areas */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#gameContainer {
  position: absolute;
  width: 800px; height: 480px;
  transform-origin: top left;
}
#gameCanvas {
  display: block; border: 4px solid #ff6b6b; border-radius: 6px;
  box-shadow: 0 0 60px #ff6b6b55, 0 0 120px #ff6b6b22;
  width: 800px; height: 480px;
}
#ui {
  position: absolute; top: 0; left: 0; width: 100%;
  padding: 8px 14px; display: flex; justify-content: space-between; align-items: center;
  pointer-events: none; background: linear-gradient(#00000088, transparent);
}
.hud { color: #fff; font-size: 17px; font-weight: bold; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000; }
#overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a0838dd 0%, #000000bb 100%);
  border-radius: 4px; gap: 0;
}
#overlay h1 {
  color: #ffd700; font-size: 54px; font-weight: 900;
  text-shadow: 3px 3px 0 #c00, 6px 6px 0 #800; margin-bottom: 6px;
}
#overlay h2 { color: #ffd700; font-size: 32px; text-shadow: 2px 2px 0 #c00; margin-bottom: 4px; }
#overlay p  { color: #ddd; font-size: 17px; margin: 4px 0; }
.controls   { font-size: 13px !important; color: #aaa !important; margin-top: 6px !important; }
.btn {
  margin-top: 16px; padding: 18px 0; width: 260px;
  background: linear-gradient(180deg, #ff9955 0%, #dd2200 55%, #aa1100 100%);
  color: #fff; font-size: 24px; font-weight: 900; border: none; border-radius: 16px;
  cursor: pointer; text-shadow: 2px 2px 0 #000;
  box-shadow: 0 7px 0 #660000, 0 10px 28px #00000099, inset 0 1px 0 #ffffff55;
  transition: transform .08s, box-shadow .08s; letter-spacing: 2px;
  user-select: none; -webkit-user-select: none;
}
.btn:hover  { background: linear-gradient(180deg, #ffbb77 0%, #ff3300 55%, #cc1100 100%); }
.btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #660000, 0 4px 8px #00000099, inset 0 1px 0 #ffffff55; }
.btn-hs {
  background: linear-gradient(180deg, #6688ff 0%, #2244cc 55%, #112299 100%);
  box-shadow: 0 7px 0 #001188, 0 10px 28px #00000099, inset 0 1px 0 #ffffff55;
}
.btn-hs:hover { background: linear-gradient(180deg, #88aaff 0%, #3355dd 55%, #2233bb 100%); }
.btn-hs:active { box-shadow: 0 2px 0 #001188, 0 4px 8px #00000099; }
#livesBar   { display: flex; gap: 3px; align-items: center; }
.heart      { font-size: 19px; line-height: 1; }
#forkHud    { font-size: 20px; margin-left: 8px; filter: drop-shadow(0 0 5px gold); display: none; }
#nameInput  {
  font-size: 22px; padding: 12px 20px; border-radius: 10px;
  border: 3px solid #ffd700; background: #0a0830; color: #fff;
  text-align: center; margin-top: 14px; width: 280px; outline: none;
  box-shadow: 0 0 16px #ffd70044;
}
#nameInput:focus { border-color: #ffee44; box-shadow: 0 0 24px #ffd70066; }
#nameInput::placeholder { color: #555; }
.hs-row        { color: #ccc; font-size: 15px; margin: 2px 0; font-family: monospace; }
.hs-row.gold   { color: #ffd700; font-weight: bold; font-size: 17px; }
.hs-row.silver { color: #c0c0c0; font-weight: bold; }
.hs-row.bronze { color: #cd7f32; font-weight: bold; }
.hs-preview    { color: #aaa; font-size: 13px; font-family: monospace; margin: 1px 0; }

/* ── Virtual gamepad ──────────────────────────────────────────────────────── */
#touch-controls {
  display: none; /* JS enables on touch devices */
  position: absolute; bottom: 0; left: 0;
  width: 100%; height: 140px;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 16px 16px;
  pointer-events: none;
  z-index: 50;
  box-sizing: border-box;
}
.tc-side {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}
.tc-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.30);
  background: rgba(0,0,0,0.38);
  color: #fff;
  font-size: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: background 0.07s, transform 0.07s, border-color 0.07s;
  /* prevent text selection on long-press */
  -webkit-user-drag: none;
}
.tc-btn.pressed {
  background: rgba(255,255,255,0.30);
  border-color: rgba(255,255,255,0.75);
  transform: scale(0.88);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
/* Jump button — bigger, blue */
.tc-jump {
  width: 86px; height: 86px; font-size: 30px;
  background: rgba(30,100,220,0.32);
  border-color: rgba(100,180,255,0.50);
}
.tc-jump.pressed { background: rgba(80,160,255,0.55); }
/* Attack button — orange */
.tc-fire {
  width: 62px; height: 62px; font-size: 22px;
  background: rgba(220,120,20,0.32);
  border-color: rgba(255,180,80,0.50);
}
.tc-fire.pressed { background: rgba(255,180,80,0.55); }

/* ── Portrait rotation hint ───────────────────────────────────────────────── */
#rotate-hint {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,0,20,0.96);
  color: #fff; text-align: center;
  font-size: 20px; line-height: 1.5;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  z-index: 9999;
  pointer-events: none;
}
/* show hint only on actual mobile portrait — not on desktop narrow windows */
@media (orientation: portrait) and (max-width: 600px) {
  #rotate-hint { display: flex; }
}
