* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #ffe1ef; font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #3a2a33;
}
#game-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
canvas#game {
  image-rendering: pixelated;
  background: #f7f2f7;
  border: 4px solid #ffb3d6;
  border-radius: 12px;
  max-width: 100vw; max-height: 100vh;
}
#hud {
  position: fixed; left: 8px; top: 8px; right: 8px; display: flex; gap: 8px; align-items: center; justify-content: space-between;
}
.badge {
  background: #ffd1e6; padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: 2px solid #ffb3d6;
}
#btnConcert {
  border: 0; background: #ff7fb3; color: white; font-weight: 700; padding: 8px 12px; border-radius: 8px; box-shadow: 0 2px 0 #d76193;
}
#btnSave, #btnHelp {
  border: 0; background: #ffd1e6; color: #3a2a33; font-weight: 700; padding: 8px 12px; border-radius: 8px; border: 2px solid #ffb3d6;
}
/* Mobile controls */
#controls {
  position: fixed; bottom: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 16px;
  pointer-events: none; /* container doesn't block */
}
.pad { pointer-events: auto; }
.dpad {
  width: 140px; height: 140px; position: relative;
}
.dbtn {
  position: absolute; width: 64px; height: 64px; border-radius: 12px;
  background: rgba(255,179,214,0.8); border: 2px solid #ffb3d6; display: grid; place-items: center;
  font-weight: 900; user-select: none;
}
.dbtn:active { transform: translateY(1px); }
.dbtn.up { left: 38px; top: -4px; }
.dbtn.down { left: 38px; bottom: -4px; }
.dbtn.left { left: -4px; top: 38px; }
.dbtn.right { right: -4px; top: 38px; }
.action {
  display: grid; place-items: center; width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,127,179,0.9); border: 3px solid #d76193; color: white; font-weight: 900; font-size: 18px;
}
@media (min-width: 900px) {
  #controls { display: none; }
}
#dialog {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 140px; background: rgba(255,255,255,0.95);
  max-width: 90vw; width: 640px; border-radius: 12px;
  border: 3px solid #ffb3d6; padding: 12px; display: none;
}
#dialog h3 { margin: 0 0 6px; }
#dialog p { margin: 0; }
#help {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center;
}
#help .card {
  background: white; padding: 16px; border-radius: 12px; max-width: 680px; border: 3px solid #ffb3d6;
}
#help ul { margin-top: 6px; }